Added prima source from cyanogen-msm8916 kernel
diff --git a/wlan/prima/CORE/BAP/inc/bapApi.h b/wlan/prima/CORE/BAP/inc/bapApi.h
index ea0ca07..606048f 100644
--- a/wlan/prima/CORE/BAP/inc/bapApi.h
+++ b/wlan/prima/CORE/BAP/inc/bapApi.h
@@ -39,6 +39,8 @@
   module.
   
       
+  Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
diff --git a/wlan/prima/CORE/BAP/src/bapApiData.c b/wlan/prima/CORE/BAP/src/bapApiData.c
index 1a1e67d..715d0c9 100644
--- a/wlan/prima/CORE/BAP/src/bapApiData.c
+++ b/wlan/prima/CORE/BAP/src/bapApiData.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -42,6 +42,9 @@
   Are listed for each API below. 
   
   
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
@@ -400,7 +403,6 @@
     // Now copy the AC values from the Logical Link context
     *pucAC = pLogLinkContext->btampAC;
     // Now copy the values from the Logical Link context to the MetaInfo 
-    tlMetaInfo->ac = *pucAC;
     tlMetaInfo->ucTID = pLogLinkContext->ucTID;
     tlMetaInfo->ucUP = pLogLinkContext->ucUP;
     tlMetaInfo->ucIsEapol = VOS_FALSE;
diff --git a/wlan/prima/CORE/BAP/src/bapApiDebug.c b/wlan/prima/CORE/BAP/src/bapApiDebug.c
index f812f2c..65599cb 100644
--- a/wlan/prima/CORE/BAP/src/bapApiDebug.c
+++ b/wlan/prima/CORE/BAP/src/bapApiDebug.c
@@ -42,6 +42,9 @@
   Are listed for each API below. 
   
   
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
diff --git a/wlan/prima/CORE/BAP/src/bapApiExt.c b/wlan/prima/CORE/BAP/src/bapApiExt.c
index b0d2ea5..6ab6035 100644
--- a/wlan/prima/CORE/BAP/src/bapApiExt.c
+++ b/wlan/prima/CORE/BAP/src/bapApiExt.c
@@ -44,6 +44,9 @@
   Are listed for each API below. 
   
   
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
diff --git a/wlan/prima/CORE/BAP/src/bapApiExt.h b/wlan/prima/CORE/BAP/src/bapApiExt.h
index 6293e65..40b22ce 100644
--- a/wlan/prima/CORE/BAP/src/bapApiExt.h
+++ b/wlan/prima/CORE/BAP/src/bapApiExt.h
@@ -39,6 +39,8 @@
   module.
   
       
+  Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
diff --git a/wlan/prima/CORE/BAP/src/bapApiHCBB.c b/wlan/prima/CORE/BAP/src/bapApiHCBB.c
index 7fc7800..595e14b 100644
--- a/wlan/prima/CORE/BAP/src/bapApiHCBB.c
+++ b/wlan/prima/CORE/BAP/src/bapApiHCBB.c
@@ -42,6 +42,9 @@
   Are listed for each API below. 
   
   
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
diff --git a/wlan/prima/CORE/BAP/src/bapApiInfo.c b/wlan/prima/CORE/BAP/src/bapApiInfo.c
index 0463c48..0e28641 100644
--- a/wlan/prima/CORE/BAP/src/bapApiInfo.c
+++ b/wlan/prima/CORE/BAP/src/bapApiInfo.c
@@ -42,6 +42,9 @@
   Are listed for each API below. 
   
   
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
diff --git a/wlan/prima/CORE/BAP/src/bapApiLinkCntl.c b/wlan/prima/CORE/BAP/src/bapApiLinkCntl.c
index e8efab2..792ecb9 100644
--- a/wlan/prima/CORE/BAP/src/bapApiLinkCntl.c
+++ b/wlan/prima/CORE/BAP/src/bapApiLinkCntl.c
@@ -42,6 +42,9 @@
   Are listed for each API below. 
   
   
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
diff --git a/wlan/prima/CORE/BAP/src/bapApiLinkSupervision.c b/wlan/prima/CORE/BAP/src/bapApiLinkSupervision.c
index 0dcd4c2..6f9305b 100644
--- a/wlan/prima/CORE/BAP/src/bapApiLinkSupervision.c
+++ b/wlan/prima/CORE/BAP/src/bapApiLinkSupervision.c
@@ -42,6 +42,9 @@
   Are listed for each API below. 
   
   
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
diff --git a/wlan/prima/CORE/BAP/src/bapApiStatus.c b/wlan/prima/CORE/BAP/src/bapApiStatus.c
index 27bb5df..dc97618 100644
--- a/wlan/prima/CORE/BAP/src/bapApiStatus.c
+++ b/wlan/prima/CORE/BAP/src/bapApiStatus.c
@@ -42,6 +42,9 @@
   Are listed for each API below. 
   
   
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
diff --git a/wlan/prima/CORE/BAP/src/bapApiTimer.c b/wlan/prima/CORE/BAP/src/bapApiTimer.c
index c27db46..302c3d2 100644
--- a/wlan/prima/CORE/BAP/src/bapApiTimer.c
+++ b/wlan/prima/CORE/BAP/src/bapApiTimer.c
@@ -42,6 +42,9 @@
   Are listed for each API below. 
   
   
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
diff --git a/wlan/prima/CORE/BAP/src/bapApiTimer.h b/wlan/prima/CORE/BAP/src/bapApiTimer.h
index 2c6a101..5e3623e 100644
--- a/wlan/prima/CORE/BAP/src/bapApiTimer.h
+++ b/wlan/prima/CORE/BAP/src/bapApiTimer.h
@@ -39,6 +39,8 @@
   module.
   
       
+  Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
diff --git a/wlan/prima/CORE/BAP/src/bapInternal.h b/wlan/prima/CORE/BAP/src/bapInternal.h
index 31b6734..689df0c 100644
--- a/wlan/prima/CORE/BAP/src/bapInternal.h
+++ b/wlan/prima/CORE/BAP/src/bapInternal.h
@@ -39,6 +39,8 @@
   module.
   
       
+  Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
diff --git a/wlan/prima/CORE/BAP/src/bapModule.c b/wlan/prima/CORE/BAP/src/bapModule.c
index 5cda7f5..5c4976c 100644
--- a/wlan/prima/CORE/BAP/src/bapModule.c
+++ b/wlan/prima/CORE/BAP/src/bapModule.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -580,7 +580,7 @@
   if( btampContext->isBapSessionOpen == TRUE )
   {
     halStatus = sme_CloseSession(halHandle, 
-            btampContext->sessionId, FALSE, VOS_TRUE, NULL, NULL);
+            btampContext->sessionId, NULL, NULL);
     if(eHAL_STATUS_SUCCESS == halStatus)
     {
       btampContext->isBapSessionOpen = FALSE;
diff --git a/wlan/prima/CORE/BAP/src/bapRsnTxRx.c b/wlan/prima/CORE/BAP/src/bapRsnTxRx.c
index 0aa72d7..ff07ea6 100644
--- a/wlan/prima/CORE/BAP/src/bapRsnTxRx.c
+++ b/wlan/prima/CORE/BAP/src/bapRsnTxRx.c
@@ -34,6 +34,9 @@
   Description...
     
   
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
   
   ============================================================================== */
 /* $HEADER$ */
diff --git a/wlan/prima/CORE/BAP/src/bapRsnTxRx.h b/wlan/prima/CORE/BAP/src/bapRsnTxRx.h
index 650dbce..cdafc0a 100644
--- a/wlan/prima/CORE/BAP/src/bapRsnTxRx.h
+++ b/wlan/prima/CORE/BAP/src/bapRsnTxRx.h
@@ -37,6 +37,9 @@
   Description...
     
   
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
   
   ==============================================================================*/
 
diff --git a/wlan/prima/CORE/BAP/src/btampFsm.c b/wlan/prima/CORE/BAP/src/btampFsm.c
index 183a7a2..d311fab 100644
--- a/wlan/prima/CORE/BAP/src/btampFsm.c
+++ b/wlan/prima/CORE/BAP/src/btampFsm.c
@@ -44,6 +44,9 @@
   Are listed for each API below.
 
 
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
diff --git a/wlan/prima/CORE/BAP/src/btampFsm.h b/wlan/prima/CORE/BAP/src/btampFsm.h
index 660f07e..0053d48 100644
--- a/wlan/prima/CORE/BAP/src/btampFsm.h
+++ b/wlan/prima/CORE/BAP/src/btampFsm.h
@@ -25,6 +25,11 @@
  * to the Linux Foundation.
  */
 
+/*
+ * Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ * Qualcomm Confidential and Proprietary
+ */
+
 /* This file is generated from btampFsm - do not edit manually*/
 /* Generated on: Thu Oct 16 15:40:39 PDT 2008 / version 1.2 Beta 1 */
 
diff --git a/wlan/prima/CORE/BAP/src/btampFsm_ext.h b/wlan/prima/CORE/BAP/src/btampFsm_ext.h
index cb089a3..587070f 100644
--- a/wlan/prima/CORE/BAP/src/btampFsm_ext.h
+++ b/wlan/prima/CORE/BAP/src/btampFsm_ext.h
@@ -25,6 +25,11 @@
  * to the Linux Foundation.
  */
 
+/*
+ * Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ * Qualcomm Confidential and Proprietary 
+ */
+
 /* This file is generated from btampFsm.cdd - do not edit manually*/
 /* Generated on: Thu Oct 16 15:40:39 PDT 2008 */
 
diff --git a/wlan/prima/CORE/BAP/src/btampHCI.c b/wlan/prima/CORE/BAP/src/btampHCI.c
index 157b8d4..0c6d85e 100644
--- a/wlan/prima/CORE/BAP/src/btampHCI.c
+++ b/wlan/prima/CORE/BAP/src/btampHCI.c
@@ -795,7 +795,7 @@
     else
     {
         /* Maximum of 5 triplets allowed, based on size of triplets definition */
-        if (tlvlen > 15)
+        if (tlvlen / 3 > 5)
         {
             tlvlen = 15;
         }
diff --git a/wlan/prima/CORE/DXE/inc/wlan_qct_dxe.h b/wlan/prima/CORE/DXE/inc/wlan_qct_dxe.h
index 70c2eb6..dc0aea3 100644
--- a/wlan/prima/CORE/DXE/inc/wlan_qct_dxe.h
+++ b/wlan/prima/CORE/DXE/inc/wlan_qct_dxe.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -35,6 +35,8 @@
   @brief 
                
    This file contains the external API exposed by the wlan data transfer abstraction layer module.
+   Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+   Qualcomm Confidential and Proprietary
 ========================================================================*/
 
 /*===========================================================================
@@ -83,13 +85,6 @@
  * Size must be same with Vos Packet Size */
 #define WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE  (VPKT_SIZE_BUFFER)
 
-/*reserve 30B of skb buff, to add NL header*/
-#define WLANDXE_NL_HEADER_SZ (30)
-
-/*MAX data transferred in one skb*/
-#define WLANDXE_FW_LOGGING_XFSIZE  (WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE - \
-                                    WLANDXE_NL_HEADER_SZ)
-
 /*The maximum number of packets that can be chained in dxe for the Low 
   priority channel
   Note: Increased it to 240 from 128 for Windows(EA) becase Windows is
@@ -179,23 +174,6 @@
 
 /*==========================================================================
   @  Type Name
-  WLANDXE_MbReceiveMsgCbType
-
-  @  Description
-  DXE Mailbox mes receive indiacation
-
-  @  Parameters
-  void
-
-  @  Return
-  void
-===========================================================================*/
-typedef WDTS_MbReceiveMsgType WLANDXE_MbReceiveMsgCbType;
-
-typedef WDTS_RxLogDoneType WLANDXE_RxLogDoneType;
-
-/*==========================================================================
-  @  Type Name
       WLANDXE_SetPowerStateCbType 
 
   @  Description 
@@ -243,7 +221,9 @@
 
   @  Parameters
       pVoid                       pDXEContext : DXE module control block
-      WDTS_ClientCallbacks        WDTSCb : Callbacks to WDTS to indicate various events
+      WDTS_RxFrameReadyCbType     rxFrameReadyCB : RX Frame ready CB function pointer
+      WDTS_TxCompleteCbType       txCompleteCB : TX complete CB function pointer
+      WDTS_LowResourceCbType      lowResourceCB : Low DXE resource notification CB function pointer
       void                       *userContext : DXE Cliennt control block
 
   @  Return
@@ -252,7 +232,9 @@
 wpt_status WLANDXE_ClientRegistration
 (
    void                       *pDXEContext,
-   WDTS_ClientCallbacks       WDTSCb,
+   WDTS_RxFrameReadyCbType     rxFrameReadyCB,
+   WDTS_TxCompleteCbType       txCompleteCB,
+   WDTS_LowResourceCbType      lowResourceCB,
    void                       *userContext
 );
 
@@ -442,33 +424,54 @@
    wpt_uint8      debugFlags
 );
 
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
 /*==========================================================================
-  @  Function Name
-    WLANDXE_KickDxe
+  @  Function Name 
+      WLANDXE_UnitTest
 
-  @  Description
-    Kick Dxe when HDD TX timeout happen
+  @  Description 
+      Temporary for the DXE module test
 
   @  Parameters
-    NONE
+      NONE
 
   @  Return
-    NONE
+      NONE
 
 ===========================================================================*/
-void WLANDXE_KickDxe
+void WLANDXE_UnitTestStartDXE
 (
    void
 );
 
-wpt_uint32 WLANDXE_SetupLogTransfer
+/*==========================================================================
+  @  Function Name 
+
+  @  Description 
+
+  @  Parameters
+
+  @  Return
+
+===========================================================================*/
+void WLANDXE_UnitTestDataTransfer
 (
-   wpt_uint64 bufferAddr,
-   wpt_uint32 bufferLen
+   void
 );
 
-wpt_status WLANDXE_StartLogTransfer
+/*==========================================================================
+  @  Function Name 
+
+  @  Description 
+
+  @  Parameters
+
+  @  Return
+
+===========================================================================*/
+void WLANDXE_UnitTestEventHandle
 (
-void
+   void     *dxeCB
 );
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 #endif /* WLAN_QCT_DXE_H */
diff --git a/wlan/prima/CORE/DXE/src/wlan_qct_dxe.c b/wlan/prima/CORE/DXE/src/wlan_qct_dxe.c
index c7f7235..8813e6a 100644
--- a/wlan/prima/CORE/DXE/src/wlan_qct_dxe.c
+++ b/wlan/prima/CORE/DXE/src/wlan_qct_dxe.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -64,6 +64,9 @@
 #include "wlan_qct_dxe.h"
 #include "wlan_qct_dxe_i.h"
 #include "wlan_qct_pal_device.h"
+#ifdef FEATURE_R33D
+#include "wlan_qct_pal_bus.h"
+#endif /* FEATURE_R33D */
 
 /*----------------------------------------------------------------------------
  * Local Definitions
@@ -90,17 +93,13 @@
 /* CSR max retry count */
 #define WLANDXE_CSR_MAX_READ_COUNT         30
 
-/* DXETRACE max records count */
-#define MAX_DXE_TRACE_RECORDS              512
-#define INVALID_TRACE_ADDR                 0xffffffff
 
 /* This is temporary fot the compile
  * WDI will release official version
  * This must be removed */
 #define WDI_GET_PAL_CTX()                  NULL
 
-#define TRACE_WLANDXE_VAR_ENABLE           1
-#define TRACE_WLANDXE_VAR_DISABLE          0
+
 /*-------------------------------------------------------------------------
   *  Local Varables
   *-------------------------------------------------------------------------*/
@@ -111,15 +110,14 @@
       "TX_LOW_PRI",
       "TX_HIGH_PRI",
       "RX_LOW_PRI",
+#ifndef WLANDXE_TEST_CHANNEL_ENABLE
       "RX_HIGH_PRI",
-      "RX_LOGS",
-      "RX_FW_LOGS",
+#else
+      "H2H_TEST_TX",
+      "H2H_TEST_RX"
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
    };
 static  wpt_packet               *rx_reaped_buf[WLANDXE_MAX_REAPED_RX_FRAMES];
-static WLANDXE_EnvInformation    dxeEnvBlk;
-static dxeTraceData              gdxeTraceData;
-static dxeTraceRecord            gdxeTraceTbl[MAX_DXE_TRACE_RECORDS];
-static spinlock_t                dtraceLock;
 
 /*-------------------------------------------------------------------------
   *  External Function Proto Type
@@ -146,16 +144,6 @@
   WLANDXE_CtrlBlkType     *dxeCtxt
 );
 
-static wpt_status dxeTXCleanup
-(
-   WLANDXE_CtrlBlkType     *hostCtxt
-);
-
-static void dxeTrace
-(
-  v_U8_t chan, v_U8_t code, v_U32_t data
-);
-
 /*-------------------------------------------------------------------------
   *  Local Function
   *-------------------------------------------------------------------------*/
@@ -189,7 +177,7 @@
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
-   if(channelEntry->channelType >= WDTS_CHANNEL_MAX)
+   if(channelEntry->channelType > WDTS_CHANNEL_RX_HIGH_PRI)
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
                "INVALID Channel type");
@@ -363,7 +351,7 @@
    dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
    wpalSleep(10);
 
-   if(channelEntry->channelType >= WDTS_CHANNEL_MAX)
+   if(channelEntry->channelType > WDTS_CHANNEL_RX_HIGH_PRI)
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
                "INVALID Channel type");
@@ -428,8 +416,7 @@
    previousCtrlValue = targetCtrlBlk->linkedDesc->descCtrl.ctrl;
 
    if((WDTS_CHANNEL_RX_LOW_PRI == channel) ||
-      (WDTS_CHANNEL_RX_HIGH_PRI == channel)||
-      (WDTS_CHANNEL_RX_LOG == channel))
+      (WDTS_CHANNEL_RX_HIGH_PRI == channel))
    {
       for(channelLoop = 0; channelLoop < channelEntry->numDesc; channelLoop++)
       {
@@ -489,30 +476,39 @@
 
 /*==========================================================================
   @  Function Name
-      dxeErrHandler
+      dxeErrChannelDebug
 
   @  Description
-      Dump channel information for which Error interrupt has occured and
-      try to recover from the Error
+      Dump channel information for which Error interrupt has occured
 
   @  Parameters
       WLANDXE_ChannelCBType  *channelCb
 
   @  Return
-      wpt_status: eWLAN_PAL_STATUS_SUCCESS if recovery is possible and
-                  successful
-                  eWLAN_PAL_STATUS_E_FAILURE if recovery is not possible
-                  or recovery fails
+      NONE
+
 ===========================================================================*/
-wpt_status dxeErrHandler
+void dxeErrChannelDebug
 (
     WLANDXE_ChannelCBType    *channelCb,
     wpt_uint32                chStatusReg
 )
 {
+   wpt_log_data_stall_channel_type channelLog;
    wpt_uint32 chLDescReg, channelLoop;
    WLANDXE_DescCtrlBlkType *targetCtrlBlk;
 
+   dxeChannelMonitor("INT_ERR", channelCb, &channelLog);
+   dxeDescriptorDump(channelCb, channelCb->headCtrlBlk->linkedDesc, 0);
+   dxeChannelRegisterDump(channelCb, "INT_ERR", &channelLog);
+   dxeChannelAllDescDump(channelCb, channelCb->channelType, &channelLog);
+   wpalMemoryCopy(channelLog.channelName,
+                  "INT_ERR",
+                  WPT_TRPT_CHANNEL_NAME);
+   wpalPacketStallUpdateInfo(NULL, NULL, &channelLog, channelCb->channelType);
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+   wpalPacketStallDumpLog();
+#endif /* FEATURE_WLAN_DIAG_SUPPORT */
    switch ((chStatusReg & WLANDXE_CH_STAT_ERR_CODE_MASK) >>
             WLANDXE_CH_STAT_ERR_CODE_OFFSET)
    {
@@ -564,75 +560,8 @@
             }
             targetCtrlBlk = (WLANDXE_DescCtrlBlkType *)targetCtrlBlk->nextCtrlBlk;
          }
-         wpalFwDumpReq(17, 0, 0, 0, 0, 1);
          break;
       }
-      case WLANDXE_ERROR_ABORT:
-      {
-          wpt_uint32 regValue, regValueLocal;
-          wpt_uint32 count = 0;
-          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-                   "%s: DXE Abort Error from S/W", __func__);
-
-          wpalReadRegister(WALNDEX_DMA_CSR_ADDRESS, &regValue);
-          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-                   "%s: DXE CSR Value: %08x", __func__,regValue);
-
-          //Execute the BMU recovery only if firmware triggered the ABORT
-          if (regValue & WLANDXE_DMA_CSR_FW_BMU_RECOVERY)
-          {
-              HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                       "%s: Firmware BMU recovery On %08x", __func__,regValue);
-
-              // Clean up the descriptors
-              if (eWLAN_PAL_STATUS_SUCCESS !=
-                        dxeTXCleanup(tempDxeCtrlBlk))
-              {
-              HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                       "%s: Host DXE Cleanup Failed!!!!", __func__);
-              }
-
-              // Unblock the firmware
-              regValue |= WLANDXE_DMA_CSR_HOST_RECOVERY_DONE;
-              HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-                       "%s: Host DXE Cleanup done %08x", __func__,regValue);
-              wpalWriteRegister(WALNDEX_DMA_CSR_ADDRESS, regValue);
-
-              // Wait for firmware to complete the cleanup
-              do
-              {
-                  wpalReadRegister(WALNDEX_DMA_CSR_ADDRESS, &regValue);
-                  wpalBusyWait(5000);
-                  count++;
-                  //count is 60 because wait is for 5 ms and 60*5=300ms
-                  //which is the time WD bark happens in firmware
-              } while(count < 60 && !(regValue & WLANDXE_DMA_CSR_RECOVERY_DONE));
-              HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                       "%s: FW Cleanup done %08x", __func__,regValue);
-
-              //clear all spare bits in CSR
-              wpalWriteRegister(WALNDEX_DMA_CSR_ADDRESS,regValue &
-                                ~(WLANDXE_DMA_CSR_RECOVERY_DONE |
-                                  WLANDXE_DMA_CSR_FW_BMU_RECOVERY |
-                                  WLANDXE_DMA_CSR_HOST_RECOVERY_DONE));
-
-              //check if the h/w resources have recovered
-              wpalReadRegister(WLANDXE_BMU_AVAILABLE_BD_PDU, &regValue);
-              wpalReadRegister(WLANDXE_BMU_AVAILABLE_BD_PDU_LOCAL, &regValueLocal);
-              HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-                       "===== count %d ABD %d, ABD LOCAL %d =====", count,
-                       regValue, regValueLocal);
-              if(regValue == 0 || regValueLocal == 0)
-              {
-                  HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                           "%s:  HW resources have not recovered", __func__);
-                  return eWLAN_PAL_STATUS_E_FAILURE;
-              }
-
-              return eWLAN_PAL_STATUS_SUCCESS;
-          }
-          break;
-      }
       default:
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
@@ -641,7 +570,7 @@
       }
 
    }
-   return eWLAN_PAL_STATUS_E_FAILURE;
+   wpalFwDumpReq(17, 0, 0, 0, 0);
 }
 /*==========================================================================
   @  Function Name
@@ -732,9 +661,6 @@
     * Just incase TX not wanted stuck, Trigger TX again */
    for(channelLoop = WDTS_CHANNEL_RX_LOW_PRI; channelLoop < WDTS_CHANNEL_MAX; channelLoop++)
    {
-      if (!WLANDXE_IS_VALID_CHANNEL(channelLoop))
-         continue;
-
       dxeChannelMonitor("******** Get Descriptor Snapshot ",
                         &tempDxeCtrlBlk->dxeChannel[channelLoop],
                         &channelLog);
@@ -771,6 +697,304 @@
 
 /*==========================================================================
   @  Function Name 
+      dxeRXHealthMonitor
+
+  @  Description 
+      Monitoring RX channel healthy stataus
+      If detect any problem, try to recover
+
+  @  Parameters
+      healthMonitorMsg    MSG pointer.
+                          will have low resource TX channel context
+
+  @  Return
+      NONE
+
+===========================================================================*/
+void dxeRXHealthMonitor
+(
+   wpt_msg         *healthMonitorMsg
+)
+{
+   WLANDXE_ChannelCBType    *channelCtrlBlk;
+   WLANDXE_ChannelCBType    *testCHCtrlBlk;
+   wpt_uint32                regValue;
+   wpt_uint32                chStatusReg, chControlReg, chDescReg, chLDescReg;
+   wpt_uint32                hwWakeLoop, chLoop;
+
+   if(NULL == healthMonitorMsg)
+   {
+      return;
+   }
+
+   /* Make wake up HW */
+   dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
+   dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
+   dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
+
+   for(hwWakeLoop = 0; hwWakeLoop < T_WLANDXE_MAX_HW_ACCESS_WAIT; hwWakeLoop++)
+   {
+      wpalReadRegister(WLANDXE_BMU_AVAILABLE_BD_PDU, &regValue);
+      if(0 != regValue)
+      {
+         break;
+      }
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "Scheduled RX, num free BD/PDU %d, loop Count %d",
+            regValue, hwWakeLoop);
+
+   for(chLoop = WDTS_CHANNEL_RX_LOW_PRI; chLoop < WDTS_CHANNEL_MAX; chLoop++)
+   {
+      testCHCtrlBlk = &tempDxeCtrlBlk->dxeChannel[chLoop];
+      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXECtrlRegAddr, &chControlReg);
+      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXEStatusRegAddr, &chStatusReg);
+      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXEDesclRegAddr, &chDescReg);
+      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXELstDesclRegAddr, &chLDescReg);
+
+      wpalTrace(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
+                "%11s : CCR 0x%x, CSR 0x%x, CDR 0x%x, CLDR 0x%x, HCBO %d, HCBDP 0x%x, HCBDC 0x%x, TCBO %d,TCBDP 0x%x, TCBDC 0x%x",
+                channelType[chLoop],
+                chControlReg, chStatusReg, chDescReg, chLDescReg,
+                testCHCtrlBlk->headCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr,
+                testCHCtrlBlk->headCtrlBlk->linkedDesc->descCtrl.ctrl,
+                testCHCtrlBlk->tailCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr,
+                testCHCtrlBlk->tailCtrlBlk->linkedDesc->descCtrl.ctrl);
+
+      if((chControlReg & WLANDXE_DESC_CTRL_VALID) && 
+         (chLDescReg != testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr))
+      {
+         wpalTrace(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                   "%11s : CCR 0x%x, CSR 0x%x, CDR 0x%x, CLDR 0x%x, "
+                   "HCBO %d, HCBDP 0x%x, HCBDC 0x%x, TCBO %d,TCBDP 0x%x, TCBDC 0x%x",
+                   channelType[chLoop],
+                   chControlReg, chStatusReg, chDescReg, chLDescReg,
+                   testCHCtrlBlk->headCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr,
+                   testCHCtrlBlk->headCtrlBlk->linkedDesc->descCtrl.ctrl,
+                   testCHCtrlBlk->tailCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr,
+                   testCHCtrlBlk->tailCtrlBlk->linkedDesc->descCtrl.ctrl);
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%11s : RX CH EN Descriptor Async, resync it", channelType[chLoop]);
+         wpalWriteRegister(testCHCtrlBlk->channelRegister.chDXELstDesclRegAddr,
+                           testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr);
+      }
+      else if(!(chControlReg & WLANDXE_DESC_CTRL_VALID) && 
+               (chDescReg != testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr))
+      {
+         wpalTrace(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                   "%11s : CCR 0x%x, CSR 0x%x, CDR 0x%x, CLDR 0x%x, "
+                   "HCBO %d, HCBDP 0x%x, HCBDC 0x%x, TCBO %d,TCBDP 0x%x, TCBDC 0x%x",
+                   channelType[chLoop],
+                   chControlReg, chStatusReg, chDescReg, chLDescReg,
+                   testCHCtrlBlk->headCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr,
+                   testCHCtrlBlk->headCtrlBlk->linkedDesc->descCtrl.ctrl,
+                   testCHCtrlBlk->tailCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr,
+                   testCHCtrlBlk->tailCtrlBlk->linkedDesc->descCtrl.ctrl);
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%11s : RX CH DIS Descriptor Async, resync it", channelType[chLoop]);
+         wpalWriteRegister(testCHCtrlBlk->channelRegister.chDXEDesclRegAddr,
+                           testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr);
+      }
+   }
+
+   channelCtrlBlk = (WLANDXE_ChannelCBType *)healthMonitorMsg->pContext;
+   if(channelCtrlBlk->hitLowResource)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "%11s : Still Low Resource, kick DXE TX and restart timer",
+               channelType[channelCtrlBlk->channelType]);
+      /* Still Low Resource, Kick DXE again and start timer again */
+      wpalTimerStart(&channelCtrlBlk->healthMonitorTimer,
+                     T_WLANDXE_PERIODIC_HEALTH_M_TIME);
+   }
+   else
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "%11s : Out from Low resource condition, do nothing",
+               channelType[channelCtrlBlk->channelType]);
+      /* Recovered from low resource condition
+       * Not need to do anything */
+   }
+
+   return;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeTXHealthMonitor
+
+  @  Description 
+      Monitoring TX channel healthy stataus
+      If detect any problem, try to recover
+
+  @  Parameters
+      healthMonitorMsg    MSG pointer.
+                          will have low resource TX channel context
+
+  @  Return
+      NONE
+
+===========================================================================*/
+void dxeTXHealthMonitor
+(
+   wpt_msg         *healthMonitorMsg
+)
+{
+   WLANDXE_ChannelCBType    *channelCtrlBlk;
+   WLANDXE_ChannelCBType    *testCHCtrlBlk;
+   wpt_uint32                regValue;
+   wpt_uint32                chStatusReg, chControlReg, chDescReg, chLDescReg;
+   wpt_uint32                hwWakeLoop, chLoop;
+   wpt_status                status  = eWLAN_PAL_STATUS_SUCCESS;
+
+   if(NULL == healthMonitorMsg)
+   {
+      return;
+   }
+
+   /* First of all kick TX channel
+    * This will fix if there is any problem with SMSM state */
+   dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
+   dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
+   dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
+
+   /* Wait till RIVA up */
+   for(hwWakeLoop = 0; hwWakeLoop < T_WLANDXE_MAX_HW_ACCESS_WAIT; hwWakeLoop++)
+   {
+      wpalReadRegister(WLANDXE_BMU_AVAILABLE_BD_PDU, &regValue);
+      if(0 != regValue)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "num free BD/PDU %d, loop Count %d",
+                  regValue, hwWakeLoop);
+         break;
+      }
+   }
+
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "Scheduled TX, num free BD/PDU %d, loop Count %d",
+            regValue, hwWakeLoop);
+
+   for(chLoop = 0; chLoop < WDTS_CHANNEL_RX_LOW_PRI; chLoop++)
+   {
+      testCHCtrlBlk = &tempDxeCtrlBlk->dxeChannel[chLoop];
+      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXECtrlRegAddr, &chControlReg);
+      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXEStatusRegAddr, &chStatusReg);
+      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXEDesclRegAddr, &chDescReg);
+      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXELstDesclRegAddr, &chLDescReg);
+
+      wpalTrace(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
+                "%11s : CCR 0x%x, CSR 0x%x, CDR 0x%x, CLDR 0x%x, HCBO %d, HCBDP 0x%x, HCBDC 0x%x, TCBO %d,TCBDP 0x%x, TCBDC 0x%x",
+                channelType[chLoop],
+                chControlReg, chStatusReg, chDescReg, chLDescReg,
+                testCHCtrlBlk->headCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr,
+                testCHCtrlBlk->headCtrlBlk->linkedDesc->descCtrl.ctrl,
+                testCHCtrlBlk->tailCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr,
+                testCHCtrlBlk->tailCtrlBlk->linkedDesc->descCtrl.ctrl);
+
+      if((chControlReg & WLANDXE_DESC_CTRL_VALID) && 
+         (chLDescReg != testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr))
+      {
+         wpalTrace(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                   "%11s : CCR 0x%x, CSR 0x%x, CDR 0x%x, CLDR 0x%x, "
+                   "HCBO %d, HCBDP 0x%x, HCBDC 0x%x, TCBO %d,TCBDP 0x%x, TCBDC 0x%x",
+                   channelType[chLoop],
+                   chControlReg, chStatusReg, chDescReg, chLDescReg,
+                   testCHCtrlBlk->headCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr,
+                   testCHCtrlBlk->headCtrlBlk->linkedDesc->descCtrl.ctrl,
+                   testCHCtrlBlk->tailCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr,
+                   testCHCtrlBlk->tailCtrlBlk->linkedDesc->descCtrl.ctrl);
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%11s : TX CH EN Descriptor Async, resync it", channelType[chLoop]);
+         wpalWriteRegister(testCHCtrlBlk->channelRegister.chDXELstDesclRegAddr,
+                           testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr);
+      }
+      else if(!(chControlReg & WLANDXE_DESC_CTRL_VALID) && 
+               (chDescReg != testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr))
+      {
+         wpalTrace(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                   "%11s : CCR 0x%x, CSR 0x%x, CDR 0x%x, CLDR 0x%x, "
+                   "HCBO %d, HCBDP 0x%x, HCBDC 0x%x, TCBO %d,TCBDP 0x%x, TCBDC 0x%x",
+                   channelType[chLoop],
+                   chControlReg, chStatusReg, chDescReg, chLDescReg,
+                   testCHCtrlBlk->headCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr,
+                   testCHCtrlBlk->headCtrlBlk->linkedDesc->descCtrl.ctrl,
+                   testCHCtrlBlk->tailCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr,
+                   testCHCtrlBlk->tailCtrlBlk->linkedDesc->descCtrl.ctrl);
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "%11s : TX CH DIS Descriptor Async, resync it", channelType[chLoop]);
+         wpalWriteRegister(testCHCtrlBlk->channelRegister.chDXEDesclRegAddr,
+                           testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr);
+      }
+   }
+
+   /* TX channel test done, test RX channels */
+   channelCtrlBlk = (WLANDXE_ChannelCBType *)healthMonitorMsg->pContext;
+   channelCtrlBlk->healthMonitorMsg->callback = dxeRXHealthMonitor;
+   status = wpalPostRxMsg(WDI_GET_PAL_CTX(),
+                          channelCtrlBlk->healthMonitorMsg);
+   if (eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "TX Low resource Kick DXE MSG Serialize fail status=%d",
+               status);
+   }
+
+   return;
+}
+
+/*==========================================================================
+  @  Function Name 
+      dxeHealthMonitorTimeout
+
+  @  Description 
+      Health Monitor timer started when TX channel low resource condition
+      And if reciovered from low resource condition, timer would not fired
+      Timer fired means during certain time, TX CH could not be recovered
+
+  @  Parameters
+      channelCtxt   Low resource condition happen Channel context
+
+  @  Return
+      NONE
+
+===========================================================================*/
+void dxeHealthMonitorTimeout
+(
+   void         *channelCtxt
+)
+{
+   WLANDXE_ChannelCBType    *channelCtrlBlk;
+   wpt_status                status  = eWLAN_PAL_STATUS_SUCCESS;
+
+   if(NULL == channelCtxt)
+   {
+      return;
+   }
+
+   /* Timeout Fired, DXE TX should kick on TX thread
+    * Serailize to TX Thread */
+   channelCtrlBlk = (WLANDXE_ChannelCBType *)channelCtxt;
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
+            "%11s : Health Monitor timer expired",
+            channelType[channelCtrlBlk->channelType]);
+
+   channelCtrlBlk->healthMonitorMsg->callback = dxeTXHealthMonitor;
+   status = wpalPostTxMsg(WDI_GET_PAL_CTX(),
+                          channelCtrlBlk->healthMonitorMsg);
+   if (eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "TX Low resource Kick DXE MSG Serialize fail status=%d",
+               status);
+   }
+
+   return;
+}
+
+/*==========================================================================
+  @  Function Name 
       dxeCtrlBlkAlloc
 
   @  Description 
@@ -915,6 +1139,10 @@
    unsigned int              idx;
    void                     *physAddressAlloc = NULL;
    wpt_uint32                physAddress;
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+   WLANDXE_ChannelCBType    *testTXChannelCB = &dxeCtrlBlk->dxeChannel[WDTS_CHANNEL_H2H_TEST_TX];
+   WLANDXE_DescCtrlBlkType  *currDescCtrlBlk = testTXChannelCB->headCtrlBlk;
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE*/
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __func__);
@@ -929,6 +1157,7 @@
 
    currentCtrlBlk = channelEntry->headCtrlBlk;
 
+#if !(defined(FEATURE_R33D) || defined(WLANDXE_TEST_CHANNEL_ENABLE))
    /* allocate all DXE descriptors for this channel in one chunk */
    channelEntry->descriptorAllocation = (WLANDXE_DescType *)
       wpalDmaMemoryAllocate(sizeof(WLANDXE_DescType)*channelEntry->numDesc,
@@ -941,11 +1170,57 @@
       return eWLAN_PAL_STATUS_E_RESOURCES;
    }
    currentDesc = channelEntry->descriptorAllocation;
+#endif
 
    /* Allocate pre asigned number of descriptor */
    for(idx = 0; idx < channelEntry->numDesc; idx++)
    {
+#ifndef FEATURE_R33D
+#ifndef WLANDXE_TEST_CHANNEL_ENABLE
       // descriptors were allocated in a chunk -- use the current one
+      memset((wpt_uint8 *)currentDesc, 0, sizeof(WLANDXE_DescType));
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+               "Allocated Descriptor VA %p, PA %p", currentDesc, physAddressAlloc);
+#else
+      if(WDTS_CHANNEL_H2H_TEST_RX != channelEntry->channelType)
+      {
+         // allocate a descriptor
+         currentDesc = (WLANDXE_DescType *)wpalDmaMemoryAllocate(sizeof(WLANDXE_DescType),
+                                                                 &physAddressAlloc);
+         memset((wpt_uint8 *)currentDesc, 0, sizeof(WLANDXE_DescType));
+         physAddress = (wpt_uint32) (uintptr_t)(physAddressAlloc);
+      }
+      else
+      {
+         currentDesc     = currDescCtrlBlk->linkedDesc;
+         physAddress     = currDescCtrlBlk->linkedDescPhyAddr;
+         currDescCtrlBlk = (WLANDXE_DescCtrlBlkType *)currDescCtrlBlk->nextCtrlBlk;
+      }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+#else
+#ifndef WLANDXE_TEST_CHANNEL_ENABLE
+      currentDesc = (WLANDXE_DescType *)wpalAcpuDdrDxeDescMemoryAllocate(&physAddressAlloc);
+      memset((wpt_uint8 *)currentDesc, 0, sizeof(WLANDXE_DescType));
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+               "Allocated Descriptor VA %p, PA %p", currentDesc, physAddressAlloc);
+      physAddress = (wpt_uint32) (uintptr_t)(physAddressAlloc);
+#else
+      if(WDTS_CHANNEL_H2H_TEST_RX != channelEntry->channelType)
+      {
+         currentDesc = (WLANDXE_DescType *)wpalAcpuDdrDxeDescMemoryAllocate(&physAddressAlloc);
+         memset((wpt_uint8 *)currentDesc, 0, sizeof(WLANDXE_DescType));
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+                  "Allocated Descriptor VA %p, PA %p", currentDesc, physAddressAlloc);
+         physAddress = (wpt_uint32) (uintptr_t)(physAddressAlloc);
+      }
+      else
+      {
+         currentDesc     = currDescCtrlBlk->linkedDesc;
+         physAddress     = currDescCtrlBlk->linkedDescPhyAddr;
+         currDescCtrlBlk = (WLANDXE_DescCtrlBlkType *)currDescCtrlBlk->nextCtrlBlk;
+      }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+#endif /* FEATURE_R33D */
       if(NULL == currentDesc)
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -953,9 +1228,6 @@
                   channelEntry->channelType);
          return eWLAN_PAL_STATUS_E_FAULT;
       }
-      memset((wpt_uint8 *)currentDesc, 0, sizeof(WLANDXE_DescType));
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
-               "Allocated Descriptor VA %p, PA %p", currentDesc, physAddressAlloc);
 
       currentCtrlBlk->linkedDesc        = currentDesc;
       currentCtrlBlk->linkedDescPhyAddr = physAddress;
@@ -989,9 +1261,14 @@
       /* If Current Channel is RX channel PAL Packet and OS packet buffer should be
        * Pre allocated and physical address must be assigned into
        * Corresponding DXE Descriptor */
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
       if((WDTS_CHANNEL_RX_LOW_PRI  == channelEntry->channelType) ||
          (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType) ||
-         (WDTS_CHANNEL_RX_LOG == channelEntry->channelType))
+         (WDTS_CHANNEL_H2H_TEST_RX == channelEntry->channelType))
+#else
+      if((WDTS_CHANNEL_RX_LOW_PRI  == channelEntry->channelType) ||
+         (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType))
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
       {
          status = dxeRXFrameSingleBufferAlloc(dxeCtrlBlk,
                                               channelEntry,
@@ -1013,24 +1290,27 @@
          currentDesc->dxedesc.dxe_short_desc.dstMemAddrL = channelEntry->extraConfig.refWQ_swapped;
       }
       else if((WDTS_CHANNEL_RX_LOW_PRI == channelEntry->channelType) ||
-              (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType)||
-              (WDTS_CHANNEL_RX_LOG == channelEntry->channelType))
+              (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType))
       {
          currentDesc->descCtrl.ctrl = channelEntry->extraConfig.cw_ctrl_read;
          currentDesc->dxedesc.dxe_short_desc.srcMemAddrL = channelEntry->extraConfig.refWQ_swapped;
       }
       else
       {
-         /* Just in case. H2H RX channel, do nothing
+         /* Just in case. H2H Test RX channel, do nothing
           * By Definition this must not happen */
       }
 
       currentCtrlBlk = currentCtrlBlk->nextCtrlBlk;
       prevDesc       = currentDesc;
 
+#ifndef FEATURE_R33D
+#ifndef WLANDXE_TEST_CHANNEL_ENABLE
       // advance to the next pre-allocated descriptor in the chunk
       currentDesc++;
       physAddress = (physAddress + sizeof(WLANDXE_DescType));
+#endif
+#endif
    }
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
@@ -1062,18 +1342,22 @@
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __func__);
 
-   foreach_valid_channel(idx)
+   for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
    {
       channelEntry = &dxeCtrlBlk->dxeChannel[idx];
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+      if((WDTS_CHANNEL_TX_LOW_PRI == channelEntry->channelType) ||
+         (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType) ||
+         (WDTS_CHANNEL_H2H_TEST_TX == channelEntry->channelType))
+#else
       if((WDTS_CHANNEL_TX_LOW_PRI == channelEntry->channelType) ||
          (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType))
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
       {
          interruptPath |= (1 << channelEntry->assignedDMAChannel);
       }
       else if((WDTS_CHANNEL_RX_LOW_PRI == channelEntry->channelType) ||
-              (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType)||
-              (WDTS_CHANNEL_RX_FW_LOG == channelEntry->channelType)  ||
-              (WDTS_CHANNEL_RX_LOG == channelEntry->channelType))
+              (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType))
       {
          interruptPath |= (1 << (channelEntry->assignedDMAChannel + 16));
       }
@@ -1105,14 +1389,15 @@
                                DXE host driver main control block
 
   @  Return
-      void
+      wpt_status
 
 ===========================================================================*/
-static void dxeEngineCoreStart
+static wpt_status dxeEngineCoreStart
 (
    WLANDXE_CtrlBlkType     *dxeCtrlBlk
 )
 {
+   wpt_status                 status = eWLAN_PAL_STATUS_SUCCESS;
    wpt_uint32                 registerData = 0;
    wpt_uint8                  readRetry;
 
@@ -1170,6 +1455,7 @@
    dxeSetInterruptPath(dxeCtrlBlk);
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __func__);
+   return status;
 }
 
 /*==========================================================================
@@ -1254,8 +1540,7 @@
       }
    }
    else if((WDTS_CHANNEL_RX_LOW_PRI  == channelEntry->channelType) ||
-           (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType) ||
-           (WDTS_CHANNEL_RX_LOG == channelEntry->channelType))
+           (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType))
    {
       /* Initialize Descriptor control Word First */
       currentCtrlBlk = channelEntry->headCtrlBlk;
@@ -1286,7 +1571,7 @@
       }
 
       /* RX Channels, default Control registers MUST BE ENABLED */
-      status = wpalWriteRegister(channelEntry->channelRegister.chDXECtrlRegAddr,
+      wpalWriteRegister(channelEntry->channelRegister.chDXECtrlRegAddr,
                              channelEntry->extraConfig.chan_mask);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
@@ -1298,6 +1583,15 @@
    else
    {
       /* H2H test channel, not use work Q */
+      /* Program pre allocated destination Address */
+      status = wpalWriteRegister(channelEntry->channelRegister.chDXEDadrlRegAddr,
+                                      WLANDXE_U32_SWAP_ENDIAN(channelEntry->DescBottomLoc->dxedesc.dxe_short_desc.phyNextL));
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeChannelInitProgram Write RX DAddress register fail");
+         return status;
+      }
    }
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
@@ -1506,8 +1800,7 @@
               nextDescriptor = NULL;
           }
           if((WDTS_CHANNEL_RX_LOW_PRI  == channelEntry->channelType) ||
-             (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType) ||
-             (WDTS_CHANNEL_RX_LOG == channelEntry->channelType))
+             (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType))
           {
             if (NULL != currentCtrlBlk->xfrFrame)
             {
@@ -1530,6 +1823,10 @@
                   wpalPacketFree(currentCtrlBlk->xfrFrame);
                }
          }
+#if (defined(FEATURE_R33D) || defined(WLANDXE_TEST_CHANNEL_ENABLE))
+         // descriptors allocated individually so free them individually
+         wpalDmaMemoryFree(currentDescriptor);
+#endif
          wpalMemoryFree(currentCtrlBlk);
 
          currentCtrlBlk    = nextCtrlBlk;
@@ -1543,11 +1840,13 @@
       }
    }
 
+#if !(defined(FEATURE_R33D) || defined(WLANDXE_TEST_CHANNEL_ENABLE))
    // descriptors were allocated as a single chunk so free the chunk
    if(NULL != channelEntry->descriptorAllocation)
    {
       wpalDmaMemoryFree(channelEntry->descriptorAllocation);
    }
+#endif
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __func__);
@@ -1681,7 +1980,7 @@
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
             "RX Low resource, Durign wait time period %d, RX resource not allocated",
-            wpalGetDxeReplenishRXTimerVal());
+            T_WLANDXE_MAX_RX_PACKET_WAIT);
 
    //This API wil also try to replenish packets
    wpalGetNumRxFreePacket(&numRxFreePackets);
@@ -1705,25 +2004,19 @@
                   "%s: Replenish successful. Restart the Rx Low resource timer",
                   __func__);
          wpalTimerStart(&dxeCtxt->rxResourceAvailableTimer,
-                        wpalGetDxeReplenishRXTimerVal());
+                        T_WLANDXE_MAX_RX_PACKET_WAIT);
          return;
       }
    }
-   if(wpalIsDxeSSREnable())
-   {
-      if (NULL != dxeCtxt)
-         dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
 
-      wpalWlanReload();
+   if (NULL != dxeCtxt)
+      dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
 
-      if (NULL != usrData)
-         dxeStartSSRTimer((WLANDXE_CtrlBlkType *)usrData);
-   }
-   else
-   {
-       wpalTimerStart(&dxeCtxt->rxResourceAvailableTimer,
-                      wpalGetDxeReplenishRXTimerVal());
-   }
+   wpalWlanReload();
+
+   if (NULL != usrData)
+      dxeStartSSRTimer((WLANDXE_CtrlBlkType *)usrData);
+
    return;
 }
 #endif
@@ -1895,9 +2188,15 @@
    wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
    wpt_packet               *currentPalPacketBuffer = NULL;
    WLANDXE_DescType         *currentDesc            = NULL;
+#ifdef FEATURE_R33D
+   wpt_uint32                virtualAddressPCIe;
+   wpt_uint32                physicalAddressPCIe;   
+#else
    wpt_iterator              iterator;
    wpt_uint32                allocatedSize          = 0;
    void                     *physAddress            = NULL;
+#endif /* FEATURE_R33D */
+
 
    currentDesc            = currentCtrlBlock->linkedDesc;
 
@@ -1910,33 +2209,17 @@
 
    /* First check if a packet pointer has already been provided by a previously
       invoked Rx packet available callback. If so use that packet. */
-   if (dxeCtxt->rxPalPacketUnavailable)
+   if(dxeCtxt->rxPalPacketUnavailable && (NULL != dxeCtxt->freeRXPacket))
    {
-      if (NULL != dxeCtxt->freeRXPacket)
-      {
-         currentPalPacketBuffer = dxeCtxt->freeRXPacket;
-         dxeCtxt->rxPalPacketUnavailable = eWLAN_PAL_FALSE;
-         dxeCtxt->freeRXPacket = NULL;
+      currentPalPacketBuffer = dxeCtxt->freeRXPacket;
+      dxeCtxt->rxPalPacketUnavailable = eWLAN_PAL_FALSE;
+      dxeCtxt->freeRXPacket = NULL;
 
-         if (channelEntry->doneIntDisabled)
-         {
-            wpalWriteRegister(channelEntry->channelRegister.chDXECtrlRegAddr,
-                              channelEntry->extraConfig.chan_mask);
-            channelEntry->doneIntDisabled = 0;
-         }
-      }
-      else if (VOS_TIMER_STATE_RUNNING !=
-               wpalTimerGetCurStatus(&dxeCtxt->rxResourceAvailableTimer))
+      if (channelEntry->doneIntDisabled)
       {
-         if (eWLAN_PAL_STATUS_SUCCESS !=
-             wpalTimerStart(&dxeCtxt->rxResourceAvailableTimer,
-                            wpalGetDxeReplenishRXTimerVal()))
-         {
-             HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                      "RX resource available timer not started");
-         }
-         else
-            dxeEnvBlk.rx_low_resource_timer = 1;
+         wpalWriteRegister(channelEntry->channelRegister.chDXECtrlRegAddr,
+                           channelEntry->extraConfig.chan_mask);
+         channelEntry->doneIntDisabled = 0;
       }
    }
    else if(!dxeCtxt->rxPalPacketUnavailable)
@@ -1958,15 +2241,8 @@
          {
             HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                      "RX Low resource, wait available resource");
-            if (eWLAN_PAL_STATUS_SUCCESS !=
-                wpalTimerStart(&dxeCtxt->rxResourceAvailableTimer,
-                           wpalGetDxeReplenishRXTimerVal()))
-            {
-                HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                         "RX resource available timer not started");
-            }
-            else
-               dxeEnvBlk.rx_low_resource_timer = 1;
+            wpalTimerStart(&dxeCtxt->rxResourceAvailableTimer,
+                           T_WLANDXE_MAX_RX_PACKET_WAIT);
          }
 #endif
       }
@@ -1982,12 +2258,31 @@
    currentPalPacketBuffer->pBD      = NULL;
    currentPalPacketBuffer->pBDPhys  = NULL;
    currentPalPacketBuffer->BDLength = 0;
-
-   if (channelEntry->channelType == WDTS_CHANNEL_RX_FW_LOG)
-      wpalPacketRawTrimHead(currentCtrlBlock->xfrFrame, WLANDXE_NL_HEADER_SZ);
-
+#ifdef FEATURE_R33D
+   status = wpalAllocateShadowRxFrame(currentPalPacketBuffer,
+                                           &physicalAddressPCIe,
+                                           &virtualAddressPCIe);
+   if((0 == physicalAddressPCIe) || (0 = virtualAddressPCIe))
+   {
+       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+               "RX NULL Shadow Memory");
+       HDXE_ASSERT(0);
+       return eWLAN_PAL_STATUS_E_FAULT;
+   }
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+            "RX Shadow Memory Va 0x%x, Pa 0x%x",
+            virtualAddressPCIe, physicalAddressPCIe);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXFrameBufferAlloc Shadow Mem Alloc fail");
+      return status;
+   }
+   currentCtrlBlock->shadowBufferVa = virtualAddressPCIe;
+   currentPalPacketBuffer->pBDPhys  = (void *)physicalAddressPCIe;
+   memset((wpt_uint8 *)currentCtrlBlock->shadowBufferVa, 0, WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE);
+#else
    status = wpalLockPacketForTransfer(currentPalPacketBuffer);
-
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -2014,6 +2309,7 @@
       return status;
    }
    currentPalPacketBuffer->pBDPhys = physAddress;
+#endif /* FEATURE_R33D */
 
    /* DXE descriptor must have SWAPPED addres in it's structure
     * !!! SWAPPED !!! */
@@ -2081,9 +2377,6 @@
          the descriptor. */
       if(channelEntry->extraConfig.cw_ctrl_read != currentDesc->descCtrl.ctrl)
       {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeRXFrameRefillRing, Descriptor write failed");
-         ++channelEntry->desc_write_fail_count;
          //HDXE_ASSERT(0);
       }
 
@@ -2105,74 +2398,6 @@
    return status;
 }
 
-static wpt_uint32 dxeRXLogRefillRing
-(
-   WLANDXE_CtrlBlkType      *dxeCtxt,
-   WLANDXE_ChannelCBType    *channelEntry,
-   wpt_uint64                bufferAddr,
-   wpt_uint32                bufferLen
-)
-{
-   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
-   WLANDXE_DescCtrlBlkType  *currentCtrlBlk = channelEntry->tailCtrlBlk;
-   WLANDXE_DescType         *currentDesc    = NULL;
-   wpt_uint32                xfrSize, allocatedLen = 0;
-
-   while(bufferLen > 0 && channelEntry->numFreeDesc > 0)
-   {
-      /* Current Control block is free
-       * and associated frame buffer is not linked with control block anymore
-       * allocate new frame buffer for current control block */
-      status = dxeRXFrameSingleBufferAlloc(dxeCtxt,
-                                           channelEntry,
-                                           currentCtrlBlk);
-
-      if((eWLAN_PAL_STATUS_SUCCESS != status) &&
-         (eWLAN_PAL_STATUS_E_EXISTS != status))
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "dxeRXFrameRefillRing, out of RX buffer pool, break here");
-         break;
-      }
-
-      if(eWLAN_PAL_STATUS_E_EXISTS == status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "%s, Descriptor Non-Empty",__func__);
-      }
-
-      currentDesc = currentCtrlBlk->linkedDesc;
-      currentDesc->descCtrl.ctrl = channelEntry->extraConfig.cw_ctrl_read;
-      xfrSize = WLANDXE_FW_LOGGING_XFSIZE > bufferLen ?
-                   bufferLen : WLANDXE_FW_LOGGING_XFSIZE;
-      currentDesc->xfrSize = xfrSize;
-      allocatedLen += xfrSize;
-      bufferLen -= xfrSize;
-      wpalPacketSetRxLength(currentCtrlBlk->xfrFrame,
-                            xfrSize);
-
-      currentDesc->dxedesc.dxe_short_desc.srcMemAddrL =
-              WLANDXE_U32_SWAP_ENDIAN((wpt_uint32)(uintptr_t)bufferAddr);
-
-      /* Issue a dummy read from the DXE descriptor DDR location to ensure
-         that any posted writes are reflected in memory before DXE looks at
-         the descriptor. */
-      if(channelEntry->extraConfig.cw_ctrl_read != currentDesc->descCtrl.ctrl)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "%s, Descriptor write failed",__func__);
-         ++channelEntry->desc_write_fail_count;
-      }
-
-      currentCtrlBlk = currentCtrlBlk->nextCtrlBlk;
-      --channelEntry->numFreeDesc;
-      bufferAddr += xfrSize;
-   }
-
-   channelEntry->tailCtrlBlk = currentCtrlBlk;
-
-   return allocatedLen;
-}
 /*==========================================================================
   @  Function Name
       dxeRXFrameRouteUpperLayer
@@ -2219,15 +2444,36 @@
    {
       channelEntry->numTotalFrame++;
       channelEntry->numFreeDesc++;
-      status = wpalUnlockPacket(currentCtrlBlk->xfrFrame);
+#ifdef FEATURE_R33D
+      /* Transfer Size should be */
+      currentDesc->xfrSize = WLANDXE_U32_SWAP_ENDIAN(WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE);
+      status = wpalPrepareRxFrame(&currentCtrlBlk->xfrFrame,
+                                       (wpt_uint32)currentCtrlBlk->xfrFrame->pBDPhys,
+                                       currentCtrlBlk->shadowBufferVa,
+                                       WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXFrameReady Prepare RX Frame fail");
+         return ret_val;
+      }
+      status = wpalFreeRxFrame(currentCtrlBlk->shadowBufferVa);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXFrameReady Free Shadow RX Frame fail");
+         return ret_val;
+      }
 
+#else /* FEATURE_R33D */
+      status = wpalUnlockPacket(currentCtrlBlk->xfrFrame);
       if (eWLAN_PAL_STATUS_SUCCESS != status)
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeRXFrameReady unable to unlock packet");
          return ret_val;
       }
-
+#endif /* FEATURE_R33D */
       /* This Descriptor is valid, so linked Control block is also valid
        * Linked Control block has pre allocated packet buffer
        * So, just let upper layer knows preallocated frame pointer will be OK */
@@ -2237,8 +2483,7 @@
       currentCtrlBlk->xfrFrame = NULL;
 
       /* Now try to refill the ring with empty Rx buffers to keep DXE busy */
-      if (WDTS_CHANNEL_RX_FW_LOG != channelEntry->channelType)
-          dxeRXFrameRefillRing(dxeCtxt, channelEntry);
+      dxeRXFrameRefillRing(dxeCtxt, channelEntry);
 
       /* Test next contorl block
        * if valid, this control block also has new RX frame must be handled */
@@ -2485,25 +2730,6 @@
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_HIGH, "C%x S%x", clrSt, setSt);
 
-   /* Store the smsm notification sent to firmware */
-   tempDxeCtrlBlk->smsmDxeHistogram = (tempDxeCtrlBlk->smsmDxeHistogram << 1);
-   if(setSt & WPAL_SMSM_WLAN_TX_ENABLE)
-   {
-      tempDxeCtrlBlk->smsmDxeHistogram |= 1;
-   }
-   else
-   {
-      tempDxeCtrlBlk->smsmDxeHistogram &= ~((wpt_uint32)1);
-   }
-   tempDxeCtrlBlk->smsmRingsEmptyHistogram = (tempDxeCtrlBlk->smsmRingsEmptyHistogram << 1);
-   if(setSt & WPAL_SMSM_WLAN_TX_RINGS_EMPTY)
-   {
-      tempDxeCtrlBlk->smsmRingsEmptyHistogram |= 1;
-   }
-   else
-   {
-      tempDxeCtrlBlk->smsmRingsEmptyHistogram &= ~((wpt_uint32)1);
-   }
    wpalNotifySmsm(clrSt, setSt);
 
    return eWLAN_PAL_STATUS_SUCCESS;
@@ -2596,8 +2822,6 @@
    WLANDXE_ChannelCBType    *channelCb  = NULL;
    wpt_uint32                chHighStat = 0;
    wpt_uint32                chLowStat  = 0;
-   wpt_uint32                chLogRxStat  = 0;
-   wpt_uint32                chLogRxFwStat = 0;
    wpt_uint32                regValue, chanMask;
 
    dxeCtxt = (WLANDXE_CtrlBlkType *)(msgContent->pContext);
@@ -2612,58 +2836,22 @@
    /* Now try to refill the ring with empty Rx buffers to keep DXE busy */
    dxeRXFrameRefillRing(dxeCtxt, &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI]);
    dxeRXFrameRefillRing(dxeCtxt, &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI]);
-   if (WLANDXE_IS_VALID_CHANNEL(WDTS_CHANNEL_RX_LOG))
-      dxeRXFrameRefillRing(dxeCtxt, &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOG]);
+
+   dxeCtxt = (WLANDXE_CtrlBlkType *)(msgContent->pContext);
       
    if((!dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI].extraConfig.chEnabled) ||
-      (!dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI].extraConfig.chEnabled) ||
-      (WLANDXE_IS_VALID_CHANNEL(WDTS_CHANNEL_RX_LOG) &&
-       !dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOG].extraConfig.chEnabled))
+      (!dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI].extraConfig.chEnabled))
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
          "DXE already stopped in RX event handler. Just return");
       return;
    }
 
-   /* Disable device interrupt */
-   /* Read whole interrupt mask register and exclusive only this channel int */
-   status = wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
-                              &intSrc);
-   if(eWLAN_PAL_STATUS_SUCCESS != status)
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "dxeRXEventHandler Read INT_SRC register fail");
-      return;
-   }
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
-            "RX Event Handler INT Source 0x%x", intSrc);
-
-   dxeEnvBlk.rxIntChanlSrc = intSrc&0xFF;
-
    if((WLANDXE_POWER_STATE_IMPS == dxeCtxt->hostPowerState) ||
       (WLANDXE_POWER_STATE_DOWN == dxeCtxt->hostPowerState))
    {
-      if (WLANDXE_POWER_STATE_DOWN != dxeCtxt->hostPowerState)
-      {
-        if(0 == intSrc)
-        {
-           HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                    "%s: Read status: %d, regVal: %d",
-                    __func__, status, intSrc);
-        }
-        else
-        {
-           /* Register Read was succesful and we have a valid interrupt
-            * source, so WCN is not power collapsed yet and it should
-            * not power collapse till we set the synchronization bit
-            * at the end of this function, safe to pull frames...
-            */
-            goto pull_frames;
-        }
-      }
-
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-         "%s Riva is in %d, Just Pull frames without any register touch",
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+         "%s Riva is in %d, Just Pull frames without any register touch ",
            __func__, dxeCtxt->hostPowerState);
 
       /* Not to touch any register, just pull frame directly from chain ring
@@ -2675,7 +2863,7 @@
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeRXEventHandler Pull from RX high channel fail");
+                  "dxeRXEventHandler Pull from RX high channel fail");        
       }
       /* In case FW could not power collapse in IMPS mode
        * Next power restore might have empty interrupt
@@ -2693,35 +2881,31 @@
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeRXEventHandler Pull from RX low channel fail");
+                  "dxeRXEventHandler Pull from RX low channel fail");        
       }
       /* LOW Priority CH same above */
       channelCb->numFragmentCurrentChain = 1;
 
-      if (WLANDXE_IS_VALID_CHANNEL(WDTS_CHANNEL_RX_LOG))
-      {
-         channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOG];
-         status = dxeRXFrameReady(dxeCtxt,
-                                  channelCb,
-                                  chLogRxStat);
-         if(eWLAN_PAL_STATUS_SUCCESS != status)
-         {
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                     "dxeRXEventHandler Pull from RX log channel fail");
-         }
-         channelCb->numFragmentCurrentChain = 1;
-      }
       /* Interrupt will not enabled at here, it will be enabled at PS mode change */
       tempDxeCtrlBlk->rxIntDisabledByIMPS = eWLAN_PAL_TRUE;
-      dxeEnvBlk.rxIntDisableReturn = VOS_RETURN_ADDRESS;
-      dxeEnvBlk.rxIntDisableFrame = __builtin_frame_address(0);
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-            "%s Host is in %d RX Int Disabled",
-            __func__, dxeCtxt->hostPowerState);
+
       return;
    }
 
-pull_frames:
+   /* Disable device interrupt */
+   /* Read whole interrupt mask register and exclusive only this channel int */
+   status = wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
+                             &intSrc);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXEventHandler Read INT_SRC register fail");
+      return;         
+   }
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+            "RX Event Handler INT Source 0x%x", intSrc);
+
+#ifndef WLANDXE_TEST_CHANNEL_ENABLE
    /* Test High Priority Channel interrupt is enabled or not */
    channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI];
    if(intSrc & (1 << channelCb->assignedDMAChannel))
@@ -2740,12 +2924,11 @@
                   "%11s : 0x%x Error Reported, Reload Driver",
                   channelType[channelCb->channelType], chHighStat);
 
-         if (eWLAN_PAL_STATUS_SUCCESS != dxeErrHandler(channelCb, chHighStat))
-         {
-            dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
-            wpalWlanReload();
-            dxeStartSSRTimer(dxeCtxt);
-         }
+         dxeErrChannelDebug(channelCb, chHighStat);
+
+         dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
+         wpalWlanReload();
+         dxeStartSSRTimer(dxeCtxt);
       }
       else if((WLANDXE_CH_STAT_INT_DONE_MASK & chHighStat) ||
               (WLANDXE_CH_STAT_INT_ED_MASK & chHighStat))
@@ -2771,9 +2954,57 @@
       }
       else
       {
-         channelCb->rxDoneHistogram &= ~((wpt_uint64)1);
+         channelCb->rxDoneHistogram &= ~1;
       }
    }
+#else
+   /* Test H2H Test interrupt is enabled or not */
+   channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_H2H_TEST_RX];
+   if(intSrc & (1 << channelCb->assignedDMAChannel))
+   {
+      status = dxeChannelCleanInt(channelCb, &chStat);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXEventHandler INT Clean up fail");
+         return;         
+      }
+
+      if(WLANDXE_CH_STAT_INT_ERR_MASK & chStat)
+      {
+         /* Error Happen during transaction, Handle it */
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                  "%11s : 0x%x Error Reported, Reload Driver",
+                  channelType[channelCb->channelType], chStat);
+
+         dxeErrChannelDebug(channelCb, chStat);
+
+         dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
+         wpalWlanReload();
+         dxeStartSSRTimer(dxeCtxt);
+      }
+      else if(WLANDXE_CH_STAT_INT_ED_MASK & chStat)
+      {
+         /* Handle RX Ready for high priority channel */
+         status = dxeRXFrameReady(dxeCtxt,
+                                  channelCb,
+                                  chStat);
+      }
+      /* Update the Rx DONE histogram */
+      channelCb->rxDoneHistogram = (channelCb->rxDoneHistogram << 1);
+      if(WLANDXE_CH_STAT_INT_DONE_MASK & chStat)
+      {
+         channelCb->rxDoneHistogram |= 1;
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "DXE Channel Number %d, Rx DONE Histogram 0x%016llx",
+            channelCb->assignedDMAChannel, channelCb->rxDoneHistogram);
+      }
+      else
+      {
+         channelCb->rxDoneHistogram &= ~1;
+      }
+   }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 
    /* Test Low Priority Channel interrupt is enabled or not */
        channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI];
@@ -2794,13 +3025,11 @@
                   "%11s : 0x%x Error Reported, Reload Driver",
                   channelType[channelCb->channelType], chLowStat);
 
-         if (eWLAN_PAL_STATUS_SUCCESS !=
-                         dxeErrHandler(channelCb, chLowStat))
-         {
-            dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
-            wpalWlanReload();
-            dxeStartSSRTimer(dxeCtxt);
-         }
+         dxeErrChannelDebug(channelCb, chLowStat);
+
+         dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
+         wpalWlanReload();
+         dxeStartSSRTimer(dxeCtxt);
       }
       else if((WLANDXE_CH_STAT_INT_ED_MASK & chLowStat) ||
                (WLANDXE_CH_STAT_INT_DONE_MASK & chLowStat))
@@ -2819,139 +3048,11 @@
       }
       else
       {
-         channelCb->rxDoneHistogram &= ~((wpt_uint64)1);
+         channelCb->rxDoneHistogram &= ~1;
       }
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
                "RX LOW CH EVNT STAT 0x%x, %d frames handled", chLowStat, channelCb->numFragmentCurrentChain);
    }
-
-   if (WLANDXE_IS_VALID_CHANNEL(WDTS_CHANNEL_RX_LOG))
-   {
-      channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOG];
-
-      if(intSrc & (1 << channelCb->assignedDMAChannel))
-      {
-         status = dxeChannelCleanInt(channelCb,&chLogRxStat);
-         if(eWLAN_PAL_STATUS_SUCCESS != status)
-         {
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                     "dxeRXEventHandler INT Clean up fail");
-            return;
-         }
-
-         if(WLANDXE_CH_STAT_INT_ERR_MASK & chLogRxStat)
-         {
-            /* Error Happen during transaction, Handle it */
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                     "%11s : 0x%x Error Reported, Reload Driver",
-                     channelType[channelCb->channelType], chLogRxStat);
-
-            if (eWLAN_PAL_STATUS_SUCCESS !=
-                            dxeErrHandler(channelCb, chLogRxStat))
-            {
-               dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
-               wpalWlanReload();
-               dxeStartSSRTimer(dxeCtxt);
-            }
-
-         }
-         else if((WLANDXE_CH_STAT_INT_ED_MASK & chLogRxStat) ||
-                  (WLANDXE_CH_STAT_INT_DONE_MASK & chLogRxStat))
-         {
-            /* Handle RX Ready for low priority channel */
-            status = dxeRXFrameReady(dxeCtxt,
-                                     channelCb,
-                                     chLogRxStat);
-          }
-
-         /* Update the Rx DONE histogram */
-         channelCb->rxDoneHistogram = (channelCb->rxDoneHistogram << 1);
-         if(WLANDXE_CH_STAT_INT_DONE_MASK & chLogRxStat)
-         {
-            channelCb->rxDoneHistogram |= 1;
-         }
-         else
-         {
-            channelCb->rxDoneHistogram &= ~1;
-         }
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-                  "RX LOG CH EVNT STAT 0x%x, %d frames handled", chLogRxStat, channelCb->numFragmentCurrentChain);
-      }
-   }
-
-   if (WLANDXE_IS_VALID_CHANNEL(WDTS_CHANNEL_RX_FW_LOG))
-   {
-      channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_FW_LOG];
-
-      if(intSrc & (1 << channelCb->assignedDMAChannel))
-      {
-         status = dxeChannelCleanInt(channelCb,&chLogRxFwStat);
-         if(eWLAN_PAL_STATUS_SUCCESS != status)
-         {
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                     "dxeRXEventHandler INT Clean up fail");
-            return;
-         }
-
-         if(WLANDXE_CH_STAT_INT_ERR_MASK & chLogRxFwStat)
-         {
-            /* Error Happen during transaction, Handle it */
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                     "%11s : 0x%x Error Reported, Reload Driver",
-                     channelType[channelCb->channelType], chLogRxFwStat);
-
-            if (eWLAN_PAL_STATUS_SUCCESS !=
-                            dxeErrHandler(channelCb, chLogRxFwStat))
-            {
-               dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
-               wpalWlanReload();
-               dxeStartSSRTimer(dxeCtxt);
-            }
-
-         }
-         else if((WLANDXE_CH_STAT_INT_ED_MASK & chLogRxFwStat) ||
-                 (WLANDXE_CH_STAT_INT_DONE_MASK & chLogRxFwStat))
-         {
-            if (!dxeCtxt->hostInitiatedH2H)
-            {
-               dxeCtxt->receiveMbMsgCB(dxeCtxt->clientCtxt);
-            }
-            else
-            {
-               status = dxeRXFrameReady(dxeCtxt,
-                                        channelCb,
-                                        chLogRxFwStat);
-               if (channelCb->numFreeDesc == channelCb->numDesc)
-               {
-                  /*
-                   * We have already cleared the interrupts before coming here,
-                   * but it can happen that DXE will copy some new packets after
-                   * that and raise interrupts for those. The packets will be
-                   * processed above but the interrupts will still be pending.
-                   * Its safe to clear those interrupts here because we have
-                   * pulled data from all the allocated descriptors.
-                   */
-                  dxeChannelCleanInt(channelCb,&chLogRxFwStat);
-                  dxeCtxt->hostInitiatedH2H = 0;
-                  dxeCtxt->receiveLogCompleteCB(dxeCtxt->clientCtxt);
-               }
-            }
-         }
-
-         /* Update the Rx DONE histogram */
-         channelCb->rxDoneHistogram = (channelCb->rxDoneHistogram << 1);
-         if(WLANDXE_CH_STAT_INT_DONE_MASK & chLogRxFwStat)
-         {
-            channelCb->rxDoneHistogram |= 1;
-         }
-         else
-         {
-            channelCb->rxDoneHistogram &= ~1;
-         }
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-                  "RX LOG CH EVNT STAT 0x%x, %d frames handled", chLogRxFwStat, channelCb->numFragmentCurrentChain);
-      }
-   }
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -3001,50 +3102,12 @@
    wpalWriteRegister(dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI].channelRegister.chDXECtrlRegAddr,
                      chanMask);
 
-   /* We do not have knowledge of firmare capabilities when the
-    * RX_LOG channel is enabled. But when we get the first interrupt
-    * we have all the required information. So if MGMT Logging is not
-    * supported by the firmware, do not re-enable RX_LOG channel
-    */
-   if (WLANDXE_IS_VALID_CHANNEL(WDTS_CHANNEL_RX_LOG) && wpalIsFwLoggingSupported())
-   {
-      if(!(dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOG].extraConfig.chan_mask & WLANDXE_CH_CTRL_EN_MASK))
-      {
-         HDXE_ASSERT(0);
-      }
-
-      if (dxeCtxt->rxPalPacketUnavailable &&
-          (WLANDXE_CH_STAT_INT_DONE_MASK & chLogRxStat))
-      {
-        chanMask = dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOG].extraConfig.chan_mask &
-                   (~WLANDXE_CH_CTRL_INE_DONE_MASK);
-        dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOG].doneIntDisabled = 1;
-      }
-      else
-      {
-        chanMask = dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOG].extraConfig.chan_mask;
-        dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOG].doneIntDisabled = 0;
-      }
-      wpalWriteRegister(dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOG].channelRegister.chDXECtrlRegAddr,
-                        chanMask);
-   }
 
    /* Clear Interrupt handle processing bit
     * RIVA may power down */
-   if (!(wpalIsFwLoggingSupported() && wpalIsFwLoggingEnabled()))
-   {
-      wpalReadRegister(WLANDXE_INT_MASK_REG_ADDRESS, &regValue);
-      regValue &= WLANDXE_RX_INTERRUPT_PRO_UNMASK;
-      wpalWriteRegister(WLANDXE_INT_MASK_REG_ADDRESS, regValue);
-   }
-   else
-   {
-      wpalReadRegister(WLAN_PMU_SPARE_OUT_ADDRESS, &regValue);
-      regValue &= (~WLAN_PMU_POWER_DOWN_MASK);
-      wpalWriteRegister(WLAN_PMU_SPARE_OUT_ADDRESS, regValue);
-   }
-
-   dxeEnvBlk.rxIntChanlSrc = 0;
+   wpalReadRegister(WLANDXE_INT_MASK_REG_ADDRESS, &regValue);
+   regValue &= WLANDXE_RX_INTERRUPT_PRO_UNMASK;
+   wpalWriteRegister(WLANDXE_INT_MASK_REG_ADDRESS, regValue);
 
    /* Enable system level ISR */
    /* Enable RX ready Interrupt at here */
@@ -3055,8 +3118,7 @@
                "dxeRXEventHandler Enable RX Ready interrupt fail");
       return;
    }
-   DXTRACE(dxeTrace(WLANDXE_DMA_CHANNEL_MAX, TRACE_RXINT_STATE,
-                    TRACE_WLANDXE_VAR_ENABLE));
+
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __func__);
    return;
@@ -3110,7 +3172,6 @@
       wpalTimerGetCurStatus(&dxeCtxt->rxResourceAvailableTimer))
    {
       wpalTimerStop(&dxeCtxt->rxResourceAvailableTimer);
-      dxeEnvBlk.rx_low_resource_timer = 0;
    }
 #endif
 
@@ -3135,16 +3196,6 @@
       {
          break;
       }
-
-      if (WLANDXE_IS_VALID_CHANNEL(WDTS_CHANNEL_RX_LOG))
-      {
-         channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOG];
-         status = dxeRXFrameRefillRing(dxeCtxt,channelCb);
-         if(eWLAN_PAL_STATUS_SUCCESS != status)
-         {
-            break;
-         }
-      }
    } while(0);
 
    if((WLANDXE_POWER_STATE_IMPS == dxeCtxt->hostPowerState) ||
@@ -3152,10 +3203,6 @@
    {
       /* Interrupt will not enabled at here, it will be enabled at PS mode change */
       tempDxeCtrlBlk->rxIntDisabledByIMPS = eWLAN_PAL_TRUE;
-      dxeEnvBlk.rxIntDisableReturn = VOS_RETURN_ADDRESS;
-      dxeEnvBlk.rxIntDisableFrame = __builtin_frame_address(0);
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-            "dxeRXPacketAvailableEventHandler Int Disabled by IMPS");
    }
 }
 
@@ -3185,22 +3232,31 @@
    WLANDXE_CtrlBlkType      *dxeCtxt    = (WLANDXE_CtrlBlkType *)hostCtxt;
    wpt_status                status     = eWLAN_PAL_STATUS_SUCCESS;
    wpt_uint32                regValue;
-   wpt_uint32                intSrc     = 0;
+
+#ifdef FEATURE_R33D
+   status = wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
+                                  &regValue);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXCompISR Read INT_SRC_RAW fail");
+      return;
+   }
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "INT_SRC_RAW 0x%x", regValue);
+   if(0 == regValue)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "This is not DXE Interrupt, Reject it 0x%x", regValue);
+      return;
+   }
+#endif /* FEATURE_R33D */
 
    /* Set Interrupt processing bit
     * During this bit set, WLAN HW may not power collapse */
-   if (!(wpalIsFwLoggingSupported() && wpalIsFwLoggingEnabled()))
-   {
-      wpalReadRegister(WLANDXE_INT_MASK_REG_ADDRESS, &regValue);
-      regValue |= WLANPAL_RX_INTERRUPT_PRO_MASK;
-      wpalWriteRegister(WLANDXE_INT_MASK_REG_ADDRESS, regValue);
-   }
-   else
-   {
-      wpalReadRegister(WLAN_PMU_SPARE_OUT_ADDRESS, &regValue);
-      regValue |= WLAN_PMU_POWER_DOWN_MASK;
-      wpalWriteRegister(WLAN_PMU_SPARE_OUT_ADDRESS, regValue);
-   }
+   wpalReadRegister(WLANDXE_INT_MASK_REG_ADDRESS, &regValue);
+   regValue |= WLANPAL_RX_INTERRUPT_PRO_MASK;
+   wpalWriteRegister(WLANDXE_INT_MASK_REG_ADDRESS, regValue);
 
    /* Disable interrupt at here
     * Disable RX Ready system level Interrupt at here
@@ -3213,12 +3269,6 @@
       return;         
    }
 
-   wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
-                                  &intSrc);
-   /* Note: intSrc which holds the INT_SRC_RAW_ADDRESS reg value
-      While debugging crash dump convert to power of 2 for channel type */
-   DXTRACE(dxeTrace(intSrc, TRACE_RXINT_STATE, TRACE_WLANDXE_VAR_DISABLE));
-
    /* Serialize RX Ready interrupt upon RX thread */
    if(NULL == dxeCtxt->rxIsrMsg)
    {
@@ -3264,15 +3314,19 @@
 {
    wpt_status                  status = eWLAN_PAL_STATUS_SUCCESS;
    WLANDXE_DescCtrlBlkType    *currentCtrlBlk = NULL;
-   WLANDXE_DescCtrlBlkType    *tailCtrlBlk    = NULL;
    WLANDXE_DescType           *currentDesc    = NULL;
    WLANDXE_DescType           *firstDesc      = NULL;
    WLANDXE_DescType           *LastDesc       = NULL;
-   WLANDXE_DescType           *tailDesc       = NULL;
    void                       *sourcePhysicalAddress = NULL;
    wpt_uint32                  xferSize = 0;
+#ifdef FEATURE_R33D
+   tx_frm_pcie_vector_t        frameVector;
+   wpt_uint32                  Va;
+   wpt_uint32                  fragCount = 0;
+#else
    wpt_iterator                iterator;
-   wpt_uint8                   KickDxe   = 0;
+#endif /* FEATURE_R33D */
+   wpt_uint32                  isEmpty = 0;
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __func__);
@@ -3281,27 +3335,19 @@
    if((0 == tempDxeCtrlBlk->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].numRsvdDesc) &&
       (0 == tempDxeCtrlBlk->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI].numRsvdDesc))
    {
-       KickDxe = 1;
-   }
-
-   /* Kick DXE when the ring is about to fill */
-   if (WLANDXE_TX_LOW_RES_THRESHOLD >= channelEntry->numFreeDesc)
-   {
-       KickDxe = 1;
-       tailCtrlBlk = channelEntry->tailCtrlBlk;
-       tailDesc = tailCtrlBlk->linkedDesc;
-
-       if(tailDesc->descCtrl.ctrl& WLANDXE_DESC_CTRL_VALID)
-       {
-          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-                   "dxeTXPushFrame Descs threshold reached No DMA");
-       }
+      isEmpty = 1;
    }
 
    channelEntry->numFragmentCurrentChain = 0;
    currentCtrlBlk = channelEntry->headCtrlBlk;
 
    /* Initialize interator, TX is fragmented */
+#ifdef FEATURE_R33D
+   memset(&frameVector, 0, sizeof(tx_frm_pcie_vector_t));
+   status = wpalPrepareTxFrame(palPacket,
+                                    &frameVector,
+                                    &Va);
+#else
    status = wpalLockPacketForTransfer(palPacket);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
@@ -3311,6 +3357,7 @@
    }
 
    status = wpalIteratorInit(&iterator, palPacket);
+#endif /* FEATURE_R33D */
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -3334,16 +3381,35 @@
       /* Get next fragment physical address and fragment size
        * if this is the first trial, will get first physical address
        * if no more fragment, Descriptor src address will be set as NULL, OK??? */
+#ifdef FEATURE_R33D
+      if(fragCount == frameVector.num_frg)
+      {
+         break;
+      }
+      currentCtrlBlk->shadowBufferVa = frameVector.frg[0].va;
+      sourcePhysicalAddress          = (void *)frameVector.frg[fragCount].pa;
+      xferSize                       = frameVector.frg[fragCount].size;
+      fragCount++;
+      if(0 == xferSize)
+      {
+          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXPushFrame invalid transfer size");
+
+          HDXE_ASSERT(0);
+          return eWLAN_PAL_STATUS_E_FAILURE;
+      }
+      if(NULL == sourcePhysicalAddress)
+      {
+          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "dxeTXPushFrame invalid sourcePhysicalAddress");
+          HDXE_ASSERT(0);
+          return eWLAN_PAL_STATUS_E_FAILURE;
+      }
+#else
       status = wpalIteratorNext(&iterator,
                                 palPacket,
                                 &sourcePhysicalAddress,
                                 &xferSize);
-      if(eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeTXPushFrame Get next frame fail");
-         return status;
-      }
       if((NULL == sourcePhysicalAddress) ||
          (0    == xferSize))
       {
@@ -3351,6 +3417,13 @@
                   "dxeTXPushFrame end of current frame");
          break;
       }
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXPushFrame Get next frame fail");
+         return status;
+      }
+#endif /* FEATURE_R33D */
 
       /* This is the LAST descriptor valid for this transaction */
       LastDesc    = currentCtrlBlk->linkedDesc;
@@ -3418,17 +3491,15 @@
    {
       /* Update channel head as next avaliable linked slot */
       channelEntry->headCtrlBlk = currentCtrlBlk;
-      if(KickDxe)
+      if(isEmpty)
       {
          tempDxeCtrlBlk->ringNotEmpty = eWLAN_PAL_TRUE;
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
                   "SMSM_ret LO=%d HI=%d",
                   tempDxeCtrlBlk->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].numRsvdDesc,
                   tempDxeCtrlBlk->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI].numRsvdDesc );
-         dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
          dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
          tempDxeCtrlBlk->smsmToggled = eWLAN_PAL_TRUE;
-         DXTRACE(dxeTrace(channelEntry->channelType, TRACE_SMSM_NOTIFY, TRACE_WLANDXE_VAR_ENABLE));
       }
       return status;
    }
@@ -3455,7 +3526,6 @@
                   "dxeTXPushFrame Write Channel Ctrl Register fail");
          return status;
       }
-      DXTRACE(dxeTrace(channelEntry->channelType, TRACE_CH_ENABLE, TRACE_WLANDXE_VAR_ENABLE));
 
       /* Update channel head as next avaliable linked slot */
       channelEntry->headCtrlBlk = currentCtrlBlk;
@@ -3499,6 +3569,37 @@
                   "dxeTXPushFrame LONG Descriptor Format!!!");
       }
    }
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+   else if(WDTS_CHANNEL_H2H_TEST_TX  == channelEntry->channelType)
+   {
+      /* Destination address, Physical memory address */
+      status = wpalWriteRegister(channelEntry->channelRegister.chDXEDadrlRegAddr,
+                                      WLANDXE_U32_SWAP_ENDIAN(firstDesc->dxedesc.dxe_short_desc.dstMemAddrL));
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXPushFrame Program dest address register fail");
+         return status;
+      }
+      /* If descriptor format is SHORT */
+      if(channelEntry->channelConfig.useShortDescFmt)
+      {
+         status = wpalWriteRegister(channelEntry->channelRegister.chDXEDadrhRegAddr,
+                                         0);
+         if(eWLAN_PAL_STATUS_SUCCESS != status)
+         {
+            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                     "dxeTXPushFrame Program dest address register fail");
+            return status;
+         }
+      }
+      else
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeTXPushFrame LONG Descriptor Format!!!");
+      }
+   }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 
    /* Program Source address register
     * This address is already programmed into DXE Descriptor
@@ -3682,6 +3783,9 @@
       if(WLANDXE_U32_SWAP_ENDIAN(descCtrlValue) & WLANDXE_DESC_CTRL_EOP)
       {
          hostCtxt->txCompletedFrames--;
+#ifdef FEATURE_R33D
+         wpalFreeTxFrame(currentCtrlBlk->shadowBufferVa);
+#else
          status = wpalUnlockPacket(currentCtrlBlk->xfrFrame);
          if (eWLAN_PAL_STATUS_SUCCESS != status)
          {
@@ -3695,6 +3799,7 @@
             }
             return status;
          }
+#endif /* FEATURE_R33D */
          hostCtxt->txCompCB(hostCtxt->clientCtxt,
                             currentCtrlBlk->xfrFrame,
                             eWLAN_PAL_STATUS_SUCCESS);
@@ -3740,6 +3845,7 @@
                               channelEntry->channelType,
                               eWLAN_PAL_TRUE);
       channelEntry->hitLowResource = eWLAN_PAL_FALSE;
+      wpalTimerStop(&channelEntry->healthMonitorTimer);
    }
 
    status = wpalMutexRelease(&channelEntry->dxeChannelLock);
@@ -3755,204 +3861,6 @@
 }
 
 /*==========================================================================
-  @  Function Name
-      dxeTXCleanup
-
-  @  Description
-      Cleanup the TX channels after DXE Error
-
-  @  Parameters
-      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
-                               DXE host driver main control block
-
-  @  Return
-      PAL_STATUS_T
-===========================================================================*/
-static wpt_status dxeTXCleanup
-(
-   WLANDXE_CtrlBlkType     *hostCtxt
-)
-{
-   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
-   WLANDXE_DescCtrlBlkType  *currentCtrlBlk = NULL;
-   WLANDXE_DescType         *currentDesc    = NULL;
-   wpt_uint32                descCtrlValue  = 0;
-   unsigned int             *lowThreshold   = NULL;
-   unsigned int              idx;
-   WLANDXE_ChannelCBType    *channelEntry;
-
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
-            "%s Enter", __func__);
-
-   /* Sanity */
-   if((NULL == hostCtxt))
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-               "%s: Invalid ARG", __func__);
-      return eWLAN_PAL_STATUS_E_INVAL;
-   }
-
-   if(NULL == hostCtxt->txCompCB)
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-               "%s: TXCompCB is not registered",__func__);
-      return eWLAN_PAL_STATUS_SUCCESS;
-   }
-
-   for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
-   {
-      channelEntry = &tempDxeCtrlBlk->dxeChannel[idx];
-      if(idx != WDTS_CHANNEL_TX_LOW_PRI && idx != WDTS_CHANNEL_TX_HIGH_PRI)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-                  "%s: %11s continue",__func__,
-                  channelType[channelEntry->channelType]);
-          continue;
-      }
-
-      status = wpalMutexAcquire(&channelEntry->dxeChannelLock);
-      if(eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "%s: %11s Mutex Acquire fail",__func__,
-                  channelType[channelEntry->channelType]);
-         return status;
-      }
-
-      currentCtrlBlk = channelEntry->tailCtrlBlk;
-      currentDesc    = currentCtrlBlk->linkedDesc;
-
-      if( currentCtrlBlk == channelEntry->headCtrlBlk )
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-                  "%s: %11s Head and Tail are Same",__func__,
-                  channelType[channelEntry->channelType]);
-
-         status = wpalMutexRelease(&channelEntry->dxeChannelLock);
-         if(eWLAN_PAL_STATUS_SUCCESS != status)
-         {
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                     "%s: %11s Mutex Release fail",__func__,
-                     channelType[channelEntry->channelType]);
-            return status;
-         }
-         continue;
-      }
-
-      while(1)
-      {
-         descCtrlValue = currentDesc->descCtrl.ctrl;
-         if((descCtrlValue & WLANDXE_DESC_CTRL_VALID))
-         {
-             /* invalidate... */
-             currentDesc->descCtrl.ctrl &= ~WLANDXE_DESC_CTRL_VALID;
-         }
-
-         if(currentCtrlBlk->xfrFrame == NULL)
-         {
-             HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                     "%s: %11s Invalid transfer frame",__func__,
-                     channelType[channelEntry->channelType]);
-             HDXE_ASSERT(0);
-             break;
-         }
-         channelEntry->numFreeDesc++;
-         channelEntry->numRsvdDesc--;
-
-         /* Send Frame TX Complete notification with frame start fragment location */
-         if(WLANDXE_U32_SWAP_ENDIAN(descCtrlValue) & WLANDXE_DESC_CTRL_EOP)
-         {
-            hostCtxt->txCompletedFrames--;
-            status = wpalUnlockPacket(currentCtrlBlk->xfrFrame);
-            if (eWLAN_PAL_STATUS_SUCCESS != status)
-            {
-               HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                        "%s: unable to unlock packet",__func__);
-               status = wpalMutexRelease(&channelEntry->dxeChannelLock);
-               if(eWLAN_PAL_STATUS_SUCCESS != status)
-               {
-                  HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                           "%s: Mutex Release fail",__func__);
-               }
-               return status;
-            }
-            hostCtxt->txCompCB(hostCtxt->clientCtxt,
-                               currentCtrlBlk->xfrFrame,
-                               eWLAN_PAL_STATUS_SUCCESS); //mir: SUCCESS or FAILURE?
-            channelEntry->numFragmentCurrentChain = 0;
-         }
-         currentCtrlBlk = currentCtrlBlk->nextCtrlBlk;
-         currentDesc    = currentCtrlBlk->linkedDesc;
-
-         /* Break condition
-          * Head control block is the control block must be programed for the next TX
-          * so, head control block is not programmed control block yet
-          * if loop encounte head control block, stop to complete
-          * in theory, COMP CB must be called already ??? */
-         if(currentCtrlBlk == channelEntry->headCtrlBlk)
-         {
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-                     "%s: %11s caught up with head ptr",__func__,
-                     channelType[channelEntry->channelType]);
-            break;
-         }
-         /* VALID Bit check ???? */
-      }
-
-      /* Tail and Head Control block must be same */
-      channelEntry->tailCtrlBlk = currentCtrlBlk;
-      /* Re-Sync Head and CDR */
-      status = wpalWriteRegister(channelEntry->channelRegister.chDXEDesclRegAddr,
-                                      channelEntry->headCtrlBlk->linkedDescPhyAddr);
-      if(eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeChannelInitProgram Write DESC Address register fail");
-         status = wpalMutexRelease(&channelEntry->dxeChannelLock);
-         if(eWLAN_PAL_STATUS_SUCCESS != status)
-         {
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                     "%s: %11s Mutex Release fail", __func__,
-                     channelType[channelEntry->channelType]);
-         }
-         return status;
-      }
-
-      lowThreshold = channelEntry->channelType == WDTS_CHANNEL_TX_LOW_PRI?
-         &(hostCtxt->txCompInt.txLowResourceThreshold_LoPriCh):
-         &(hostCtxt->txCompInt.txLowResourceThreshold_HiPriCh);
-
-      /* If specific channel hit low resource condition send notification to upper layer */
-      if((eWLAN_PAL_TRUE == channelEntry->hitLowResource) &&
-         (channelEntry->numFreeDesc > *lowThreshold))
-      {
-         /* Change it back if we raised it for fetching a remaining packet from TL */
-         if(WLANDXE_TX_LOW_RES_THRESHOLD > *lowThreshold)
-         {
-            *lowThreshold = WLANDXE_TX_LOW_RES_THRESHOLD;
-         }
-
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "DXE TX %d channel recovered from low resource", channelEntry->channelType);
-         hostCtxt->lowResourceCB(hostCtxt->clientCtxt,
-                                 channelEntry->channelType,
-                                 eWLAN_PAL_TRUE);
-         channelEntry->hitLowResource = eWLAN_PAL_FALSE;
-      }
-      status = wpalMutexRelease(&channelEntry->dxeChannelLock);
-      if(eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "%s: %11s Mutex Release fail", __func__,
-                  channelType[channelEntry->channelType]);
-      }
-   }
-
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
-            "%s Exit", __func__);
-   return status;
-}
-/*==========================================================================
   @  Function Name 
       dxeTXEventHandler
 
@@ -3997,20 +3905,6 @@
       return;
    }
 
-   /* Read whole interrupt mask register and exclusive only this channel int */
-   status = wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
-                                  &intSrc);
-   if(eWLAN_PAL_STATUS_SUCCESS != status)
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "dxeTXCompleteEventHandler Read INT_DONE_SRC register fail");
-      return;
-   }
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
-            "TX Event Handler INT Source 0x%x", intSrc);
-
-   dxeEnvBlk.txCmpIntChanlSrc = intSrc&0xFF;
-
    /* Return from here if the RIVA is in IMPS, to avoid register access */
    if(WLANDXE_POWER_STATE_IMPS == dxeCtxt->hostPowerState)
    {
@@ -4040,9 +3934,6 @@
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                      "TX COMP INT Enabled, remain TX frame count on ring %d",
                      dxeCtxt->txCompletedFrames);
-
-         dxeEnvBlk.txCmpIntChanlSrc = 0;
-
          /*Kicking the DXE after the TX Complete interrupt was enabled - to avoid 
            the posibility of a race*/
          dxePsComplete(dxeCtxt, eWLAN_PAL_TRUE);
@@ -4066,6 +3957,19 @@
       return;
    }
 
+   /* Disable device interrupt */
+   /* Read whole interrupt mask register and exclusive only this channel int */
+   status = wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
+                                  &intSrc);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXCompleteEventHandler Read INT_DONE_SRC register fail");
+      return;         
+   }
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
+            "TX Event Handler INT Source 0x%x", intSrc);
+
    /* Test High Priority Channel is the INT source or not */
    channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI];
    if(intSrc & (1 << channelCb->assignedDMAChannel))
@@ -4084,14 +3988,11 @@
                   "%11s : 0x%x Error Reported, Reload Driver",
                   channelType[channelCb->channelType], chStat);
 
-         if (eWLAN_PAL_STATUS_SUCCESS !=
-                         dxeErrHandler(channelCb, chStat))
-         {
-            dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
-            wpalWlanReload();
-            dxeStartSSRTimer(dxeCtxt);
-         }
-         bEnableISR = 1;
+         dxeErrChannelDebug(channelCb, chStat);
+
+         dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
+         wpalWlanReload();
+         dxeStartSSRTimer(dxeCtxt);
       }
       else if(WLANDXE_CH_STAT_INT_DONE_MASK & chStat)
       {
@@ -4141,14 +4042,11 @@
                   "%11s : 0x%x Error Reported, Reload Driver",
                   channelType[channelCb->channelType], chStat);
 
-         if (eWLAN_PAL_STATUS_SUCCESS !=
-                         dxeErrHandler(channelCb, chStat))
-         {
-             dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
-             wpalWlanReload();
-             dxeStartSSRTimer(dxeCtxt);
-         }
-         bEnableISR = 1;
+         dxeErrChannelDebug(channelCb, chStat);
+
+         dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
+         wpalWlanReload();
+         dxeStartSSRTimer(dxeCtxt);
       }
       else if(WLANDXE_CH_STAT_INT_DONE_MASK & chStat)
       {
@@ -4179,6 +4077,53 @@
                "TX LOW STAT 0x%x RESRVD %d", chStat, channelCb->numRsvdDesc);
    }
 
+
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+   /* Test H2H TX Channel interrupt is enabled or not */
+   channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_H2H_TEST_TX];
+   if(intSrc & (1 << channelCb->assignedDMAChannel))
+   {
+      status = wpalReadRegister(channelCb->channelRegister.chDXEStatusRegAddr,
+                                     &chStat);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeChannelCleanInt Read CH STAT register fail");
+         return;         
+      }
+
+      if(WLANDXE_CH_STAT_INT_ERR_MASK & chStat)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+                  "%11s : 0x%x Error Reported, Reload Driver",
+                  channelType[channelCb->channelType], chStat);
+
+         dxeErrChannelDebug(channelCb, chStat);
+
+         dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
+         wpalWlanReload();
+         dxeStartSSRTimer(dxeCtxt);
+      }
+      else if(WLANDXE_CH_STAT_INT_DONE_MASK & chStat)
+      {
+         /* Handle TX complete for high priority channel */
+         status = dxeTXCompFrame(dxeCtxt,
+                                 channelCb);
+         if(eWLAN_PAL_STATUS_SUCCESS != status)
+         {
+            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                     "dxeTXEventHandler INT Clean up fail");
+            return;         
+         }
+      }
+      else
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "unexpected channel state %d", chStat);
+      }
+   }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
+
    if((bEnableISR || (dxeCtxt->txCompletedFrames)) &&
       (eWLAN_PAL_FALSE == dxeCtxt->txIntEnable))
    {
@@ -4192,12 +4137,6 @@
       }
    }
 
-   if(eWLAN_PAL_TRUE == dxeCtxt->txIntEnable)
-      DXTRACE(dxeTrace(WLANDXE_DMA_CHANNEL_MAX, TRACE_TXINT_STATE,
-                       TRACE_WLANDXE_VAR_ENABLE));
-
-   dxeEnvBlk.txCmpIntChanlSrc = 0;
-
    /*Kicking the DXE after the TX Complete interrupt was enabled - to avoid 
      the posibility of a race*/
    dxePsComplete(dxeCtxt, eWLAN_PAL_TRUE);
@@ -4268,8 +4207,7 @@
           * Then when push frame, no SMSM toggle happen
           * To avoid permanent TX stall, SMSM toggle is needed at here
           * With this toggle, host should gaurantee SMSM state should be changed */
-         dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
-         dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
+         dxeNotifySmsm(eWLAN_PAL_TRUE, dxeCtxt->txRingsEmpty);
       }
    }
    
@@ -4492,9 +4430,11 @@
    void                    *hostCtxt
 )
 {
-   WLANDXE_CtrlBlkType      *dxeCtxt = (WLANDXE_CtrlBlkType *)hostCtxt;
+   WLANDXE_CtrlBlkType      *dxeCtxt    = (WLANDXE_CtrlBlkType *)hostCtxt;
    wpt_status                status  = eWLAN_PAL_STATUS_SUCCESS;
-   wpt_uint32                intSrc  = 0;
+#ifdef FEATURE_R33D
+   wpt_uint32                regValue;
+#endif /* FEATURE_R33D */
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __func__);
@@ -4518,6 +4458,25 @@
       return;
    }
 
+#ifdef FEATURE_R33D
+   status = wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
+                                  &regValue);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeTXCompISR Read INT_SRC_RAW fail");
+      return;
+   }
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "INT_SRC_RAW 0x%x", regValue);
+   if(0 == regValue)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "This is not DXE Interrupt, Reject it");
+      return;
+   }
+#endif /* FEATURE_R33D */
+
    /* Disable TX Complete Interrupt at here */
    status = wpalDisableInterrupt(DXE_INTERRUPT_TX_COMPLE);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
@@ -4528,11 +4487,6 @@
    }
    dxeCtxt->txIntEnable = eWLAN_PAL_FALSE;
 
-   wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
-                                  &intSrc);
-   /* intSrc which holds the INT_SRC_RAW_ADDRESS reg value
-      While debugging crash dump convert to power of 2 for channel type */
-   DXTRACE(dxeTrace(intSrc, TRACE_TXINT_STATE, TRACE_WLANDXE_VAR_DISABLE));
 
    if( dxeCtxt->ucTxMsgCnt )
    {
@@ -4540,7 +4494,7 @@
                  "Avoiding serializing TX Complete event");
     return;
    }
-
+   
    dxeCtxt->ucTxMsgCnt = 1;
 
    /* Serialize TX complete interrupt upon TX thread */
@@ -4551,7 +4505,6 @@
        HDXE_ASSERT(0);
        return;
    }
-
    status = wpalPostTxMsg(WDI_GET_PAL_CTX(),
                           dxeCtxt->txIsrMsg);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
@@ -4565,97 +4518,6 @@
    return;
 }
 
-/*==========================================================================
-  @  Function Name
-      dxeTraceInit
-
-  @  Description
-      Initialize the DXTRACE when enabled
-
-  @  Parameters
-      NONE
-
-  @  Return
-      NONE
-===========================================================================*/
-void dxeTraceInit(void)
-{
-   gdxeTraceData.head   = INVALID_VOS_TRACE_ADDR;
-   gdxeTraceData.tail   = INVALID_VOS_TRACE_ADDR;
-   gdxeTraceData.num    = 0;
-   gdxeTraceData.enable = eWLAN_PAL_TRUE;
-}
-
-/*==========================================================================
-  @  Function Name
-      dxeTrace
-
-  @  Description
-       puts the messages in to ring-buffer
-
-  @  Parameters
-      v_U8_t   chan
-               Rx/Tx path record
-      v_U8_t   code
-               Rx/Tx Event
-      v_U32_t  data
-               Actual message contents
-  @  Return
-      NONE
-===========================================================================*/
-void dxeTrace(v_U8_t chan, v_U8_t code, v_U32_t data)
-{
-    pdxeTraceRecord rec = NULL;
-    unsigned long flags;
-
-    if (!gdxeTraceData.enable)
-    {
-        return;
-    }
-
-    /* Aquire the lock and only one thread can access the buffer at a time */
-    spin_lock_irqsave(&dtraceLock, flags);
-
-    gdxeTraceData.num++;
-
-    if (gdxeTraceData.num > MAX_DXE_TRACE_RECORDS)
-    {
-        gdxeTraceData.num = MAX_DXE_TRACE_RECORDS;
-    }
-    if (INVALID_VOS_TRACE_ADDR == gdxeTraceData.head)
-    {
-        /* first record */
-        gdxeTraceData.head = 0;
-        gdxeTraceData.tail = 0;
-    }
-    else
-    {
-        /* queue is not empty */
-        v_U32_t tail = gdxeTraceData.tail + 1;
-        if (MAX_DXE_TRACE_RECORDS == tail)
-        {
-            tail = 0;
-        }
-        if (gdxeTraceData.head == tail)
-        {
-            /* full */
-            if (MAX_DXE_TRACE_RECORDS == ++gdxeTraceData.head)
-            {
-                gdxeTraceData.head = 0;
-            }
-        }
-        gdxeTraceData.tail = tail;
-    }
-
-    rec = &gdxeTraceTbl[gdxeTraceData.tail];
-    rec->code = code;
-    rec->data = data;
-    rec->time = vos_timer_get_system_time();
-    rec->chan = chan;
-
-    spin_unlock_irqrestore(&dtraceLock, flags);
-}
-
 /*-------------------------------------------------------------------------
  *  Global Function
  *-------------------------------------------------------------------------*/
@@ -4682,22 +4544,16 @@
    unsigned int            idx;
    WLANDXE_ChannelCBType  *currentChannel = NULL;
    int                     smsmInitState;
-   wpt_uint8               chanMask = WDTS_TRANSPORT_CHANNELS_MASK;
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+   wpt_uint32                 sIdx;
+   WLANDXE_ChannelCBType     *channel = NULL;
+   WLANDXE_DescCtrlBlkType   *crntDescCB = NULL;
+   WLANDXE_DescCtrlBlkType   *nextDescCB = NULL;
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __func__);
 
-   if (wpalIsFwLoggingEnabled())
-   {
-      chanMask |= WDTS_RX_LOG_CHANNEL_MASK;
-   }
-
-   if (wpalIsFwEvLoggingEnabled())
-   {
-      chanMask |= WDTS_RX_FW_LOG_CHANNEL_MASK;
-   }
-   dxeSetEnabledChannels(chanMask);
-
    /* This is temporary allocation */
    tempDxeCtrlBlk = (WLANDXE_CtrlBlkType *)wpalMemoryAllocate(sizeof(WLANDXE_CtrlBlkType));
    if(NULL == tempDxeCtrlBlk)
@@ -4708,14 +4564,46 @@
    }
    wpalMemoryZero(tempDxeCtrlBlk, sizeof(WLANDXE_CtrlBlkType));
 
-   dxeCommonDefaultConfig(tempDxeCtrlBlk);
+   status = dxeCommonDefaultConfig(tempDxeCtrlBlk);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Open Common Configuration Fail");
+      WLANDXE_Close(tempDxeCtrlBlk);
+      return NULL;         
+   }
 
-   foreach_valid_channel(idx)
+   for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "WLANDXE_Open Channel %s Open Start", channelType[idx]);
       currentChannel = &tempDxeCtrlBlk->dxeChannel[idx];
-      currentChannel->channelType = idx;
+      if(idx == WDTS_CHANNEL_TX_LOW_PRI)
+      {
+         currentChannel->channelType = WDTS_CHANNEL_TX_LOW_PRI;
+      }
+      else if(idx == WDTS_CHANNEL_TX_HIGH_PRI)
+      {
+         currentChannel->channelType = WDTS_CHANNEL_TX_HIGH_PRI;
+      }
+      else if(idx == WDTS_CHANNEL_RX_LOW_PRI)
+      {
+         currentChannel->channelType = WDTS_CHANNEL_RX_LOW_PRI;
+      }
+      else if(idx == WDTS_CHANNEL_RX_HIGH_PRI)
+      {
+         currentChannel->channelType = WDTS_CHANNEL_RX_HIGH_PRI;
+      }
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+      else if(idx == WDTS_CHANNEL_H2H_TEST_TX)
+      {
+         currentChannel->channelType = WDTS_CHANNEL_H2H_TEST_TX;
+      }
+      else if(idx == WDTS_CHANNEL_H2H_TEST_RX)
+      {
+         currentChannel->channelType = WDTS_CHANNEL_H2H_TEST_RX;
+      }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 
       /* Config individual channels from channel default setup table */
       status = dxeChannelDefaultConfig(tempDxeCtrlBlk,
@@ -4747,6 +4635,29 @@
          return NULL;
       }
 
+      status = wpalTimerInit(&currentChannel->healthMonitorTimer,
+                    dxeHealthMonitorTimeout,
+                    (void *)currentChannel);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "WLANDXE_Open Health Monitor timer init fail %d", idx);
+         WLANDXE_Close(tempDxeCtrlBlk);
+         return NULL;
+      }
+
+      currentChannel->healthMonitorMsg = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
+      if(NULL == currentChannel->healthMonitorMsg)
+      {
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+                  "WLANDXE_Open Health Monitor MSG Alloc fail %d", idx);
+         WLANDXE_Close(tempDxeCtrlBlk);
+         return NULL;
+      }
+      wpalMemoryZero(currentChannel->healthMonitorMsg, sizeof(wpt_msg));
+      currentChannel->healthMonitorMsg->callback = dxeTXHealthMonitor;
+      currentChannel->healthMonitorMsg->pContext = (void *)currentChannel;
+
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "WLANDXE_Open Channel %s Open Success", channelType[idx]);
    }
@@ -4796,8 +4707,6 @@
    tempDxeCtrlBlk->txIntDisabledByIMPS = eWLAN_PAL_FALSE;
    tempDxeCtrlBlk->driverReloadInProcessing = eWLAN_PAL_FALSE;
    tempDxeCtrlBlk->smsmToggled              = eWLAN_PAL_FALSE;
-   tempDxeCtrlBlk->smsmRingsEmptyHistogram  = 0;
-   tempDxeCtrlBlk->smsmDxeHistogram         = 0;
 
    /* Initialize SMSM state
     * Init State is
@@ -4809,7 +4718,7 @@
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "SMSM Channel init fail %d", smsmInitState);
-      foreach_valid_channel(idx)
+      for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
       {
          dxeChannelClose(tempDxeCtrlBlk, &tempDxeCtrlBlk->dxeChannel[idx]);
       }
@@ -4828,12 +4737,6 @@
    wpalTimerInit(&tempDxeCtrlBlk->dxeSSRTimer,
                  dxeSSRTimerExpHandler, tempDxeCtrlBlk);
 
-   spin_lock_init(&dtraceLock);
-
-#ifdef DXE_TRACE
-   DXTRACE(dxeTraceInit());
-#endif
-
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
             "WLANDXE_Open Success");
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
@@ -4850,7 +4753,9 @@
 
   @  Parameters
       pVoid                       pDXEContext : DXE module control block
-      WDTS_ClientCallbacks        WDTSCb : Callbacks to WDTS to indicate various events
+      WDTS_RxFrameReadyCbType     rxFrameReadyCB : RX Frame ready CB function pointer
+      WDTS_TxCompleteCbType       txCompleteCB : TX complete CB function pointer
+      WDTS_LowResourceCbType      lowResourceCB : Low DXE resource notification CB function pointer
       void                       *userContext : DXE Cliennt control block
 
   @  Return
@@ -4859,7 +4764,9 @@
 wpt_status WLANDXE_ClientRegistration
 (
    void                       *pDXEContext,
-   WDTS_ClientCallbacks       WDTSCb,
+   WLANDXE_RxFrameReadyCbType  rxFrameReadyCB,
+   WLANDXE_TxCompleteCbType    txCompleteCB,
+   WLANDXE_LowResourceCbType   lowResourceCB,
    void                       *userContext
 )
 {
@@ -4877,6 +4784,27 @@
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
 
+   if(NULL == rxFrameReadyCB)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_ClientRegistration Invalid RX READY CB");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
+   if(NULL == txCompleteCB)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_ClientRegistration Invalid txCompleteCB");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
+   if(NULL == lowResourceCB)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_ClientRegistration Invalid lowResourceCB");
+      return eWLAN_PAL_STATUS_E_INVAL;   
+   }
+
    if(NULL == userContext)
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -4887,11 +4815,9 @@
    dxeCtxt = (WLANDXE_CtrlBlkType *)pDXEContext;
 
    /* Assign */
-   dxeCtxt->rxReadyCB     = WDTSCb.rxFrameReadyCB;
-   dxeCtxt->txCompCB      = WDTSCb.txCompleteCB;
-   dxeCtxt->lowResourceCB = WDTSCb.lowResourceCB;
-   dxeCtxt->receiveMbMsgCB = WDTSCb.receiveMbMsgCB;
-   dxeCtxt->receiveLogCompleteCB = WDTSCb.receiveLogCompleteCB;
+   dxeCtxt->rxReadyCB     = rxFrameReadyCB;
+   dxeCtxt->txCompCB      = txCompleteCB;
+   dxeCtxt->lowResourceCB = lowResourceCB;
    dxeCtxt->clientCtxt    = userContext;
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
@@ -4937,10 +4863,16 @@
    /* WLANDXE_Start called means DXE engine already initiates
     * And DXE HW is reset and init finished
     * But here to make sure HW is initialized, reset again */
-   dxeEngineCoreStart(dxeCtxt);
+   status = dxeEngineCoreStart(dxeCtxt);
+   if(eWLAN_PAL_STATUS_SUCCESS != status)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "WLANDXE_Start DXE HW init Fail");
+      return status;         
+   }
 
    /* Individual Channel Start */
-   foreach_valid_channel(idx)
+   for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "WLANDXE_Start Channel %s Start", channelType[idx]);
@@ -5062,7 +4994,7 @@
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
 
-   if(WDTS_CHANNEL_MAX <= channel)
+   if((WDTS_CHANNEL_MAX < channel) || (WDTS_CHANNEL_MAX == channel))
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Start Invalid channel");
@@ -5149,6 +5081,8 @@
          dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
          dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
       }
+      wpalTimerStart(&currentChannel->healthMonitorTimer,
+                     T_WLANDXE_PERIODIC_HEALTH_M_TIME);
    }
    status = wpalMutexRelease(&currentChannel->dxeChannelLock);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
@@ -5211,6 +5145,8 @@
                              WDTS_CHANNEL_TX_LOW_PRI,
                              eWLAN_PAL_FALSE);
       inLowRes = channelCb->hitLowResource = eWLAN_PAL_TRUE;
+      wpalTimerStart(&channelCb->healthMonitorTimer,
+                     T_WLANDXE_PERIODIC_HEALTH_M_TIME);
     }
   }
 
@@ -5249,6 +5185,8 @@
                              WDTS_CHANNEL_TX_LOW_PRI,
                              eWLAN_PAL_FALSE);
         channelCb->hitLowResource = eWLAN_PAL_TRUE;
+        wpalTimerStart(&channelCb->healthMonitorTimer,
+                       T_WLANDXE_PERIODIC_HEALTH_M_TIME);
       }
     }
   }
@@ -5292,8 +5230,13 @@
    }
 
    dxeCtxt = (WLANDXE_CtrlBlkType *)pDXEContext;
-   foreach_valid_channel(idx)
+   for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
    {
+      if(VOS_TIMER_STATE_RUNNING == wpalTimerGetCurStatus(&dxeCtxt->dxeChannel[idx].healthMonitorTimer))
+      {
+         wpalTimerStop(&dxeCtxt->dxeChannel[idx].healthMonitorTimer);
+      }
+
       status = dxeChannelStop(dxeCtxt, &dxeCtxt->dxeChannel[idx]);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
@@ -5344,6 +5287,12 @@
    wpt_status               status = eWLAN_PAL_STATUS_SUCCESS;
    wpt_uint32                 idx;
    WLANDXE_CtrlBlkType       *dxeCtxt = NULL;
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+   wpt_uint32                 sIdx;
+   WLANDXE_ChannelCBType     *channel = NULL;
+   WLANDXE_DescCtrlBlkType   *crntDescCB = NULL;
+   WLANDXE_DescCtrlBlkType   *nextDescCB = NULL;
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __func__);
@@ -5361,10 +5310,29 @@
    wpalTimerDelete(&dxeCtxt->rxResourceAvailableTimer);
 #endif
    wpalTimerDelete(&dxeCtxt->dxeSSRTimer);
-   foreach_valid_channel(idx)
+   for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
    {
       wpalMutexDelete(&dxeCtxt->dxeChannel[idx].dxeChannelLock);
+      wpalTimerDelete(&dxeCtxt->dxeChannel[idx].healthMonitorTimer);
+      if(NULL != dxeCtxt->dxeChannel[idx].healthMonitorMsg)
+      {
+         wpalMemoryFree(dxeCtxt->dxeChannel[idx].healthMonitorMsg);
+      }
       dxeChannelClose(dxeCtxt, &dxeCtxt->dxeChannel[idx]);
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+      channel    = &dxeCtxt->dxeChannel[idx];
+      crntDescCB = channel->headCtrlBlk;
+      for(sIdx = 0; sIdx < channel->numDesc; sIdx++)
+      {
+         nextDescCB = (WLANDXE_DescCtrlBlkType *)crntDescCB->nextCtrlBlk;
+         wpalMemoryFree((void *)crntDescCB);
+         crntDescCB = nextDescCB;
+         if(NULL == crntDescCB)
+         {
+            break;
+         }
+      }
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
    }
 
    if(NULL != dxeCtxt->rxIsrMsg)
@@ -5520,8 +5488,6 @@
          break;
    }
 
-   DXTRACE(dxeTrace(WLANDXE_DMA_CHANNEL_MAX, TRACE_POWER_STATE, dxeCtxt->hostPowerState));
-
    if(WLANDXE_POWER_STATE_BMPS_PENDING != dxeCtxt->hostPowerState)
    {
       dxeCtxt->setPowerStateCb(status, 
@@ -5608,7 +5574,6 @@
    WLANDXE_PowerStateType   hostPowerState;
    wpt_msg                 *rxCompMsg;
    wpt_msg                 *txDescReSyncMsg;
-   int                      state;
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __func__);
@@ -5623,7 +5588,6 @@
    switch(powerState)
    {
       case WDTS_POWER_STATE_FULL:
-         dxeEnvBlk.dxe_prev_ps = pDxeCtrlBlk->hostPowerState;
          if(WLANDXE_POWER_STATE_IMPS == pDxeCtrlBlk->hostPowerState)
          {
             txDescReSyncMsg = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
@@ -5753,17 +5717,6 @@
       {
          HDXE_ASSERT(0);
       }
-      DXTRACE(dxeTrace(WLANDXE_DMA_CHANNEL_MAX, TRACE_POWER_STATE,
-                                                pDxeCtrlBlk->hostPowerState));
-   }
-
-   if (WDTS_POWER_STATE_FULL == powerState &&
-       WLANDXE_POWER_STATE_FULL == pDxeCtrlBlk->hostPowerState) {
-      state = wpal_get_int_state(DXE_INTERRUPT_RX_READY);
-      if (0 == state && eWLAN_PAL_TRUE == pDxeCtrlBlk->rxIntDisabledByIMPS) {
-          dxeEnvBlk.rx_imps_set_fp = 1;
-          WARN_ON(1);
-      }
    }
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
@@ -5800,7 +5753,8 @@
       return (0);
    }
 
-   return ((WLANDXE_CtrlBlkType *)pDXEContext)->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].numFreeDesc;
+   return 
+      ((WLANDXE_CtrlBlkType *)pDXEContext)->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].numFreeDesc;
 }
 
 /*==========================================================================
@@ -5898,69 +5852,13 @@
       }
    }
 
+   if(debugFlags & WPAL_DEBUG_START_HEALTH_TIMER)
+   {
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "DXE TX Stall detect");
+      /* Start Stall detect timer and detect stall */
+      wpalTimerStart(&tempDxeCtrlBlk->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].healthMonitorTimer,
+                     T_WLANDXE_PERIODIC_HEALTH_M_TIME);
+   }
    return;
 }
-
-/*==========================================================================
-  @  Function Name
-    WLANDXE_KickDxe
-
-  @  Description
-    Kick DXE when HDD TX time out happen
-
-  @  Parameters
-    NONE
-
-  @  Return
-    NONE
-
-===========================================================================*/
-void WLANDXE_KickDxe(void)
-{
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "%s: Kick Dxe for HDD TX timeout",__func__);
-   /* Make wake up HW */
-   dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
-   dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
-   DXTRACE(dxeTrace(WLANDXE_DMA_CHANNEL_MAX, TRACE_SMSM_NOTIFY,
-                      TRACE_WLANDXE_VAR_ENABLE));
-}
-
-wpt_uint32 WLANDXE_SetupLogTransfer(wpt_uint64 bufferAddr, wpt_uint32 bufferLen)
-{
-   WLANDXE_ChannelCBType    *channelEntry;
-
-   channelEntry = &tempDxeCtrlBlk->dxeChannel[WDTS_CHANNEL_RX_FW_LOG];
-
-
-   return dxeRXLogRefillRing(tempDxeCtrlBlk, channelEntry, bufferAddr,
-                             bufferLen);
-}
-
-wpt_status WLANDXE_StartLogTransfer(void)
-{
-   WLANDXE_ChannelCBType    *channelEntry;
-   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
-
-   channelEntry = &tempDxeCtrlBlk->dxeChannel[WDTS_CHANNEL_RX_FW_LOG];
-
-   tempDxeCtrlBlk->hostInitiatedH2H = 1;
-   status = wpalWriteRegister(channelEntry->channelRegister.chDXEDesclRegAddr,
-                                   channelEntry->headCtrlBlk->linkedDescPhyAddr);
-   if(eWLAN_PAL_STATUS_SUCCESS != status)
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "%s Write DESC Address register fail", __func__);
-      return status;
-   }
-
-   status = wpalWriteRegister(channelEntry->channelRegister.chDXECtrlRegAddr,
-                          channelEntry->extraConfig.chan_mask);
-   if(eWLAN_PAL_STATUS_SUCCESS != status)
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "dxeChannelInitProgram Write RX Control register fail");
-      return status;
-   }
-   return status;
-}
diff --git a/wlan/prima/CORE/DXE/src/wlan_qct_dxe_cfg_i.c b/wlan/prima/CORE/DXE/src/wlan_qct_dxe_cfg_i.c
index 4d6b57b..24ecc91 100644
--- a/wlan/prima/CORE/DXE/src/wlan_qct_dxe_cfg_i.c
+++ b/wlan/prima/CORE/DXE/src/wlan_qct_dxe_cfg_i.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -32,6 +32,9 @@
   @brief 
                
    This file contains the external API exposed by the wlan data transfer abstraction layer module.
+   Copyright (c) 2011 QUALCOMM Incorporated.
+   All Rights Reserved.
+   Qualcomm Confidential and Proprietary
 ========================================================================*/
 
 /*===========================================================================
@@ -81,8 +84,7 @@
    WLANDXE_DMA_CHAN3_BASE_ADDRESS,
    WLANDXE_DMA_CHAN4_BASE_ADDRESS,
    WLANDXE_DMA_CHAN5_BASE_ADDRESS,
-   WLANDXE_DMA_CHAN6_BASE_ADDRESS,
-   WLANDXE_DMA_CHAN7_BASE_ADDRESS
+   WLANDXE_DMA_CHAN6_BASE_ADDRESS
 };
 
 wpt_uint32 channelInterruptMask[WLANDXE_DMA_CHANNEL_MAX] =
@@ -93,8 +95,7 @@
    WLANDXE_INT_MASK_CHAN_3,
    WLANDXE_INT_MASK_CHAN_4,
    WLANDXE_INT_MASK_CHAN_5,
-   WLANDXE_INT_MASK_CHAN_6,
-   WLANDXE_INT_MASK_CHAN_7
+   WLANDXE_INT_MASK_CHAN_6
 };
 
 WLANDXE_ChannelConfigType chanTXLowPriConfig =
@@ -254,58 +255,21 @@
    eWLAN_PAL_TRUE
 };
 
-WLANDXE_ChannelConfigType chanRXLogConfig =
+#ifdef WLANDXE_TEST_CHANNEL_ENABLE
+WLANDXE_ChannelConfigType chanH2HTestConfig =
 {
    /* Q handle type, Circular */
    WLANDXE_CHANNEL_HANDLE_CIRCULA,
 
-   /* Number of Descriptors*/
-   8,
+   /* Number of Descriptor, NOT CLEAR YET !!! */
+   5,
 
-   /* MAX num RX Buffer*/
-   1,
-
-   /* Reference WQ, RX23 */
-   23,
-
-   /* USB Only, End point info */
+   /* MAX num RX Buffer, NOT CLEAR YET !!! */
    0,
 
-   /* Transfer Type */
-   WLANDXE_DESC_CTRL_XTYPE_B2H,
-
-   /* Channel Priority 7(Highest) - 0(Lowest)*/
-   1,
-
-   /* BD attached to frames for this pipe */
-   eWLAN_PAL_TRUE,
-
-   /* chk_size*/
-   0,
-
-   /* bmuThdSel*/
-   8,
-
-   /* Added in Gen5 for Prefetch*/
-   eWLAN_PAL_TRUE,
-
-   /* Use short Descriptor */
-   eWLAN_PAL_TRUE
-};
-
-WLANDXE_ChannelConfigType chanRXFWLogConfig =
-{
-   /* Q handle type, Circular */
-   WLANDXE_CHANNEL_HANDLE_CIRCULA,
-
-   /* Number of Descriptors*/
-   32,
-
-   /* MAX num RX Buffer*/
-   1,
-
-   /* Reference WQ - NA as channel used for H2H */
-   0,
+   /* Reference WQ, NOT CLEAR YET !!! */
+   /* Temporary BMU Work Q 5 */
+   5,
 
    /* USB Only, End point info */
    0,
@@ -313,33 +277,37 @@
    /* Transfer Type */
    WLANDXE_DESC_CTRL_XTYPE_H2H,
 
-   /* Channel Priority 7(Highest) - 0(Lowest)*/
-   0,
+   /* Channel Priority 7(Highest) - 0(Lowest), NOT CLEAR YET !!! */
+   5,
 
    /* BD attached to frames for this pipe */
-   eWLAN_PAL_TRUE,
+   eWLAN_PAL_FALSE,
 
-   /* chk_size*/
+   /* chk_size, NOT CLEAR YET !!!*/
    0,
 
-   /* bmuThdSel*/
-   8,
+   /* bmuThdSel, NOT CLEAR YET !!! */
+   0,
 
-   /* Added in Gen5 for Prefetch*/
+   /* Added in Gen5 for Prefetch, NOT CLEAR YET !!!*/
    eWLAN_PAL_TRUE,
 
    /* Use short Descriptor */
    eWLAN_PAL_TRUE
 };
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 
 WLANDXE_ChannelMappingType channelList[WDTS_CHANNEL_MAX] =
 {
    {WDTS_CHANNEL_TX_LOW_PRI,  WLANDXE_DMA_CHANNEL_0, &chanTXLowPriConfig},
    {WDTS_CHANNEL_TX_HIGH_PRI, WLANDXE_DMA_CHANNEL_4, &chanTXHighPriConfig},
    {WDTS_CHANNEL_RX_LOW_PRI,  WLANDXE_DMA_CHANNEL_1, &chanRXLowPriConfig},
+#ifndef WLANDXE_TEST_CHANNEL_ENABLE
    {WDTS_CHANNEL_RX_HIGH_PRI, WLANDXE_DMA_CHANNEL_3, &chanRXHighPriConfig},
-   {WDTS_CHANNEL_RX_LOG, WLANDXE_DMA_CHANNEL_5, &chanRXLogConfig},
-   {WDTS_CHANNEL_RX_FW_LOG, WLANDXE_DMA_CHANNEL_7, &chanRXFWLogConfig},
+#else
+   {WDTS_CHANNEL_H2H_TEST_TX,    WLANDXE_DMA_CHANNEL_2, &chanH2HTestConfig},
+   {WDTS_CHANNEL_H2H_TEST_RX,    WLANDXE_DMA_CHANNEL_2, &chanH2HTestConfig}
+#endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 };
 
 WLANDXE_TxCompIntConfigType txCompInt = 
@@ -363,49 +331,6 @@
    10
 };
 
-// Indicates the DXE channels being used in the current run.
-static wpt_uint8 dxeEnabledChannels;
-
-/*==========================================================================
-  @  Function Name
-      dxeSetEnabledChannels
-
-  @  Description
-
-  @  Parameters
-
-  @  Return
-      void
-
-===========================================================================*/
-void dxeSetEnabledChannels
-(
-   wpt_uint8 enabledChannels
-)
-{
-   dxeEnabledChannels = enabledChannels;
-}
-
-/*==========================================================================
-  @  Function Name
-      dxeGetEnabledChannels
-
-  @  Description
-
-  @  Parameters
-
-  @  Return
-      wpt_uint8
-
-===========================================================================*/
-wpt_uint8 dxeGetEnabledChannels
-(
-   void
-)
-{
-   return dxeEnabledChannels;
-}
-
 /*==========================================================================
   @  Function Name 
       dxeCommonDefaultConfig
@@ -417,14 +342,16 @@
                                DXE host driver main control block
 
   @  Return
-      void
+      wpt_status
 
 ===========================================================================*/
-void dxeCommonDefaultConfig
+wpt_status dxeCommonDefaultConfig
 (
    WLANDXE_CtrlBlkType     *dxeCtrlBlk
 )
 {
+   wpt_status                  status = eWLAN_PAL_STATUS_SUCCESS;
+
    dxeCtrlBlk->rxReadyCB     = NULL;
    dxeCtrlBlk->txCompCB      = NULL;
    dxeCtrlBlk->lowResourceCB = NULL;
@@ -432,6 +359,8 @@
    wpalMemoryCopy(&dxeCtrlBlk->txCompInt,
                   &txCompInt,
                   sizeof(WLANDXE_TxCompIntConfigType));
+
+   return status;
 }
 
 /*==========================================================================
@@ -540,31 +469,20 @@
       (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType))
    {
       channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_DIQ_MASK;
-      if (wpalWcnssIsProntoHwVer3())
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "Using WQ 6 for TX Low/High PRI Channel");
-         channelEntry->channelConfig.refWQ = WLANDXE_PRONTO_TX_WQ;
-      }
    }
    /* RX Channel, Set SIQ bit, Clear DIQ bit since source is not WQ */
    else if((WDTS_CHANNEL_RX_LOW_PRI  == channelEntry->channelType) ||
-           (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType) ||
-           (WDTS_CHANNEL_RX_LOG == channelEntry->channelType))
+           (WDTS_CHANNEL_RX_HIGH_PRI == channelEntry->channelType))
    {
       channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_SIQ_MASK;
    }
    else
    {
-      /* This is H2H channel, TX, RX not use work Q
+      /* This is test H2H channel, TX, RX not use work Q
        * Do Nothing */
    }
-
-   if (WDTS_CHANNEL_RX_FW_LOG != channelEntry->channelType)
-   {
-      /* Frame Contents Swap */
-      channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_SWAP_MASK;
-   }
+   /* Frame Contents Swap */
+   channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_SWAP_MASK;
    /* Host System Using Little Endian */
    channelEntry->extraConfig.chan_mask |= WLANDXE_CH_CTRL_ENDIAN_MASK;
    /* BMU Threshold select */
@@ -587,14 +505,9 @@
     * DXE engine will reference this value before DMA transfer */
    dxeControlRead = 0;
    /* Source is a Queue ID, not flat memory address */
-   if (WDTS_CHANNEL_RX_FW_LOG != channelEntry->channelType)
-     dxeControlRead |= WLANDXE_DESC_CTRL_SIQ;
+   dxeControlRead |= WLANDXE_DESC_CTRL_SIQ;
    /* Transfer direction is BMU 2 Host */
-   if (WDTS_CHANNEL_RX_FW_LOG != channelEntry->channelType)
-     dxeControlRead |= WLANDXE_DESC_CTRL_XTYPE_B2H;
-   else
-     dxeControlRead |= WLANDXE_DESC_CTRL_XTYPE_H2H;
-
+   dxeControlRead |= WLANDXE_DESC_CTRL_XTYPE_B2H;
    /* End of Packet, RX is single fragment */
    dxeControlRead |= WLANDXE_DESC_CTRL_EOP;
    /* BD Present, default YES, B2H case it must be 0 to insert BD */
@@ -617,15 +530,11 @@
    dxeControlRead |= WLANDXE_DESC_CTRL_INT;
    /* For ready status, this Control WORD must be VALID */
    dxeControlRead |= WLANDXE_DESC_CTRL_VALID;
-
    /* Frame Contents Swap */
-   if (WDTS_CHANNEL_RX_FW_LOG != channelEntry->channelType)
-      dxeControlRead |= WLANDXE_DESC_CTRL_BDT_SWAP;
-
+   dxeControlRead |= WLANDXE_DESC_CTRL_BDT_SWAP;
    /* Host Little Endian */
    if((WDTS_CHANNEL_TX_LOW_PRI  == channelEntry->channelType) ||
-      (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType) ||
-      (WDTS_CHANNEL_RX_FW_LOG == channelEntry->channelType))
+      (WDTS_CHANNEL_TX_HIGH_PRI == channelEntry->channelType))
    {
       dxeControlRead |= WLANDXE_DESC_CTRL_ENDIANNESS;
    }
@@ -705,14 +614,6 @@
    {
       channelEntry->numDesc         = mappedChannel->channelConfig->nDescs;
    }
-   else if(WDTS_CHANNEL_RX_LOG == channelEntry->channelType)
-   {
-      channelEntry->numDesc         = mappedChannel->channelConfig->nDescs;
-   }
-   else if(WDTS_CHANNEL_RX_FW_LOG == channelEntry->channelType)
-   {
-      channelEntry->numDesc         = mappedChannel->channelConfig->nDescs;
-   }
    else
    {
       channelEntry->numDesc         = rxResourceCount / 4;
@@ -720,7 +621,6 @@
    channelEntry->assignedDMAChannel = mappedChannel->DMAChannel;
    channelEntry->numFreeDesc             = 0;
    channelEntry->numRsvdDesc             = 0;
-   channelEntry->desc_write_fail_count   = 0;
    channelEntry->numFragmentCurrentChain = 0;
    channelEntry->numTotalFrame           = 0;
    channelEntry->hitLowResource          = eWLAN_PAL_FALSE;
diff --git a/wlan/prima/CORE/DXE/src/wlan_qct_dxe_i.h b/wlan/prima/CORE/DXE/src/wlan_qct_dxe_i.h
index 9c2eb8f..fa819ef 100644
--- a/wlan/prima/CORE/DXE/src/wlan_qct_dxe_i.h
+++ b/wlan/prima/CORE/DXE/src/wlan_qct_dxe_i.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -73,20 +73,6 @@
  * -------------------------------------------------------------------------*/
 #define WLANDXE_CTXT_COOKIE              0xC00CC111
 
-#ifdef DXE_TRACE
-#define DXTRACE(p) p
-#else
-#define DXTRACE(p) {  }
-#endif
-
-#define foreach_valid_channel(idx)                \
-    for (idx = 0; idx < WDTS_CHANNEL_MAX; idx++)  \
-        if (!(dxeGetEnabledChannels() & 1<<idx))  \
-            continue;                             \
-        else
-
-#define WLANDXE_IS_VALID_CHANNEL(idx) \
-    (dxeGetEnabledChannels() & 1<<idx)
 
 /* From here WCNSS DXE register information
  * This is temporary definition location to make compile and unit test
@@ -106,13 +92,9 @@
 #endif
 
 #define WLANDXE_BMU_AVAILABLE_BD_PDU      0x80084
-#define WLANDXE_BMU_ERROR_INTR_STATUS     0x80004
 
 #define WLANDXE_REGISTER_BASE_ADDRESS     0x202000
 
-#define WLAN_PMU_SPARE_OUT_ADDRESS        0x21c088
-#define WLAN_PMU_POWER_DOWN_MASK          0x04000000
-
 /* Common over the channels register addresses */
 #define WALNDEX_DMA_CSR_ADDRESS          (WLANDXE_REGISTER_BASE_ADDRESS + 0x00)
 #define WALNDEX_DMA_ENCH_ADDRESS         (WLANDXE_REGISTER_BASE_ADDRESS + 0x04)
@@ -156,7 +138,6 @@
 #define WLANDXE_DMA_CHAN4_BASE_ADDRESS   (WLANDXE_REGISTER_BASE_ADDRESS + 0x500)
 #define WLANDXE_DMA_CHAN5_BASE_ADDRESS   (WLANDXE_REGISTER_BASE_ADDRESS + 0x540)
 #define WLANDXE_DMA_CHAN6_BASE_ADDRESS   (WLANDXE_REGISTER_BASE_ADDRESS + 0x580)
-#define WLANDXE_DMA_CHAN7_BASE_ADDRESS   (WLANDXE_REGISTER_BASE_ADDRESS + 0x5c0)
 
 /* Channel specific register offset */
 #define WLANDXE_DMA_CH_CTRL_REG          0x0000
@@ -182,10 +163,6 @@
 #define WLANDXE_DMA_CSR_RESERVED_OFFSET       0x10
 #define WLANDXE_DMA_CSR_RESERVED_DEFAULT      0x0
 
-#define WLANDXE_DMA_CSR_FW_BMU_RECOVERY       0x400000
-#define WLANDXE_DMA_CSR_RECOVERY_DONE         0x200000
-#define WLANDXE_DMA_CSR_HOST_RECOVERY_DONE    0x800000
-
 #define WLANDXE_DMA_CSR_H2H_SYNC_EN_MASK      0x8000
 #define WLANDXE_DMA_CSR_H2H_SYNC_EN_OFFSET    0x0F
 #define WLANDXE_DMA_CSR_H2H_SYNC_EN_DEFAULT   0x0
@@ -427,7 +404,6 @@
 #define WLANDXE_INT_MASK_CHAN_4          0x00000010
 #define WLANDXE_INT_MASK_CHAN_5          0x00000020
 #define WLANDXE_INT_MASK_CHAN_6          0x00000040
-#define WLANDXE_INT_MASK_CHAN_7          0x00000080
 
 #define WLANDXE_TX_LOW_RES_THRESHOLD     (5)
 
@@ -477,7 +453,6 @@
 #define HDXE_MSG                     WPAL_TRACE
 #define HDXE_ASSERT(a)               VOS_ASSERT(a)
 
-#define WLANDXE_PRONTO_TX_WQ       0x6
 /*----------------------------------------------------------------------------
  *  Type Declarations
  * -------------------------------------------------------------------------*/
@@ -511,19 +486,9 @@
    WLANDXE_DMA_CHANNEL_4,
    WLANDXE_DMA_CHANNEL_5,
    WLANDXE_DMA_CHANNEL_6,
-   WLANDXE_DMA_CHANNEL_7,
    WLANDXE_DMA_CHANNEL_MAX
 } WLANDXE_DMAChannelType;
 
-enum
-{
-   TRACE_CH_ENABLE,
-   TRACE_POWER_STATE,
-   TRACE_RXINT_STATE,
-   TRACE_TXINT_STATE,
-   TRACE_SMSM_NOTIFY
-};
-
 /** DXE HW Long Descriptor format */
 typedef struct
 {
@@ -581,6 +546,9 @@
    WLANDXE_DescType                *linkedDesc;
    wpt_uint32                       linkedDescPhyAddr;
    wpt_uint32                       ctrlBlkOrder;
+#ifdef FEATURE_R33D
+   wpt_uint32                       shadowBufferVa;
+#endif /* FEATURE_R33D */
 } WLANDXE_DescCtrlBlkType;
 
 typedef struct
@@ -659,13 +627,14 @@
    WDTS_ChannelType                channelType;
    WLANDXE_DescCtrlBlkType        *headCtrlBlk;
    WLANDXE_DescCtrlBlkType        *tailCtrlBlk;
+#if !(defined(FEATURE_R33D) || defined(WLANDXE_TEST_CHANNEL_ENABLE))
    WLANDXE_DescType               *descriptorAllocation;
+#endif
    WLANDXE_DescType               *DescBottomLoc;
    wpt_uint32                      descBottomLocPhyAddr;
    wpt_uint32                      numDesc;
    wpt_uint32                      numFreeDesc;
    wpt_uint32                      numRsvdDesc;
-   wpt_uint32                      desc_write_fail_count;
    wpt_uint32                      maxFrameSize;
    wpt_uint32                      numFragmentCurrentChain;
    wpt_uint32                      numFrameBeforeInt;
@@ -678,6 +647,8 @@
    WLANDXE_ChannelExConfigType     extraConfig;
    WLANDXE_DMAChannelType          assignedDMAChannel;
    wpt_uint64                      rxDoneHistogram;
+   wpt_timer                       healthMonitorTimer;
+   wpt_msg                        *healthMonitorMsg;
 } WLANDXE_ChannelCBType;
 
 typedef struct
@@ -696,69 +667,34 @@
    WLANDXE_RxFrameReadyCbType      rxReadyCB;
    WLANDXE_TxCompleteCbType        txCompCB;
    WLANDXE_LowResourceCbType       lowResourceCB;
-   WLANDXE_MbReceiveMsgCbType      receiveMbMsgCB;
-   WLANDXE_RxLogDoneType           receiveLogCompleteCB;
    WLANDXE_TxCompIntConfigType     txCompInt;
    void                           *clientCtxt;
    wpt_uint32                      interruptPath;
    wpt_msg                        *rxIsrMsg;
    wpt_msg                        *txIsrMsg;
-   wpt_msg                        *rxPktAvailMsg;
+   wpt_msg                        *rxPktAvailMsg;   
    volatile WLANDXE_PowerStateType hostPowerState;
    wpt_boolean                     rxIntDisabledByIMPS;
    wpt_boolean                     txIntDisabledByIMPS;
    WLANDXE_SetPowerStateCbType     setPowerStateCb;
    volatile WLANDXE_RivaPowerStateType rivaPowerState;
-   wpt_boolean                     ringNotEmpty;
+   wpt_boolean                     ringNotEmpty; 
    wpt_boolean                     txIntEnable;
-   wpt_uint32                      txCompletedFrames;
-   wpt_uint8                       ucTxMsgCnt;
-   wpt_uint16                      lastKickOffDxe;
-   wpt_uint32                      smsmRingsEmptyHistogram;
-   wpt_uint32                      smsmDxeHistogram;
+   wpt_uint32                      txCompletedFrames; 
+   wpt_uint8                       ucTxMsgCnt; 
+   wpt_uint16                      lastKickOffDxe; 
    wpt_uint32                      dxeCookie;
    wpt_packet                     *freeRXPacket;
    wpt_boolean                     rxPalPacketUnavailable;
    wpt_boolean                     driverReloadInProcessing;
    wpt_boolean                     smsmToggled;
    wpt_boolean                     txRingsEmpty;
-   wpt_boolean                     hostInitiatedH2H;
 #ifdef WLAN_DXE_LOW_RESOURCE_TIMER
    wpt_timer                       rxResourceAvailableTimer;
 #endif
    wpt_timer                       dxeSSRTimer;
 } WLANDXE_CtrlBlkType;
 
-typedef struct
-{
-   u64                             *rxIntDisableReturn;
-   u64                             *rxIntDisableFrame;
-   wpt_uint8                       rxIntChanlSrc;
-   wpt_uint8                       txCmpIntChanlSrc;
-   wpt_uint8                       rx_low_resource_timer;
-   wpt_uint8                       dxe_prev_ps;
-   wpt_uint8                       rx_imps_set_fp;
-} WLANDXE_EnvInformation;
-
-typedef struct
-{
-    /* Records are stored in ring buffer */
-    v_U32_t head;
-    v_U32_t tail;
-    v_U32_t num;
-
-    /* Config for controlling the trace */
-    v_U8_t enable;
-}dxeTraceData;
-
-typedef struct
-{
-    v_U32_t time;
-    v_U8_t chan;
-    v_U8_t code;
-    v_U32_t data;
-}dxeTraceRecord, *pdxeTraceRecord;
-
 /*==========================================================================
   @  Function Name 
       dxeCommonDefaultConfig
@@ -770,10 +706,10 @@
                                DXE host driver main control block
 
   @  Return
-      void
+      wpt_status
 
 ===========================================================================*/
-extern void dxeCommonDefaultConfig
+extern wpt_status dxeCommonDefaultConfig
 (
    WLANDXE_CtrlBlkType     *dxeCtrlBlk
 );
@@ -802,13 +738,4 @@
    WLANDXE_ChannelCBType   *channelEntry
 );
 
-void dxeSetEnabledChannels
-(
-   wpt_uint8 enabledChannels
-);
-
-wpt_uint8 dxeGetEnabledChannels
-(
-   void
-);
 #endif /* WLAN_QCT_DXE_I_H */
diff --git a/wlan/prima/CORE/HDD/inc/bap_hdd_main.h b/wlan/prima/CORE/HDD/inc/bap_hdd_main.h
index 6bfab6d..3623f40 100644
--- a/wlan/prima/CORE/HDD/inc/bap_hdd_main.h
+++ b/wlan/prima/CORE/HDD/inc/bap_hdd_main.h
@@ -33,6 +33,9 @@
   \file  BAP_HDD_MAIN_H.h
   
   \brief Linux HDD Adapter Type
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
   
   ==========================================================================*/
   
diff --git a/wlan/prima/CORE/HDD/inc/bap_hdd_misc.h b/wlan/prima/CORE/HDD/inc/bap_hdd_misc.h
index b373760..8afba6d 100644
--- a/wlan/prima/CORE/HDD/inc/bap_hdd_misc.h
+++ b/wlan/prima/CORE/HDD/inc/bap_hdd_misc.h
@@ -33,6 +33,9 @@
   \file  BAP_HDD_MISC.h
   
   \brief Linux HDD Adapter Type
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
   
   ==========================================================================*/
   
diff --git a/wlan/prima/CORE/HDD/inc/qc_sap_ioctl.h b/wlan/prima/CORE/HDD/inc/qc_sap_ioctl.h
index 2bc3b6a..5106939 100644
--- a/wlan/prima/CORE/HDD/inc/qc_sap_ioctl.h
+++ b/wlan/prima/CORE/HDD/inc/qc_sap_ioctl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -40,7 +40,6 @@
 #define QCSAP_MAX_OPT_IE        256
 #define QCSAP_MAX_WSC_IE        256
 #define QCSAP_MAX_GET_STA_INFO  512
-#define QCSAP_MAX_STR_LEN      1024
 
 typedef struct sSSID
 {
@@ -143,7 +142,7 @@
 #define QCSAP_IOCTL_COMMIT            (SIOCIWFIRSTPRIV+2)
 
 #define QCSAP_IOCTL_GET_STAWPAIE      (SIOCIWFIRSTPRIV+4)
-
+#define QCSAP_IOCTL_SETWPAIE          (SIOCIWFIRSTPRIV+5)
 #define QCSAP_IOCTL_STOPBSS           (SIOCIWFIRSTPRIV+6)
 #define QCSAP_IOCTL_VERSION           (SIOCIWFIRSTPRIV+7)
 #define QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES       (SIOCIWFIRSTPRIV+8)
@@ -185,8 +184,6 @@
     QCSAP_PARAM_AUTO_CHANNEL = 9,
     QCSAP_PARAM_SET_MC_RATE = 10,
     QCSAP_PARAM_SET_AUTO_CHANNEL = 11,
-    QCSAP_PARAM_GET_FRAME_LOGS = 12,
-    QCSAP_PARAM_SET_PROXIMITY = 13
 };
 
 int iw_softap_get_channel_list(struct net_device *dev, 
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_assoc.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_assoc.h
index 35930df..df4b904 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_assoc.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_assoc.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -35,19 +35,13 @@
 #ifdef FEATURE_WLAN_TDLS
 #define HDD_MAX_NUM_TDLS_STA ( 8 )
 #define TDLS_STA_INDEX_VALID(staId) \
-                          (((staId) >= 3) && ((staId) < 0xFF))
+                          (((staId) >= 4) && ((staId) < 0xFF))
 #endif
 #define TKIP_COUNTER_MEASURE_STARTED 1
 #define TKIP_COUNTER_MEASURE_STOPED  0 
 /* Timeout (in ms) for Link to Up before Registering Station */
 #define ASSOC_LINKUP_TIMEOUT 60
 #define IBSS_BROADCAST_STAID 0
-
-#ifdef WLAN_FEATURE_RMC
-/* Timeout in ms for peer info request commpletion */
-#define IBSS_PEER_INFO_REQ_TIMOEUT 1000
-#endif
-
 typedef enum 
 {
    /** Not associated in Infra or participating in an IBSS / Ad-hoc network.*/
@@ -111,8 +105,6 @@
 
    /** Dot11Mode */
    tANI_U32 dot11Mode;
-
-   uint32_t  rate_flags;
    
 }connection_info_t;
 /*Forward declaration of Adapter*/
@@ -137,14 +129,8 @@
 
 int hdd_set_csr_auth_type( hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType );
 VOS_STATUS hdd_roamRegisterTDLSSTA( hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                    const tANI_U8 *peerMac,
-#else
-                                    tANI_U8 *peerMac,
-#endif
-                                    tANI_U16 staId, tANI_U8 ucastSig);
+                                    tANI_U8 *peerMac, tANI_U16 staId, tANI_U8 ucastSig);
 void hdd_PerformRoamSetKeyComplete(hdd_adapter_t *pAdapter);
-VOS_STATUS hdd_roamDeregisterTDLSSTA(hdd_adapter_t *pAdapter, tANI_U8 staId);
 
 #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
 void hdd_indicateEseBcnReportNoResults(const hdd_adapter_t *pAdapter,
@@ -153,6 +139,4 @@
                                        const tANI_U8 numBss);
 #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
 
-void iw_full_power_cbfn (void *pContext, eHalStatus status);
-
 #endif
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_cfg.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_cfg.h
index 74e6d78..1450851 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_cfg.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_cfg.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -34,6 +34,9 @@
 
   \brief Android WLAN Adapter Configuration functions
 
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
 
   ==========================================================================*/
 
@@ -263,44 +266,11 @@
 #define CFG_ENABLE_AUTO_BMPS_TIMER_MIN         ( 0 )
 #define CFG_ENABLE_AUTO_BMPS_TIMER_MAX         ( 1 )
 #define CFG_ENABLE_AUTO_BMPS_TIMER_DEFAULT     ( 1 )
-/*
- * gEnableDynamicRAstartRate usage:
- *
- * 11B and 11A/G rates can be specified in multiples of 0.5
- * So for 5.5 mbps, gEnableDynamicRAstartRate=11
- * and for 12 mbps, gEnableDynamicRAstartRate=24 etc.
- *
- * for MCS 0 - 7 rates, Bit 7 should set to 1 and Bit 0-6
- * represent the MCS index.
- * So for MCS0, gEnableDynamicRAstartRate=128
- * and for MCS2, gEnableDynamicRAstartRate=130 etc.
- *
- * Any invalid non-zero value will set the start rate
- * to 6 mbps (value 1 will also set it to 6 mbps)
- *
- * Bit 8 is used to enable PER discount logic in RA
- * Ex: if PER discount logic needs to be enabled along with
- * RA start rate as 6mbps:
- * (Bit 8 for PER discount logic and Bit 0 for 6 mbps)
- * gEnableDynamicRAstartRate=257
- */
 
 #define CFG_ENABLE_DYNAMIC_RA_START_RATE_NAME    "gEnableDynamicRAstartRate"
-#define CFG_ENABLE_DYNAMIC_RA_START_RATE_MIN     (0)
-#define CFG_ENABLE_DYNAMIC_RA_START_RATE_MAX     (65535)
-#define CFG_ENABLE_DYNAMIC_RA_START_RATE_DEFAULT (0)
-
-/* Bit mask value to enable RTS/CTS for different modes
- * for 2.4 GHz, HT20 - 0x0001, for 2.4 GHz, HT40 - 0x0002
- * for 2.4 GHz, VHT20 - 0x0004, for 2.4 GHz, VHT40 - 0x0008
- * for 5 GHz, HT20 - 0x0100, for 5 GHz, HT40 - 0x0200
- * for 5 GHz, VHT20 - 0x0400, for 5 GHz, VHT40 - 0x0800
- * for 5 GHz, VHT80 - 0x1000
- */
-#define CFG_ENABLE_RTSCTS_HTVHT_NAME             "gEnableRtsCtsHtVht"
-#define CFG_ENABLE_RTSCTS_HTVHT_MIN              ( 0x0000 )
-#define CFG_ENABLE_RTSCTS_HTVHT_MAX              ( 0x1f0f )
-#define CFG_ENABLE_RTSCTS_HTVHT_DEFAULT          ( 0x0000 )
+#define CFG_ENABLE_DYNAMIC_RA_START_RATE_MIN     ( 0 )
+#define CFG_ENABLE_DYNAMIC_RA_START_RATE_MAX     ( 1 )
+#define CFG_ENABLE_DYNAMIC_RA_START_RATE_DEFAULT ( 0 )
 
 #define CFG_AUTO_BMPS_TIMER_VALUE_NAME         "gAutoBmpsTimerValue" 
 #define CFG_AUTO_BMPS_TIMER_VALUE_MIN          ( 1000 )
@@ -345,10 +315,15 @@
 #define CFG_DOT11_MODE_DEFAULT                 eHDD_DOT11_MODE_11n
 #endif
 
-#define CFG_SAP_ENABLE_11AC_NAME               "gSapEnable11AC"
-#define CFG_SAP_ENABLE_11AC_MIN                ( 0 )
-#define CFG_SAP_ENABLE_11AC_MAX                ( 1 )
-#define CFG_SAP_ENABLE_11AC_DEFAULT            ( 1 )
+#define CFG_SAP_DOT11_MODE_NAME                "gSapDot11Mode"
+#define CFG_SAP_DOT11_MODE_MIN                 eHDD_DOT11_MODE_AUTO
+#ifdef WLAN_FEATURE_11AC
+#define CFG_SAP_DOT11_MODE_MAX                 eHDD_DOT11_MODE_11ac
+#define CFG_SAP_DOT11_MODE_DEFAULT             eHDD_DOT11_MODE_11ac
+#else
+#define CFG_SAP_DOT11_MODE_MAX                 eHDD_DOT11_MODE_11b_ONLY
+#define CFG_SAP_DOT11_MODE_DEFAULT             eHDD_DOT11_MODE_11n
+#endif
 
 #define CFG_CHANNEL_BONDING_MODE_24GHZ_NAME    "gChannelBondingMode24GHz"
 #define CFG_CHANNEL_BONDING_MODE_MIN           WNI_CFG_CHANNEL_BONDING_MODE_STAMIN 
@@ -543,12 +518,12 @@
 
 #define CFG_AP_KEEP_ALIVE_PERIOD_NAME          "gApKeepAlivePeriod"
 #define CFG_AP_KEEP_ALIVE_PERIOD_MIN           ( 3 )
-#define CFG_AP_KEEP_ALIVE_PERIOD_MAX           ( 255 )
+#define CFG_AP_KEEP_ALIVE_PERIOD_MAX           ( 20 )
 #define CFG_AP_KEEP_ALIVE_PERIOD_DEFAULT       ( 5 )
 
 #define CFG_GO_KEEP_ALIVE_PERIOD_NAME          "gGoKeepAlivePeriod"
 #define CFG_GO_KEEP_ALIVE_PERIOD_MIN           ( 3 )
-#define CFG_GO_KEEP_ALIVE_PERIOD_MAX           ( 255 )
+#define CFG_GO_KEEP_ALIVE_PERIOD_MAX           ( 20 )
 #define CFG_GO_KEEP_ALIVE_PERIOD_DEFAULT       ( 5 )
 
 #define CFG_AP_LINK_MONITOR_PERIOD_NAME          "gApLinkMonitorPeriod"
@@ -604,12 +579,12 @@
 #define CFG_ACTIVE_MAX_CHANNEL_TIME_NAME       "gActiveMaxChannelTime"
 #define CFG_ACTIVE_MAX_CHANNEL_TIME_MIN        ( 0 )
 #define CFG_ACTIVE_MAX_CHANNEL_TIME_MAX        ( 10000 )
-#define CFG_ACTIVE_MAX_CHANNEL_TIME_DEFAULT    ( 50 )
+#define CFG_ACTIVE_MAX_CHANNEL_TIME_DEFAULT    ( 40 )
 
 #define CFG_ACTIVE_MIN_CHANNEL_TIME_NAME       "gActiveMinChannelTime"
 #define CFG_ACTIVE_MIN_CHANNEL_TIME_MIN        ( 0 )
 #define CFG_ACTIVE_MIN_CHANNEL_TIME_MAX        ( 10000 )
-#define CFG_ACTIVE_MIN_CHANNEL_TIME_DEFAULT    ( 30 )
+#define CFG_ACTIVE_MIN_CHANNEL_TIME_DEFAULT    ( 20 )
 
 #define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_NAME       "gActiveMaxChannelTimeBtc"
 #define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_MIN        ( 0 )
@@ -903,78 +878,6 @@
 #define CFG_ROAM_SCAN_OFFLOAD_ENABLED_MIN                   (0)
 #define CFG_ROAM_SCAN_OFFLOAD_ENABLED_MAX                   (1)
 #define CFG_ROAM_SCAN_OFFLOAD_ENABLED_DEFAULT               (1)
-
-/* Enable/disable PER based roaming */
-#define CFG_PER_ROAM_SCAN_OFFLOAD_ENABLED                  "gPERRoamEnable"
-#define CFG_PER_ROAM_SCAN_OFFLOAD_ENABLED_MIN              (0)
-#define CFG_PER_ROAM_SCAN_OFFLOAD_ENABLED_MAX              (1)
-#define CFG_PER_ROAM_SCAN_OFFLOAD_ENABLED_DEFAULT          (0)
-
-/*
- * Rate at which to stop monitoring data rates for PER based Roam
- * Value: MBPS * 10
- * Min: Minimum rate of data transfer
- * Max: Max rate for 1x1 transmission
- */
-#define CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD                "gPERRoamUpThresholdRate"
-#define CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD_MIN            (10)
-#define CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD_MAX            (3330)
-#define CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD_DEFAULT        (400)
-
-/*
- * rate at which to start monitoring data rates for PER based roam
- * Value: MBPS * 10
- */
-#define CFG_PER_ROAM_SCAN_RATE_DOWN_THRESHOLD              "gPERRoamDownThresholdRate"
-#define CFG_PER_ROAM_SCAN_RATE_DOWN_THRESHOLD_MIN          (10)
-#define CFG_PER_ROAM_SCAN_RATE_DOWN_THRESHOLD_MAX          (3330)
-#define CFG_PER_ROAM_SCAN_RATE_DOWN_THRESHOLD_DEFAULT      (100)
-
-/*
- * time to wait before start monitoring again once a roam scan has been
- * triggered. (Minimum time difference between two scans)
- * Value : seconds
- */
-#define CFG_PER_ROAM_SCAN_WAIT_TIME                        "gPERRoamScanInterval"
-#define CFG_PER_ROAM_SCAN_WAIT_TIME_MIN                    (0)
-#define CFG_PER_ROAM_SCAN_WAIT_TIME_MAX                    (3600)
-#define CFG_PER_ROAM_SCAN_WAIT_TIME_DEFAULT                (1200)
-
-/* Time to collect stats to trigger roam scan for Tx path */
-#define CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD               "gPERRoamStatsTime"
-#define CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD_MIN           (0)
-#define CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD_MAX           (25)
-#define CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD_DEFAULT       (20)
-
-/* Rx monitoring is enabled to trigger a PER based roam scan */
-#define CFG_PER_ROAM_SCAN_RX_MONITOR_ENABLED               "gPERRoamRxMonitorEnable"
-#define CFG_PER_ROAM_SCAN_RX_MONITOR_ENABLED_MIN           (0)
-#define CFG_PER_ROAM_SCAN_RX_MONITOR_ENABLED_MAX           (1)
-#define CFG_PER_ROAM_SCAN_RX_MONITOR_ENABLED_DEFAULT       (0)
-
-/*
- * Minimum number of packets required to consider if PER based roam scan
- * needs to be triggered in Rx
- */
-#define CFG_PER_ROAM_SCAN_RX_MIN_PACKETS               "gPERRoamRxPktThreshold"
-#define CFG_PER_ROAM_SCAN_RX_MIN_PACKETS_MIN           (10)
-#define CFG_PER_ROAM_SCAN_RX_MIN_PACKETS_MAX           (10000)
-#define CFG_PER_ROAM_SCAN_RX_MIN_PACKETS_DEFAULT       (100)
-
-/*
- * Minimum percentage of packets needs to be below gPERRoamScanRateDownThreshold
- * to trigger a roam scan
- */
-#define CFG_PER_ROAM_SCAN_MIN_PERCENTAGE               "gPERRoamTriggerPercent"
-#define CFG_PER_ROAM_SCAN_MIN_PERCENTAGE_MIN           (20)
-#define CFG_PER_ROAM_SCAN_MIN_PERCENTAGE_MAX           (100)
-#define CFG_PER_ROAM_SCAN_MIN_PERCENTAGE_DEFAULT       (60)
-
-/* Channel sensing is enabled/disabled for PER based roam scan */
-#define CFG_PER_ROAM_SCAN_CCA_ENABLED                  "gPERRoamCCAEnabled"
-#define CFG_PER_ROAM_SCAN_CCA_ENABLED_MIN              (0)
-#define CFG_PER_ROAM_SCAN_CCA_ENABLED_MAX              (1)
-#define CFG_PER_ROAM_SCAN_CCA_ENABLED_DEFAULT          (0)
 #endif
 
 #define CFG_QOS_WMM_PKT_CLASSIFY_BASIS_NAME                "PktClassificationBasis" // DSCP or 802.1Q
@@ -1100,7 +1003,7 @@
 #define CFG_TL_WFQ_VI_WEIGHT_NAME                           "WfqViWeight"
 #define CFG_TL_WFQ_VI_WEIGHT_MIN                            1
 #define CFG_TL_WFQ_VI_WEIGHT_MAX                            0xFF
-#define CFG_TL_WFQ_VI_WEIGHT_DEFAULT                        7
+#define CFG_TL_WFQ_VI_WEIGHT_DEFAULT                        5
 
 #define CFG_TL_WFQ_VO_WEIGHT_NAME                           "WfqVoWeight"
 #define CFG_TL_WFQ_VO_WEIGHT_MIN                            1
@@ -1162,7 +1065,7 @@
 #define CFG_ENABLE_LOGP_NAME                                "gEnableLogp"
 #define CFG_ENABLE_LOGP_MIN                                 ( 0 )
 #define CFG_ENABLE_LOGP_MAX                                 ( 1 )
-#define CFG_ENABLE_LOGP_DEFAULT                             ( 1 )
+#define CFG_ENABLE_LOGP_DEFAULT                             ( 0 )
 
 #define CFG_BTC_EXECUTION_MODE_NAME                         "BtcExecutionMode"
 #define CFG_BTC_EXECUTION_MODE_MIN                          ( 0 )
@@ -1349,11 +1252,6 @@
 #define CFG_BCN_EARLY_TERM_WAKE_MAX                  ( 255 )
 #define CFG_BCN_EARLY_TERM_WAKE_DEFAULT              ( 3 )
 
-#define CFG_ENABLE_ROAM_DELAY_STATS                  "gEnableRoamDelayStats"
-#define CFG_ENABLE_ROAM_DELAY_STATS_MIN              ( 0 )
-#define CFG_ENABLE_ROAM_DELAY_STATS_MAX              ( 1 )
-#define CFG_ENABLE_ROAM_DELAY_STATS_DEFAULT          ( 0 )
-
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
 #define CFG_NEIGHBOR_SCAN_TIMER_PERIOD_NAME             "gNeighborScanTimerPeriod"
 #define CFG_NEIGHBOR_SCAN_TIMER_PERIOD_MIN              (3)
@@ -1501,16 +1399,9 @@
 #define CFG_ENABLE_BYPASS_11D_MAX                  ( 1 )
 #define CFG_ENABLE_BYPASS_11D_DEFAULT              ( 1 )
 
-/*
- * gEnableDFSChnlScan
- * 0: disable scan on DFS channels
- * 1: enables passive scan on DFS channels
- * 2: enables active scan on DFS channels for static list.
- *    Static or cfg list is the channel list set by ioctl SETROAMSCANCHANNELS.
-*/
 #define CFG_ENABLE_DFS_CHNL_SCAN_NAME              "gEnableDFSChnlScan"
 #define CFG_ENABLE_DFS_CHNL_SCAN_MIN               ( 0 )
-#define CFG_ENABLE_DFS_CHNL_SCAN_MAX               ( 2 )
+#define CFG_ENABLE_DFS_CHNL_SCAN_MAX               ( 1 )
 #define CFG_ENABLE_DFS_CHNL_SCAN_DEFAULT           ( 1 )
 
 #define CFG_ENABLE_DFS_PNO_CHNL_SCAN_NAME              "gEnableDFSPnoChnlScan"
@@ -1612,23 +1503,6 @@
 #define CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_MAX             ( 900 )
 #define CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_DEFAULT         ( 200 )
 
-/* RPS configurations */
-#define CFG_RPS_CPU_MAP_MIN                        (0)
-#define CFG_RPS_CPU_MAP_MAX                        (0xff)
-
-#define CFG_RPS_CPU_MAP_NAME                       "rps_mask"
-#define CFG_RPS_CPU_MAP_DEFAULT                    (0x00)
-
-#define CFG_MULTICAST_HOST_FW_MSGS          "gMulticastHostMsgs"
-#define CFG_MULTICAST_HOST_FW_MSGS_MIN      (0)
-#define CFG_MULTICAST_HOST_FW_MSGS_MAX      (1)
-#define CFG_MULTICAST_HOST_FW_MSGS_DEFAULT  (1)
-
-#define CFG_ENABLE_TCP_DELACK_NAME           "gEnableDelAck"
-#define CFG_ENABLE_TCP_DELACK_MIN            (0)
-#define CFG_ENABLE_TCP_DELACK_MAX            (1)
-#define CFG_ENABLE_TCP_DELACK_DEFAULT        (1)
-
 /* In cfg.dat 1=1MBPS, 2=2MBPS, 3=5_5MBPS, 4=11MBPS, 5=6MBPS, 6=9MBPS,
  * 7=12MBPS, 8=18MBPS, 9=24MBPS. But 6=9MBPS and 8=18MBPS are not basic
  * 11g rates and should not be set by gDefaultRateIndex24Ghz. So instead
@@ -1646,16 +1520,6 @@
 #define CFG_DEFAULT_RATE_INDEX_24GH_MAX           ( 7 )
 #define CFG_DEFAULT_RATE_INDEX_24GH_DEFAULT       ( 1 )
 
-/*
- * This INI item is used to control subsystem restart(SSR) test framework
- * Set its value to 1 to enable APPS trigerred SSR testing
- */
-
-#define CFG_ENABLE_CRASH_INJECT         "gEnableForceTargetAssert"
-#define CFG_ENABLE_CRASH_INJECT_MIN     (0)
-#define CFG_ENABLE_CRASH_INJECT_MAX     (1)
-#define CFG_ENABLE_CRASH_INJECT_DEFAULT (0)
-
 static __inline tANI_U32 defHddRateToDefCfgRate( tANI_U32 defRateIndex )
 {
     switch(defRateIndex){
@@ -1877,7 +1741,7 @@
 #define CFG_THERMAL_MIGRATION_ENABLE_NAME      "gThermalMitigationEnable"   
 #define CFG_THERMAL_MIGRATION_ENABLE_MIN       ( 0 ) 
 #define CFG_THERMAL_MIGRATION_ENABLE_MAX       ( 1 ) 
-#define CFG_THERMAL_MIGRATION_ENABLE_DEFAULT   ( 1 )
+#define CFG_THERMAL_MIGRATION_ENABLE_DEFAULT   ( 0 ) 
 
 /*
  * Enable/Disable Modulated DTIM feature
@@ -1939,14 +1803,14 @@
 #define CFG_TDLS_IMPLICIT_TRIGGER_DEFAULT           ( 0 )
 
 #define CFG_TDLS_TX_STATS_PERIOD                    "gTDLSTxStatsPeriod"
-#define CFG_TDLS_TX_STATS_PERIOD_MIN                (1000)
+#define CFG_TDLS_TX_STATS_PERIOD_MIN                ( 10 )
 #define CFG_TDLS_TX_STATS_PERIOD_MAX                ( 4294967295UL )
-#define CFG_TDLS_TX_STATS_PERIOD_DEFAULT            (2000)
+#define CFG_TDLS_TX_STATS_PERIOD_DEFAULT            ( 5000 )
 
 #define CFG_TDLS_TX_PACKET_THRESHOLD                "gTDLSTxPacketThreshold"
 #define CFG_TDLS_TX_PACKET_THRESHOLD_MIN            ( 0 )
 #define CFG_TDLS_TX_PACKET_THRESHOLD_MAX            ( 4294967295UL )
-#define CFG_TDLS_TX_PACKET_THRESHOLD_DEFAULT        (40)
+#define CFG_TDLS_TX_PACKET_THRESHOLD_DEFAULT        ( 100 )
 
 #define CFG_TDLS_DISCOVERY_PERIOD                   "gTDLSDiscoveryPeriod"
 #define CFG_TDLS_DISCOVERY_PERIOD_MIN               ( 5000 )
@@ -1956,7 +1820,7 @@
 #define CFG_TDLS_MAX_DISCOVERY_ATTEMPT              "gTDLSMaxDiscoveryAttempt"
 #define CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MIN          ( 1 )
 #define CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MAX          ( 100 )
-#define CFG_TDLS_MAX_DISCOVERY_ATTEMPT_DEFAULT      (5)
+#define CFG_TDLS_MAX_DISCOVERY_ATTEMPT_DEFAULT      ( 3 )
 
 #define CFG_TDLS_IDLE_TIMEOUT                       "gTDLSIdleTimeout"
 #define CFG_TDLS_IDLE_TIMEOUT_MIN                   ( 2000 )
@@ -2011,12 +1875,12 @@
 #define CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE          "gEnableTDLSOffChannel"
 #define CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE_MIN      (0)
 #define CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE_MAX      (1)
-#define CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE_DEFAULT  (1)
+#define CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE_DEFAULT  (0)
 
 #define CFG_TDLS_WMM_MODE_ENABLE                     "gEnableTDLSWmmMode"
 #define CFG_TDLS_WMM_MODE_ENABLE_MIN                 (0)
 #define CFG_TDLS_WMM_MODE_ENABLE_MAX                 (1)
-#define CFG_TDLS_WMM_MODE_ENABLE_DEFAULT             (1)
+#define CFG_TDLS_WMM_MODE_ENABLE_DEFAULT             (0)
 
 #define CFG_TDLS_SCAN_COEX_SUPPORT_ENABLE            "gEnableTDLSScanCoexistence"
 #define CFG_TDLS_SCAN_COEX_SUPPORT_ENABLE_MIN        (0)
@@ -2034,12 +1898,6 @@
 #define CFG_TDLS_SCAN_ENABLE_MIN        (0)
 #define CFG_TDLS_SCAN_ENABLE_MAX        (2)
 #define CFG_TDLS_SCAN_ENABLE_DEFAULT    (0)
-
-#define CFG_TDLS_ENABLE_DEFER_TIMER           "gTDLSEnableDeferTime"
-#define CFG_TDLS_ENABLE_DEFER_TIMER_MIN       (2000)
-#define CFG_TDLS_ENABLE_DEFER_TIMER_MAX       (6000)
-#define CFG_TDLS_ENABLE_DEFER_TIMER_DEFAULT   (5000)
-
 #endif
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
@@ -2053,7 +1911,7 @@
 #define CFG_EXTSCAN_ENABLE                  "gEnableEXTScan"
 #define CFG_EXTSCAN_ENABLE_MIN              (0)
 #define CFG_EXTSCAN_ENABLE_MAX              (1)
-#define CFG_EXTSCAN_ENABLE_DEFAULT          (1)
+#define CFG_EXTSCAN_ENABLE_DEFAULT          (0)
 #endif
 
 #ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
@@ -2116,7 +1974,7 @@
 #define CFG_VHT_AMPDU_LEN_EXP_NAME          "gVhtMaxAmpduLenExp"
 #define CFG_VHT_AMPDU_LEN_EXP_MIN           ( 0 )
 #define CFG_VHT_AMPDU_LEN_EXP_MAX           ( 7 )
-#define CFG_VHT_AMPDU_LEN_EXP_DEFAULT       ( 7 )
+#define CFG_VHT_AMPDU_LEN_EXP_DEFAULT       ( 3 )
 
 #endif
 
@@ -2295,20 +2153,20 @@
  */
 #define CFG_ASD_PROBE_INTERVAL_NAME                     "gAsdProbeInterval"
 #define CFG_ASD_PROBE_INTERVAL_DEFAULT                  (50)
-#define CFG_ASD_PROBE_INTERVAL_MIN                      (1)
-#define CFG_ASD_PROBE_INTERVAL_MAX                      (500)
+#define CFG_ASD_PROBE_INTERVAL_MIN                      (10)
+#define CFG_ASD_PROBE_INTERVAL_MAX                      (100)
 
 /* RSSI Threshold used to trigger probing activity/selection process*/
 #define CFG_ASD_TRIGGER_THRESHOLD_NAME                  "gAsdTriggerThreshold"
-#define CFG_ASD_TRIGGER_THRESHOLD_DEFAULT               (-60)
-#define CFG_ASD_TRIGGER_THRESHOLD_MIN                   (-100)
-#define CFG_ASD_TRIGGER_THRESHOLD_MAX                   (-10)
+#define CFG_ASD_TRIGGER_THRESHOLD_DEFAULT               (-75)
+#define CFG_ASD_TRIGGER_THRESHOLD_MIN                   (-120)
+#define CFG_ASD_TRIGGER_THRESHOLD_MAX                   (0)
 
 /*RSSI Hysteresis Threshold for RSSI-RTT*/
 #define CFG_ASD_RTT_RSSI_HYST_THRESHOLD_NAME             "gAsdRTTRssiHystThreshold"
-#define CFG_ASD_RTT_RSSI_HYST_THRESHOLD_DEFAULT          (3)
+#define CFG_ASD_RTT_RSSI_HYST_THRESHOLD_DEFAULT          (50)
 #define CFG_ASD_RTT_RSSI_HYST_THRESHOLD_MIN              (0)
-#define CFG_ASD_RTT_RSSI_HYST_THRESHOLD_MAX              (5)
+#define CFG_ASD_RTT_RSSI_HYST_THRESHOLD_MAX              (100)
 
 //Enable debug for remain on channel issues
 #define CFG_DEBUG_P2P_REMAIN_ON_CHANNEL_NAME    "gDebugP2pRemainOnChannel"
@@ -2324,18 +2182,8 @@
 #define CFG_BTC_FAST_WLAN_CONN_PREF             "gBtcFastWlanConnPref"
 #define CFG_BTC_FAST_WLAN_CONN_PREF_DEFAULT     ( 1 )
 #define CFG_BTC_FAST_WLAN_CONN_PREF_MIN         ( 0 )
-#define CFG_BTC_FAST_WLAN_CONN_PREF_MAX         ( 5 )
+#define CFG_BTC_FAST_WLAN_CONN_PREF_MAX         ( 1 )
 
-#define CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN             "gBtcStaticOppWlanIdleWlanLen"
-#define CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_DEFAULT     ( 30000 )
-#define CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_MIN         ( 0 )
-#define CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_MAX         ( 250000 )
-
-
-#define CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN             "gBtcStaticOppWlanIdleBtLen"
-#define CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_DEFAULT     ( 120000 )
-#define CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_MIN         ( 0 )
-#define CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_MAX         ( 250000 )
 /*
  * Connection related log Enable/Disable.
  * 0x1 - Enable mgmt pkt logs (no probe req/rsp).
@@ -2371,22 +2219,7 @@
 #define CFG_ROAMING_DFS_CHANNEL_NAME                "gAllowDFSChannelRoam"
 #define CFG_ROAMING_DFS_CHANNEL_MIN                 (0)
 #define CFG_ROAMING_DFS_CHANNEL_MAX                 (1)
-#define CFG_ROAMING_DFS_CHANNEL_DEFAULT             (1)
-
-#define CFG_TCP_DELACK_COMPUTE_INTERVAL         "gTcpDelAckComputeInterval"
-#define CFG_TCP_DELACK_COMPUTE_INTERVAL_DEFAULT ( 2000 )
-#define CFG_TCP_DELACK_COMPUTE_INTERVAL_MIN     ( 1000 )
-#define CFG_TCP_DELACK_COMPUTE_INTERVAL_MAX     ( 10000 )
-
-#define CFG_TCP_DELACK_THRESHOLD_HIGH              "gTcpDelAckThresholdHigh"
-#define CFG_TCP_DELACK_THRESHOLD_HIGH_DEFAULT      ( 17000 )
-#define CFG_TCP_DELACK_THRESHOLD_HIGH_MIN          ( 1000 )
-#define CFG_TCP_DELACK_THRESHOLD_HIGH_MAX          ( 25000 )
-
-#define CFG_TCP_DELACK_THRESHOLD_LOW               "gTcpDelAckThresholdLow"
-#define CFG_TCP_DELACK_THRESHOLD_LOW_DEFAULT       ( 12000 )
-#define CFG_TCP_DELACK_THRESHOLD_LOW_MIN           ( 0 )
-#define CFG_TCP_DELACK_THRESHOLD_LOW_MAX           ( 25000 )
+#define CFG_ROAMING_DFS_CHANNEL_DEFAULT             (0)
 
 
 #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
@@ -2407,31 +2240,8 @@
 #define CFG_WLAN_LOGGING_NUM_BUF_MIN      ( 4  )
 #define CFG_WLAN_LOGGING_NUM_BUF_MAX      ( 64 )
 #define CFG_WLAN_LOGGING_NUM_BUF_DEFAULT  ( 32 )
-
-//Number of buffers to be used for WLAN logging
-#define CFG_WLAN_PKT_STATS_NUM_BUF_NAME     "wlanPerPktStatsNumBuf"
-#define CFG_WLAN_PKT_STATS_NUM_BUF_MIN      ( 4  )
-#define CFG_WLAN_PKT_STATS_NUM_BUF_MAX      ( 64 )
-#define CFG_WLAN_PKT_STATS_NUM_BUF_DEFAULT  ( 16 )
-
 #endif //WLAN_LOGGING_SOCK_SVC_ENABLE
 
-//Enable PerPKT stats Logging
-#define CFG_WLAN_PKT_STATS_LOGGING_NAME            "wlanPerPktStatsLogEnable"
-#define CFG_WLAN_PKT_STATS_LOGGING_ENABLE          ( 1 )
-#define CFG_WLAN_PKT_STATS_LOGGING_DISABLE         ( 0 )
-#define CFG_WLAN_PKT_STATS_LOGGING_DEFAULT         ( 1 )
-
-#define CFG_IGNORE_PEER_ERP_INFO_NAME      "gIgnorePeerErpInfo"
-#define CFG_IGNORE_PEER_ERP_INFO_MIN       ( 0 )
-#define CFG_IGNORE_PEER_ERP_INFO_MAX       ( 1 )
-#define CFG_IGNORE_PEER_ERP_INFO_DEFAULT   ( 0 )
-
-#define CFG_IGNORE_PEER_HT_MODE_NAME       "gIgnorePeerHTopMode"
-#define CFG_IGNORE_PEER_HT_MODE_MIN        ( 0 )
-#define CFG_IGNORE_PEER_HT_MODE_MAX        ( 1 )
-#define CFG_IGNORE_PEER_HT_MODE_DEFAULT    ( 0 )
-
 #define CFG_INITIAL_DWELL_TIME_NAME            "gInitialDwellTime"
 #define CFG_INITIAL_DWELL_TIME_DEFAULT         (0)
 #define CFG_INITIAL_DWELL_TIME_MIN             (0)
@@ -2487,63 +2297,11 @@
 #define CFG_ENABLE_DEAUTH_BEFORE_CONNECTION_MAX              (1)
 #define CFG_ENABLE_DEAUTH_BEFORE_CONNECTION_DEFAULT          (0)
 
-/* gEnableMacAddrSpoof = 0 => disable mac spoofing
-                       = 1 => enable mac spoofing in both HOST and FW
-                       = 2 => enable mac spoofing in FW and
-                              disable mac spoofing in HOST
- */
 #define CFG_ENABLE_MAC_ADDR_SPOOFING                         "gEnableMacAddrSpoof"
 #define CFG_ENABLE_MAC_ADDR_SPOOFING_MIN                     (0)
-#define CFG_ENABLE_MAC_ADDR_SPOOFING_MAX                     (2)
+#define CFG_ENABLE_MAC_ADDR_SPOOFING_MAX                     (1)
 #define CFG_ENABLE_MAC_ADDR_SPOOFING_DEFAULT                 (0)
 
-/* Disable Mac Spoof for p2p Scan */
-#define CFG_DISABLE_P2P_MAC_ADDR_SPOOFING              "gDisableP2PMacAddrSpoof"
-#define CFG_DISABLE_P2P_MAC_ADDR_SPOOFING_MIN          (0)
-#define CFG_DISABLE_P2P_MAC_ADDR_SPOOFING_MAX          (1)
-#define CFG_DISABLE_P2P_MAC_ADDR_SPOOFING_DEFAULT      (1)
-
-#define CFG_ENABLE_FATAL_EVENT_TRIGGER                 "gEnableFatalEvent"
-#define CFG_ENABLE_FATAL_EVENT_TRIGGER_MIN             (0)
-#define CFG_ENABLE_FATAL_EVENT_TRIGGER_MAX             (1)
-#define CFG_ENABLE_FATAL_EVENT_TRIGGER_DEFAULT         (1)
-
-
-#define CFG_ENABLE_MGMT_LOGGING                         "gEnableMgmtLogging"
-#define CFG_ENABLE_MGMT_LOGGING_MIN                     (0)
-#define CFG_ENABLE_MGMT_LOGGING_MAX                     (1)
-#define CFG_ENABLE_MGMT_LOGGING_DEFAULT                 (0)
-
-#define CFG_ENABLE_BMUHW_TRACING                         "gEnableBMUHWtracing"
-#define CFG_ENABLE_BMUHW_TRACING_MIN                     (0)
-#define CFG_ENABLE_BMUHW_TRACING_MAX                     (1)
-#define CFG_ENABLE_BMUHW_TRACING_DEFAULT                 (1)
-
-#define CFG_ENABLE_FW_LOGGING                            "gEnableFWLogging"
-#define CFG_ENABLE_FW_LOGGING_MIN                        (0)
-#define CFG_ENABLE_FW_LOGGING_MAX                        (1)
-#define CFG_ENABLE_FW_LOGGING_DEFAULT                    (1)
-
-// firmware will wakeup the host to send logs always
-#define CFG_ENABLE_FW_CONTINIOUS_LOGGING                 "gEnableContFWLogging"
-#define CFG_ENABLE_FW_CONTINIOUS_LOGGING_MIN             (0)
-#define CFG_ENABLE_FW_CONTINIOUS_LOGGING_MAX             (1)
-#define CFG_ENABLE_FW_CONTINIOUS_LOGGING_DEFAULT         (0)
-
-/* when firmware log reaches this threshold and
- * if host is awake it will push the logs.
- */
-#define CFG_MIN_LOGGING_BUFFER_SIZE                      "gMinLoggingBufferSize"
-#define CFG_MIN_LOGGING_BUFFER_SIZE_MIN                  (0)
-#define CFG_MIN_LOGGING_BUFFER_SIZE_MAX                  (6)
-#define CFG_MIN_LOGGING_BUFFER_SIZE_DEFAULT              (1)
-
-// Max ring size in firmware to log msgs when host is suspended state
-#define CFG_MAX_LOGGING_BUFFER_SIZE                      "gMaxLoggingBufferSize"
-#define CFG_MAX_LOGGING_BUFFER_SIZE_MIN                  (0)
-#define CFG_MAX_LOGGING_BUFFER_SIZE_MAX                  (6)
-#define CFG_MAX_LOGGING_BUFFER_SIZE_DEFAULT              (6)
-
 #define CFG_ENABLE_CH_AVOID                                  "gEnableChannelAvoidance"
 #define CFG_ENABLE_CH_AVOID_MIN                              ( 0 )
 #define CFG_ENABLE_CH_AVOID_MAX                              ( 1 )
@@ -2554,13 +2312,6 @@
 #define CFG_MAX_CONCURRENT_CONNECTIONS_MIN        ( 1 )
 #define CFG_MAX_CONCURRENT_CONNECTIONS_MAX        ( 4 )
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-#define CFG_ENABLE_HT_2040_COEX                    "gApHT4024G"
-#define CFG_ENABLE_HT_2040_COEX_MIN                ( 0 )
-#define CFG_ENABLE_HT_2040_COEX_MAX                ( 1 )
-#define CFG_ENABLE_HT_2040_COEX_DEFAULT            ( 0 )
-#endif
-
 //Enable Dynamic WMM PS support
 #define CFG_ENABLE_DYNAMIC_WMMPS_NAME        "gEnableDynamicWMMPS"
 #define CFG_ENABLE_DYNAMIC_WMM_PS_MIN        (0)
@@ -2635,205 +2386,25 @@
 #define CFG_MAX_UAPSD_INACT_INTVL_MAX        (255)
 #define CFG_MAX_UAPSD_INACT_INTVL_DEFAULT    (10)
 
+/*
+ * This will enable DHCP packet logging for debugging purpose
+ * The log level is set as INFO.
+ */
+#define CFG_DEBUG_DHCP                          "gEnableDhcpDebug"
+#define CFG_DEBUG_DHCP_DISABLE                  ( 0 )
+#define CFG_DEBUG_DHCP_ENABLE                   ( 1 )
+#define CFG_DEBUG_DHCP_DEFAULT                  ( CFG_DEBUG_DHCP_DISABLE )
+
 #define CFG_BURST_MODE_BE_TXOP_VALUE           "gBurstModeTXOPValue"
 #define CFG_BURST_MODE_BE_TXOP_VALUE_MIN       ( 0 )
 #define CFG_BURST_MODE_BE_TXOP_VALUE_MAX       ( 12288 )
 #define CFG_BURST_MODE_BE_TXOP_VALUE_DEFAULT   ( 0 )
 
-#define CFG_P2P_LISTEN_DEFER_INTERVAL_NAME     "gP2PListenDeferInterval"
-#define CFG_P2P_LISTEN_DEFER_INTERVAL_MIN      ( 100 )
-#define CFG_P2P_LISTEN_DEFER_INTERVAL_MAX      ( 200 )
-#define CFG_P2P_LISTEN_DEFER_INTERVAL_DEFAULT  ( 100 )
-
 #define CFG_BTC_ENABLE_IND_TIMER_VALUE          "gBtcEnableIndTimerVal"
 #define CFG_BTC_ENABLE_IND_TIMER_VALUE_MIN     ( 5 )
 #define CFG_BTC_ENABLE_IND_TIMER_VALUE_MAX     ( 60 )
 #define CFG_BTC_ENABLE_IND_TIMER_VALUE_DEFAULT ( 60 )
 
-#define CFG_DXE_REPLENISH_RX_TIMER_VALUE          "gDXEReplenishRXTimerVal"
-#define CFG_DXE_REPLENISH_RX_TIMER_VALUE_MIN       ( 0 )
-#define CFG_DXE_REPLENISH_RX_TIMER_VALUE_MAX       ( 20000 )
-#define CFG_DXE_REPLENISH_RX_TIMER_VALUE_DEFAULT   ( 6000 )
-
-#define CFG_DXE_SSR_ENABLE           "gDxeSSREnable"
-#define CFG_DXE_SSR_ENABLE_DEFAULT   ( 1 )
-#define CFG_DXE_SSR_ENABLE_MIN       ( 0 )
-#define CFG_DXE_SSR_ENABLE_MAX       ( 1 )
-
-#define CFG_TOGGLE_ARP_BDRATES_NAME       "gToggleArpBDRates"
-#define CFG_TOGGLE_ARP_BDRATES_MIN         0
-#define CFG_TOGGLE_ARP_BDRATES_MAX         2
-#define CFG_TOGGLE_ARP_BDRATES_DEFAULT     0
-
-#define CFG_DISABLE_BAR_WAKEUP_HOST_NAME       "gDisableBarWakeUp"
-#define CFG_DISABLE_BAR_WAKEUP_HOST_MIN         0
-#define CFG_DISABLE_BAR_WAKEUP_HOST_MAX         1
-#define CFG_DISABLE_BAR_WAKEUP_HOST_DEFAULT     0
-
-
-/*
- * gExtScanConcMode is used to manage EXT Scan during concurrency
- * This can be useful during WFD session. To avoid glitches during WFD
- * either ext scan has to be disabled or use split scan
- * 0: Disable EXT Scan
- * 1: Use Split scan
- * 2: Enable EXT Scan
- */
-#define CFG_EXT_SCAN_CONC_MODE                             "gExtScanConcMode"
-#define CFG_EXT_SCAN_CONC_MODE_MIN                          (0)
-#define CFG_EXT_SCAN_CONC_MODE_MAX                          (2)
-#define CFG_EXT_SCAN_CONC_MODE_DEFAULT                      (0)
-
-/*
- * If within gLinkFailTimeout period(values is mentioned in msec) if FW
- * doesn't receive acks for gLinkFailTxCnt number of packets, then link will
- * be disconnected.
- */
-
-#define CFG_LINK_FAIL_TIMEOUT_NAME    "gLinkFailTimeout"
-#define CFG_LINK_FAIL_TIMEOUT_MIN     ( 1000 )
-#define CFG_LINK_FAIL_TIMEOUT_MAX     ( 60000 )
-#define CFG_LINK_FAIL_TIMEOUT_DEF     ( 6000 )
-
-#define CFG_LINK_FAIL_TX_CNT_NAME    "gLinkFailTxCnt"
-#define CFG_LINK_FAIL_TX_CNT_MIN     ( 50 )
-#define CFG_LINK_FAIL_TX_CNT_MAX     ( 1000 )
-#define CFG_LINK_FAIL_TX_CNT_DEF     ( 200 )
-
-#define CFG_OPTIMIZE_CA_EVENT_NAME       "gOptimizeCAevent"
-#define CFG_OPTIMIZE_CA_EVENT_DISABLE    ( 0 )
-#define CFG_OPTIMIZE_CA_EVENT_ENABLE     ( 1 )
-#define CFG_OPTIMIZE_CA_EVENT_DEFAULT    ( 0 )
-
-#define CFG_FWR_MEM_DUMP_NAME       "gEnableFwrMemDump"
-#define CFG_FWR_MEM_DUMP_MAX        ( 1 )
-#define CFG_FWR_MEM_DUMP_MIN        ( 0 )
-#define CFG_FWR_MEM_DUMP_DEF        ( 1 )
-
-#define CFG_ACTIVE_PASSIVE_CHAN_CONV_NAME "gActivePassiveChCon"
-#define CFG_ACTIVE_PASSIVE_CHAN_CONV_MIN  (0)
-#define CFG_ACTIVE_PASSIVE_CHAN_CONV_MAX  (1)
-#define CFG_ACTIVE_PASSIVE_CHAN_CONV_DEF  (1)
-
-#define CFG_WIFI_CONFIG_ENABLE                  "gEnableWifiConfig"
-#define CFG_WIFI_CONFIG_MIN                          (0)
-#define CFG_WIFI_CONFIG_MAX                          (1)
-#define CFG_WIFI_CONFIG_DEFAULT                      (1)
-
-#define CFG_MAXCHAN_FOR_CHANTIME_CORR_NAME       "gMaxChannelForMoreDwellTime"
-#define CFG_MAXCHAN_FOR_CHANTIME_CORR_MIN        (0)
-#define CFG_MAXCHAN_FOR_CHANTIME_CORR_MAX        (35)
-#define CFG_MAXCHAN_FOR_CHANTIME_CORR_DEFAULT    (10)
-
-/*
- * BOffsetCorrectionEnable : This ini will control enabling/disabling
- * of rate dependent power offsets in firmware
- */
-#define CFG_SAR_BOFFSET_SET_CORRECTION_NAME      "gBOffsetCorrectionEnable"
-#define CFG_SAR_BOFFSET_SET_CORRECTION_MIN       (0)
-#define CFG_SAR_BOFFSET_SET_CORRECTION_MAX       (1)
-#define CFG_SAR_BOFFSET_SET_CORRECTION_DEFAULT   (0)
-
-/*
- * If gEnableEdcaParams is set to 1, params gEdcaVoCwmin,
- * gEdcaViCwmin, gEdcaBkCwmin, gEdcaBeCwmin, gEdcaVoCwmax,
- * gEdcaViCwmax, gEdcaBkCwmax, gEdcaBeCwmax, gEdcaVoAifs,
- * gEdcaViAifs, gEdcaBkAifs and gEdcaBeAifs values are used
- * to overwrite the values received from AP
- */
-#define CFG_ENABLE_EDCA_INI_NAME       "gEnableEdcaParams"
-#define CFG_ENABLE_EDCA_INI_MIN        (0)
-#define CFG_ENABLE_EDCA_INI_MAX        (1)
-#define CFG_ENABLE_EDCA_INI_DEFAULT    (0)
-
-/* Cwmin value for EDCA_AC_VO. CWVomin = 2^gEdcaVoCwmin -1 */
-#define CFG_EDCA_VO_CWMIN_VALUE_NAME      "gEdcaVoCwmin"
-#define CFG_EDCA_VO_CWMIN_VALUE_MIN       (0x0)
-#define CFG_EDCA_VO_CWMIN_VALUE_MAX       (15)
-#define CFG_EDCA_VO_CWMIN_VALUE_DEFAULT   (2)
-
-/* Cwmin value for EDCA_AC_VI. CWVimin = 2^gEdcaViCwmin -1 */
-#define CFG_EDCA_VI_CWMIN_VALUE_NAME      "gEdcaViCwmin"
-#define CFG_EDCA_VI_CWMIN_VALUE_MIN       (0x0)
-#define CFG_EDCA_VI_CWMIN_VALUE_MAX       (15)
-#define CFG_EDCA_VI_CWMIN_VALUE_DEFAULT   (3)
-
-/* Cwmin value for EDCA_AC_BK. CWBkmin = 2^gEdcaBkCwmin -1 */
-#define CFG_EDCA_BK_CWMIN_VALUE_NAME      "gEdcaBkCwmin"
-#define CFG_EDCA_BK_CWMIN_VALUE_MIN       (0x0)
-#define CFG_EDCA_BK_CWMIN_VALUE_MAX       (15)
-#define CFG_EDCA_BK_CWMIN_VALUE_DEFAULT   (4)
-
-/* Cwmin value for EDCA_AC_BE. CWBemin = 2^gEdcaBeCwmin -1 */
-#define CFG_EDCA_BE_CWMIN_VALUE_NAME      "gEdcaBeCwmin"
-#define CFG_EDCA_BE_CWMIN_VALUE_MIN       (0x0)
-#define CFG_EDCA_BE_CWMIN_VALUE_MAX       (15)
-#define CFG_EDCA_BE_CWMIN_VALUE_DEFAULT   (4)
-
-/* Cwmax value for EDCA_AC_VO. CWVomax = 2^gEdcaVoCwmax -1 */
-#define CFG_EDCA_VO_CWMAX_VALUE_NAME      "gEdcaVoCwmax"
-#define CFG_EDCA_VO_CWMAX_VALUE_MIN       (0)
-#define CFG_EDCA_VO_CWMAX_VALUE_MAX       (15)
-#define CFG_EDCA_VO_CWMAX_VALUE_DEFAULT   (3)
-
-/* Cwmax value for EDCA_AC_VI. CWVimax = 2^gEdcaViCwmax -1 */
-#define CFG_EDCA_VI_CWMAX_VALUE_NAME      "gEdcaViCwmax"
-#define CFG_EDCA_VI_CWMAX_VALUE_MIN       (0)
-#define CFG_EDCA_VI_CWMAX_VALUE_MAX       (15)
-#define CFG_EDCA_VI_CWMAX_VALUE_DEFAULT   (4)
-
-/* Cwmax value for EDCA_AC_BK. CWBkmax = 2^gEdcaBkCwmax -1 */
-#define CFG_EDCA_BK_CWMAX_VALUE_NAME      "gEdcaBkCwmax"
-#define CFG_EDCA_BK_CWMAX_VALUE_MIN       (0)
-#define CFG_EDCA_BK_CWMAX_VALUE_MAX       (15)
-#define CFG_EDCA_BK_CWMAX_VALUE_DEFAULT   (10)
-
-/* Cwmax value for EDCA_AC_BE. CWBemax = 2^gEdcaBeCwmax -1 */
-#define CFG_EDCA_BE_CWMAX_VALUE_NAME      "gEdcaBeCwmax"
-#define CFG_EDCA_BE_CWMAX_VALUE_MIN       (0)
-#define CFG_EDCA_BE_CWMAX_VALUE_MAX       (15)
-#define CFG_EDCA_BE_CWMAX_VALUE_DEFAULT   (10)
-
-/* Aifs value for EDCA_AC_VO.*/
-#define CFG_EDCA_VO_AIFS_VALUE_NAME       "gEdcaVoAifs"
-#define CFG_EDCA_VO_AIFS_VALUE_MIN        (0)
-#define CFG_EDCA_VO_AIFS_VALUE_MAX        (15)
-#define CFG_EDCA_VO_AIFS_VALUE_DEFAULT    (2)
-
-/* Aifs value for EDCA_AC_VI.*/
-#define CFG_EDCA_VI_AIFS_VALUE_NAME       "gEdcaViAifs"
-#define CFG_EDCA_VI_AIFS_VALUE_MIN        (0)
-#define CFG_EDCA_VI_AIFS_VALUE_MAX        (15)
-#define CFG_EDCA_VI_AIFS_VALUE_DEFAULT    (2)
-
-/* Aifs value for EDCA_AC_BK.*/
-#define CFG_EDCA_BK_AIFS_VALUE_NAME       "gEdcaBkAifs"
-#define CFG_EDCA_BK_AIFS_VALUE_MIN        (0)
-#define CFG_EDCA_BK_AIFS_VALUE_MAX        (15)
-#define CFG_EDCA_BK_AIFS_VALUE_DEFAULT    (7)
-
-/* Aifs value for EDCA_AC_BE.*/
-#define CFG_EDCA_BE_AIFS_VALUE_NAME       "gEdcaBeAifs"
-#define CFG_EDCA_BE_AIFS_VALUE_MIN        (0)
-#define CFG_EDCA_BE_AIFS_VALUE_MAX        (15)
-#define CFG_EDCA_BE_AIFS_VALUE_DEFAULT    (3)
-
-/* If gSendMgmtPktViaWQ5 is enabled, mgmt packet will go via WQ5 */
-#define CFG_SEND_MGMT_PKT_VIA_WQ5_NAME    "gSendMgmtPktViaWQ5"
-#define CFG_SEND_MGMT_PKT_VIA_WQ5_MIN      ( 0 )
-#define CFG_SEND_MGMT_PKT_VIA_WQ5_MAX      ( 1)
-#define CFG_SEND_MGMT_PKT_VIA_WQ5_DEF      ( 0 )
-
-/*
- * gSapProbeRespOffload: when set in sap, offloads the
- * probe response transmission to firmware
- */
-#define CFG_SAP_PROBE_RESP_OFFLOAD_NAME    "gSapProbeRespOffload"
-#define CFG_SAP_PROBE_RESP_OFFLOAD_MIN     (0)
-#define CFG_SAP_PROBE_RESP_OFFLOAD_MAX     (1)
-#define CFG_SAP_PROBE_RESP_OFFLOAD_DEFAULT (1)
-
-
 /*--------------------------------------------------------------------------- 
   Type declarations
   -------------------------------------------------------------------------*/ 
@@ -2965,7 +2536,6 @@
    v_BOOL_t      fFTResourceReqSupported;
 #endif
 
-   v_BOOL_t      gEnableRoamDelayStats;
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
    v_U16_t       nNeighborScanPeriod;
    v_U8_t        nNeighborReassocRssiThreshold;
@@ -3050,15 +2620,6 @@
 #endif
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
    v_BOOL_t                     isRoamOffloadScanEnabled;
-   v_BOOL_t                     isPERRoamEnabled;
-   v_BOOL_t                     isPERRoamRxPathEnabled;
-   v_BOOL_t                     isPERRoamCCAEnabled;
-   v_U16_t                      rateUpThreshold;
-   v_U16_t                      rateDownThreshold;
-   v_U16_t                      PERroamTriggerPercent;
-   v_U32_t                      waitPeriodForNextPERScan;
-   v_U32_t                      PERtimerThreshold;
-   v_U32_t                      PERroamRxPktsThreshold;
 #endif
    hdd_wmm_classification_t     PktClassificationBasis; // DSCP or 802.1Q
    v_BOOL_t                     bImplicitQosEnabled;
@@ -3281,7 +2842,7 @@
 #endif
    char                        overrideCountryCode[4];
    v_U32_t                     gAsdProbeInterval;
-   v_S7_t                      gAsdTriggerThreshold;
+   v_U32_t                     gAsdTriggerThreshold;
    v_U32_t                     gAsdRTTRssiHystThreshold;
    v_BOOL_t                    debugP2pRemainOnChannel;
    v_U32_t                     cfgBtcCTS2SduringSCO;
@@ -3292,7 +2853,7 @@
    v_BOOL_t                    gEnableStrictRegulatoryForFCC;
    v_BOOL_t                    advertiseConcurrentOperation;
    v_U32_t                     defaultRateIndex24Ghz;
-   v_BOOL_t                    sapEnable11AC;
+   eHddDot11Mode               sapDot11Mode;
    v_BOOL_t                    cfgRAFilterEnable;
    v_U16_t                     cfgRARateLimitInterval;
    v_U8_t                      allowDFSChannelRoam;
@@ -3302,18 +2863,13 @@
    v_U32_t                     wlanLoggingEnable;
    v_U32_t                     wlanLoggingFEToConsole;
    v_U32_t                     wlanLoggingNumBuf;
-   v_U32_t                     wlanPerPktStatsLogEnable;
-   v_U32_t                     wlanPerPktStatsNumBuf;
 #endif
-   v_BOOL_t                    ignorePeerErpInfo;
+
    v_BOOL_t                    initialScanSkipDFSCh;
    v_U32_t                     cfgBtcFatalHidnSniffBlkGuidance;
    v_U32_t                     cfgBtcCriticalHidnSniffBlkGuidance;
    v_U32_t                     cfgBtcA2dpTxQueueThold;
    v_U32_t                     cfgBtcOppTxQueueThold;
-   v_U32_t                     tcpDelAckComputeInterval;
-   v_U32_t                     tcpDelAckThresholdHigh;
-   v_U32_t                     tcpDelAckThresholdLow;
 
 #ifdef WLAN_FEATURE_11W
    v_U32_t                     pmfSaQueryMaxRetries;
@@ -3321,15 +2877,7 @@
 #endif
    v_U32_t                     deferImpsTime;
    v_BOOL_t                    sendDeauthBeforeCon;
-   v_U8_t                      enableMacSpoofing;
-   v_BOOL_t                    disableP2PMacSpoofing;
-   v_BOOL_t                    enableFatalEvent;
-   v_BOOL_t                    enableMgmtLogging;
-   v_BOOL_t                    enableBMUHWtracing;
-   v_BOOL_t                    enableFWLogging;
-   v_BOOL_t                    enableContFWLogging;
-   v_U8_t                      minLoggingBufferSize;
-   v_U8_t                      maxLoggingBufferSize;
+   v_BOOL_t                    enableMacSpoofing;
    v_BOOL_t                    fenableCHAvoidance;
    v_U8_t                      gMaxConcurrentActiveSessions;
 
@@ -3341,55 +2889,14 @@
    v_U32_t                     uapsdConsecTxCntMeasWindow;
    v_U32_t                     maxPsPollInWmmUapsdMode;
    v_U32_t                     maxUapsdInactivityIntervals;
+   v_U8_t                      enableDhcpDebug; /* Enable/Disable dhcp debug */
    v_U32_t                     burstModeTXOPValue;
    v_U8_t                      acsScanBandPreference;
    v_U16_t                     acsBandSwitchThreshold;
    v_U32_t                     enableDynamicRAStartRate;
-   v_U32_t                     enableRtsCtsHtVht;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-   v_BOOL_t                    apHT40_24GEnabled;
-#endif
-   v_U16_t                     gP2PListenDeferInterval;
    v_U8_t                      btcEnableIndTimerVal;
-   v_U8_t                      btcFastWlanConnPref;
-   v_U32_t                     dxeReplenishRXTimerVal;
-   v_U32_t                     dxeSSREnable;
-   v_U8_t                      multicast_host_msgs;
-   v_BOOL_t                    toggleArpBDRates;
-   v_U32_t                     btcStaticOppWlanIdleWlanLen;
-   v_U32_t                     btcStaticOppWlanIdleBtLen;
-   v_U32_t                     linkFailTimeout;
-   v_U32_t                     linkFailTxCnt;
-   v_BOOL_t                    ignorePeerHTopMode;
-   v_U8_t                      gOptimizeCAevent;
-   v_BOOL_t                    enableFwrMemDump;
-   v_U8_t                      gActivePassiveChCon;
-   v_U32_t                     cfgExtScanConcMode;
-   v_U16_t                     rps_mask;
-   v_BOOL_t                    fEnableWifiConfig;
-   v_BOOL_t                    crash_inject_enabled;
-   v_U32_t                     enable_delack;
-   v_BOOL_t                    disableBarWakeUp;
-   v_U8_t                      max_chan_for_dwell_time_cfg;
-   v_U16_t                     tdls_enable_defer_time;
-   v_U8_t                      boffset_correction_enable;
-   uint32_t                    enable_edca_params;
-   uint32_t                    edca_vo_cwmin;
-   uint32_t                    edca_vi_cwmin;
-   uint32_t                    edca_bk_cwmin;
-   uint32_t                    edca_be_cwmin;
-   uint32_t                    edca_vo_cwmax;
-   uint32_t                    edca_vi_cwmax;
-   uint32_t                    edca_bk_cwmax;
-   uint32_t                    edca_be_cwmax;
-   uint32_t                    edca_vo_aifs;
-   uint32_t                    edca_vi_aifs;
-   uint32_t                    edca_bk_aifs;
-   uint32_t                    edca_be_aifs;
-   v_BOOL_t                    sendMgmtPktViaWQ5;
-   v_BOOL_t                    sap_probe_resp_offload;
+   v_BOOL_t                    btcFastWlanConnPref;
 } hdd_config_t;
-
 /*--------------------------------------------------------------------------- 
   Function declarations and documenation
   -------------------------------------------------------------------------*/ 
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_cfg80211.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_cfg80211.h
index b673717..b8fd5b4 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_cfg80211.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_cfg80211.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -100,7 +100,7 @@
 #endif
 #endif
 
-#define MAX_CHANNEL NUM_2_4GHZ_CHANNELS + NUM_5GHZ_CHANNELS
+#define MAX_CHANNEL MAX_2_4GHZ_CHANNEL + NUM_5GHZ_CHANNELS
 
 typedef struct {
    u8 element_id;
@@ -149,6 +149,9 @@
     QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND = 28,
     QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST = 29,
     QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST = 30,
+    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE = 31,
+    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE = 32,
+    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE = 33,
     /* EXT TDLS */
     QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE = 34,
     QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE = 35,
@@ -159,36 +162,8 @@
     QCA_NL80211_VENDOR_SUBCMD_MAC_OUI = 39,
     /* Set nodfs_flag */
     QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG = 40,
-
-    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST = 41,
-
     /* Get Concurrency Matrix */
-    QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX = 42,
-    /* Start Wifi Logger */
-    QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_START = 62,
-
-    /* Get Wifi Specific Info */
-    QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO = 61,
-    /* Start Wifi Memory Dump */
-    QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP = 63,
-    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SSID_HOTLIST = 65,
-    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SSID_HOTLIST = 66,
-    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND = 67,
-    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST = 68,
-
-    /* Wi-Fi Configuration subcommands */
-    QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION = 74,
-    QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_CONFIGURATION = 75,
-    QCA_NL80211_VENDOR_SUBCMD_GET_RING_DATA = 77,
-
-    QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI = 80,
-
-    QCA_NL80211_VENDOR_SUBCMD_OFFLOADED_PACKETS = 79,
-
-    /* subcommand to get link properties */
-    QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES = 101,
-
-    QCA_NL80211_VENDOR_SUBCMD_SETBAND = 105,
+    QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX = 42
 };
 
 enum qca_nl80211_vendor_subcmds_index {
@@ -212,18 +187,11 @@
     QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX,
     QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST_INDEX,
     QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST_INDEX,
+    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE_INDEX,
+    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE_INDEX,
+    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE_INDEX,
     /*EXT TDLS*/
     QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX,
-    QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX,
-    QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP_INDEX,
-
-    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SSID_HOTLIST_INDEX,
-    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SSID_HOTLIST_INDEX,
-    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND_INDEX,
-    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST_INDEX,
-
-    QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX,
-    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST_INDEX,
 };
 
 enum qca_wlan_vendor_attr
@@ -241,8 +209,6 @@
      * by enum qca_roaming_policy. */
     QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY = 5,
     QCA_WLAN_VENDOR_ATTR_MAC_ADDR = 6,
-    /* Unsigned 32-bit value from enum qca_set_band. */
-    QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE = 12,
     /* keep last */
     QCA_WLAN_VENDOR_ATTR_AFTER_LAST,
     QCA_WLAN_VENDOR_ATTR_MAX = QCA_WLAN_VENDOR_ATTR_AFTER_LAST - 1,
@@ -353,28 +319,6 @@
                         QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_AFTER_LAST - 1,
 };
 
-/**
- * enum qca_wlan_vendor_attr_ll_stats_results_type - ll stats result type
- *
- * @QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_INVALID: Initial invalid value
- * @QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_RADIO: Link layer stats type radio
- * @QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_IFACE: Link layer stats type interface
- * @QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_PEER: Link layer stats type peer
- * @QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_AFTER_LAST: Last value
- * @QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_MAX: Max value
- */
-enum qca_wlan_vendor_attr_ll_stats_results_type {
-    QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_INVALID = 0,
-
-    QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_RADIO = 1,
-    QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_IFACE,
-    QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_PEER,
-
-    QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_AFTER_LAST,
-    QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_MAX =
-    QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_AFTER_LAST - 1
-};
-
 enum qca_wlan_vendor_attr_ll_stats_results
 {
     QCA_WLAN_VENDOR_ATTR_LL_STATS_INVALID = 0,
@@ -601,21 +545,6 @@
      */
     QCA_WLAN_VENDOR_ATTR_LL_STATS_RESULTS_MORE_DATA,
 
-    /* Unsigned 64bit value */
-    QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_AVERAGE_TSF_OFFSET,
-
-    /* Unsigned 32bit value */
-    QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_DETECTED,
-
-    /* Unsigned 32bit value */
-    QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_AVG_NUM_FRAMES_LEAKED,
-
-    /* Unsigned 32bit value */
-    QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_GUARD_TIME,
-
-    /* Unsigned 32bit value to indicate ll stats result type */
-    QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE,
-
     /* keep last */
     QCA_WLAN_VENDOR_ATTR_LL_STATS_AFTER_LAST,
     QCA_WLAN_VENDOR_ATTR_LL_STATS_MAX   =
@@ -632,22 +561,22 @@
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_INVALID = 0,
 
     /* Unsigned 32-bit value; Middleware provides it to the driver. Middle ware
-     * either gets it from caller, e.g., framework, or generates one if
-     * framework doesn't provide it.
-     */
+      * either gets it from caller, e.g., framework, or generates one if
+      * framework doesn't provide it.
+      */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID,
 
     /* NL attributes for data used by
-     * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS sub command.
-     */
+      * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS sub command.
+      */
     /* Unsigned 32-bit value */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND,
     /* Unsigned 32-bit value */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS,
 
     /* NL attributes for input params used by
-     * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START sub command.
-     */
+      * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START sub command.
+      */
 
     /* Unsigned 32-bit value; channel frequency */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL,
@@ -666,35 +595,35 @@
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD,
     /* Unsigned 8-bit value; report events semantics. */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS,
-    /* Unsigned 32-bit value.
-     * Followed by a nested array of EXTSCAN_CHANNEL_SPEC_* attributes.
-     */
+    /* Unsigned 32-bit value. Followed by a nested array of
+     * EXTSCAN_CHANNEL_SPECS attributes.
+      */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS,
 
     /* Array of QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_* attributes.
-     * Array size: QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS
-     */
+      * Array size: QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS
+      */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC,
 
     /* Unsigned 32-bit value; base timer period in ms. */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD,
     /* Unsigned 32-bit value; number of APs to store in each scan in the
-     * BSSID/RSSI history buffer (keep the highest RSSI APs).
-     */
+      * BSSID/RSSI history buffer (keep the highest RSSI APs).
+      */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN,
-    /* Unsigned 8-bit value; in %, when scan buffer is this much full, wake up
-     * APPS.
-     */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT,
+    /* Unsigned 8-bit value; In %, when scan buffer is this much full, wake up
+      * APPS.
+      */
+    QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD,
     /* Unsigned 8-bit value; number of scan bucket specs; followed by a nested
-     * array of_EXTSCAN_BUCKET_SPEC_* attributes and values. The size of the
-     * array is determined by NUM_BUCKETS.
-     */
+      * array of_EXTSCAN_BUCKET_SPEC_* attributes and values. The size of the
+      * array is determined by NUM_BUCKETS.
+      */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS,
 
     /* Array of QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_* attributes.
-     * Array size: QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS
-     */
+      * Array size: QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS
+      */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC,
 
     /* Unsigned 8-bit value */
@@ -711,15 +640,16 @@
     /* Unsigned 32-bit value */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL,
 
+
     /* Number of hotlist APs as unsigned 32-bit value, followed by a nested
      * array of AP_THRESHOLD_PARAM attributes and values. The size of the
      * array is determined by NUM_AP.
-     */
+      */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP,
 
     /* Array of QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_* attributes.
-     * Array size: QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS
-     */
+      * Array size: QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS
+      */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM,
 
     /* Unsigned 32bit value; number of samples for averaging RSSI. */
@@ -729,58 +659,15 @@
     /* Unsigned 32bit value; number of APs breaching threshold. */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING,
     /* Unsigned 32bit value; number of APs. Followed by an array of
-     * AP_THRESHOLD_PARAM attributes. Size of the array is NUM_AP.
-     */
+      * AP_THRESHOLD_PARAM attributes. Size of the array is NUM_AP.
+      */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP,
-    /* Unsigned 32bit value; number of samples to confirm AP loss. */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE,
-
-    /* Unsigned 32-bit value. If max_period is non zero or different than
-     * period, then this bucket is an exponential backoff bucket.
-     */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD,
-    /* Unsigned 32-bit value. */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT,
-    /* Unsigned 32-bit value. For exponential back off bucket, number of scans
-     * performed at a given period and until the exponent is applied.
-     */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT,
-    /* Unsigned 8-bit value; in number of scans, wake up AP after these
-     * many scans.
-     */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS,
-
-    /* NL attributes for data used by
-     * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SSID_HOTLIST sub command.
-     */
-    /* Unsigned 32bit value; number of samples to confirm SSID loss. */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_LOST_SSID_SAMPLE_SIZE,
-    /* Number of hotlist SSIDs as unsigned 32-bit value, followed by a nested
-     * array of SSID_THRESHOLD_PARAM_* attributes and values. The size of the
-     * array is determined by NUM_SSID.
-     */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID,
-    /* Array of QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_* attributes.
-     * Array size: QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID
-     */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM,
-
-    /* An array of 33 x Unsigned 8-bit value; NULL terminated SSID */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID,
-    /* Unsigned 8-bit value */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_BAND,
-    /* Signed 32-bit value */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_LOW,
-    /* Signed 32-bit value */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_HIGH,
-
-    /* Unsigned 32-bit value; a bitmask w/additional extscan config flag. */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_CONFIGURATION_FLAGS,
 
     /* keep last */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_AFTER_LAST,
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX =
         QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_AFTER_LAST - 1,
+
 };
 
 enum qca_wlan_vendor_attr_extscan_results
@@ -818,7 +705,7 @@
     /* Signed 32bit value */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD,
     /* Unsigned 32bit value */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_BSSIDS,
+    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_APS,
     /* Unsigned 32bit value */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS,
     /* Unsigned 32bit value */
@@ -874,35 +761,30 @@
       */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA,
 
-    /* Use attr QCA_WLAN_VENDOR_ATTR_EXTSCAN_NUM_RESULTS_AVAILABLE
-     * to indicate number of wifi scan results/bssids retrieved by the scan.
-     * Also, use QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST to indicate the list
-     * of wifi scan results returned for each cached result block.
-     */
-
     /* EXTSCAN attributes for
-     * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT sub-command.
-     */
+      * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT sub-command.
+      */
     /* Unsigned 8-bit value */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE,
     /* Unsigned 32-bit value */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS,
 
     /* EXTSCAN attributes for
-     * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND sub-command.
-     */
-    /* Use attr QCA_WLAN_VENDOR_ATTR_EXTSCAN_NUM_RESULTS_AVAILABLE
-     * to indicate number of results.
-     */
+      * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND sub-command.
+      */
+    /* Use attr QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE
+      * to indicate number of results.
+      */
 
     /* EXTSCAN attributes for
-     * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE sub-command.
-     */
+      * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE sub-command.
+      */
     /* An array of 6 x Unsigned 8-bit value */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_BSSID,
     /* Unsigned 32-bit value */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_CHANNEL,
-    /* Unsigned 32-bit value.
+    /* Unsigned 32-bit value  - followed by a nested array of signed 32-bit
+      * RSSI values. Size of the array is determined by NUM_RSSI.
       */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_NUM_RSSI,
     /* A nested array of signed 32-bit RSSI values. Size of the array is
@@ -910,80 +792,6 @@
      */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_RSSI_LIST,
 
-    /* EXTSCAN attributes used with
-     * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS sub-command.
-     */
-    /* Use attr QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE
-     * to indicate number of gscan cached results returned.
-     * Also, use QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_LIST to indicate
-     *  the list of gscan cached results.
-     */
-
-    /* An array of NUM_RESULTS_AVAILABLE x
-     * QCA_NL80211_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_*
-     */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_LIST,
-    /* Unsigned 32-bit value; a unique identifier for the scan unit. */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_SCAN_ID,
-    /* Unsigned 32-bit value; a bitmask w/additional information about scan. */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_FLAGS,
-    /* Use attr QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE
-     * to indicate number of wifi scan results/bssids retrieved by the scan.
-     * Also, use QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST to indicate the list
-     * of wifi scan results returned for each cached result block.
-     */
-
-    /* EXTSCAN attributes for
-     * QCA_NL80211_VENDOR_SUBCMD_PNO_NETWORK_FOUND sub-command.
-     */
-    /* Use QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE for number
-     * of results.
-     * Use QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST to indicate the nested
-     * list of wifi scan results returned for each wifi_passpoint_match_result block.
-     * Array size: QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE.
-     */
-
-    /* EXTSCAN attributes for
-     * QCA_NL80211_VENDOR_SUBCMD_PNO_PASSPOINT_NETWORK_FOUND sub-command.
-     */
-    /* Unsigned 32-bit value */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_PNO_RESULTS_PASSPOINT_NETWORK_FOUND_NUM_MATCHES,
-    /* A nested array of
-     * QCA_WLAN_VENDOR_ATTR_EXTSCAN_PNO_RESULTS_PASSPOINT_MATCH_*
-     * attributes. Array size =
-     * *_ATTR_EXTSCAN_PNO_RESULTS_PASSPOINT_NETWORK_FOUND_NUM_MATCHES.
-     */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_PNO_RESULTS_PASSPOINT_MATCH_RESULT_LIST,
-
-    /* Unsigned 32-bit value; network block id for the matched network */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_PNO_RESULTS_PASSPOINT_MATCH_ID,
-    /* Use QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST to indicate the nested
-     * list of wifi scan results returned for each wifi_passpoint_match_result block.
-     */
-    /* Unsigned 32-bit value */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_PNO_RESULTS_PASSPOINT_MATCH_ANQP_LEN,
-    /* An array size of PASSPOINT_MATCH_ANQP_LEN of unsigned 8-bit values;
-     * ANQP data in the information_element format.
-     */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_PNO_RESULTS_PASSPOINT_MATCH_ANQP,
-
-    /* Unsigned 32bit value; a EXTSCAN Capabilities attribute. */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_SSIDS,
-    /* Unsigned 32bit value; a EXTSCAN Capabilities attribute. */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_NUM_EPNO_NETS,
-    /* Unsigned 32bit value; a EXTSCAN Capabilities attribute. */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_NUM_EPNO_NETS_BY_SSID,
-    /* Unsigned 32bit value; a EXTSCAN Capabilities attribute. */
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_NUM_WHITELISTED_SSID,
-
-    /* EXTSCAN attributes for
-     * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND sub-command &
-     * QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST sub-command
-     */
-    /* Use attr QCA_WLAN_VENDOR_ATTR_EXTSCAN_NUM_RESULTS_AVAILABLE
-     * to indicate number of results.
-     */
-
     /* keep last */
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_AFTER_LAST,
     QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_MAX =
@@ -1000,20 +808,6 @@
         QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_AFTER_LAST - 1,
 };
 
-/* NL attributes for data used by
- * QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO sub command.
- */
-enum qca_wlan_vendor_attr_get_wifi_info {
-    QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_INVALID = 0,
-    QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION     = 1,
-    QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION   = 2,
-
-    /* keep last */
-    QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_AFTER_LAST,
-    QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX  =
-        QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_AFTER_LAST - 1,
-};
-
 enum qca_wlan_vendor_attr_get_supported_features {
     QCA_WLAN_VENDOR_ATTR_FEATURE_SET_INVALID = 0,
     /* Unsigned 32-bit value */
@@ -1043,68 +837,6 @@
         QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_AFTER_LAST - 1,
 };
 
-/**
- * enum qca_wlan_vendor_attr_wifi_logger_start - Enum for wifi logger starting
- * @QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_INVALID: Invalid attribute
- * @QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID: Ring ID
- * @QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL: Verbose level
- * @QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS: Flag
- * @QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_AFTER_LAST: Last value
- * @QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX: Max value
- */
-enum qca_wlan_vendor_attr_wifi_logger_start {
-    QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_INVALID = 0,
-    QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID = 1,
-    QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL = 2,
-    QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS = 3,
-    /* keep last */
-    QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_AFTER_LAST,
-    QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX =
-       QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_AFTER_LAST - 1,
-};
-
-/* NL attributes for data used by
- * QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES.
- */
-enum qca_wlan_vendor_attr_link_properties {
-    QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_INVALID    = 0,
-    /* Unsigned 8bit value for specifying nof spatial streams */
-    QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_NSS        = 1,
-    /* Unsigned 8bit value for the rate flags */
-    QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_RATE_FLAGS = 2,
-    /* Unsigned 32bit value for operating frequency */
-    QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_FREQ       = 3,
-
-    /* KEEP LAST */
-    QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_AFTER_LAST,
-    QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_MAX =
-    QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_AFTER_LAST - 1,
-};
-
-/**
- * enum qca_wlan_vendor_config: wifi config attr
- *
- * @QCA_WLAN_VENDOR_ATTR_CONFIG_INVALID: invalid config
- * @QCA_WLAN_VENDOR_ATTR_CONFIG_MODULATED_DTIM: dynamic dtim
- * @QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR: stats avg. factor
- * @QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME: guard time
- * @QCA_WLAN_VENDOR_ATTR_CONFIG_LAST: last config
- * @QCA_WLAN_VENDOR_ATTR_CONFIG_MAX: max config
- */
-enum qca_wlan_vendor_config {
-    QCA_WLAN_VENDOR_ATTR_CONFIG_INVALID = 0,
-    QCA_WLAN_VENDOR_ATTR_CONFIG_MODULATED_DTIM,
-    QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR,
-    QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME,
-    QCA_WLAN_VENDOR_ATTR_CONFIG_FINE_TIME_MEASUREMENT,
-    QCA_WLAN_VENDOR_ATTR_CONFIG_TX_RATE,
-    QCA_WLAN_VENDOR_ATTR_CONFIG_PENALIZE_AFTER_NCONS_BEACON_MISS,
-    /* keep last */
-    QCA_WLAN_VENDOR_ATTR_CONFIG_LAST,
-    QCA_WLAN_VENDOR_ATTR_CONFIG_MAX =
-    QCA_WLAN_VENDOR_ATTR_CONFIG_LAST - 1
-};
-
 /* Feature defines */
 #define WIFI_FEATURE_INFRA              0x0001   /* Basic infrastructure mode */
 #define WIFI_FEATURE_INFRA_5G           0x0002   /* Support for 5 GHz Band */
@@ -1126,15 +858,6 @@
 #define WIFI_FEATURE_EPR                0x4000   /* Enhanced power reporting */
 #define WIFI_FEATURE_AP_STA             0x8000   /* Support for AP STA
                                                     Concurrency */
-#define WIFI_FEATURE_LINK_LAYER_STATS   0x10000  /* Link layer stats */
-
-#define WIFI_FEATURE_RTT3               0x20000  /* RTT3 */
-
-/* WIFI CONFIG Parameter defines */
-#define WIFI_CONFIG_SET_AVG_STATS_FACTOR 0x0001  /* Average stats factor */
-#define WIFI_CONFIG_SET_GUARD_TIME      0x0002  /* Guard Time */
-#define WIFI_CONFIG_SET_BCNMISS_PENALTY_COUNT 0x0001 /* BCNMISS_PENALTY_COUNT */
-
 /* Add more features here */
 enum qca_wlan_vendor_attr_set_no_dfs_flag
 {
@@ -1146,21 +869,6 @@
     QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX =
         QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_AFTER_LAST - 1,
 };
-/*
- * enum qca_wlan_vendor_attr_wifi_logger_get_ring_data - Get ring data
- * @QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_INVALID: Invalid attribute
- * @QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID: Ring ID
- * @QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_AFTER_LAST: Last value
- * @QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX: Max value
- */
-enum qca_wlan_vendor_attr_wifi_logger_get_ring_data {
-    QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_INVALID = 0,
-    QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID = 1,
-    /* keep last */
-    QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_AFTER_LAST,
-    QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX =
-        QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_AFTER_LAST - 1,
-};
 
 
 /* Vendor id to be used in vendor specific command and events
@@ -1169,8 +877,9 @@
  */
 #define QCA_NL80211_VENDOR_ID                0x001374
 
+
 #ifdef FEATURE_WLAN_CH_AVOID
-#define HDD_MAX_AVOID_FREQ_RANGES   15
+#define HDD_MAX_AVOID_FREQ_RANGES   4
 typedef struct sHddAvoidFreqRange
 {
    u32 startFreq;
@@ -1184,93 +893,6 @@
 } tHddAvoidFreqList;
 #endif /* FEATURE_WLAN_CH_AVOID */
 
-
-/**
- * enum qca_wlan_rssi_monitoring_control - rssi control commands
- * @QCA_WLAN_RSSI_MONITORING_CONTROL_INVALID: invalid
- * @QCA_WLAN_RSSI_MONITORING_START: rssi monitoring start
- * @QCA_WLAN_RSSI_MONITORING_STOP: rssi monitoring stop
- */
-enum qca_wlan_rssi_monitoring_control {
-        QCA_WLAN_RSSI_MONITORING_CONTROL_INVALID = 0,
-        QCA_WLAN_RSSI_MONITORING_START,
-        QCA_WLAN_RSSI_MONITORING_STOP,
-};
-
-/**
- * enum qca_wlan_vendor_attr_rssi_monitoring - rssi monitoring
- * @QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_INVALID: Invalid
- * @QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL: control
- * @QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX_RSSI: max rssi
- * @QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MIN_RSSI: min rssi
- * @QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_BSSID: current bssid
- * @QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_RSSI: current rssi
- * @QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_AFTER_LAST: after last
- * @QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX: max
- */
-enum qca_wlan_vendor_attr_rssi_monitoring {
-        QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_INVALID = 0,
-
-        QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL,
-        QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID,
-
-        QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX_RSSI,
-        QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MIN_RSSI,
-
-        /* attributes to be used/received in callback */
-        QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_BSSID,
-        QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_RSSI,
-
-        /* keep last */
-        QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_AFTER_LAST,
-        QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX =
-                QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_AFTER_LAST - 1,
-};
-
-#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
-/**
- * enum wlan_offloaded_packets_control - control commands
- * @WLAN_START_OFFLOADED_PACKETS: start offloaded packets
- * @WLAN_STOP_OFFLOADED_PACKETS: stop offloaded packets
- *
- */
-enum wlan_offloaded_packets_control
-{
-    WLAN_START_OFFLOADED_PACKETS = 1,
-    WLAN_STOP_OFFLOADED_PACKETS  = 2
-};
-
-/**
- * enum qca_wlan_vendor_attr_offloaded_packets - offloaded packets
- * @QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_INVALID: invalid
- * @QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SENDING_CONTROL: control
- * @QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_REQUEST_ID: request id
- * @QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_IP_PACKET_DATA: ip packet data
- * @QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SRC_MAC_ADDR: src mac address
- * @QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_DST_MAC_ADDR: destination mac address
- * @QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_PERIOD: period in milli seconds
- * @QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_AFTER_LAST: after last
- * @QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_MAX: max
- */
-enum qca_wlan_vendor_attr_offloaded_packets
-{
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_INVALID = 0,
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SENDING_CONTROL,
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_REQUEST_ID,
-
-    /* Packet in hex format */
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_IP_PACKET_DATA,
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SRC_MAC_ADDR,
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_DST_MAC_ADDR,
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_PERIOD,
-
-    /* keep last */
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_AFTER_LAST,
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_MAX =
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_AFTER_LAST - 1,
-};
-#endif
-
 struct cfg80211_bss* wlan_hdd_cfg80211_update_bss_db( hdd_adapter_t *pAdapter,
                                       tCsrRoamInfo *pRoamInfo
                                       );
@@ -1294,7 +916,7 @@
 
 #ifdef FEATURE_WLAN_WAPI
 void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter,
-              u8 key_index, const u8 *mac_addr, const u8 *key , int key_Len);
+              u8 key_index, const u8 *mac_addr, u8 *key , int key_Len);
 #endif
 struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size);
 
@@ -1343,13 +965,6 @@
 void* wlan_hdd_change_country_code_cb(void *pAdapter);
 void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel);
 
-v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                     const v_U8_t *pIes,
-#else
-                                     v_U8_t *pIes,
-#endif
-                                     int length, v_U8_t eid);
 
 #ifdef FEATURE_WLAN_CH_AVOID
 int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx,
@@ -1361,73 +976,4 @@
                                       void *pMsg);
 #endif /* WLAN_FEATURE_EXTSCAN */
 
-void hdd_rssi_threshold_breached_cb(void *hddctx,
-                                 struct rssi_breach_event *data);
-
-void wlan_hdd_cfg80211_nan_init(hdd_context_t *pHddCtx);
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-void wlan_hdd_cfg80211_oemdata_callback(void *ctx, const tANI_U16 evType,
-                                      void *pMsg,  tANI_U32 evLen);
-#endif /* FEATURE_OEM_DATA_SUPPORT */
-
-#if !(defined (SUPPORT_WDEV_CFG80211_VENDOR_EVENT_ALLOC))
-static inline struct sk_buff *
-backported_cfg80211_vendor_event_alloc(struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-    struct wireless_dev *wdev,
-#endif
-    int approxlen,
-    int event_idx, gfp_t gfp)
-{
-    return cfg80211_vendor_event_alloc(wiphy, approxlen, event_idx, gfp);
-}
-#define cfg80211_vendor_event_alloc backported_cfg80211_vendor_event_alloc
-#endif
-
-/**
- * enum qca_wlan_vendor_attr_memory_dump - values for memory dump attributes
- * @QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_INVALID - Invalid
- * @QCA_WLAN_VENDOR_ATTR_REQUEST_ID - Indicate request ID
- * @QCA_WLAN_VENDOR_ATTR_MEMDUMP_SIZE - Indicate size of the memory dump
- * @QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_AFTER_LAST - To keep track of the last enum
- * @QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_MAX - max value possible for this type
- *
- * enum values are used for NL attributes for data used by
- * QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP sub command.
- */
-enum qca_wlan_vendor_attr_memory_dump {
-    QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_INVALID = 0,
-    QCA_WLAN_VENDOR_ATTR_REQUEST_ID = 1,
-    QCA_WLAN_VENDOR_ATTR_MEMDUMP_SIZE = 2,
-
-    QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_AFTER_LAST,
-    QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_MAX =
-    QCA_WLAN_VENDOR_ATTR_MEMORY_DUMP_AFTER_LAST - 1,
-};
-
-#if defined(CFG80211_DISCONNECTED_V2) || \
-(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0))
-static inline void wlan_hdd_cfg80211_indicate_disconnect(struct net_device *dev,
-                                                         bool locally_generated,
-                                                         int reason)
-{
-    cfg80211_disconnected(dev, reason, NULL, 0,
-                          locally_generated, GFP_KERNEL);
-}
-#else
-static inline void wlan_hdd_cfg80211_indicate_disconnect(struct net_device *dev,
-                                                         bool locally_generated,
-                                                         int reason)
-{
-    cfg80211_disconnected(dev, reason, NULL, 0,
-                          GFP_KERNEL);
-}
-#endif
-
-struct cfg80211_bss* wlan_hdd_cfg80211_update_bss_list(
-   hdd_adapter_t *pAdapter, tSirMacAddr bssid);
-
-struct cfg80211_bss *wlan_hdd_cfg80211_inform_bss_frame(hdd_adapter_t *pAdapter,
-		tSirBssDescription *bss_desc);
 #endif
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_dp_utils.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_dp_utils.h
index fb1ce32..ac48abd 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_dp_utils.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_dp_utils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -63,7 +63,6 @@
    hdd_list_node_t anchor;
    v_SIZE_t count;
    v_SIZE_t max_size;
-   int ratelimit_count;
    spinlock_t lock; 
 } hdd_list_t;
 
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_ether.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_ether.h
index 1ea13c7..5b2c48e 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_ether.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_ether.h
@@ -32,6 +32,9 @@
 
   This module describes Ethernet packet formats for processing by HDD.
 
+               Copyright (c) 2009 QUALCOMM Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary
 ============================================================================*/
 /* $Header$ */
 
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_ftm.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_ftm.h
index 7c7fa9c..a2f5642 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_ftm.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_ftm.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -64,7 +64,6 @@
 #define WE_ENABLE_DPD        12
 #define WE_SET_CB            13
 #define WE_TX_CW_RF_GEN      14
-#define WE_SET_POWER_INDEX   15
 
 /* Private ioctls and their sub-ioctls */
 #define WLAN_FTM_PRIV_SET_NONE_GET_INT    (SIOCIWFIRSTPRIV + 1)
@@ -98,7 +97,6 @@
 
 #define WLAN_FTM_PRIV_SET_VAR_INT_GET_NONE   (SIOCIWFIRSTPRIV + 7)
 #define WE_SET_TX_WF_GAIN  1
-#define WE_SET_DUMP        2
 
 #define WE_FTM_MAX_STR_LEN 1024
 #define MAX_FTM_VAR_ARGS  7
@@ -147,7 +145,6 @@
     WLAN_FTM_INITIALIZED,
     WLAN_FTM_STOPPED,
     WLAN_FTM_STARTED,
-    WLAN_FTM_STARTING,
 } wlan_hdd_ftm_state;
 typedef struct wlan_hdd_ftm_status_s
 {
@@ -169,7 +166,6 @@
     v_U8_t   *targetNVTablePointer;
     v_U32_t   processedNVTableSize;
     v_U8_t   *tempNVTableBuffer;
-    struct completion startCmpVar;
 
 } wlan_hdd_ftm_status_t;
 typedef struct ftm_msg_s
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_host_offload.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_host_offload.h
index 07d609b..4e1df0d 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_host_offload.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_host_offload.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -34,6 +34,8 @@
 
   \brief Android WLAN HDD Host Offload API
 
+  Copyright 2011 (c) QUALCOMM Incorporated. All Rights Reserved.
+  QUALCOMM Proprietary and Confidential.
 
   ==========================================================================*/
 
@@ -60,15 +62,5 @@
     v_MACADDR_t bssId;
 } tHostOffloadRequest, *tpHostOffloadRequest;
 
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-void hdd_wlan_offload_event(uint8_t type, uint8_t state);
-#else
-static inline
-void hdd_wlan_offload_event(uint8_t type, uint8_t state)
-{
-    return;
-}
-#endif /* FEATURE_WLAN_DIAG_SUPPORT */
-
 #endif // __WLAN_HDD_HOST_OFFLOAD_H__
 
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_hostapd.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_hostapd.h
index 0e16923..3717257 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_hostapd.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_hostapd.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,6 +33,8 @@
   \file  WLAN_HDD_HOSTAPD_H.h
 
   \brief Linux HDD HOSTAPD include file
+         Copyright 2008-2013 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
   ==========================================================================*/
 
 /*---------------------------------------------------------------------------
@@ -58,7 +60,7 @@
 
 VOS_STATUS hdd_register_hostapd(hdd_adapter_t *pAdapter, tANI_U8 rtnl_held);
 
-VOS_STATUS hdd_unregister_hostapd(hdd_adapter_t *pAdapter, tANI_U8 rtnl_held);
+VOS_STATUS hdd_unregister_hostapd(hdd_adapter_t *pAdapter);
 
 eCsrAuthType 
 hdd_TranslateRSNToCsrAuthType( u_int8_t auth_suite[4]);
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_includes.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_includes.h
index e8d3803..efe3fe4 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_includes.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_includes.h
@@ -34,6 +34,9 @@
   
   \brief Internal includes for the Linux HDD 
   
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
   
   ==========================================================================*/
   
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_keep_alive.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_keep_alive.h
index a3aff13..5e05f5f 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_keep_alive.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_keep_alive.h
@@ -34,6 +34,8 @@
 
   \brief Android WLAN HDD Keep-Alive API
 
+  Copyright 2011 (c) QUALCOMM Incorporated. All Rights Reserved.
+  QUALCOMM Proprietary and Confidential.
 
   ==========================================================================*/
 
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_main.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_main.h
index f989f5a..9197ae8 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_main.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_main.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -35,6 +35,9 @@
   \file  WLAN_HDD_MAIN_H.h
   
   \brief Linux HDD Adapter Type
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
   
   ==========================================================================*/
   
@@ -63,19 +66,14 @@
 #endif
 #include "wlan_hdd_cfg80211.h"
 
-#include <linux/proc_fs.h> /* Necessary because we use the proc fs */
-#include <linux/fs.h>
 /*--------------------------------------------------------------------------- 
   Preprocessor definitions and constants
   -------------------------------------------------------------------------*/
 /** Number of attempts to detect/remove card */
 #define LIBRA_CARD_INSERT_DETECT_MAX_COUNT      5
 #define LIBRA_CARD_REMOVE_DETECT_MAX_COUNT      5
-
-/** Number of Tx Queues. This should be same as the one
- *  used in TL WLANTL_NUM_TX_QUEUES */
-#define NUM_TX_QUEUES 5
-
+/** Number of Tx Queues */  
+#define NUM_TX_QUEUES 4
 /** HDD's internal Tx Queue Length. Needs to be a power of 2 */
 #define HDD_TX_QUEUE_MAX_LEN 128
 /** HDD internal Tx Queue Low Watermark. Net Device TX queue is disabled
@@ -103,13 +101,11 @@
 #define TDLS_INIT_DONE         (6)
 
 /** Maximum time(ms)to wait for disconnect to complete **/
-#define WLAN_WAIT_TIME_DISCONNECT  5000
+#define WLAN_WAIT_TIME_DISCONNECT  2000
 #define WLAN_WAIT_TIME_STATS       800
 #define WLAN_WAIT_TIME_POWER       800
 #define WLAN_WAIT_TIME_COUNTRY     1000
 #define WLAN_WAIT_TIME_CHANNEL_UPDATE   600
-#define FW_STATE_WAIT_TIME 500
-#define FW_STATE_RSP_LEN 100
 /* Amount of time to wait for sme close session callback.
    This value should be larger than the timeout used by WDI to wait for
    a response from WCNSS */
@@ -138,7 +134,6 @@
 #define CRDA_WAIT_TIME 300
 #endif
 
-#define WAIT_TIME_FW_LOGS 2000
 /* Scan Req Timeout */
 #define WLAN_WAIT_TIME_SCAN_REQ 100
 
@@ -214,7 +209,7 @@
 #define HDD_PNO_SCAN_TIMERS_SET_ONE      1
 /* value should not be greater than PNO_MAX_SCAN_TIMERS */
 #define HDD_PNO_SCAN_TIMERS_SET_MULTIPLE 6
-#define WLAN_WAIT_TIME_PNO  2000
+#define WLAN_WAIT_TIME_PNO  500
 #endif
 
 #define MAX_USER_COMMAND_SIZE 4096
@@ -236,9 +231,6 @@
 #define MIN(a, b) (a > b ? b : a)
 
 #endif
-
-#define WLAN_WAIT_TIME_EXTSCAN  1000
-
 /*
  * Generic asynchronous request/response support
  *
@@ -278,13 +270,6 @@
    unsigned int magic;
 };
 
-struct getFrameLogCtx
-{
-   struct completion completion;
-   hdd_adapter_t *pAdapter;
-   unsigned int magic;
-};
-
 extern spinlock_t hdd_context_lock;
 
 #define STATS_CONTEXT_MAGIC 0x53544154   //STAT
@@ -292,13 +277,6 @@
 #define POWER_CONTEXT_MAGIC 0x504F5752   //POWR
 #define SNR_CONTEXT_MAGIC   0x534E5200   //SNR
 #define BCN_MISS_RATE_CONTEXT_MAGIC 0x513F5753
-#define FW_STATS_CONTEXT_MAGIC  0x5022474E //FW STATS
-#define GET_FRAME_LOG_MAGIC   0x464c4f47   //FLOG
-#define MON_MODE_MSG_MAGIC 0x51436B3A //MON_MODE
-#define ANTENNA_CONTEXT_MAGIC 0x414E544E //ANTN
-#define MON_MODE_MSG_TIMEOUT 5000
-#define MON_MODE_START 1
-#define MON_MODE_STOP  0
 
 /*
  * Driver miracast parameters 0-Disabled
@@ -654,9 +632,6 @@
   struct sk_buff *skb;
   hdd_remain_on_chan_ctx_t* remain_on_chan_ctx;
   eP2PActionFrameState actionFrmState;
-  /*is_go_neg_ack_received flag is set to 1 when the
-    pending ack for GO negotiation req is received*/
-  v_BOOL_t is_go_neg_ack_received;
 }hdd_cfg80211_state_t;
 
 
@@ -666,67 +641,6 @@
     HDD_SSR_DISABLED,
 }e_hdd_ssr_required;
 
-#ifdef WLAN_FEATURE_RMC
-/*---------------------------------------------------------------------------
-  hdd_ibss_peer_info_params_t
----------------------------------------------------------------------------*/
-typedef struct
-{
-    v_U8_t  staIdx;       //StaIdx
-    v_U32_t txRate;       //Current Tx Rate
-    v_U32_t mcsIndex;     //MCS Index
-    v_U32_t txRateFlags;  //TxRate Flags
-    v_S7_t  rssi;         //RSSI
-}hdd_ibss_peer_info_params_t;
-
-typedef struct {
-    /** The station entry is used or not  */
-    v_BOOL_t isUsed;
-
-    /** Station ID reported back from HAL. Broadcast
-     *  uses station ID zero by default. */
-    v_U8_t ucSTAId;
-
-    /** MAC address of the station */
-    v_MACADDR_t macAddrSTA;
-
-    /** Current Station state so HDD knows how to deal with packet
-     *  queue. Most recent states used to change TL STA state. */
-    WLANTL_STAStateType tlSTAState;
-
-   /** Transmit queues for each AC (VO,VI,BE etc). */
-   hdd_list_t wmm_tx_queue[NUM_TX_QUEUES];
-
-   /** Might need to differentiate queue depth in contention case */
-   v_U16_t aTxQueueDepth[NUM_TX_QUEUES];
-
-   /**Track whether OS TX queue has been disabled.*/
-   v_BOOL_t txSuspended[NUM_TX_QUEUES];
-
-   /** Track QoS status of station */
-   v_BOOL_t isQosEnabled;
-
-   /** The station entry for which Deauth is in progress  */
-   v_BOOL_t isDeauthInProgress;
-
-} hdd_ibss_station_info_t;
-
-typedef struct
-{
-    /** Request status */
-    v_U32_t                       status;
-
-    /** Number of peers */
-    v_U8_t                        numIBSSPeers;
-
-    /* IBSS Station table */
-    hdd_ibss_station_info_t ibssStaInfo[HDD_MAX_NUM_IBSS_STA];
-
-    /** Peer Info parameters */
-    hdd_ibss_peer_info_params_t  ibssPeerList[HDD_MAX_NUM_IBSS_STA];
-}hdd_ibss_peer_info_t;
-#endif
-
 struct hdd_station_ctx
 {
   /** Handle to the Wireless Extension State */
@@ -754,9 +668,6 @@
 
    /*Save the wep/wpa-none keys*/
    tCsrRoamSetKey ibss_enc_key;
-#ifdef WLAN_FEATURE_RMC
-   hdd_ibss_peer_info_t ibss_peer_info;
-#endif
 
    v_BOOL_t hdd_ReassocScenario;
 
@@ -777,6 +688,39 @@
 /*
  * Per station structure kept in HDD for multiple station support for SoftAP
 */
+typedef struct {
+    /** The station entry is used or not  */
+    v_BOOL_t isUsed;
+
+    /** Station ID reported back from HAL (through SAP). Broadcast
+     *  uses station ID zero by default in both libra and volans. */
+    v_U8_t ucSTAId;
+
+    /** MAC address of the station */
+    v_MACADDR_t macAddrSTA;
+
+    /** Current Station state so HDD knows how to deal with packet
+     *  queue. Most recent states used to change TL STA state. */
+    WLANTL_STAStateType tlSTAState;
+
+   /** Transmit queues for each AC (VO,VI,BE etc). */
+   hdd_list_t wmm_tx_queue[NUM_TX_QUEUES];
+
+   /** Might need to differentiate queue depth in contention case */
+   v_U16_t aTxQueueDepth[NUM_TX_QUEUES];
+   
+   /**Track whether OS TX queue has been disabled.*/
+   v_BOOL_t txSuspended[NUM_TX_QUEUES];
+
+   /**Track whether 3/4th of resources are used */
+   v_BOOL_t vosLowResource;
+
+   /** Track QoS status of station */
+   v_BOOL_t isQosEnabled;
+
+   /** The station entry for which Deauth is in progress  */
+   v_BOOL_t isDeauthInProgress;
+} hdd_station_info_t;
 
 struct hdd_ap_ctx_s
 {
@@ -820,28 +764,9 @@
    beacon_data_t *beacon;
 };
 
-#define NUM_FILTERS_SUPPORTED 1
-struct filter
-{
-   v_MACADDR_t macAddr;
-   v_BOOL_t isA1filter;
-   v_BOOL_t isA2filter;
-   v_BOOL_t isA3filter;
-};
-
 struct hdd_mon_ctx_s
 {
-  /* start or stop */
-   v_BOOL_t state;
-   /*Conversion of packet required or not*/
-   v_BOOL_t is80211to803ConReq;
-   v_U32_t ChannelNo;
-   v_U32_t ChannelBW;
-   v_BOOL_t crcCheckEnabled;
-   v_U8_t numOfMacFilters;
-   struct filter mmFilters[NUM_FILTERS_SUPPORTED];
-   v_U64_t typeSubtypeBitmap;
-   v_U64_t rsvd;
+   hdd_adapter_t *pAdapterForTx;
 };
 
 typedef struct hdd_scaninfo_s
@@ -882,19 +807,6 @@
 
 }hdd_scaninfo_t;
 
-typedef struct
-{
-    struct wiphy *wiphy;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
-    struct net_device *dev;
-#endif
-    struct cfg80211_scan_request *scan_request;
-    int magic;
-    int attempt;
-    int reject;
-    struct delayed_work scan_work;
-}scan_context_t;
-
 /* Changing value from 10 to 240, as later is
    supported by wcnss */
 #define WLAN_HDD_MAX_MC_ADDR_LIST 240
@@ -954,12 +866,6 @@
 
 #endif
 
-typedef struct
-{
-   struct completion completion;
-   tANI_U32 magic;
-   hdd_adapter_t *pAdapter;
-}fwStatsContext_t;
 
 #define WLAN_HDD_ADAPTER_MAGIC 0x574c414e //ASCII "WLAN"
 
@@ -1049,11 +955,6 @@
    struct completion tdls_link_establish_req_comp;
    eHalStatus tdlsAddStaStatus;
 #endif
-
-#ifdef WLAN_FEATURE_RMC
-   struct completion ibss_peer_info_comp;
-#endif /* WLAN_FEATURE_RMC */
-
    /* Track whether the linkup handling is needed  */
    v_BOOL_t isLinkUpSvcNeeded;
 
@@ -1083,6 +984,8 @@
  */
     /** Multiple station supports */
    /** Per-station structure */
+   spinlock_t staInfo_lock; //To protect access to station Info  
+   hdd_station_info_t aStaInfo[WLAN_MAX_STA_COUNT];
    //v_U8_t uNumActiveStation;
 
    v_U16_t aTxQueueLimit[NUM_TX_QUEUES];
@@ -1094,22 +997,12 @@
 #endif
    
    v_S7_t rssi;
-   v_S7_t rssi_on_disconnect;
 
    tANI_U8 snr;
 
    struct work_struct  monTxWorkQueue;
    struct sk_buff *skb_to_tx;
 
-   /* sta_id to mac addr hash*/
-   spinlock_t sta_hash_lock;
-   tANI_U8 is_sta_id_hash_initialized;
-   struct sta_hash{
-      tANI_U16 mask;
-      tANI_U16 idx_bits;
-      hdd_list_t *bins;
-   } sta_id_hash;
-
    union {
       hdd_station_ctx_t station;
       hdd_ap_ctx_t  ap;
@@ -1165,7 +1058,6 @@
 #endif
    /* Flag to ensure PSB is configured through framework */
    v_U8_t psbChanged;
-   v_ULONG_t prev_rx_packets;
    /* UAPSD psb value configured through framework */
    v_U8_t configuredPsb;
    v_BOOL_t is_roc_inprogress;
@@ -1177,26 +1069,11 @@
    sme_QosWmmUpType hddWmmDscpToUpMap[WLAN_HDD_MAX_DSCP+1];
    /* Lock for active sessions while processing deauth/Disassoc */
    spinlock_t lock_for_active_session;
-   tSirFwStatsResult  fwStatsRsp;
-
-   /* Time stamp for last completed RoC request */
-   v_TIME_t lastRocTs;
-
-   /* work queue to defer the back to back p2p_listen */
-   struct delayed_work roc_work;
-
    /* Time stamp for start RoC request */
    v_TIME_t startRocTs;
-
-   /* Wireless statistics */
-   struct iw_statistics iwStats;
-
-   /* Currently used antenna Index*/
-   int antennaIndex;
 };
 
 #define WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.station)
-#define WLAN_HDD_GET_MONITOR_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.monitor)
 #define WLAN_HDD_GET_AP_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap)
 #define WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter)  (&(pAdapter)->sessionCtx.station.WextState)
 #define WLAN_HDD_GET_CTX(pAdapter) ((hdd_context_t*)pAdapter->pHddCtx)
@@ -1242,105 +1119,9 @@
 
 typedef struct
 {
-   v_MACADDR_t  randomMacAddr;
-   v_U8_t       isReqDeferred;
-   v_U8_t       isEnabled;
-   struct mutex macSpoofingLock;
+   v_MACADDR_t randomMacAddr;
 }macAddrSpoof_t;
 
-#define WLAN_WAIT_TIME_LL_STATS 800
-
-/* FW memory dump feature
-@TODO : Move this code to a separate file later */
-#define PROCFS_MEMDUMP_DIR  "debug"
-#define PROCFS_MEMDUMP_NAME "fwdump"
-#define FW_MEM_DUMP_REQ_ID 1
-#define FW_MEM_DUMP_TIMEOUT_MS 800
-#define FW_MEM_DUMP_MAGIC 0x3C3A2D44
-
-/**
- * struct hdd_fw_mem_dump_req_ctx - hdd fw mem dump req context
- *
- * @magic : magic for validating cfg80211 requests
- * @status: status for cfg80211 requests
- * @pHDDCtx: ptr to HDD context
- * @req_completion: completion variable for fw mem dump
- */
-struct hdd_fw_mem_dump_req_ctx {
-   uint32_t magic;
-   bool status;
-   struct completion req_completion;
-};
-
-/**
- * callback type to check fw mem dump request.Called from SVC
- * context and update status in HDD.
- */
-typedef void (*hdd_fw_mem_dump_req_cb)(struct hdd_fw_mem_dump_req_ctx *);
-
-int memdump_init(void);
-int memdump_deinit(void);
-void wlan_hdd_fw_mem_dump_cb(void *,tAniFwrDumpRsp *);
-int wlan_hdd_fw_mem_dump_req(hdd_context_t * pHddCtx);
-void wlan_hdd_fw_mem_dump_req_cb(struct hdd_fw_mem_dump_req_ctx*);
-#ifdef WLAN_FEATURE_LINK_LAYER_STATS
-/**
- * struct hdd_ll_stats_context - hdd link layer stats context
- *
- * @request_id: userspace-assigned link layer stats request id
- * @request_bitmap: userspace-assigned link layer stats request bitmap
- * @response_event: LL stats request wait event
- */
-struct hdd_ll_stats_context {
-    uint32_t request_id;
-    uint32_t request_bitmap;
-    struct completion response_event;
-};
-#endif /* End of WLAN_FEATURE_LINK_LAYER_STATS */
-#ifdef WLAN_FEATURE_EXTSCAN
-/**
- * struct hdd_ext_scan_context - hdd ext scan context
- *
- * @request_id: userspace-assigned ID associated with the request
- * @response_status: Status returned by FW in response to a request
- * @ignore_cached_results: Flag to ignore cached results or not
- * @capability_response: Ext scan capability response data from target
- */
-
-struct hdd_ext_scan_context {
-    v_U32_t request_id;
-    int response_status;
-    bool ignore_cached_results;
-    struct completion response_event;
-    tSirEXTScanCapabilitiesEvent capability_response;
-};
-#endif /* End of WLAN_FEATURE_EXTSCAN */
-
-#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
-/**
- * struct hdd_offloaded_packets - request id to pattern id mapping
- * @request_id: request id
- * @pattern_id: pattern id
- *
- */
-struct hdd_offloaded_packets
-{
-    uint32_t request_id;
-    uint8_t  pattern_id;
-};
-
-/**
- * struct hdd_offloaded_packets_ctx - offloaded packets context
- * @op_table: request id to pattern id table
- * @op_lock: mutex lock
- */
-struct hdd_offloaded_packets_ctx
-{
-    struct hdd_offloaded_packets op_table[MAXNUM_PERIODIC_TX_PTRNS];
-    struct mutex op_lock;
-};
-#endif
-
 /** Adapter stucture definition */
 
 struct hdd_context_s
@@ -1399,6 +1180,7 @@
 #else
    struct completion driver_crda_req;
 #endif
+
    /* Completion variable to indicate updation of channel */
    struct completion wiphy_channel_update_event;
 
@@ -1445,15 +1227,6 @@
 #ifdef WLAN_KD_READY_NOTIFIER
    v_BOOL_t kd_nl_init;
 #endif /* WLAN_KD_READY_NOTIFIER */
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-   /* OEM App registered or not */
-   v_BOOL_t oem_app_registered;
-
-   /* OEM App Process ID */
-   v_SINT_t oem_pid;
-#endif
-
    v_U8_t change_iface;
 
    /** Concurrency Parameters*/
@@ -1475,8 +1248,10 @@
    /* Thermal mitigation information */
    hdd_thermal_mitigation_info_t tmInfo;
 
+#ifdef WLAN_OPEN_SOURCE
 #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-    vos_wake_lock_t rx_wake_lock;
+   struct wake_lock rx_wake_lock;
+#endif
 #endif
 
    /* 
@@ -1495,16 +1270,21 @@
    /*is_dyanmic_channel_range_set is set to 1 when Softap_set_channel_range
         is invoked*/
    v_BOOL_t is_dynamic_channel_range_set;
-   vos_wake_lock_t sap_wake_lock;
+
+#ifdef WLAN_OPEN_SOURCE
+   struct wake_lock sap_wake_lock;
+#endif
+
 #ifdef FEATURE_WLAN_TDLS
     eTDLSSupportMode tdls_mode;
     eTDLSSupportMode tdls_mode_last;
     tdlsConnInfo_t tdlsConnInfo[HDD_MAX_NUM_TDLS_STA];
     /* TDLS peer connected count */
     tANI_U16 connected_peer_count;
-    scan_context_t scan_ctxt;
+    tdls_scan_context_t tdls_scan_ctxt;
     /* Lock to avoid race condition during TDLS operations*/
     struct mutex tdls_lock;
+    v_BOOL_t is_tdls_btc_enabled;
 #endif
 
     hdd_traffic_monitor_t traffic_monitor;
@@ -1566,58 +1346,8 @@
      * IP
      */
     struct notifier_block ipv4_notifier;
-    //Lock to avoid race condition during wmm operations
-    struct mutex   wmmLock;
-    v_BOOL_t mgmt_frame_logging;
-    v_BOOL_t isSetBandByNL;
-    v_U8_t fw_Version[SIR_VERSION_STRING_LEN];
-#ifdef WLAN_FEATURE_LINK_LAYER_STATS
-    struct hdd_ll_stats_context ll_stats_context;
-#endif /* End of WLAN_FEATURE_LINK_LAYER_STATS */
-
-#ifdef WLAN_FEATURE_EXTSCAN
-    struct hdd_ext_scan_context ext_scan_context;
-#endif /* WLAN_FEATURE_EXTSCAN */
-
-    /* Time since boot up to WiFi turn ON (in micro seconds) */
-    v_U64_t wifi_turn_on_time_since_boot;
-    unsigned long  last_suspend_success;
-    v_U32_t  continuous_suspend_fail_cnt;
-
-#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
-    struct hdd_offloaded_packets_ctx op_ctx;
-#endif
-
-   /* work queue to defer mac spoofing */
-   struct delayed_work spoof_mac_addr_work;
-
-    vos_timer_t    delack_timer;
-    struct mutex   cur_rx_level_lock;
-    v_U32_t        cur_rx_level;
-    v_U64_t        prev_rx;
-    v_ULONG_t      mode;
-
-    /* bit map to set/reset TDLS by different sources */
-    unsigned long tdls_source_bitmap;
-
-    /* tdls source timer to enable/disable TDLS on p2p listen */
-    vos_timer_t tdls_source_timer;
-
-    v_U64_t extscan_start_time_since_boot;
 };
 
-typedef enum  {
-        TP_IND_LOW = 1,
-        TP_IND_MEDIUM,
-        TP_IND_HIGH,
-}TP_IND_TYPE;
-
-/* Use to notify the TDLS or BTCOEX is mode enable */
-typedef enum
-{
-   WLAN_TDLS_MODE,
-   WLAN_BTCOEX_MODE,
-} WLAN_MODE_TYPE;
 
 #define WLAN_HDD_IS_LOAD_IN_PROGRESS(pHddCtx)  \
             (pHddCtx->isLoadUnloadInProgress & WLAN_HDD_LOAD_IN_PROGRESS)
@@ -1628,48 +1358,6 @@
 #define WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)  \
             (pHddCtx->isLoadUnloadInProgress &    \
               (WLAN_HDD_LOAD_IN_PROGRESS | WLAN_HDD_UNLOAD_IN_PROGRESS))
-
-/* Logging of both Mgmt and Data pkts are supported by HW in both TX & RX.
- * But only support for logging of Mgmt pkts is supported from host driver.
- */
-typedef enum
-{
-   WLAN_FRAME_LOGGING_FRAMETYPE_DATA,
-   WLAN_FRAME_LOGGING_FRAMETYPE_MGMT,
-} WLAN_FRAME_LOGGING_FRAMETYPE;
-
-// Only first 64/128 bytes of Mgmt/Data pkts can be logged.
-typedef enum
-{
-   WLAN_MGMT_LOGGING_FRAMESIZE_64BYTES = 64,
-   WLAN_MGMT_LOGGING_FRAMESIZE_128BYTES = 128,
-} WLAN_MGMT_LOGGING_FRAMESIZE;
-
-/* In Circular Mode HW buffer will be filled in circular fashion with buffer
- * overwritten when buffer memory is full and new pkt is to be logged.
- * Freeze mode will stop filling the buffer memory when buffer is full and thus
- * no more pkts will logged unless buffer memory is freed.
- */
-typedef enum
-{
-   WLAN_FRAME_LOGGING_BUFFERMODE_CIRCULAR,
-   WLAN_FRAME_LOGGING_BUFFERMODE_FREEZE,
-} WLAN_FRAME_LOGGING_BUFFERMODE;
-
-/* WLAN_FRAME_LOG_EN - Enables frame logging in HW
- * WLAN_BMUHW_TRACE_LOG_EN - 8K/16K memory buffer will be used for logging
- * WLAN_QXDM_LOG_EN - FW QXDM logs will be routed through host driver
- * WLAN_DPU_TXP_LOG_EN - pkts will be logged at both DPU and TXP HW block.
- */
-typedef enum
-{
-   WLAN_FRAME_LOG_EN = 1<<0,
-   WLAN_BMUHW_TRACE_LOG_EN = 1<<1,
-   WLAN_QXDM_LOG_EN = 1<<2,
-   WLAN_DPU_TXP_LOG_EN = 1<<3,
-   WLAN_FW_MEM_DUMP_EN = 1<<6,
-} WLAN_ENABLE_HW_FW_LOG_TYPE;
-
 /*--------------------------------------------------------------------------- 
   Function declarations and documenation
   -------------------------------------------------------------------------*/
@@ -1705,22 +1393,17 @@
 void hdd_dump_concurrency_info(hdd_context_t *pHddCtx);
 hdd_adapter_t * hdd_get_adapter_by_name( hdd_context_t *pHddCtx, tANI_U8 *name );
 hdd_adapter_t * hdd_get_adapter_by_macaddr( hdd_context_t *pHddCtx, tSirMacAddr macAddr );
-hdd_adapter_t *hdd_get_adapter_by_sme_session_id( hdd_context_t *pHddCtx,
-                                        tANI_U32 sme_session_id );
 hdd_adapter_t * hdd_get_mon_adapter( hdd_context_t *pHddCtx );
 VOS_STATUS hdd_init_station_mode( hdd_adapter_t *pAdapter );
 hdd_adapter_t * hdd_get_adapter( hdd_context_t *pHddCtx, device_mode_t mode );
-void hdd_deinit_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter, tANI_U8 rtnl_held );
+void hdd_deinit_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter );
 VOS_STATUS hdd_stop_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
                              const v_BOOL_t bCloseSession );
 void hdd_set_station_ops( struct net_device *pWlanDev );
 tANI_U8* wlan_hdd_get_intf_addr(hdd_context_t* pHddCtx);
 void wlan_hdd_release_intf_addr(hdd_context_t* pHddCtx, tANI_U8* releaseAddr);
 v_U8_t hdd_get_operating_channel( hdd_context_t *pHddCtx, device_mode_t mode );
-void wlan_hdd_mon_set_typesubtype( hdd_mon_ctx_t *pMonCtx,int type);
-void hdd_monPostMsgCb(tANI_U32 *magic, struct completion *cmpVar);
-VOS_STATUS wlan_hdd_mon_postMsg(tANI_U32 *magic, struct completion *cmpVar,
-                                hdd_mon_ctx_t *pMonCtx , void* callback);
+
 void hdd_set_conparam ( v_UINT_t newParam );
 tVOS_CON_MODE hdd_get_conparam( void );
 
@@ -1728,10 +1411,9 @@
 v_BOOL_t wlan_hdd_is_GO_power_collapse_allowed(hdd_context_t* pHddCtx);
 v_BOOL_t hdd_is_apps_power_collapse_allowed(hdd_context_t* pHddCtx);
 v_BOOL_t hdd_is_suspend_notify_allowed(hdd_context_t* pHddCtx);
-tSirAbortScanStatus hdd_abort_mac_scan(hdd_context_t* pHddCtx,
-                                       tANI_U8 sessionId,
-                                       eCsrAbortReason reason);
-void hdd_processSpoofMacAddrRequest(struct work_struct *work);
+void hdd_abort_mac_scan(hdd_context_t* pHddCtx, tANI_U8 sessionId,
+                        eCsrAbortReason reason);
+void wlan_hdd_set_monitor_tx_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter );
 void hdd_cleanup_actionframe( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter );
 
 void crda_regulatory_entry_default(v_U8_t *countryCode, int domain_id);
@@ -1744,12 +1426,11 @@
 void wlan_hdd_decr_active_session(hdd_context_t *pHddCtx,
                                   tVOS_CON_MODE mode);
 void wlan_hdd_reset_prob_rspies(hdd_adapter_t* pHostapdAdapter);
-void hdd_prevent_suspend(uint32_t reason);
-void hdd_allow_suspend(uint32_t reason);
-void hdd_prevent_suspend_timeout(v_U32_t timeout, uint32_t reason);
+void hdd_prevent_suspend(void);
+void hdd_allow_suspend(void);
+void hdd_prevent_suspend_timeout(v_U32_t timeout);
 bool hdd_is_ssr_required(void);
 void hdd_set_ssr_required(e_hdd_ssr_required value);
-void hdd_set_pre_close(hdd_context_t *pHddCtx);
 
 VOS_STATUS hdd_enable_bmps_imps(hdd_context_t *pHddCtx);
 VOS_STATUS hdd_disable_bmps_imps(hdd_context_t *pHddCtx, tANI_U8 session_type);
@@ -1762,10 +1443,8 @@
 int wlan_hdd_validate_context(hdd_context_t *pHddCtx);
 v_BOOL_t hdd_is_valid_mac_address(const tANI_U8* pMacAddr);
 VOS_STATUS hdd_issta_p2p_clientconnected(hdd_context_t *pHddCtx);
-VOS_STATUS hdd_is_any_session_connected(hdd_context_t *pHddCtx);
 void hdd_ipv4_notifier_work_queue(struct work_struct *work);
 v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx);
-void hdd_set_ibss_ops(hdd_adapter_t *pAdapter);
 #ifdef WLAN_FEATURE_PACKET_FILTERING
 int wlan_hdd_setIPv6Filter(hdd_context_t *pHddCtx, tANI_U8 filterType, tANI_U8 sessionId);
 #endif
@@ -1774,34 +1453,11 @@
 void hdd_ipv6_notifier_work_queue(struct work_struct *work);
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-v_MACADDR_t* hdd_wlan_get_ibss_mac_addr_from_staid(hdd_adapter_t *pAdapter, v_U8_t staIdx);
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef CONFIG_ENABLE_LINUX_REG
 void hdd_checkandupdate_phymode( hdd_context_t *pHddCtx);
 #endif
 int hdd_wmmps_helper(hdd_adapter_t *pAdapter, tANI_U8 *ptr);
 
-/*
- * start/stop bandwidth compute timer, Based on which tcp delack
- * value will be configured
- */
-void hdd_manage_delack_timer(hdd_context_t *pHddCtx);
-
-void hdd_update_prev_rx_packet_count(hdd_context_t *pHddCtx);
-void hdd_start_delack_timer(hdd_context_t *pHddCtx);
-void hdd_set_default_stop_delack_timer(hdd_context_t *pHddCtx);
-v_U8_t hdd_get_total_sessions(hdd_context_t *pHddCtx);
-void hdd_set_delack_value(hdd_context_t *pHddCtx, v_U32_t next_rx_level);
-
-/*
- *  Calculate the packet channel bandwidth and send notification to cnss demon
- */
-void hdd_request_tcp_delack(hdd_context_t *pHddCtx,
-                                               uint64_t rx_packets);
-void hdd_tcp_delack_compute_function(void *priv);
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
 /**---------------------------------------------------------------------------
 
@@ -1852,83 +1508,6 @@
 #endif
 
 VOS_STATUS wlan_hdd_cancel_remain_on_channel(hdd_context_t *pHddCtx);
-hdd_remain_on_chan_ctx_t *hdd_get_remain_on_channel_ctx(hdd_context_t *pHddCtx);
 
-VOS_STATUS wlan_hdd_handle_dfs_chan_scan(hdd_context_t *pHddCtx,
-                                   tANI_U8 dfsScanMode);
-
-v_U8_t hdd_is_fw_logging_enabled(void);
-v_U8_t hdd_is_fw_ev_logging_enabled(void);
-
-#define HDD_STA_ID_HASH_MULTIPLIER 2
-
-struct hdd_align_mac_addr_t {
-    uint16 bytes_ab;
-    uint16 bytes_cd;
-    uint16 bytes_ef;
-};
-
-typedef struct hdd_staid_hash_node
-{
-    hdd_list_node_t node;
-    v_U8_t sta_id;
-    v_MACADDR_t mac_addr;
-}hdd_staid_hash_node_t;
-
-/* sta_id hash related APIs */
-VOS_STATUS hdd_sta_id_hash_attach(hdd_adapter_t *pAdapter);
-VOS_STATUS hdd_sta_id_hash_detach(hdd_adapter_t *pAdapter);
-int hdd_sta_id_hash_calculate_index(hdd_adapter_t *pAdapter,
-                               v_MACADDR_t *mac_addr_in);
-VOS_STATUS hdd_sta_id_hash_add_entry(hdd_adapter_t *pAdapter,
-                                    v_U8_t sta_id, v_MACADDR_t *mac_addr);
-VOS_STATUS hdd_sta_id_hash_remove_entry(hdd_adapter_t *pAdapter,
-                                       v_U8_t sta_id, v_MACADDR_t *mac_addr);
-int hdd_sta_id_find_from_mac_addr(hdd_adapter_t *pAdapter,
-                                  v_MACADDR_t *mac_addr_in);
-void hdd_init_frame_logging(hdd_context_t *pHddCtx);
-
-int hdd_enable_disable_ca_event(hdd_context_t *pHddCtx,
-                                tANI_U8* command, tANI_U8 cmd_len);
-void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind);
-
-#ifdef WLAN_FEATURE_LINK_LAYER_STATS
-/**
- * hdd_init_ll_stats_ctx() - initialize link layer stats context
- * @hdd_ctx: Pointer to hdd context
- *
- * Return: none
- */
-static inline void hdd_init_ll_stats_ctx(hdd_context_t *hdd_ctx)
-{
-    init_completion(&hdd_ctx->ll_stats_context.response_event);
-    hdd_ctx->ll_stats_context.request_bitmap = 0;
-
-     return;
-}
-#else
-static inline void hdd_init_ll_stat_ctx(void)
-{
-    return;
-}
-#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
-void hdd_initialize_adapter_common(hdd_adapter_t *pAdapter);
-void hdd_wlan_free_wiphy_channels(struct wiphy *wiphy);
-void wlan_hdd_init_deinit_defer_scan_context(scan_context_t *scan_ctx);
-int wlan_hdd_copy_defer_scan_context(hdd_context_t *pHddCtx,
-                            struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
-                            struct net_device *dev,
-#endif
-                            struct cfg80211_scan_request *request);
-void wlan_hdd_schedule_defer_scan(struct work_struct *work);
-void wlan_hdd_defer_scan_init_work(hdd_context_t *pHddCtx,
-                                struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
-                                struct net_device *dev,
-#endif
-                                struct cfg80211_scan_request *request,
-                                unsigned long delay);
-int hdd_reassoc(hdd_adapter_t *pAdapter, const tANI_U8 *bssid,
-			const tANI_U8 channel, const handoff_src src);
+void hdd_nullify_netdev_ops(hdd_context_t *pHddCtx);
 #endif    // end #if !defined( WLAN_HDD_MAIN_H )
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_oemdata.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_oemdata.h
index 5b68187..f484b51 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_oemdata.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_oemdata.h
@@ -33,6 +33,9 @@
   
   \brief Internal includes for the oem data
   
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
   
   ==========================================================================*/
 
@@ -70,95 +73,6 @@
     tANI_U8           oemDataRsp[OEM_DATA_RSP_SIZE];
 };
 
-int oem_activate_service(void *pAdapter);
-
-int iw_get_oem_data_cap(struct net_device *dev, struct iw_request_info *info,
-                        union iwreq_data *wrqu, char *extra);
-
-#define OEM_APP_SIGNATURE_LEN      16
-#define OEM_APP_SIGNATURE_STR      "QUALCOMM-OEM-APP"
-
-#define OEM_TARGET_SIGNATURE_LEN   8
-#define OEM_TARGET_SIGNATURE       "QUALCOMM"
-
-#define OEM_CAP_MAX_NUM_CHANNELS   128
-
-#define TARGET_TYPE_PRONTO   0xa0
-
-#define WLAN_HAL_CHAN_FLAG_DFS         10
-
-typedef enum
-{
-  /* Error null context */
-  OEM_ERR_NULL_CONTEXT = 1,
-
-  /* OEM App is not registered */
-  OEM_ERR_APP_NOT_REGISTERED,
-
-  /* Invalid signature */
-  OEM_ERR_INVALID_SIGNATURE,
-
-  /* Invalid message type */
-  OEM_ERR_NULL_MESSAGE_HEADER,
-
-  /* Invalid message type */
-  OEM_ERR_INVALID_MESSAGE_TYPE,
-
-  /* Invalid length in message body */
-  OEM_ERR_INVALID_MESSAGE_LENGTH
-} eOemErrorCode;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-  tANI_U8 major;
-  tANI_U8 minor;
-  tANI_U8 patch;
-  tANI_U8 build;
-} tDriverVersion;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    /* Signature of chip set vendor, e.g. QUALCOMM */
-    tANI_U8 oem_target_signature[OEM_TARGET_SIGNATURE_LEN];
-    tANI_U32 oem_target_type;         /* Chip type */
-    tANI_U32 oem_fw_version;          /* FW version */
-    tDriverVersion driver_version;    /* CLD version */
-    tANI_U16 allowed_dwell_time_min;  /* Channel dwell time - allowed min */
-    tANI_U16 allowed_dwell_time_max;  /* Channel dwell time - allowed max */
-    tANI_U16 curr_dwell_time_min;     /* Channel dwell time - current min */
-    tANI_U16 curr_dwell_time_max;     /* Channel dwell time - current max */
-    tANI_U16 supported_bands;          /* 2.4G or 5G Hz */
-    tANI_U16 num_channels;             /* Num of channels IDs to follow */
-    tANI_U8 channel_list[OEM_CAP_MAX_NUM_CHANNELS];  /* List of channel IDs */
-} t_iw_oem_data_cap;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    /* channel id */
-    tANI_U32 chan_id;
-
-    /* reserved0 */
-    tANI_U32 reserved0;
-
-    /* Primary 20 MHz channel frequency in MHz */
-    tANI_U32 mhz;
-
-    /* Center frequency 1 in MHz */
-    tANI_U32 band_center_freq1;
-
-    /* Center frequency 2 in MHz - valid only for 11acvht 80plus80 mode */
-    tANI_U32 band_center_freq2;
-
-    /* channel info described below */
-    tANI_U32 info;
-
-    /* contains min power, max power, reg power and reg class id */
-    tANI_U32 reg_info_1;
-
-    /* contains antennamax */
-    tANI_U32 reg_info_2;
-} tHddChannelInfo;
-
 #endif //__WLAN_HDD_OEM_DATA_H__
 
 #endif //FEATURE_OEM_DATA_SUPPORT
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_p2p.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_p2p.h
index 4e733f0..1326fab 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_p2p.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_p2p.h
@@ -32,10 +32,11 @@
 \file         wlan_hdd_p2p.h
 
 \brief       Linux HDD P2P include file
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
 
 ==========================================================================*/
-#include <linux/netdevice.h>
-#include <linux/inetdevice.h>
 #define ACTION_FRAME_TX_TIMEOUT 2000
 #define WAIT_CANCEL_REM_CHAN    1000
 #define WAIT_REM_CHAN_READY     1000
@@ -57,8 +58,6 @@
 #define WLAN_HDD_SET_WEP_FRM_FC(__fc__)     ( (__fc__) = ((__fc__) | 0x40))
 #endif //WLAN_FEATURE_11W
 
-#define HDD_P2P_MAX_ROC_DURATION            1000
-
 enum hdd_rx_flags {
     HDD_RX_FLAG_DECRYPTED        = 1 << 0,
     HDD_RX_FLAG_MMIC_STRIPPED    = 1 << 1,
@@ -129,19 +128,17 @@
 int hdd_setP2pOpps( struct net_device *dev, tANI_U8 *command );
 int hdd_setP2pNoa( struct net_device *dev, tANI_U8 *command );
 
-void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter,
+void hdd_indicateMgmtFrame( hdd_adapter_t *pAdapter,
                             tANI_U32 nFrameLength, tANI_U8* pbFrames,
                             tANI_U8 frameType,
                             tANI_U32 rxChan, tANI_S8 rxRssi);
+
 void hdd_remainChanReadyHandler( hdd_adapter_t *pAdapter );
 void hdd_sendActionCnf( hdd_adapter_t *pAdapter, tANI_BOOLEAN actionSendSuccess );
 int wlan_hdd_check_remain_on_channel(hdd_adapter_t *pAdapter);
 VOS_STATUS wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter);
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
-                     struct cfg80211_mgmt_tx_params *params, u64 *cookie);
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
 int wlan_hdd_mgmt_tx( struct wiphy *wiphy, struct wireless_dev *wdev,
                      struct ieee80211_channel *chan, bool offchan,
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
@@ -197,5 +194,5 @@
 #else
 int wlan_hdd_del_virtual_intf( struct wiphy *wiphy, struct net_device *dev );
 #endif
-void hdd_p2p_roc_work_queue(struct work_struct *work);
+
 #endif // __P2P_H
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_power.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_power.h
index 87756d4..9e33c25 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_power.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_power.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -108,32 +108,5 @@
 int wlan_hdd_ipv6_changed(struct notifier_block *nb,
                            unsigned long data, void *arg);
 
-/**
- * enum suspend_resume_state - Suspend resume state
- * @HDD_WLAN_EARLY_SUSPEND: Early suspend state.
- * @HDD_WLAN_SUSPEND: Suspend state.
- * @HDD_WLAN_EARLY_RESUME: Early resume state.
- * @HDD_WLAN_RESUME: Resume state.
- *
- * Suspend state to indicate in diag event of suspend resume.
- */
-
-enum suspend_resume_state {
-   HDD_WLAN_EARLY_SUSPEND,
-   HDD_WLAN_SUSPEND,
-   HDD_WLAN_EARLY_RESUME,
-   HDD_WLAN_RESUME
-};
-
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-void hdd_wlan_suspend_resume_event(uint8_t state);
-#else
-static inline
-void hdd_wlan_suspend_resume_event(uint8_t state)
-{
-    return;
-}
-#endif /* FEATURE_WLAN_DIAG_SUPPORT */
-
 
 #endif // if !defined __WLAN_QCT_DRIVER_H
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h
index d7c23ec..6e62502 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h
@@ -33,6 +33,9 @@
   \file  wlan_hdd_softap_tx_rx.h
   
   \brief Linux HDD SOFTAP Tx/RX APIs
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
   
   ==========================================================================*/
   
@@ -64,17 +67,6 @@
   -------------------------------------------------------------------------*/ 
 
 /**============================================================================
-  @brief hdd_softap_get_connected_sta() - Function to get numbeer of connected
-  stations with softap
-
-  @param pHostapdAdapter      : [in]  pointer to  saftap adapter
-
-  @return         :  Number of connected peer with softap
-  ===========================================================================*/
-
-v_U8_t hdd_softap_get_connected_sta(hdd_adapter_t *pHostapdAdapter);
-
-/**============================================================================
   @brief hdd_softap_hard_start_xmit() - Function registered with the Linux OS for 
   transmitting packets
 
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_tdls.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_tdls.h
index e19f7f5..0759f36 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_tdls.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_tdls.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -34,8 +34,6 @@
 \brief       Linux HDD TDLS include file
 ==========================================================================*/
 
-#ifdef FEATURE_WLAN_TDLS
-
 #define MAX_NUM_TDLS_PEER           3
 
 #define TDLS_SUB_DISCOVERY_PERIOD   100
@@ -65,22 +63,6 @@
 #define TDLS_IS_CONNECTED(peer)  \
         ((eTDLS_LINK_CONNECTED == (peer)->link_status) || \
          (eTDLS_LINK_TEARING == (peer)->link_status))
-
-/* TDLS Off Channel Bandwidth Offset */
-#define TDLS_OFF_CHANNEL_BW_OFFSET  0
-
-/* TDLS Channel Switch Request */
-#define TDLS_CHANNEL_SWITCH_ENABLE  1
-#define TDLS_CHANNEL_SWITCH_DISABLE 2
-
-enum tdls_disable_source {
-    HDD_SET_TDLS_MODE_SOURCE_USER = 1,
-    HDD_SET_TDLS_MODE_SOURCE_SCAN = 2,
-    HDD_SET_TDLS_MODE_SOURCE_OFFCHANNEL = 4,
-    HDD_SET_TDLS_MODE_SOURCE_BTC = 8,
-    HDD_SET_TDLS_MODE_SOURCE_P2P = 16
-};
-
 typedef struct
 {
     tANI_U32    tdls;
@@ -95,6 +77,19 @@
     tANI_S32    rssi_teardown_threshold;
 } tdls_config_params_t;
 
+typedef struct
+{
+    struct wiphy *wiphy;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+    struct net_device *dev;
+#endif
+    struct cfg80211_scan_request *scan_request;
+    int magic;
+    int attempt;
+    int reject;
+    struct delayed_work tdls_scan_work;
+} tdls_scan_context_t;
+
 typedef enum {
     eTDLS_SUPPORT_NOT_ENABLED = 0,
     eTDLS_SUPPORT_DISABLED, /* suppress implicit trigger and not respond to the peer */
@@ -117,28 +112,6 @@
     eTDLS_LINK_TEARING,
 } tTDLSLinkStatus;
 
-/**
- * enum tdls_teardown_reason - Reason for TDLS teardown
- * @eTDLS_TEARDOWN_EXT_CTRL: Reason ext ctrl.
- * @eTDLS_TEARDOWN_CONCURRENCY: Reason concurrency.
- * @eTDLS_TEARDOWN_RSSI_THRESHOLD: Reason rssi threashold.
- * @eTDLS_TEARDOWN_TXRX_THRESHOLD: Reason txrx threashold.
- * @eTDLS_TEARDOWN_BTCOEX: Reason BTCOEX.
- * @eTDLS_TEARDOWN_SCAN: Reason scan.
- * @eTDLS_TEARDOWN_BSS_DISCONNECT: Reason bss disconnected.
- *
- * Reason to indicate in diag event of tdls teardown.
- */
-
-enum tdls_teardown_reason {
-    eTDLS_TEARDOWN_EXT_CTRL,
-    eTDLS_TEARDOWN_CONCURRENCY,
-    eTDLS_TEARDOWN_RSSI_THRESHOLD,
-    eTDLS_TEARDOWN_TXRX_THRESHOLD,
-    eTDLS_TEARDOWN_BTCOEX,
-    eTDLS_TEARDOWN_SCAN,
-    eTDLS_TEARDOWN_BSS_DISCONNECT,
-};
 
 typedef enum {
     eTDLS_LINK_SUCCESS,                              /* Success */
@@ -166,12 +139,7 @@
     WIFI_TDLS_FAILED                    /* Direct link failed */
 } tdls_state_t;
 
-typedef int (*cfg80211_exttdls_callback)(
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                         const tANI_U8* mac,
-#else
-                                         tANI_U8* mac,
-#endif
+typedef int (*cfg80211_exttdls_callback)(tANI_U8* mac,
                                          tANI_S32 state,
                                          tANI_S32 reason,
                                          void *ctx);
@@ -241,9 +209,6 @@
     /*EXT TDLS*/
     tTDLSLinkReason reason;
     cfg80211_exttdls_callback state_change_notification;
-    tANI_BOOLEAN   isOffChannelConfigured;
-    tANI_BOOLEAN   isOffChannelEstablished;
-    tdls_req_params_t peerParams;
 } hddTdlsPeer_t;
 
 typedef struct {
@@ -259,113 +224,53 @@
 
 void wlan_hdd_tdls_init(hdd_context_t * pHddCtx);
 
-void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter, tANI_BOOLEAN mutexLock);
+void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter);
 
 void wlan_hdd_tdls_extract_da(struct sk_buff *skb, u8 *mac);
 
 void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, u8 *mac);
 
-int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                             const u8 *mac,
-#else
-                             u8 *mac,
-#endif
-                             u8 staId);
+int wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter, u8 *mac, u8 tx);
 
-hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter,
-                                       const u8 *mac,
-                                       tANI_BOOLEAN mutexLock);
+int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter, u8 *mac, u8 staId);
 
-hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(hdd_context_t *pHddCtx,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                           const u8 *mac
-#else
-                                           u8 *mac
-#endif
-);
+hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter, u8 *mac, tANI_BOOLEAN mutexLock);
 
-int wlan_hdd_tdls_get_link_establish_params(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                            const u8 *mac,
-#else
-                                            u8 *mac,
-#endif
+hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(hdd_context_t *pHddCtx, u8 *mac);
+
+int wlan_hdd_tdls_get_link_establish_params(hdd_adapter_t *pAdapter, u8 *mac,
                                             tCsrTdlsLinkEstablishParams* tdlsLinkEstablishParams);
-hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                      const u8 *mac
-#else
-                                      u8 *mac
-#endif
-                                     );
+hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter, u8 *mac);
 
-int wlan_hdd_tdls_set_cap(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                          const u8* mac,
-#else
-                          u8* mac,
-#endif
-                          tTDLSCapType cap);
+int wlan_hdd_tdls_set_cap(hdd_adapter_t *pAdapter, u8* mac, tTDLSCapType cap);
 
 void wlan_hdd_tdls_set_peer_link_status(hddTdlsPeer_t *curr_peer,
                                         tTDLSLinkStatus status,
                                         tTDLSLinkReason reason);
 void wlan_hdd_tdls_set_link_status(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                   const u8 *mac,
-#else
-                                   u8 *mac,
-#endif
+                                   u8* mac,
                                    tTDLSLinkStatus linkStatus,
                                    tTDLSLinkReason reason);
 
 int wlan_hdd_tdls_recv_discovery_resp(hdd_adapter_t *pAdapter, u8 *mac);
 
 int wlan_hdd_tdls_set_peer_caps(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                const u8 *mac,
-#else
                                 u8 *mac,
-#endif
                                 tCsrStaParams *StaParams,
                                 tANI_BOOLEAN isBufSta,
-                                tANI_BOOLEAN isOffChannelSupported,
-                                tANI_BOOLEAN isQosWmmSta);
+                                tANI_BOOLEAN isOffChannelSupported);
 
-int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                           const u8 *mac,
-#else
-                           u8 *mac,
-#endif
-                           tANI_S8 rxRssi);
+int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, u8 *mac, tANI_S8 rxRssi);
 
-int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                const u8 *mac,
-#else
-                                u8 *mac,
-#endif
-                                tANI_U8 responder);
+int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter, u8 *mac, tANI_U8 responder);
 
-int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                const u8 *mac,
-#else
-                                u8 *mac,
-#endif
-                                tANI_U8 uSignature);
+int wlan_hdd_tdls_get_responder(hdd_adapter_t *pAdapter, u8 *mac);
+
+int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter, u8 *mac, tANI_U8 uSignature);
 
 int wlan_hdd_tdls_set_params(struct net_device *dev, tdls_config_params_t *config);
 
-int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                             const u8 *mac
-#else
-                             u8 *mac
-#endif
-                             );
+int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter, u8 *mac);
 
 tANI_U16 wlan_hdd_tdlsConnectedPeers(hdd_adapter_t *pAdapter);
 
@@ -383,23 +288,27 @@
 
 void wlan_hdd_tdls_check_bmps(hdd_adapter_t *pAdapter);
 
-hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                         const u8 *mac,
-#else
-                                         u8 *mac,
-#endif
-                                         u8 skip_self, tANI_BOOLEAN mutexLock);
+u8 wlan_hdd_tdls_is_peer_progress(hdd_adapter_t *pAdapter, u8 *mac);
+
+hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx, u8* mac, u8 skip_self);
 
 void wlan_hdd_tdls_set_mode(hdd_context_t *pHddCtx,
                             eTDLSSupportMode tdls_mode,
-                            v_BOOL_t bUpdateLast,
-                            enum tdls_disable_source source);
+                            v_BOOL_t bUpdateLast);
 
 tANI_U32 wlan_hdd_tdls_discovery_sent_cnt(hdd_context_t *pHddCtx);
 
 void wlan_hdd_tdls_check_power_save_prohibited(hdd_adapter_t *pAdapter);
 
+void wlan_hdd_tdls_free_scan_request (tdls_scan_context_t *tdls_scan_ctx);
+
+int wlan_hdd_tdls_copy_scan_context(hdd_context_t *pHddCtx,
+                            struct wiphy *wiphy,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+                            struct net_device *dev,
+#endif
+                            struct cfg80211_scan_request *request);
+
 int wlan_hdd_tdls_scan_callback (hdd_adapter_t *pAdapter,
                                 struct wiphy *wiphy,
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
@@ -415,69 +324,16 @@
 void wlan_hdd_tdls_indicate_teardown(hdd_adapter_t *pAdapter,
                                      hddTdlsPeer_t *curr_peer,
                                      tANI_U16 reason);
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
-                                      uint8_t *peer_mac);
-void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac,
-                           uint8_t is_off_chan_supported,
-                           uint8_t is_off_chan_configured,
-                           uint8_t is_off_chan_established);
-void hdd_wlan_block_scan_by_tdls(void);
 
-#else
-static inline
-void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
-                                      uint8_t *peer_mac)
-{
-    return;
-}
-static inline
-void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac,
-                           uint8_t is_off_chan_supported,
-                           uint8_t is_off_chan_configured,
-                           uint8_t is_off_chan_established)
-{
-    return;
-}
-static inline
-void hdd_wlan_block_scan_by_tdls(void)
-{
-    return;
-}
-#endif /* FEATURE_WLAN_DIAG_SUPPORT */
-
-int wlan_hdd_tdls_set_force_peer(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                 const u8 *mac,
-#else
-                                 u8 *mac,
-#endif
+int wlan_hdd_tdls_set_force_peer(hdd_adapter_t *pAdapter, u8 *mac,
                                  tANI_BOOLEAN forcePeer);
-int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                        const u8 *peer
-#else
-                                        u8 *peer
-#endif
-);
+int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, u8 *peer);
 int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                      const u8 *peer,
-#else
                                       u8 *peer,
-#endif
-                                      tdls_req_params_t *tdls_peer_params,
                                       cfg80211_exttdls_callback callback);
-void hdd_tdls_notify_mode_change(hdd_adapter_t *pAdapter,
-                                 hdd_context_t *pHddCtx);
-void wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *pHddCtx);
 /*EXT TDLS*/
 int wlan_hdd_tdls_get_status(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                             const tANI_U8* mac,
-#else
                              tANI_U8* mac,
-#endif
                              tANI_S32 *state,
                              tANI_S32 *reason);
 void wlan_hdd_tdls_get_wifi_hal_state(hddTdlsPeer_t *curr_peer,
@@ -489,53 +345,5 @@
                    tANI_U8 *ptr);
 
 // tdlsoffchan
-hddTdlsPeer_t *wlan_hdd_tdls_get_connected_peer(hdd_adapter_t *pAdapter);
-
-int wlan_hdd_validate_tdls_context(hdd_context_t *pHddCtx, tdlsCtx_t *pTdlsCtx);
-
-void wlan_hdd_tdls_reenable(hdd_context_t *pHddCtx);
-
-void wlan_hdd_tdls_notify_packet(hdd_adapter_t *adapter, struct sk_buff *skb);
-
-void wlan_hdd_change_tdls_mode(void *hdd_ctx);
-
-void wlan_hdd_start_stop_tdls_source_timer(hdd_context_t *pHddCtx,
-                                           eTDLSSupportMode tdls_mode);
-#else
-static inline void hdd_tdls_notify_mode_change(hdd_adapter_t *pAdapter,
-                                               hdd_context_t *pHddCtx)
-{
-}
-static inline void
-wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *pHddCtx)
-{
-}
-static inline void
-wlan_hdd_tdls_reenable(hdd_context_t *pHddCtx)
-{
-}
-static inline void
-wlan_hdd_tdls_notify_packet(hdd_adapter_t *adapter, struct sk_buff *skb)
-{
-}
-static inline void
-wlan_hdd_change_tdls_mode(void *hdd_ctx)
-{
-}
-
-static inline void
-wlan_hdd_start_stop_tdls_source_timer(hdd_context_t *pHddCtx,
-                                      eTDLSSupportMode tdls_mode)
-{
-}
-#endif
-void wlan_hdd_tdls_update_rx_pkt_cnt_n_rssi(hdd_adapter_t *pAdapter,
-        u8 *mac, v_S7_t rssiAvg);
-
-
-tdlsConnInfo_t *wlan_hdd_get_conn_info(hdd_context_t *pHddCtx,
-                                       tANI_U8 idx);
-
-v_VOID_t wlan_hdd_tdls_initiator_wait_cb(v_PVOID_t userData);
-
+hddTdlsPeer_t *wlan_hdd_tdls_get_first_connected_peer(hdd_adapter_t *pAdapter);
 #endif // __HDD_TDSL_H
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_trace.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_trace.h
index b12c6a3..191ec49 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_trace.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_trace.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -31,7 +31,6 @@
 #include "macTrace.h"
 
 #define NO_SESSION 0xFF
-#define TRACE_CODE_HDD_RX_SME_MSG 0xFF
 
 enum
 {
@@ -98,24 +97,11 @@
     TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA,
     TRACE_CODE_HDD_UNSUPPORTED_IOCTL,
     TRACE_CODE_HDD_SETROAMSCANCHANNELMINTIME_IOCTL,
-    TRACE_CODE_HDD_GETROAMSCANCHANNELMINTIME_IOCTL,
-    TRACE_CODE_HDD_STOP_NETDEV,
-    TRACE_CODE_HDD_WAKE_NETDEV,
-    TRACE_CODE_HDD_FLUSH_TX_QUEUES,
-    TRACE_CODE_HDD_CFG80211_RESUME_WLAN,
-    TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN,
-    TRACE_CODE_HDD_CFG80211_SET_MAC_ACL,
-    TRACE_CODE_HDD_CFG80211_TESTMODE,
-    TRACE_CODE_HDD_CFG80211_DUMP_SURVEY,
-    TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START,
-    TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP,
-    TRACE_CODE_HDD_CFG80211_DEL_PMKSA,
+    TRACE_CODE_HDD_GETROAMSCANCHANNELMINTIME_IOCTL
 };
 
 extern void hddTraceDump(void *pMac, tpvosTraceRecord pRecord, tANI_U16 recIndex);
 extern void hddTraceInit(void);
-void hdd_register_debug_callback(void);
-
 #endif
 
 
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_tx_rx.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_tx_rx.h
index 68f7174..a94dacf 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_tx_rx.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_tx_rx.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -76,8 +76,6 @@
 #define SME_QOS_UAPSD_CFG_VI_CHANGED_MASK     0xF4
 #define SME_QOS_UAPSD_CFG_VO_CHANGED_MASK     0xF8
 
-#define HDD_ETH_HEADER_LEN      14
-
 /* WLAN_DHCP_DEBUG */
 #define RX_PATH     ( 0 )
 #define TX_PATH     ( 1 )
@@ -113,30 +111,20 @@
 #define DHCP_OPTION53_STATUS_OFFSET    ( 0x11C )
 /* WLAN_DHCP_DEBUG */
 
-#define TID3 0x60
+
+
 
 
 /*--------------------------------------------------------------------------- 
   Type declarations
   -------------------------------------------------------------------------*/ 
  
-/*---------------------------------------------------------------------------
+/*--------------------------------------------------------------------------- 
   Function declarations and documenation
-  -------------------------------------------------------------------------*/
-/**============================================================================
-  @brief hdd_ibss_hard_start_xmit() - Function registered with the Linux OS for
-  transmitting packets in IBSS mode.
-
-  @param skb      : [in]  pointer to OS packet (sk_buff)
-  @param dev      : [in] pointer to network device
-
-  @return         : NET_XMIT_DROP if packets are dropped
-                  : NET_XMIT_SUCCESS if packet is enqueued succesfully
-  ===========================================================================*/
-extern int hdd_ibss_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
+  -------------------------------------------------------------------------*/ 
 
 /**============================================================================
-  @brief hdd_hard_start_xmit() - Function registered with the Linux OS for
+  @brief hdd_hard_start_xmit() - Function registered with the Linux OS for 
   transmitting packets
 
   @param skb      : [in]  pointer to OS packet (sk_buff)
@@ -169,26 +157,6 @@
 extern struct net_device_stats* hdd_stats(struct net_device *dev);
 
 /**============================================================================
-  @brief hdd_ibss_init_tx_rx() - Init function to initialize Tx/RX
-  modules in HDD
-
-  @param pAdapter : [in] pointer to adapter context
-  @return         : VOS_STATUS_E_FAILURE if any errors encountered
-                  : VOS_STATUS_SUCCESS otherwise
-  ===========================================================================*/
-extern void hdd_ibss_init_tx_rx( hdd_adapter_t *pAdapter );
-
-/**============================================================================
-  @brief hdd_ibss_deinit_tx_rx() - Deinit function to clean up Tx/RX
-  modules in HDD
-
-  @param pAdapter : [in] pointer to adapter context..
-  @return         : VOS_STATUS_E_FAILURE if any errors encountered.
-                  : VOS_STATUS_SUCCESS otherwise
-  ===========================================================================*/
-extern VOS_STATUS hdd_ibss_deinit_tx_rx( hdd_adapter_t *pAdapter );
-
-/**============================================================================
   @brief hdd_init_tx_rx() - Init function to initialize Tx/RX
   modules in HDD
 
@@ -235,26 +203,6 @@
                                        VOS_STATUS vosStatusIn );
 
 /**============================================================================
-  @brief hdd_ibss_tx_fetch_packet_cbk() - Callback function invoked by TL to
-  fetch a packet for transmission.
-
-  @param vosContext   : [in] pointer to VOS context
-  @param staId        : [in] Station for which TL is requesting a pkt
-  @param ucAC         : [in] pointer to access category requested by TL
-  @param pVosPacket   : [out] pointer to VOS packet packet pointer
-  @param pPktMetaInfo : [out] pointer to meta info for the pkt
-
-  @return             : VOS_STATUS_E_EMPTY if no packets to transmit
-                      : VOS_STATUS_E_FAILURE if any errors encountered
-                      : VOS_STATUS_SUCCESS otherwise
-  ===========================================================================*/
-extern VOS_STATUS hdd_ibss_tx_fetch_packet_cbk( v_VOID_t *vosContext,
-                                           v_U8_t *pStaId,
-                                           WLANTL_ACEnumType    ucAC,
-                                           vos_pkt_t **ppVosPacket,
-                                           WLANTL_MetaInfoType *pPktMetaInfo );
-
-/**============================================================================
   @brief hdd_tx_fetch_packet_cbk() - Callback function invoked by TL to 
   fetch a packet for transmission.
 
@@ -289,8 +237,6 @@
 extern VOS_STATUS hdd_tx_low_resource_cbk( vos_pkt_t *pVosPacket, 
                                            v_VOID_t *userData );
 
-extern VOS_STATUS hdd_rx_packet_monitor_cbk(v_VOID_t *vosContext,vos_pkt_t *pVosPacket, int conversion);
-
 /**============================================================================
   @brief hdd_rx_packet_cbk() - Receive callback registered with TL.
   TL will call this to notify the HDD when a packet was received 
@@ -379,25 +325,4 @@
    ========================================================================*/
 void hdd_dump_dhcp_pkt(struct sk_buff *skb, int path);
 
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-/**
- * wlan_hdd_log_eapol() - Function to check and extract EAPOL params
- * @skb:               skb data
- * @event_type:        One of enum wifi_connectivity_events to indicate Tx/Rx
- *
- * This function parses the input skb data to get the EAPOL params,if the
- * packet is EAPOL and store it in the pointer passed as input
- *
- * Return: None
- *
- */
-void wlan_hdd_log_eapol(struct sk_buff *skb,
-                         uint8_t event_type);
-#else
-static inline void wlan_hdd_log_eapol(struct sk_buff *skb,
-                                      uint8_t event_type)
-{
-}
-#endif /* FEATURE_WLAN_DIAG_SUPPORT */
-
 #endif    // end #if !defined( WLAN_HDD_TX_RX_H )
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_wext.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_wext.h
index fe8bfed..c15445d 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_wext.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_wext.h
@@ -274,13 +274,6 @@
     WEXT_SCAN_PENDING_MAX
 } hdd_scan_pending_option_e;
 
-enum
-{
-   WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR          = 1<<0,
-   WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR = 1<<1,
-   WLAN_HDD_GET_FRAME_LOG_CMD_BMU_TRACING    = 1<<2,
-};
-
 /* 
  * This structure contains the interface level (granularity) 
  * configuration information in support of wireless extensions. 
@@ -462,7 +455,6 @@
 
 int hdd_setBand(struct net_device *dev, u8 ui_band);
 int hdd_setBand_helper(struct net_device *dev, const char *command);
-VOS_STATUS wlan_hdd_get_frame_logs(hdd_adapter_t *pAdapter, v_U8_t flag);
-int wlan_hdd_set_proximity(int set_value);
+
 #endif // __WEXT_IW_H__
 
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_wmm.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_wmm.h
index 76c2837..7d0b288 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_wmm.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_wmm.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -193,6 +193,7 @@
 typedef struct
 {
    struct list_head             wmmContextList;
+   struct mutex                 wmmLock;
    hdd_wmm_ac_status_t          wmmAcStatus[WLANTL_MAX_AC];
    v_BOOL_t                     wmmQap;
    v_BOOL_t                     wmmQosConnection;
@@ -264,14 +265,8 @@
   @return         : Qdisc queue index
   ===========================================================================*/
 
-v_U16_t hdd_hostapd_select_queue(struct net_device * dev, struct sk_buff *skb
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0))
-                                 , void *accel_priv
-#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-                                 , select_queue_fallback_t fallbac
-#endif
-);
+v_U16_t hdd_hostapd_select_queue(struct net_device * dev, struct sk_buff *skb);
+
 
 
 /**============================================================================
diff --git a/wlan/prima/CORE/HDD/inc/wlan_hdd_wowl.h b/wlan/prima/CORE/HDD/inc/wlan_hdd_wowl.h
index 93ae7f9..5aeb487 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_hdd_wowl.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_hdd_wowl.h
@@ -96,6 +96,9 @@
   the device in BMPS mode (if not already in BMPS). If attempt to BMPS fails, 
   request for WoWL will be rejected.
 
+  Copyright (c) 2009 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 
 ============================================================================*/
 /* $Header$ */
diff --git a/wlan/prima/CORE/HDD/inc/wlan_qct_driver.h b/wlan/prima/CORE/HDD/inc/wlan_qct_driver.h
index f231690..d7bedae 100644
--- a/wlan/prima/CORE/HDD/inc/wlan_qct_driver.h
+++ b/wlan/prima/CORE/HDD/inc/wlan_qct_driver.h
@@ -34,6 +34,9 @@
   
   \brief Header file for Wireless LAN Host Device Driver Kernel Module
                
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/HDD/src/bap_hdd_main.c b/wlan/prima/CORE/HDD/src/bap_hdd_main.c
index af48dab..328f5e1 100644
--- a/wlan/prima/CORE/HDD/src/bap_hdd_main.c
+++ b/wlan/prima/CORE/HDD/src/bap_hdd_main.c
@@ -31,6 +31,9 @@
 
   \brief 802.11 BT-AMP PAL Host Device Driver implementation
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -4164,7 +4167,7 @@
         // save away the pctx context...so it can be retrieved by the work procedure.
         pHciContext->pctx = pctx;
         pHciContext->magic = BT_AMP_HCI_CTX_MAGIC;
-        vos_init_work(&pHciContext->hciInterfaceProcessing,
+        INIT_WORK(&pHciContext->hciInterfaceProcessing,
                   bslWriteFinish);
 
         VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_assoc.c b/wlan/prima/CORE/HDD/src/wlan_hdd_assoc.c
index 479b094..821b694 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_assoc.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_assoc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -53,19 +53,20 @@
 #include "wlan_nlink_common.h"
 #include "wlan_btc_svc.h"
 #include "wlan_hdd_power.h"
-#include "wlan_hdd_trace.h"
 #include <linux/ieee80211.h>
 #include <linux/wireless.h>
 #include <net/cfg80211.h>
 #include "wlan_hdd_cfg80211.h"
 #include "csrInsideApi.h"
 #include "wlan_hdd_p2p.h"
-#include <vos_sched.h>
+#ifdef FEATURE_WLAN_TDLS
 #include "wlan_hdd_tdls.h"
+#endif
 #include "sme_Api.h"
 #include "wlan_hdd_hostapd.h"
+#ifdef DEBUG_ROAM_DELAY
 #include "vos_utils.h"
-#include <wlan_hdd_wext.h>
+#endif
 
 v_BOOL_t mibIsDot11DesiredBssTypeInfrastructure( hdd_adapter_t *pAdapter );
 
@@ -326,8 +327,6 @@
 
           // Save  dot11mode in which STA associated to AP
           pHddStaCtx->conn_info.dot11Mode = pRoamInfo->u.pConnectedProfile->dot11Mode;
-
-          pHddStaCtx->conn_info.rate_flags = pRoamInfo->maxRateFlags;
       }
    }
 
@@ -432,8 +431,8 @@
     vos_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN);
     vos_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN);
 
-    sme_GetRICIEs(pHddCtx->hHal, (u8 *)ricIe,
-                  DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length );
+    sme_GetRICIEs( pHddCtx->hHal, (u8 *)ricIe,
+                  DOT11F_IE_FTINFO_MAX_LEN, &ric_ies_length );
     if (ric_ies_length == 0)
     {
         hddLog(LOGW,
@@ -506,7 +505,6 @@
     if (auth_resp_len == 0)
     {
         hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__);
-        kfree(buff);
         return;
     }
 
@@ -669,14 +667,11 @@
              }
         }
 #endif
-        hddLog(VOS_TRACE_LEVEL_ERROR, MAC_ADDRESS_STR " connected to "
-                MAC_ADDRESS_STR,
+        pr_info("wlan: " MAC_ADDRESS_STR " connected to " MAC_ADDRESS_STR "\n",
                 MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes),
                 MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data));
         hdd_SendUpdateBeaconIEsEvent(pAdapter, pCsrRoamInfo);
 
-        hdd_manage_delack_timer(pHddCtx);
-
         /* Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS is Enabled Or
          * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_VOWIFI_11R is Enabled
          * and fFTEnable is TRUE */
@@ -699,19 +694,14 @@
         wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode);
         memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId, ETH_ALEN);
         type = WLAN_STA_ASSOC_DONE_IND;
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "wlan: new IBSS connection to " MAC_ADDRESS_STR,
-                 MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId));
+        pr_info("wlan: new IBSS connection to " MAC_ADDRESS_STR"\n",
+                MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId));
     }
     else /* Not Associated */
     {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "wlan: disconnected");
+        pr_info("wlan: disconnected\n");
         type = WLAN_STA_DISASSOC_DONE_IND;
         memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN);
-
-        hdd_manage_delack_timer(pHddCtx);
     }
     hdd_dump_concurrency_info(pHddCtx);
 
@@ -753,223 +743,31 @@
 
    vos_mem_zero( &pHddStaCtx->conn_info.SSID, sizeof( tCsrSSIDInfo ) );
 }
-
-VOS_STATUS hdd_ibss_deinit_tx_rx_sta ( hdd_adapter_t *pAdapter, v_U8_t STAId )
-{
-   v_U8_t ac;
-   /**Track whether OS TX queue has been disabled.*/
-   v_BOOL_t txSuspended[NUM_TX_QUEUES];
-   v_U8_t tlAC;
-   v_U8_t i;
-   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   hdd_ibss_peer_info_t *pPeerInfo;
-
-   if( NULL == pHddStaCtx )
-   {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   "%s: HDD station context NULL ",__func__);
-        return VOS_STATUS_E_FAILURE;
-   }
-
-   pPeerInfo = &pHddStaCtx->ibss_peer_info;
-   if (FALSE == pPeerInfo->ibssStaInfo[STAId].isUsed)
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Deinit station not inited %d", __func__, STAId );
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   hdd_flush_ibss_tx_queues(pAdapter, STAId);
-
-   for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++)
-   {
-      tlAC = hdd_QdiscAcToTlAC[ac];
-      txSuspended[ac] = pPeerInfo->ibssStaInfo[STAId].txSuspended[tlAC];
-   }
-
-   vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t));
-
-   /* re-init hdd list, since netdev can still open adapter until
-    * driver gets unloaded
-    */
-   for (i = 0; i < NUM_TX_QUEUES; i ++)
-   {
-      hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i],
-                    HDD_TX_QUEUE_MAX_LEN);
-   }
-
-   for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++)
-   {
-      if (txSuspended[ac])
-      {
-         VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-                    "%s: TX queue re-enabled", __func__);
-         netif_wake_subqueue(pAdapter->dev, ac);
-      }
-   }
-   return VOS_STATUS_SUCCESS;
-}
-
-static VOS_STATUS hdd_ibss_DeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId )
-{
-    VOS_STATUS vosStatus;
-
-    vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId );
-    if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   "%s: WLANTL_ClearSTAClient() failed to for staID %d.  "
-                   "Status= %d [0x%08X]",
-                   __func__, staId, vosStatus, vosStatus );
-    }
-
-    vosStatus = hdd_ibss_deinit_tx_rx_sta ( pAdapter, staId );
-    if( VOS_STATUS_E_FAILURE == vosStatus )
-    {
-        VOS_TRACE ( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                    "hdd_ibss_deinit_tx_rx_sta() failed for staID %d. "
-                    "Status = %d [0x%08X]",
-                    staId, vosStatus, vosStatus );
-    }
-
-    return( vosStatus );
-}
-
-VOS_STATUS hdd_ibss_init_tx_rx_sta( hdd_adapter_t *pAdapter, v_U8_t STAId, v_MACADDR_t *pmacAddrSTA)
-{
-   v_U8_t i = 0;
-   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info;
-
-   if (pPeerInfo->ibssStaInfo[STAId].isUsed)
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Reinit station %d", __func__, STAId );
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t));
-   for (i = 0; i < NUM_TX_QUEUES; i ++)
-   {
-      hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN);
-   }
-
-   pPeerInfo->ibssStaInfo[STAId].isUsed = VOS_TRUE;
-   pPeerInfo->ibssStaInfo[STAId].isDeauthInProgress = VOS_FALSE;
-   vos_copy_macaddr( &pPeerInfo->ibssStaInfo[STAId].macAddrSTA, pmacAddrSTA);
-
-   return VOS_STATUS_SUCCESS;
-}
-
-static VOS_STATUS hdd_ibss_RegisterSTA( hdd_adapter_t *pAdapter,
-                                       tCsrRoamInfo *pRoamInfo,
-                                       v_U8_t staId,
-                                       v_MACADDR_t *pPeerMacAddress,
-                                       tSirBssDescription *pBssDesc )
-{
-   VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
-   WLAN_STADescType staDesc = {0};
-   eCsrEncryptionType connectedCipherAlgo;
-   v_BOOL_t  fConnected;
-   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info;
-   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-
-   if ( pPeerInfo->ibssStaInfo[staId].isUsed )
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-                 "clean up old entry for STA %d", staId);
-      hdd_ibss_DeregisterSTA( pAdapter, staId );
-   }
-
-   staDesc.ucSTAId = staId;
-   staDesc.wSTAType = WLAN_STA_IBSS;
-
-   // Note that for IBSS, the STA MAC address and BSSID are goign to be different where
-   // in infrastructure, they are the same (BSSID is the MAC address of the AP).  So,
-   // for IBSS we have a second field to pass to TL in the STA descriptor that we don't
-   // pass when making an Infrastructure connection.
-   vos_mem_copy(staDesc.vSTAMACAddress.bytes, pPeerMacAddress->bytes,sizeof(pPeerMacAddress->bytes));
-   vos_mem_copy( staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId, 6 );
-   vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent );
-
-   if (hdd_wmm_is_active(pAdapter))
-   {
-      staDesc.ucQosEnabled = 1;
-   }
-   else
-   {
-      staDesc.ucQosEnabled = 0;
-   }
-   VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-              "HDD SOFTAP register TL QoS_enabled=%d",
-              staDesc.ucQosEnabled );
-
-   fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo );
-   if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE )
-   {
-      staDesc.ucProtectedFrame = 1;
-   }
-   else
-   {
-      staDesc.ucProtectedFrame = 0;
-
-   }
-
-   hdd_ibss_init_tx_rx_sta(pAdapter, staId, &staDesc.vSTAMACAddress);
-
-   // UMA is Not ready yet, Xlation will be done by TL
-   staDesc.ucSwFrameTXXlation = 1;
-   staDesc.ucSwFrameRXXlation = 1;
-   staDesc.ucAddRmvLLC = 1;
-   // Initialize signatures and state
-   staDesc.ucUcastSig  = pRoamInfo->ucastSig;
-   staDesc.ucBcastSig  = pRoamInfo->bcastSig;
-   staDesc.ucInitState = WLANTL_STA_AUTHENTICATED;
-
-   staDesc.ucIsReplayCheckValid = VOS_FALSE;
-
-   // Register the Station with TL.
-   vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext,
-                                         hdd_rx_packet_cbk,
-                                         hdd_tx_complete_cbk,
-                                         hdd_ibss_tx_fetch_packet_cbk, &staDesc,
-                                         pBssDesc->rssi );
-   if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "WLANTL_RegisterSTAClient() failed to register.  Status= %d [0x%08X]",
-                 vosStatus, vosStatus );
-      return vosStatus;
-   }
-
-   //Timer value should be in milliseconds
-   if ( pHddCtx->cfg_ini->dynSplitscan &&
-      ( VOS_TIMER_STATE_RUNNING !=
-                      vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)))
-   {
-       vos_timer_start(&pHddCtx->tx_rx_trafficTmr,
-                        pHddCtx->cfg_ini->trafficMntrTmrForSplitScan);
-   }
-
-   pPeerInfo->ibssStaInfo[staId].ucSTAId = staId;
-   pPeerInfo->ibssStaInfo[staId].isQosEnabled = staDesc.ucQosEnabled;
-
-   vosStatus = WLANTL_ChangeSTAState( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staDesc.ucSTAId,
-                                      WLANTL_STA_AUTHENTICATED );
-
-   pPeerInfo->ibssStaInfo[staId].tlSTAState = WLANTL_STA_AUTHENTICATED;
-   pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
-
-   return( vosStatus );
-}
-
 /* TODO Revist this function. and data path */
 static VOS_STATUS hdd_roamDeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId )
 {
     VOS_STATUS vosStatus;
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
 
-    hdd_disconnect_tx_rx(pAdapter);
+    if (WLAN_HDD_IBSS != pAdapter->device_mode)
+    {
+       hdd_disconnect_tx_rx(pAdapter);
+    }
+    else
+    {
+       // Need to cleanup all queues only if the last peer leaves
+       if (eConnectionState_IbssDisconnected == pHddStaCtx->conn_info.connState)
+       {
+          netif_tx_disable(pAdapter->dev);
+          netif_carrier_off(pAdapter->dev);
+          hdd_disconnect_tx_rx(pAdapter);
+       }
+       else
+       {
+          // There is atleast one more peer, do not cleanup all queues
+          hdd_flush_ibss_tx_queues(pAdapter, staId);
+       }
+    }
 
     vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId );
     if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
@@ -1004,13 +802,15 @@
     }
 
     // notify apps that we can't pass traffic anymore
-    hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
     netif_tx_disable(dev);
     netif_carrier_off(dev);
     //TxTimeoutCount need to reset in case of disconnect handler
     pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount = 0;
 
     INIT_COMPLETION(pAdapter->disconnect_comp_var);
+    /* HDD has initiated disconnect, do not send disconnect indication
+     * to kernel as it will be handled by __cfg80211_disconnect.
+     */
     /* If only STA mode is on */
     if((pHddCtx->concurrency_mode <= 1) &&
        (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <= 1))
@@ -1024,14 +824,7 @@
      */
 
     spin_lock_bh(&pAdapter->lock_for_active_session);
-
-    /* HDD has initiated disconnect, do not send disconnect indication
-     * to kernel. Sending disconnected event to kernel for userspace
-     * initiated disconnect will be handled by diconnect handler call
-     * to cfg80211_disconnected
-     */
-    if ((eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) ||
-        (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState))
+    if ( eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState )
     {
        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                    FL(" HDD has initiated a disconnect, no need to send"
@@ -1041,7 +834,7 @@
     else if (eConnectionState_Associated == pHddStaCtx->conn_info.connState)
     {
        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-            FL("Set HDD connState to eConnectionState_Disconnecting from %d "),
+               FL(" Set HDD connState to eConnectionState_Disconnecting from %d "),
                        pHddStaCtx->conn_info.connState);
        hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting );
        wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode);
@@ -1061,10 +854,9 @@
             driver so not sending the status of the connection to supplicant*/
         if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS)
         {
-            if (sendDisconInd)
-                hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
-                       "%s: sent disconnected event to nl80211",
-                       __func__);
+            hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
+                    "%s: sent disconnected event to nl80211",
+                    __func__);
 #ifdef WLAN_FEATURE_P2P_DEBUG
             if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
             {
@@ -1082,33 +874,19 @@
                 }
             }
 #endif
-               if ((roamStatus == eCSR_ROAM_LOSTLINK) &&
-                    !pRoamInfo->reasonCode)
-                   wlan_hdd_get_frame_logs(pAdapter,
-                                WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR);
             /*Only send indication to kernel if not initiated by kernel*/
             if ( sendDisconInd )
             {
                /* To avoid wpa_supplicant sending "HANGED" CMD to ICS UI */
                if ( eCSR_ROAM_LOSTLINK == roamStatus )
                {
-                    wlan_hdd_cfg80211_indicate_disconnect(dev, false,
-                                                   pRoamInfo->reasonCode);
+                   cfg80211_disconnected(dev, pRoamInfo->reasonCode, NULL, 0, GFP_KERNEL);
                }
                else
                {
-                   wlan_hdd_cfg80211_indicate_disconnect(dev, false,
-                                                   WLAN_REASON_UNSPECIFIED);
+                   cfg80211_disconnected(dev, WLAN_REASON_UNSPECIFIED, NULL, 0, GFP_KERNEL);
                }
             }
-
-            if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
-            {
-                hddLog(LOG1,
-                       FL("P2P client is getting removed and we are tryig to re-enable TDLS"));
-                wlan_hdd_tdls_reenable(pHddCtx);
-            }
-
             //If the Device Mode is Station
             // and the P2P Client is Connected
             //Enable BMPS
@@ -1144,120 +922,44 @@
     }
 
      hdd_wmm_adapter_clear(pAdapter);
-     /* Clear PER based roam stats */
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-     if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) &&
-         (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
-         pHddCtx->cfg_ini && pHddCtx->cfg_ini->isPERRoamEnabled &&
-         pHddCtx->cfg_ini->isPERRoamRxPathEnabled)
-         sme_unset_per_roam_rxconfig(pHddCtx->hHal);
-#endif
 #if defined(WLAN_FEATURE_VOWIFI_11R)
      sme_FTReset(WLAN_HDD_GET_HAL_CTX(pAdapter));
 #endif
 
     if (eCSR_ROAM_IBSS_LEAVE == roamStatus)
     {
-        v_U8_t i;
-
         sta_id = IBSS_BROADCAST_STAID;
-        vstatus = hdd_ibss_DeregisterSTA( pAdapter, sta_id );
+        vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id );
         if ( !VOS_IS_STATUS_SUCCESS(vstatus ) )
         {
             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    FL("hdd_roamDeregisterSTA() failed to for staID %d.  "
-                     "Status= %d [0x%x]"),
+                     "hdd_roamDeregisterSTA() failed to for staID %d.  "
+                     "Status= %d [0x%x]",
                      sta_id, status, status );
 
             status = eHAL_STATUS_FAILURE;
         }
+
         pHddCtx->sta_to_adapter[sta_id] = NULL;
 
-        /*Clear all the peer sta register with TL.*/
-        for (i =0; i < HDD_MAX_NUM_IBSS_STA; i++ )
-        {
-            if (0 != pHddStaCtx->conn_info.staId[i])
-            {
-               sta_id = pHddStaCtx->conn_info.staId[i];
-
-               VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                     FL("Deregister StaID %d"),sta_id);
-               vstatus = hdd_ibss_DeregisterSTA( pAdapter, sta_id );
-               if ( !VOS_IS_STATUS_SUCCESS(vstatus ) )
-               {
-                   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                     FL("hdd_roamDeregisterSTA() failed to for staID %d.  "
-                      "Status= %d [0x%x]"),
-                       sta_id, status, status );
-                   status = eHAL_STATUS_FAILURE;
-               }
-
-               vstatus = hdd_sta_id_hash_remove_entry(pAdapter,
-                           sta_id, &pHddStaCtx->conn_info.peerMacAddress[i]);
-               if (vstatus != VOS_STATUS_SUCCESS) {
-                   hddLog(VOS_TRACE_LEVEL_ERROR,
-                             FL("Not able to remove staid hash %d"),
-                             sta_id);
-                   status = eHAL_STATUS_FAILURE;
-               } else {
-                   hddLog(VOS_TRACE_LEVEL_INFO,
-                         FL("ibss station removed sta_id %d mac:"
-                         MAC_ADDRESS_STR), sta_id,
-                         MAC_ADDR_ARRAY(pHddStaCtx->conn_info.peerMacAddress[i].bytes));
-               }
-
-               /*set the staid and peer mac as 0, all other reset are
-                * done in hdd_connRemoveConnectInfo.
-                */
-               pHddStaCtx->conn_info.staId[i]= 0;
-               vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[i], sizeof( v_MACADDR_t ) );
-
-               if (sta_id < (WLAN_MAX_STA_COUNT + 3))
-                    pHddCtx->sta_to_adapter[sta_id] = NULL;
-            }
-        }
-
     }
-    else
-    {
-       sta_id = pHddStaCtx->conn_info.staId[0];
-       /* clear scan cache for Link Lost */
-       if (pRoamInfo && !pRoamInfo->reasonCode &&
-           (eCSR_ROAM_LOSTLINK == roamStatus)) {
-           wlan_hdd_cfg80211_update_bss_list(pAdapter,
-                               pHddStaCtx->conn_info.bssId);
-           sme_remove_bssid_from_scan_list(pHddCtx->hHal,
-                               pHddStaCtx->conn_info.bssId);
-        }
 
-       //We should clear all sta register with TL, for now, only one.
-       vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id );
-       if ( !VOS_IS_STATUS_SUCCESS(vstatus ) )
-       {
-           VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("hdd_roamDeregisterSTA() failed to for staID %d.  "
-                  "Status= %d [0x%x]"),
+
+    sta_id = pHddStaCtx->conn_info.staId[0];
+
+    //We should clear all sta register with TL, for now, only one.
+    vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id );
+    if ( !VOS_IS_STATUS_SUCCESS(vstatus ) )
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "hdd_roamDeregisterSTA() failed to for staID %d.  "
+                  "Status= %d [0x%x]",
                   sta_id, status, status );
 
-           status = eHAL_STATUS_FAILURE;
-       }
-
-       pHddCtx->sta_to_adapter[sta_id] = NULL;
+        status = eHAL_STATUS_FAILURE;
     }
 
-#ifdef WLAN_FEATURE_LINK_LAYER_STATS
-    if (VOS_STATUS_SUCCESS !=
-            WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
-                pHddStaCtx->conn_info.staId[0], WIFI_STATS_IFACE_AC))
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, "%s:"
-                "WLANTL_ClearInterfaceStats Failed", __func__);
-    }
-    pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0;
-    pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0;
-    pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0;
-    pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0;
-#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
+    pHddCtx->sta_to_adapter[sta_id] = NULL;
 
     // Clear saved connection information in HDD
     hdd_connRemoveConnectInfo( pHddStaCtx );
@@ -1286,56 +988,6 @@
     complete(&pAdapter->disconnect_comp_var);
     return( status );
 }
-
-static void hdd_postTLPacketPendingInd(hdd_adapter_t *pAdapter,
-                                       v_U8_t staId)
-{
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    v_SINT_t i;
-    v_SIZE_t size;
-    VOS_STATUS status;
-    v_BOOL_t granted = VOS_FALSE;
-
-    if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) ||
-        (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ||
-        (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE))
-    {
-        //Indicate to TL that there is pending data if a queue is non empty
-        for (i = WLANTL_AC_HIGH_PRIO; i>=0; --i)
-        {
-            size = 0;
-            hdd_list_size(&pAdapter->wmm_tx_queue[i], &size);
-            if (size > 0)
-            {
-               if (i != WLANTL_AC_HIGH_PRIO)
-               {
-                  if (VOS_FALSE ==
-                      pAdapter->hddWmmStatus.wmmAcStatus[i].wmmAcAccessAllowed)
-                  {
-                     hdd_wmm_acquire_access(pAdapter,
-                                           (WLANTL_ACEnumType)i, &granted);
-                     pAdapter->psbChanged |= (1 << i);
-                  }
-                  else
-                     granted = VOS_TRUE;
-               }
-
-               if (granted || (i == WLANTL_AC_HIGH_PRIO))
-               {
-                  status = WLANTL_STAPktPending(pHddCtx->pvosContext,
-                                                staId, (WLANTL_ACEnumType)i);
-                  if (!VOS_IS_STATUS_SUCCESS(status))
-                  {
-                     VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
-                               "%s: Failure in indicating pkt to TL for QID=%d",
-                               __func__, i);
-                  }
-               }
-            }
-        }
-    }
-}
-
 static VOS_STATUS hdd_roamRegisterSTA( hdd_adapter_t *pAdapter,
                                        tCsrRoamInfo *pRoamInfo,
                                        v_U8_t staId,
@@ -1357,12 +1009,26 @@
    // Get the Station ID from the one saved during the assocation.
    staDesc.ucSTAId = staId;
 
-   staDesc.wSTAType = WLAN_STA_INFRA;
+   if ( pHddStaCtx->conn_info.connDot11DesiredBssType == eMib_dot11DesiredBssType_infrastructure)
+   {
+      staDesc.wSTAType = WLAN_STA_INFRA;
 
-   // grab the bssid from the connection info in the adapter structure and hand that
-   // over to TL when registering.
-   vos_mem_copy( staDesc.vSTAMACAddress.bytes, pHddStaCtx->conn_info.bssId,
-                 sizeof(pHddStaCtx->conn_info.bssId) );
+      // grab the bssid from the connection info in the adapter structure and hand that
+      // over to TL when registering.
+      vos_mem_copy( staDesc.vSTAMACAddress.bytes, pHddStaCtx->conn_info.bssId,sizeof(pHddStaCtx->conn_info.bssId) );
+   }
+   else
+   {
+      // for an IBSS 'connect', setup the Station Descriptor for TL.
+      staDesc.wSTAType = WLAN_STA_IBSS;
+
+      // Note that for IBSS, the STA MAC address and BSSID are goign to be different where
+      // in infrastructure, they are the same (BSSID is the MAC address of the AP).  So,
+      // for IBSS we have a second field to pass to TL in the STA descriptor that we don't
+      // pass when making an Infrastructure connection.
+      vos_mem_copy( staDesc.vSTAMACAddress.bytes, pPeerMacAddress->bytes,sizeof(pPeerMacAddress->bytes) );
+      vos_mem_copy( staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 );
+   }
 
    vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent );
 
@@ -1478,8 +1144,6 @@
                                          WLANTL_STA_AUTHENTICATED );
 
       pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
-
-      hdd_postTLPacketPendingInd(pAdapter, staDesc.ucSTAId);
    }
    else
    {
@@ -1588,10 +1252,9 @@
     /* HDD has initiated disconnect, do not send connect result indication
      * to kernel as it will be handled by __cfg80211_disconnect.
      */
-    if (((eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) ||
-        (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState)) &&
-        ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) ||
-        (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus)))
+    if(( eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) &&
+        (( eCSR_ROAM_RESULT_ASSOCIATED == roamResult) ||
+        ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus)) )
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                FL(" Disconnect from HDD in progress "));
@@ -1611,22 +1274,6 @@
         pAdapter->maxRateFlags = pRoamInfo->maxRateFlags;
         // Save the connection info from CSR...
         hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE );
-
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-        if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) &&
-            (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
-            !hddDisconInProgress &&
-            pHddCtx->cfg_ini && pHddCtx->cfg_ini->isPERRoamEnabled &&
-            pHddCtx->cfg_ini->isPERRoamRxPathEnabled)
-            sme_set_per_roam_rxconfig(pHddCtx->hHal,
-                 pHddStaCtx->conn_info.staId[0],
-                 pHddCtx->cfg_ini->rateDownThreshold,
-                 pHddCtx->cfg_ini->rateUpThreshold,
-                 pHddCtx->cfg_ini->PERroamTriggerPercent,
-                 pHddCtx->cfg_ini->PERroamRxPktsThreshold,
-                 pHddCtx->cfg_ini->waitPeriodForNextPERScan);
-#endif
-
 #ifdef FEATURE_WLAN_WAPI
         if ( pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE ||
                 pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_PSK )
@@ -1688,6 +1335,9 @@
         else
             hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Wrong Staid: %d", __func__, pRoamInfo->staId);
 
+#ifdef FEATURE_WLAN_TDLS
+        wlan_hdd_tdls_connection_callback(pAdapter);
+#endif
         //For reassoc, the station is already registered, all we need is to change the state
         //of the STA in TL.
         //If authentication is required (WPA/WPA2/DWEP), change TL to CONNECTED instead of AUTHENTICATED
@@ -1709,22 +1359,8 @@
             bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo);
             if (NULL == bss)
             {
-                hddLog(LOGE,
-                     FL("Not able to create BSS entry"));
+                pr_err("wlan: Not able to create BSS entry\n");
                 netif_carrier_off(dev);
-                if (!hddDisconInProgress) {
-                   /*
-                    * Here driver was not able to update cfg80211 database
-                    * this can happen if connected channel is not valid,
-                    * i.e reg domain was changed during connection.
-                    * Queue disconnect for the session if disconnect is
-                    * not in progress.
-                    */
-                    hddLog(LOGE, FL("Disconnecting..."));
-                    sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                 pAdapter->sessionId,
-                                 eCSR_DISCONNECT_REASON_UNSPECIFIED);
-                }
                 return eHAL_STATUS_FAILURE;
             }
 #ifdef WLAN_FEATURE_VOWIFI_11R
@@ -1786,10 +1422,10 @@
                                          (int)pRoamInfo->pBssDesc->channelId);
                         hddLog(LOG1, "assocReqlen %d assocRsplen %d", assocReqlen,
                                          assocRsplen);
-                        if (pHddCtx->cfg_ini->gEnableRoamDelayStats)
-                        {
-                            vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0);
-                        }
+#ifdef DEBUG_ROAM_DELAY
+                        //HACK we are using the buff len as Auth Type
+                        vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0);
+#endif
                         cfg80211_roamed(dev,chan, pRoamInfo->bssid,
                                     pFTAssocReq, assocReqlen, pFTAssocRsp, assocRsplen,
                                     GFP_KERNEL);
@@ -1840,10 +1476,10 @@
                     if(ft_carrier_on)
                     {
                         hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength);
-                        if (pHddCtx->cfg_ini->gEnableRoamDelayStats)
-                        {
-                            vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0);
-                        }
+#ifdef DEBUG_ROAM_DELAY
+                        //HACK we are using the buff len as Auth Type
+                        vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0);
+#endif
                     }
                     else
 #endif /* FEATURE_WLAN_ESE */
@@ -1852,7 +1488,7 @@
                          hddLog(VOS_TRACE_LEVEL_INFO,
                             "%s: sending connect indication to nl80211:"
                             " for bssid " MAC_ADDRESS_STR
-                            " result:%d and Status:%d",
+                            " reason:%d and Status:%d\n",
                             __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid),
                             roamResult, roamStatus);
 
@@ -1907,8 +1543,6 @@
                                                    pHddStaCtx->conn_info.staId[ 0 ],
                                                    WLANTL_STA_AUTHENTICATED );
                 pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
-                hdd_postTLPacketPendingInd(pAdapter,
-                                           pHddStaCtx->conn_info.staId[0]);
             }
         }
 
@@ -1927,19 +1561,11 @@
         vos_mem_zero( &pAdapter->hdd_stats.hddPmfStats,
                       sizeof(pAdapter->hdd_stats.hddPmfStats) );
 #endif
-
         // Start the Queue
         if ( !hddDisconInProgress )
-        {
-            hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
             netif_tx_wake_all_queues(dev);
-        }
-        if (pHddCtx->cfg_ini->gEnableRoamDelayStats)
-        {
-            vos_record_roam_event(e_HDD_ENABLE_TX_QUEUE, NULL, 0);
-        }
-#ifdef FEATURE_WLAN_TDLS
-        wlan_hdd_tdls_connection_callback(pAdapter);
+#ifdef DEBUG_ROAM_DELAY
+        vos_record_roam_event(e_HDD_ENABLE_TX_QUEUE, NULL, 0);
 #endif
     }
     else
@@ -1948,31 +1574,16 @@
 
         hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
         if (pRoamInfo)
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    "wlan: connection failed with " MAC_ADDRESS_STR " result:%d and Status:%d",
-                    MAC_ADDR_ARRAY(pRoamInfo->bssid), roamResult, roamStatus);
+            pr_info("wlan: connection failed with " MAC_ADDRESS_STR
+                    " reason:%d and Status:%d\n",
+                    MAC_ADDR_ARRAY(pRoamInfo->bssid),
+                    roamResult, roamStatus);
         else
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   "wlan: connection failed with " MAC_ADDRESS_STR " result:%d and Status:%d",
+            pr_info("wlan: connection failed with " MAC_ADDRESS_STR
+                    " reason:%d and Status:%d\n",
                     MAC_ADDR_ARRAY(pWextState->req_bssId),
                     roamResult, roamStatus);
 
-        if (( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus) ||
-            ((roamResult != eCSR_ROAM_RESULT_ASSOCIATED) &&
-             (eCSR_ROAM_ASSOCIATION_COMPLETION == roamStatus)))
-            wlan_hdd_get_frame_logs(pAdapter,
-                                WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR);
-
-        if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) ||
-           (pRoamInfo &&
-           ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode) ||
-           (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode) ||
-           (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode)))) {
-             wlan_hdd_cfg80211_update_bss_list(pAdapter,
-                    pRoamInfo ? pRoamInfo->bssid : pWextState->req_bssId);
-             sme_remove_bssid_from_scan_list(pHddCtx->hHal,
-                    pRoamInfo ? pRoamInfo->bssid : pWextState->req_bssId);
-        }
         /* Set connection state to eConnectionState_NotConnected only when CSR
          * has completed operation - with a ASSOCIATION_FAILURE status
          */
@@ -2027,29 +1638,24 @@
          * completed operation - with a ASSOCIATION_FAILURE status.*/
         if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus &&  !hddDisconInProgress )
         {
-
-            if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
-            {
-                hddLog(LOG1,
-                       FL("Assoication Failure for P2P client and we are trying to re-enable TDLS"));
-                wlan_hdd_tdls_reenable(pHddCtx);
-            }
-
             if (pRoamInfo)
                 hddLog(VOS_TRACE_LEVEL_ERROR,
                      "%s: send connect failure to nl80211:"
                      " for bssid " MAC_ADDRESS_STR
-                     " result:%d and Status:%d reasonCode %d" ,
+                     " reason:%d and Status:%d\n" ,
                      __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid),
-                     roamResult, roamStatus, pRoamInfo->reasonCode);
+                     roamResult, roamStatus);
              else
                  hddLog(VOS_TRACE_LEVEL_ERROR,
                      "%s: connect failed:"
                      " for bssid " MAC_ADDRESS_STR
-                     " result:%d and Status:%d" ,
+                     " reason:%d and Status:%d\n" ,
                      __func__, MAC_ADDR_ARRAY(pWextState->req_bssId),
                      roamResult, roamStatus);
 
+            /*Clear the roam profile*/
+            hdd_clearRoamProfileIe( pAdapter );
+
             /* inform association failure event to nl80211 */
             if ( eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == roamResult )
             {
@@ -2069,18 +1675,14 @@
                 if (pRoamInfo)
                     cfg80211_connect_result ( dev, pRoamInfo->bssid,
                         NULL, 0, NULL, 0,
-                        pRoamInfo->reasonCode ?
-                        pRoamInfo->reasonCode :
                         WLAN_STATUS_UNSPECIFIED_FAILURE,
                         GFP_KERNEL );
                 else
                     cfg80211_connect_result ( dev, pWextState->req_bssId,
                         NULL, 0, NULL, 0,
                         WLAN_STATUS_UNSPECIFIED_FAILURE,
-                         GFP_KERNEL );
+                        GFP_KERNEL );
             }
-            /*Clear the roam profile*/
-            hdd_clearRoamProfileIe( pAdapter );
         }
 
         hdd_wmm_init( pAdapter );
@@ -2090,7 +1692,6 @@
             WLANTL_AssocFailed(pRoamInfo->staId);
         }
 
-        hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
         netif_tx_disable(dev);
         netif_carrier_off(dev);
 
@@ -2110,7 +1711,7 @@
                 hddLog(VOS_TRACE_LEVEL_INFO,"Restart Sap as SAP channel is %d "
                        "and STA channel is %d", pHostapdAdapter->sessionCtx.ap.operatingChannel,
                        (int)pRoamInfo->pBssDesc->channelId);
-                hdd_hostapd_stop(pHostapdAdapter->dev);
+                hdd_restart_softap(pHddCtx, pHostapdAdapter);
              }
         }
     }
@@ -2129,11 +1730,6 @@
                                            eRoamCmdStatus roamStatus,
                                            eCsrRoamResult roamResult )
 {
-   hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
-   v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER;
-   struct cfg80211_bss *bss;
-   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-
    hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: id %d, status %d, result %d",
           __func__, pAdapter->dev->name, roamId, roamStatus, roamResult);
 
@@ -2144,6 +1740,9 @@
       case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS:
       case eCSR_ROAM_RESULT_IBSS_COALESCED:
       {
+         hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
+         v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER;
+
          if (NULL == pRoamInfo)
          {
             VOS_ASSERT(0);
@@ -2162,17 +1761,13 @@
          /*notify wmm */
          hdd_wmm_connect(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS);
          pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter;
+         hdd_roamRegisterSTA (pAdapter, pRoamInfo,
+                      IBSS_BROADCAST_STAID,
+                      &broadcastMacAddr, pRoamInfo->pBssDesc);
 
          if (pRoamInfo->pBssDesc)
          {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
-             struct ieee80211_channel *chan;
-             int chan_no;
-             unsigned int freq;
-#endif
-             hdd_ibss_RegisterSTA (pAdapter, pRoamInfo,
-                          IBSS_BROADCAST_STAID,
-                          &broadcastMacAddr, pRoamInfo->pBssDesc);
+            struct cfg80211_bss *bss;
 
             /* we created the IBSS, notify supplicant */
             hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: created ibss "
@@ -2189,73 +1784,15 @@
                       __func__, pAdapter->dev->name);
                return;
             }
-#ifdef WLAN_FEATURE_RMC
-            netif_carrier_on(pAdapter->dev);
-            hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
-            netif_tx_start_all_queues(pAdapter->dev);
-#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
-            chan_no = pRoamInfo->pBssDesc->channelId;
 
-            if (chan_no <= 14)
-                freq = ieee80211_channel_to_frequency(chan_no,
-                                                      IEEE80211_BAND_2GHZ);
-            else
-                freq = ieee80211_channel_to_frequency(chan_no,
-                                                      IEEE80211_BAND_5GHZ);
-
-            chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq);
-
-            if (chan)
-                cfg80211_ibss_joined(pAdapter->dev, bss->bssid,
-                                     chan, GFP_KERNEL);
-            else
-                hddLog(LOGE, FL("%s: chanId: %d, can't find channel"),
-                       pAdapter->dev->name,
-                       (int)pRoamInfo->pBssDesc->channelId);
-#else
             cfg80211_ibss_joined(pAdapter->dev, bss->bssid, GFP_KERNEL);
-#endif
             cfg80211_put_bss(
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
                              pHddCtx->wiphy,
 #endif
                              bss);
          }
-         else
-         {
-             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                       "%s: NULL Bss Desc",__func__);
-         }
 
-         /* Set Broadcast key again in case IBSS_COALESCED as DEL BSS,
-          * in IBSS_COALESCED will remove the BC key.
-          */
-         if ((eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) &&
-             ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY
-                                           == pHddStaCtx->ibss_enc_key.encType
-               ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY
-                                           == pHddStaCtx->ibss_enc_key.encType
-               ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType
-               ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType ))
-         {
-             u8 grpmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
-             VOS_STATUS vosStatus;
-
-             pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX;
-
-             memcpy(&pHddStaCtx->ibss_enc_key.peerMac,
-                            grpmacaddr, WNI_CFG_BSSID_LEN);
-             hddLog(VOS_TRACE_LEVEL_INFO,
-                       FL(" SET GTK in case of COALESCED"));
-             vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter),
-                      pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId );
-             if ( VOS_STATUS_SUCCESS != vosStatus )
-             {
-                hddLog(VOS_TRACE_LEVEL_ERROR,
-                       FL("sme_RoamSetKey failed, returned %d"),vosStatus);
-             }
-         }
          break;
       }
 
@@ -2284,12 +1821,10 @@
   return FALSE.
 
   ===========================================================================*/
-static int roamSaveIbssStation(hdd_adapter_t *pAdapter, v_U8_t staId, v_MACADDR_t *peerMacAddress)
+static int roamSaveIbssStation( hdd_station_ctx_t *pHddStaCtx, v_U8_t staId, v_MACADDR_t *peerMacAddress )
 {
    int fSuccess = FALSE;
    int idx = 0;
-   VOS_STATUS status;
-   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
 
    for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ )
    {
@@ -2304,18 +1839,6 @@
       }
    }
 
-   status = hdd_sta_id_hash_add_entry(pAdapter, staId, peerMacAddress);
-   if (status != VOS_STATUS_SUCCESS) {
-       hddLog(VOS_TRACE_LEVEL_ERROR,
-                 FL("Not able to add staid hash %d"), staId);
-       return FALSE;
-   }
-
-   hddLog(VOS_TRACE_LEVEL_INFO,
-             FL("New station added sta_id %d mac:"
-             MAC_ADDRESS_STR), staId,
-             MAC_ADDR_ARRAY(peerMacAddress->bytes));
-
    return( fSuccess );
 }
 /**============================================================================
@@ -2333,32 +1856,21 @@
    v_U8_t  del_idx   = 0;
    v_U8_t  empty_slots = 0;
    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   VOS_STATUS status;
 
    for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ )
    {
       if ( staId == pHddStaCtx->conn_info.staId[ idx ] )
       {
          pHddStaCtx->conn_info.staId[ idx ] = 0;
-         status = hdd_sta_id_hash_remove_entry(pAdapter,
-                  staId, &pHddStaCtx->conn_info.peerMacAddress[idx]);
-         if (status != VOS_STATUS_SUCCESS) {
-             hddLog(VOS_TRACE_LEVEL_ERROR,
-                      FL("Not able to remove staid hash %d"), staId );
-             fSuccess = FALSE;
-         } else {
-             hddLog(VOS_TRACE_LEVEL_INFO,
-                   FL("station removed sta_id %d mac:"
-                   MAC_ADDRESS_STR), staId,
-                   MAC_ADDR_ARRAY(pHddStaCtx->conn_info.peerMacAddress[idx].bytes));
 
-             vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ] );
+         vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ] );
 
-             fSuccess = TRUE;
-             // Note the deleted Index, if its 0 we need special handling
-             del_idx = idx;
-             empty_slots++;
-         }
+         fSuccess = TRUE;
+
+         // Note the deleted Index, if its 0 we need special handling
+         del_idx = idx;
+
+         empty_slots++;
       }
       else
       {
@@ -2526,9 +2038,7 @@
    v_BOOL_t fConnected   = FALSE;
    VOS_STATUS vosStatus    = VOS_STATUS_E_FAILURE;
    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   WLANTL_STAStateType prevTLState = WLANTL_STA_INIT;
    ENTER();
 
    if (NULL == pRoamInfo)
@@ -2558,8 +2068,6 @@
          {
             vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext,
                                                 IBSS_BROADCAST_STAID);
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-                "WLAN TL STA GTK Installed for STAID=%d", IBSS_BROADCAST_STAID);
             pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
          }
          else
@@ -2579,9 +2087,6 @@
       }
       else
       {
-            WLANTL_GetSTAState(pHddCtx->pvosContext,
-                               pHddStaCtx->conn_info.staId[0],
-                               &prevTLState);
          // TODO: Considering getting a state machine in HDD later.
          // This routine is invoked twice. 1)set PTK 2)set GTK.
          // The folloing if statement will be TRUE when setting GTK.
@@ -2590,10 +2095,9 @@
          if ( ( eCSR_ROAM_RESULT_AUTHENTICATED == roamResult ) &&
              (pRoamInfo != NULL) && !pRoamInfo->fAuthRequired )
          {
-
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "Key set "
-                      "for StaId=%d. Changing TL state to AUTHENTICATED from"
-                      " state:%d", pHddStaCtx->conn_info.staId[0], prevTLState);
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "Key set "
+                       "for StaId= %d.  Changing TL state to AUTHENTICATED",
+                       pHddStaCtx->conn_info.staId[ 0 ] );
 
             // Connections that do not need Upper layer authentication,
             // transition TL to 'Authenticated' state after the keys are set.
@@ -2602,10 +2106,6 @@
                                                WLANTL_STA_AUTHENTICATED );
 
             pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
-
-            if (WLANTL_STA_AUTHENTICATED != prevTLState)
-                hdd_postTLPacketPendingInd(pAdapter,
-                                           pHddStaCtx->conn_info.staId[0]);
             //Need to call offload because when roaming happen at that time fwr
             //clean offload info as part of the DelBss
             // No need to configure offload if host was not suspended
@@ -2619,41 +2119,17 @@
             {
                 spin_unlock(&pHddCtx->filter_lock);
             }
-            if (pHddCtx->cfg_ini->gEnableRoamDelayStats)
-            {
-                vos_record_roam_event(e_HDD_SET_GTK_RSP, NULL, 0);
-            }
+#ifdef DEBUG_ROAM_DELAY
+            vos_record_roam_event(e_HDD_SET_GTK_RSP, NULL, 0);
+#endif
          }
          else
          {
             vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext,
                                                 pHddStaCtx->conn_info.staId[ 0 ]);
-
-            /* In case of  OSEN move TL to 'Authenticated' after PTK is set */
-            if (pWextState->roamProfile.bOSENAssociation == VOS_TRUE)
-            {
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "PTK set"
-                      " for StaId=%d. Due to OSEN, Changing TL state to"
-                      "AUTHENTICATED from state:%d",
-                      pHddStaCtx->conn_info.staId[0], prevTLState);
-
-                vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext,
-                                               pHddStaCtx->conn_info.staId[ 0 ],
-                                               WLANTL_STA_AUTHENTICATED );
-
-                pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
-
-                if (WLANTL_STA_AUTHENTICATED != prevTLState)
-                    hdd_postTLPacketPendingInd(pAdapter,
-                                               pHddStaCtx->conn_info.staId[0]);
-            }
-
-
-
-            if (pHddCtx->cfg_ini->gEnableRoamDelayStats)
-            {
-                vos_record_roam_event(e_HDD_SET_PTK_RSP, (void *)pRoamInfo->peerMac, 6);
-            }
+#ifdef DEBUG_ROAM_DELAY
+            vos_record_roam_event(e_HDD_SET_PTK_RSP, (void *)pRoamInfo->peerMac, 6);
+#endif
          }
 
          pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
@@ -2730,12 +2206,19 @@
          hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
          struct station_info staInfo;
 
-         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   "IBSS New Peer indication from SME with peerMac " MAC_ADDRESS_STR " BSSID: " MAC_ADDRESS_STR " and stationID= %d",
+         pr_info ( "IBSS New Peer indication from SME "
+                    "with peerMac " MAC_ADDRESS_STR " BSSID: " MAC_ADDRESS_STR " and stationID= %d",
                     MAC_ADDR_ARRAY(pRoamInfo->peerMac),
                     MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId),
                     pRoamInfo->staId );
 
+         if ( !roamSaveIbssStation( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pRoamInfo->staId, (v_MACADDR_t *)pRoamInfo->peerMac ) )
+         {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                       "New IBSS peer but we already have the max we can handle.  Can't register this one" );
+            break;
+         }
+
          pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter;
 
          pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter;
@@ -2743,7 +2226,7 @@
                       IBSS_BROADCAST_STAID,pHddStaCtx->conn_info.bssId);
 
          // Register the Station with TL for the new peer.
-         vosStatus = hdd_ibss_RegisterSTA( pAdapter,
+         vosStatus = hdd_roamRegisterSTA( pAdapter,
                                           pRoamInfo,
                                           pRoamInfo->staId,
                                           (v_MACADDR_t *)pRoamInfo->peerMac,
@@ -2754,13 +2237,6 @@
                "Cannot register STA with TL for IBSS.  Failed with vosStatus = %d [%08X]",
                vosStatus, vosStatus );
          }
-         if (!roamSaveIbssStation(pAdapter,
-               pRoamInfo->staId,
-               (v_MACADDR_t *)pRoamInfo->peerMac))
-         {
-            hddLog(LOGW, FL("Not Able to add sta in sta hash"));
-            break;
-         }
          pHddStaCtx->ibss_sta_generation++;
          memset(&staInfo, 0, sizeof(staInfo));
          staInfo.filled = 0;
@@ -2776,7 +2252,6 @@
             ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType )
          {
             pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX;
-
             memcpy(&pHddStaCtx->ibss_enc_key.peerMac,
                               pRoamInfo->peerMac, WNI_CFG_BSSID_LEN);
 
@@ -2796,7 +2271,6 @@
             }
          }
          netif_carrier_on(pAdapter->dev);
-         hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
          netif_tx_start_all_queues(pAdapter->dev);
          break;
       }
@@ -2818,13 +2292,13 @@
                     "IBSS peer departed by cannot find peer in our registration table with TL" );
          }
 
-          VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   "IBSS Peer Departed from SME with peerMac " MAC_ADDRESS_STR " BSSID: " MAC_ADDRESS_STR " and stationID= %d",
+         pr_info ( "IBSS Peer Departed from SME "
+                    "with peerMac " MAC_ADDRESS_STR " BSSID: " MAC_ADDRESS_STR " and stationID= %d",
                     MAC_ADDR_ARRAY(pRoamInfo->peerMac),
                     MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId),
                     pRoamInfo->staId );
 
-         hdd_ibss_DeregisterSTA( pAdapter, pRoamInfo->staId );
+         hdd_roamDeregisterSTA( pAdapter, pRoamInfo->staId );
 
          pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL;
          pHddStaCtx->ibss_sta_generation++;
@@ -2839,7 +2313,6 @@
           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
                     "Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME");
          // Stop only when we are inactive
-         hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
          netif_tx_disable(pAdapter->dev);
          netif_carrier_off(pAdapter->dev);
          VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
@@ -2869,13 +2342,8 @@
   Return: VOS_STATUS
 
   ===========================================================================*/
-VOS_STATUS hdd_roamRegisterTDLSSTA(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                   const tANI_U8 *peerMac,
-#else
-                                   tANI_U8 *peerMac,
-#endif
-                                   tANI_U16 staId, tANI_U8 ucastSig)
+VOS_STATUS hdd_roamRegisterTDLSSTA( hdd_adapter_t *pAdapter,
+                                    tANI_U8 *peerMac, tANI_U16 staId, tANI_U8 ucastSig)
 {
     hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
@@ -2965,7 +2433,7 @@
     return( vosStatus );
 }
 
-VOS_STATUS hdd_roamDeregisterTDLSSTA( hdd_adapter_t *pAdapter, tANI_U8 staId )
+static VOS_STATUS hdd_roamDeregisterTDLSSTA( hdd_adapter_t *pAdapter, tANI_U8 staId )
 {
     VOS_STATUS vosStatus;
     vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId );
@@ -2996,6 +2464,7 @@
     eHalStatus status = eHAL_STATUS_FAILURE ;
     tANI_U8 staIdx;
 
+#ifdef WLAN_FEATURE_TDLS_DEBUG
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
               ("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR),
               roamResult == eCSR_ROAM_RESULT_ADD_TDLS_PEER ?
@@ -3009,31 +2478,17 @@
               roamResult == eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ?
               "UPDATE_TDLS_PEER" :
               roamResult == eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ?
-              "LINK_ESTABLISH_REQ_RSP" :
-              roamResult == eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP ?
-              "CHANNEL_SWITCH_REQ_RSP" : "UNKNOWN",
+              "LINK_ESTABLISH_REQ_RSP" : "UNKNOWN",
               pRoamInfo->staId, MAC_ADDR_ARRAY(pRoamInfo->peerMac));
+#endif
     switch( roamResult )
     {
         case eCSR_ROAM_RESULT_ADD_TDLS_PEER:
         {
             if(eSIR_SME_SUCCESS != pRoamInfo->statusCode)
             {
-                hddTdlsPeer_t *curr_peer;
-
                 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                      ("%s: Add Sta is failed. %d"),__func__, pRoamInfo->statusCode);
-                wlan_hdd_tdls_check_bmps(pAdapter);
-
-                mutex_lock(&pHddCtx->tdls_lock);
-                curr_peer = wlan_hdd_tdls_find_peer(pAdapter,
-                                      pRoamInfo->peerMac, FALSE);
-                if (NULL != curr_peer)
-                    curr_peer->link_status = eTDLS_LINK_TEARING;
-                else
-                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                              "%s %d curr_peer is Null", __func__,__LINE__);
-                mutex_unlock(&pHddCtx->tdls_lock);
             }
             else
             {
@@ -3075,7 +2530,6 @@
                                                       pRoamInfo->peerMac,
                                                       pRoamInfo->staId,
                                                       pRoamInfo->ucastSig);
-                    wlan_hdd_tdls_increment_peer_count(pAdapter);
                 }
                 else
                 {
@@ -3106,35 +2560,12 @@
         {
             if (eSIR_SME_SUCCESS != pRoamInfo->statusCode)
             {
-                hddTdlsPeer_t *curr_peer;
-
                 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                      "%s: Link Establish Request failed. %d", __func__, pRoamInfo->statusCode);
-
-                mutex_lock(&pHddCtx->tdls_lock);
-                curr_peer = wlan_hdd_tdls_find_peer(pAdapter,
-                                       pRoamInfo->peerMac, FALSE);
-                if (curr_peer)
-                    curr_peer->link_status = eTDLS_LINK_TEARING;
-                else
-                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                              "%s %d curr_peer is Null",__func__,__LINE__);
-                mutex_unlock(&pHddCtx->tdls_lock);
             }
             complete(&pAdapter->tdls_link_establish_req_comp);
             break;
         }
-        case eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP:
-        {
-            if (eSIR_SME_SUCCESS != pRoamInfo->statusCode)
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                          "%s: Channel switch request failed. %d", __func__,
-                          pRoamInfo->statusCode);
-            else
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                          "%s: Channel switch request Success", __func__);
-            break;
-        }
         case eCSR_ROAM_RESULT_DELETE_TDLS_PEER:
         {
             hddTdlsPeer_t *curr_peer;
@@ -3146,31 +2577,23 @@
                     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
                                    ("HDD: del STA IDX = %x"), pRoamInfo->staId) ;
 
-                    mutex_lock(&pHddCtx->tdls_lock);
-                    curr_peer = wlan_hdd_tdls_find_peer(pAdapter,
-                                                  pRoamInfo->peerMac, FALSE);
+                    curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac, TRUE);
                     if (NULL != curr_peer)
                     {
                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                                  " Current status for peer" MAC_ADDRESS_STR "is %d",
                                  MAC_ADDR_ARRAY(pRoamInfo->peerMac), curr_peer->link_status);
-                       if (TDLS_IS_CONNECTED(curr_peer) ||
-                          (eTDLS_LINK_CONNECTING == curr_peer->link_status))
+                       if (TDLS_IS_CONNECTED(curr_peer))
                        {
-                           mutex_unlock(&pHddCtx->tdls_lock);
+                           hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId );
+                           wlan_hdd_tdls_decrement_peer_count(pAdapter);
+                       }
+                       else if (eTDLS_LINK_CONNECTING == curr_peer->link_status)
+                       {
                            hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId );
                        }
-                       else
-                           mutex_unlock(&pHddCtx->tdls_lock);
-
-                       wlan_hdd_tdls_decrement_peer_count(pAdapter);
                     }
-                    else
-                        mutex_unlock(&pHddCtx->tdls_lock);
-
-                    mutex_lock(&pHddCtx->tdls_lock);
                     wlan_hdd_tdls_reset_peer(pAdapter, pRoamInfo->peerMac);
-                    mutex_unlock(&pHddCtx->tdls_lock);
 
                     pHddCtx->tdlsConnInfo[staIdx].staId = 0 ;
                     pHddCtx->tdlsConnInfo[staIdx].sessionId = 255;
@@ -3192,13 +2615,8 @@
                        __func__, pRoamInfo->reasonCode);
 
 #ifdef CONFIG_TDLS_IMPLICIT
-            mutex_lock(&pHddCtx->tdls_lock);
-            curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac,
-                                                FALSE);
+            curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac, TRUE);
             wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, pRoamInfo->reasonCode);
-            hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT,
-                                                          curr_peer->peerMac);
-            mutex_unlock(&pHddCtx->tdls_lock);
 #endif
             status = eHAL_STATUS_SUCCESS ;
             break ;
@@ -3215,11 +2633,7 @@
                               ("hdd_tdlsStatusUpdate: staIdx %d " MAC_ADDRESS_STR),
                                 pHddCtx->tdlsConnInfo[staIdx].staId,
                                 MAC_ADDR_ARRAY(pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes));
-
-                    mutex_lock(&pHddCtx->tdls_lock);
                     wlan_hdd_tdls_reset_peer(pAdapter, pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes);
-                    mutex_unlock(&pHddCtx->tdls_lock);
-
                     hdd_roamDeregisterTDLSSTA ( pAdapter,  pHddCtx->tdlsConnInfo[staIdx].staId );
                     wlan_hdd_tdls_decrement_peer_count(pAdapter);
 
@@ -3244,14 +2658,12 @@
 }
 #endif
 
-void iw_full_power_cbfn (void *pContext, eHalStatus status)
+static void iw_full_power_cbfn (void *pContext, eHalStatus status)
 {
     hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext;
     hdd_context_t *pHddCtx = NULL;
     int ret;
 
-    ENTER();
-
     if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
@@ -3264,6 +2676,8 @@
     ret = wlan_hdd_validate_context(pHddCtx);
     if (0 != ret)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               "%s: HDD context is not valid (%d)", __func__, ret);
         return;
     }
 
@@ -3271,8 +2685,6 @@
     {
         sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), NULL, NULL);
     }
-
-    EXIT();
 }
 
 eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, tANI_U32 roamId,
@@ -3283,7 +2695,6 @@
     hdd_wext_state_t *pWextState = NULL;
     hdd_station_ctx_t *pHddStaCtx = NULL;
     VOS_STATUS status = VOS_STATUS_SUCCESS;
-    struct cfg80211_bss *bss_status;
     hdd_context_t *pHddCtx = NULL;
 
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
@@ -3308,13 +2719,14 @@
        return eHAL_STATUS_FAILURE;
     }
 
-    MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG,
-                               pAdapter->sessionId, roamStatus));
     switch( roamStatus )
     {
         case eCSR_ROAM_SESSION_OPENED:
-            set_bit(SME_SESSION_OPENED, &pAdapter->event_flags);
-            complete(&pAdapter->session_open_comp_var);
+            if(pAdapter != NULL)
+            {
+                set_bit(SME_SESSION_OPENED, &pAdapter->event_flags);
+                complete(&pAdapter->session_open_comp_var);
+            }
             break;
 
 #if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
@@ -3346,29 +2758,28 @@
             // after reassoc.
             {
                 struct net_device *dev = pAdapter->dev;
-                hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
                 netif_tx_disable(dev);
-                pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-                if (pHddCtx->cfg_ini->gEnableRoamDelayStats)
-                {
-                    vos_record_roam_event(e_HDD_DISABLE_TX_QUEUE, NULL, 0);
-                }
+#ifdef DEBUG_ROAM_DELAY
+                vos_record_roam_event(e_HDD_DISABLE_TX_QUEUE, NULL, 0);
+#endif
                 /*
-                 * Deregister this STA with TL, but do not flush the packets
-                 * for this STA from wmm_tx_queue. Since there is no valid STA
-                 * for these packets they will not be transmitted. Eventually
-                 * after the reassociation is successful, these packets will be
-                 * transmitted after registering STA with TL again. This ensures
-                 * that driver does not drop packets during roaming.
+                 * Deregister for this STA with TL with the objective to flush
+                 * all the packets for this STA from wmm_tx_queue. If not done here,
+                 * we would run into a race condition (CR390567) wherein TX
+                 * thread would schedule packets from wmm_tx_queue AFTER peer STA has
+                 * been deleted. And, these packets get assigned with a STA idx of
+                 * self-sta (since the peer STA has been deleted) and get transmitted
+                 * on the new channel before the reassoc request. Since there will be
+                 * no ACK on the new channel, each packet gets retransmitted which
+                 * takes several seconds before the transmission of reassoc request.
+                 * This leads to reassoc-timeout and roam failure.
                  */
-                status = WLANTL_ClearSTAClient(pHddCtx->pvosContext,
-                                               pHddStaCtx->conn_info.staId[0]);
-                if (!VOS_IS_STATUS_SUCCESS(status))
+                status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] );
+                if ( !VOS_IS_STATUS_SUCCESS(status ) )
                 {
-                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                              FL("WLANTL_ClearSTAClient failed for staID %d."
-                              "Status= %d [0x%x]"), pHddStaCtx->conn_info.staId[0],
-                              status, status);
+                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                            FL("hdd_roamDeregisterSTA() failed to for staID %d.  Status= %d [0x%x]"),
+                            pHddStaCtx->conn_info.staId[0], status, status );
                     halStatus = eHAL_STATUS_FAILURE;
                 }
             }
@@ -3383,7 +2794,6 @@
                 struct net_device *dev = pAdapter->dev;
                 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
                 // notify apps that we can't pass traffic anymore
-                hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
                 netif_tx_disable(dev);
 #if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
                 if (pHddStaCtx->ft_carrier_on == FALSE)
@@ -3475,26 +2885,15 @@
         case eCSR_ROAM_MIC_ERROR_IND:
             halStatus = hdd_RoamMicErrorIndicationHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
             break;
-        case eCSR_ROAM_LOST_LINK_PARAMS_IND:
-            {
-                /*
-                 * The RSSI will be subtracted from 100 as FW is sending the RSSI by
-                 * adding the 100 value.
-                 */
-                pAdapter->rssi_on_disconnect = pRoamInfo->u.pLostLinkParams->rssi - 100;
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                    "%s : Rssi on Disconnect : %d",
-                    __func__, pAdapter->rssi_on_disconnect);
-                break;
-            }
+
         case eCSR_ROAM_SET_KEY_COMPLETE:
             {
                 hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
 
                 if((pHddCtx) &&
+                   (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) &&
                    (TRUE == pHddCtx->hdd_wlan_suspended) &&
-                   ((eCSR_ROAM_RESULT_NONE == roamResult)||
-                     (pRoamInfo && pRoamInfo->is11rAssoc)))
+                   (eCSR_ROAM_RESULT_NONE == roamResult))
                 {
                     /* Send DTIM period to the FW; only if the wlan is already
                        in suspend. This is the case with roaming (reassoc),
@@ -3503,6 +2902,7 @@
                        before the ENTER_BMPS_REQ ensures Listen Interval is
                        regained back to LI * Modulated DTIM */
                     hdd_set_pwrparams(pHddCtx);
+                    pHddStaCtx->hdd_ReassocScenario = VOS_FALSE;
 
                     /* At this point, device should not be in BMPS;
                        if due to unexpected scenario, if we are in BMPS,
@@ -3517,27 +2917,8 @@
                                          eSME_FULL_PWR_NEEDED_BY_HDD);
                     }
                 }
-
-                if ((pHddCtx) &&
-                    (FULL_POWER == pmcGetPmcState(pHddCtx->hHal)) &&
-                    (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) &&
-                    ((eCSR_ROAM_RESULT_NONE == roamResult) ||
-                      (pRoamInfo && pRoamInfo->is11rAssoc)))
-                {
-                    hddLog( LOG1, FL("Device in full power."
-                           "Stop and start traffic timer for roaming"));
-                    pmcStopTrafficTimer(pHddCtx->hHal);
-                    if (pmcStartTrafficTimer(pHddCtx->hHal,
-                        TRAFFIC_TIMER_ROAMING) != eHAL_STATUS_SUCCESS)
-                    {
-                       hddLog(LOGP, FL("Cannot start traffic timer"));
-                    }
-                }
-
                 halStatus = hdd_RoamSetKeyCompleteHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
-                if ((eCSR_ROAM_RESULT_NONE == roamResult) ||
-                     (pRoamInfo && pRoamInfo->is11rAssoc))
-                    pHddStaCtx->hdd_ReassocScenario = FALSE;
+                pHddStaCtx->hdd_ReassocScenario = FALSE;
             }
             break;
 #ifdef WLAN_FEATURE_VOWIFI_11R
@@ -3592,6 +2973,15 @@
            }
            break;
 #endif
+
+        case eCSR_ROAM_INDICATE_MGMT_FRAME:
+            hdd_indicateMgmtFrame( pAdapter,
+                                  pRoamInfo->nFrameLength,
+                                  pRoamInfo->pbFrames,
+                                  pRoamInfo->frameType,
+                                  pRoamInfo->rxChan,
+                                  pRoamInfo->rxRssi );
+            break;
         case eCSR_ROAM_REMAIN_CHAN_READY:
             hdd_remainChanReadyHandler( pAdapter );
             break;
@@ -3643,26 +3033,7 @@
             break;
          }
 #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
-       case eCSR_ROAM_UPDATE_MAX_RATE_IND:
-         {
-            pAdapter->maxRateFlags = roamResult;
-            break;
-         }
-       case eCSR_ROAM_UPDATE_SCAN_RESULT:
-         if (pRoamInfo && pRoamInfo->pBssDesc) {
-              bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter,
-                                pRoamInfo->pBssDesc);
-              if (bss_status)
-                  cfg80211_put_bss(
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS)
-                                   (WLAN_HDD_GET_CTX(pAdapter))->wiphy,
-#endif
-                                   bss_status);
-              else
-                  hddLog(LOG1, FL("UPDATE_SCAN_RESULT returned NULL"));
-         }
-         break;
-       default:
+        default:
             break;
     }
     return( halStatus );
@@ -3844,6 +3215,14 @@
     memset( &dot11WPAIE, 0 , sizeof(tDot11fIEWPA) );
     memset( &dot11RSNIE, 0 , sizeof(tDot11fIERSN) );
 
+    // Validity checks
+    if ((gen_ie_len < VOS_MIN(DOT11F_IE_RSN_MIN_LEN, DOT11F_IE_WPA_MIN_LEN)) ||
+            (gen_ie_len > VOS_MAX(DOT11F_IE_RSN_MAX_LEN, DOT11F_IE_WPA_MAX_LEN)) )
+    {
+        hddLog(LOGE, "%s: Invalid DOT11F IE Length passed :%d",
+               __func__,  gen_ie_len);
+        return -EINVAL;
+    }
     // Type check
     if ( gen_ie[0] ==  DOT11F_EID_RSN)
     {
@@ -3960,8 +3339,8 @@
     eCsrEncryptionType RSNEncryptType;
     eCsrEncryptionType mcRSNEncryptType;
 #ifdef WLAN_FEATURE_11W
-    u_int8_t RSNMfpRequired = 0;
-    u_int8_t RSNMfpCapable = 0;
+    u_int8_t RSNMfpRequired;
+    u_int8_t RSNMfpCapable;
 #endif
     struct ether_addr   bSsid;   // MAC address of assoc peer
     // MAC address of assoc peer
@@ -4014,14 +3393,10 @@
         }
 
 #ifdef WLAN_FEATURE_11W
-        hddLog( LOG1, FL("RSNMfpRequired = %d, RSNMfpCapable = %d"),
-                                       RSNMfpRequired, RSNMfpCapable);
         pWextState->roamProfile.MFPRequired = RSNMfpRequired;
         pWextState->roamProfile.MFPCapable = RSNMfpCapable;
 #endif
-        hddLog( LOG1,
-          FL("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d"),
-          *RSNAuthType, RSNEncryptType, mcRSNEncryptType);
+        hddLog( LOG1, "%s: CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", __func__, *RSNAuthType, RSNEncryptType, mcRSNEncryptType);
     }
     return 0;
 }
@@ -4143,7 +3518,7 @@
 
 /**---------------------------------------------------------------------------
 
-  \brief __iw_set_essid() -
+  \brief iw_set_essid() -
    This function sets the ssid received from wpa_supplicant
    to the CSR roam profile.
 
@@ -4155,59 +3530,31 @@
 
   --------------------------------------------------------------------------*/
 
-int __iw_set_essid(struct net_device *dev,
-                   struct iw_request_info *info,
-                   union iwreq_data *wrqu, char *extra)
+int iw_set_essid(struct net_device *dev,
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
 {
     v_U32_t status = 0;
     hdd_wext_state_t *pWextState;
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     v_U32_t roamId;
     tCsrRoamProfile          *pRoamProfile;
     eMib_dot11DesiredBssType connectedBssType;
     eCsrAuthType RSNAuthType;
-    tHalHandle hHal;
-    hdd_station_ctx_t *pHddStaCtx;
-    int ret = 0;
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
 
     ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+        return 0;
     }
 
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
-    hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    if (NULL == pHddStaCtx)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: STA Context is NULL",__func__);
-        return -EINVAL;
-    }
-    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-    if (NULL == pWextState)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pWextState is NULL",__func__);
-        return -EINVAL;
-    }
     if(pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) {
         hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s :Counter measure is in progress", __func__);
         return -EBUSY;
@@ -4330,46 +3677,8 @@
         hdd_select_cbmode(pAdapter,
             (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->AdHocChannel5G);
     }
-   /*
-    * Change conn_state to connecting before sme_RoamConnect(),
-    * because sme_RoamConnect() has a direct path to call
-    * hdd_smeRoamCallback(), which will change the conn_state
-    * If direct path, conn_state will be accordingly changed
-    * to NotConnected or Associated by either
-    * hdd_AssociationCompletionHandler() or hdd_DisConnectHandler()
-    * in sme_RoamCallback()
-    * if sme_RomConnect is to be queued,
-    * Connecting state will remain until it is completed.
-    *
-    * If connection state is not changed,
-    * connection state will remain in eConnectionState_NotConnected state.
-    * In hdd_AssociationCompletionHandler, "hddDisconInProgress" is set to true
-    * if conn state is eConnectionState_NotConnected.
-    * If "hddDisconInProgress" is set to true then cfg80211 layer is not
-    * informed of connect result indication which is an issue.
-    */
-    if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode ||
-            WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                   FL("Set HDD connState to eConnectionState_Connecting"));
-        hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
-                                                 eConnectionState_Connecting);
-    }
     status = sme_RoamConnect( hHal,pAdapter->sessionId,
                          &(pWextState->roamProfile), &roamId);
-
-    if ((eHAL_STATUS_SUCCESS != status) &&
-        (WLAN_HDD_INFRA_STATION == pAdapter->device_mode ||
-        WLAN_HDD_P2P_CLIENT == pAdapter->device_mode))
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-               FL("sme_RoamConnect (session %d) failed with status %d. -> NotConnected"),
-                            pAdapter->sessionId, status);
-            /* change back to NotAssociated */
-        hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
-                                             eConnectionState_NotConnected);
-    }
     pRoamProfile->ChannelInfo.ChannelList = NULL;
     pRoamProfile->ChannelInfo.numOfChannels = 0;
 
@@ -4377,22 +3686,9 @@
     return status;
 }
 
-int iw_set_essid(struct net_device *dev,
-                 struct iw_request_info *info,
-                 union iwreq_data *wrqu, char *extra)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __iw_set_essid(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 /**---------------------------------------------------------------------------
 
-  \brief __iw_get_essid() -
+  \brief iw_get_essid() -
    This function returns the essid to the wpa_supplicant.
 
   \param  - dev - Pointer to the net device.
@@ -4402,49 +3698,15 @@
   \return - 0 for success, non zero for failure
 
   --------------------------------------------------------------------------*/
-int __iw_get_essid(struct net_device *dev,
-                   struct iw_request_info *info,
-                   struct iw_point *dwrq, char *extra)
+int iw_get_essid(struct net_device *dev,
+                       struct iw_request_info *info,
+                       struct iw_point *dwrq, char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   hdd_wext_state_t *wextBuf;
-   hdd_station_ctx_t *pHddStaCtx;
-   int ret = 0;
-
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_wext_state_t *wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
    ENTER();
 
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-
-   pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   if (NULL == pHddStaCtx)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: STA Context is NULL",__func__);
-       return -EINVAL;
-   }
-
-   wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-   if (NULL == wextBuf)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: wextBuf is NULL",__func__);
-       return -EINVAL;
-   }
-
    if((pHddStaCtx->conn_info.connState == eConnectionState_Associated &&
      wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) ||
       ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected ||
@@ -4462,22 +3724,9 @@
    EXIT();
    return 0;
 }
-
-int iw_get_essid(struct net_device *dev,
-                 struct iw_request_info *info,
-                 struct iw_point *dwrq, char *extra)
-{
-   int ret;
-
-   vos_ssr_protect(__func__);
-   ret = __iw_get_essid(dev, info, dwrq, extra);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
 /**---------------------------------------------------------------------------
 
-  \brief __iw_set_auth() -
+  \brief iw_set_auth() -
    This function sets the auth type received from the wpa_supplicant.
 
   \param  - dev - Pointer to the net device.
@@ -4487,53 +3736,25 @@
   \return - 0 for success, non zero for failure
 
   --------------------------------------------------------------------------*/
-int __iw_set_auth(struct net_device *dev,struct iw_request_info *info,
-                  union iwreq_data *wrqu,char *extra)
+int iw_set_auth(struct net_device *dev,struct iw_request_info *info,
+                        union iwreq_data *wrqu,char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   hdd_wext_state_t *pWextState;
-   hdd_station_ctx_t *pHddStaCtx;
-   tCsrRoamProfile *pRoamProfile;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+   tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile;
    eCsrEncryptionType mcEncryptionType;
    eCsrEncryptionType ucEncryptionType;
-   int ret = 0;
 
    ENTER();
 
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+              "%s:LOGP in Progress. Ignore!!!", __func__);
+       return -EBUSY;
    }
 
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-
-   pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   if (NULL == pHddStaCtx)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: STA Context is NULL",__func__);
-       return -EINVAL;
-   }
-
-   pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-   if (NULL == pWextState)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: pWextState is NULL",__func__);
-       return -EINVAL;
-   }
-
-   pRoamProfile = &pWextState->roamProfile;
-
    switch(wrqu->param.flags & IW_AUTH_INDEX)
    {
       case IW_AUTH_WPA_VERSION:
@@ -4729,22 +3950,9 @@
    EXIT();
    return 0;
 }
-
-int iw_set_auth(struct net_device *dev, struct iw_request_info *info,
-                union iwreq_data *wrqu, char *extra)
-{
-   int ret;
-
-   vos_ssr_protect(__func__);
-   ret = __iw_set_auth(dev, info, wrqu, extra);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
 /**---------------------------------------------------------------------------
 
-  \brief __iw_get_auth() -
+  \brief iw_get_auth() -
    This function returns the auth type to the wpa_supplicant.
 
   \param  - dev - Pointer to the net device.
@@ -4754,41 +3962,21 @@
   \return - 0 for success, non zero for failure
 
   --------------------------------------------------------------------------*/
-int __iw_get_auth(struct net_device *dev,struct iw_request_info *info,
-                  union iwreq_data *wrqu,char *extra)
+int iw_get_auth(struct net_device *dev,struct iw_request_info *info,
+                         union iwreq_data *wrqu,char *extra)
 {
-    hdd_adapter_t* pAdapter;
-    hdd_wext_state_t *pWextState;
-    tCsrRoamProfile *pRoamProfile;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
-
+    hdd_adapter_t* pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile;
     ENTER();
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+              "%s:LOGP in Progress. Ignore!!!", __func__);
+        return -EBUSY;
     }
 
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
-    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-    if (NULL == pWextState)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pWextState is NULL",__func__);
-        return -EINVAL;
-    }
-    pRoamProfile = &pWextState->roamProfile;
-
     switch(pRoamProfile->negotiatedAuthType)
     {
         case eCSR_AUTH_TYPE_WPA_NONE:
@@ -4900,22 +4088,9 @@
     EXIT();
     return 0;
 }
-
-int iw_get_auth(struct net_device *dev,struct iw_request_info *info,
-                union iwreq_data *wrqu,char *extra)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __iw_get_auth(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 /**---------------------------------------------------------------------------
 
-  \brief __iw_set_ap_address() -
+  \brief iw_set_ap_address() -
    This function calls the sme_RoamConnect function to associate
    to the AP with the specified BSSID received from the wpa_supplicant.
 
@@ -4926,64 +4101,24 @@
   \return - 0 for success, non zero for failure
 
   --------------------------------------------------------------------------*/
-int __iw_set_ap_address(struct net_device *dev,
-                        struct iw_request_info *info,
-                        union iwreq_data *wrqu, char *extra)
+int iw_set_ap_address(struct net_device *dev,
+        struct iw_request_info *info,
+        union iwreq_data *wrqu, char *extra)
 {
-    hdd_station_ctx_t *pHddStaCtx;
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    v_U8_t  *pMacAddress = NULL;
-    int ret = 0;
-
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev));
+    v_U8_t  *pMacAddress=NULL;
     ENTER();
-
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL", __func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    if (NULL == pHddStaCtx)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pHddStaCtx is NULL", __func__);
-        return -EINVAL;
-    }
-
     pMacAddress = (v_U8_t*) wrqu->ap_addr.sa_data;
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s "MAC_ADDRESS_STR,
               __func__, MAC_ADDR_ARRAY(pMacAddress));
     vos_mem_copy( pHddStaCtx->conn_info.bssId, pMacAddress, sizeof( tCsrBssid ));
-
     EXIT();
+
     return 0;
 }
-
-int iw_set_ap_address(struct net_device *dev,
-                        struct iw_request_info *info,
-                        union iwreq_data *wrqu, char *extra)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __iw_set_ap_address(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 /**---------------------------------------------------------------------------
 
-  \brief __iw_get_ap_address() -
+  \brief iw_get_ap_address() -
    This function returns the BSSID to the wpa_supplicant
   \param  - dev - Pointer to the net device.
               - info - Pointer to the iw_request_info.
@@ -4992,38 +4127,15 @@
   \return - 0 for success, non zero for failure
 
   --------------------------------------------------------------------------*/
-int __iw_get_ap_address(struct net_device *dev,
-                        struct iw_request_info *info,
-                        union iwreq_data *wrqu, char *extra)
+int iw_get_ap_address(struct net_device *dev,
+                             struct iw_request_info *info,
+                             union iwreq_data *wrqu, char *extra)
 {
-    hdd_station_ctx_t *pHddStaCtx;
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
+    //hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev));
 
     ENTER();
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-               "%s: Adapter is NULL", __func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    if (NULL == pHddStaCtx)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-               "%s: pHddStaCtx is NULL", __func__);
-        return -EINVAL;
-    }
-
     if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) ||
         (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState))
     {
@@ -5037,19 +4149,6 @@
     return 0;
 }
 
-int iw_get_ap_address(struct net_device *dev,
-                        struct iw_request_info *info,
-                        union iwreq_data *wrqu, char *extra)
-{
-   int ret;
-
-   vos_ssr_protect(__func__);
-   ret = __iw_get_ap_address(dev, info, wrqu, extra);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
 #ifdef WLAN_FEATURE_11W
 /**---------------------------------------------------------------------------
 
@@ -5109,20 +4208,12 @@
     /* Get pAdapter from Destination mac address of the frame */
     if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC)
     {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
-        cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, nFrameLength);
-#else
         cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, nFrameLength);
-#endif
         pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++;
     }
     else if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DEAUTH)
     {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
-        cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, nFrameLength);
-#else
         cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, nFrameLength);
-#endif
         pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++;
     }
     else
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_cfg.c b/wlan/prima/CORE/HDD/src/wlan_hdd_cfg.c
index c659b1c..047f1e3 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_cfg.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_cfg.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1859,13 +1859,6 @@
                  CFG_FT_RESOURCE_REQ_MAX ),
 #endif
 
-   REG_VARIABLE( CFG_ENABLE_ROAM_DELAY_STATS, WLAN_PARAM_Integer,
-                 hdd_config_t, gEnableRoamDelayStats,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_ENABLE_ROAM_DELAY_STATS_DEFAULT,
-                 CFG_ENABLE_ROAM_DELAY_STATS_MIN,
-                 CFG_ENABLE_ROAM_DELAY_STATS_MAX ),
-
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
    REG_DYNAMIC_VARIABLE( CFG_NEIGHBOR_SCAN_TIMER_PERIOD_NAME, WLAN_PARAM_Integer,
                  hdd_config_t, nNeighborScanPeriod,
@@ -2776,69 +2769,6 @@
                         CFG_ENABLE_FAST_ROAM_IN_CONCURRENCY_MIN,
                         CFG_ENABLE_FAST_ROAM_IN_CONCURRENCY_MAX,
                         cbNotifySetEnableFastRoamInConcurrency, 0 ),
-
-   REG_VARIABLE(CFG_PER_ROAM_SCAN_OFFLOAD_ENABLED, WLAN_PARAM_Integer,
-                 hdd_config_t, isPERRoamEnabled,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_PER_ROAM_SCAN_OFFLOAD_ENABLED_DEFAULT,
-                 CFG_PER_ROAM_SCAN_OFFLOAD_ENABLED_MIN,
-                 CFG_PER_ROAM_SCAN_OFFLOAD_ENABLED_MAX),
-
-   REG_VARIABLE(CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD, WLAN_PARAM_Integer,
-                 hdd_config_t, rateUpThreshold,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD_DEFAULT,
-                 CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD_MIN,
-                 CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD_MAX),
-
-   REG_VARIABLE(CFG_PER_ROAM_SCAN_RATE_DOWN_THRESHOLD, WLAN_PARAM_Integer,
-                 hdd_config_t, rateDownThreshold,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_PER_ROAM_SCAN_RATE_DOWN_THRESHOLD_DEFAULT,
-                 CFG_PER_ROAM_SCAN_RATE_DOWN_THRESHOLD_MIN,
-                 CFG_PER_ROAM_SCAN_RATE_DOWN_THRESHOLD_MAX),
-
-   REG_VARIABLE(CFG_PER_ROAM_SCAN_WAIT_TIME, WLAN_PARAM_Integer,
-                 hdd_config_t, waitPeriodForNextPERScan,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_PER_ROAM_SCAN_WAIT_TIME_DEFAULT,
-                 CFG_PER_ROAM_SCAN_WAIT_TIME_MIN,
-                 CFG_PER_ROAM_SCAN_WAIT_TIME_MAX),
-
-   REG_VARIABLE(CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD, WLAN_PARAM_Integer,
-                 hdd_config_t, PERtimerThreshold,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD_DEFAULT,
-                 CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD_MIN,
-                 CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD_MAX),
-
-   REG_VARIABLE(CFG_PER_ROAM_SCAN_RX_MONITOR_ENABLED, WLAN_PARAM_Integer,
-                 hdd_config_t, isPERRoamRxPathEnabled,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_PER_ROAM_SCAN_RX_MONITOR_ENABLED_DEFAULT,
-                 CFG_PER_ROAM_SCAN_RX_MONITOR_ENABLED_MIN,
-                 CFG_PER_ROAM_SCAN_RX_MONITOR_ENABLED_MAX),
-
-   REG_VARIABLE(CFG_PER_ROAM_SCAN_MIN_PERCENTAGE, WLAN_PARAM_Integer,
-                 hdd_config_t, PERroamTriggerPercent,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_PER_ROAM_SCAN_MIN_PERCENTAGE_DEFAULT,
-                 CFG_PER_ROAM_SCAN_MIN_PERCENTAGE_MIN,
-                 CFG_PER_ROAM_SCAN_MIN_PERCENTAGE_MAX),
-
-   REG_VARIABLE(CFG_PER_ROAM_SCAN_RX_MIN_PACKETS, WLAN_PARAM_Integer,
-                 hdd_config_t, PERroamRxPktsThreshold,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_PER_ROAM_SCAN_RX_MIN_PACKETS_DEFAULT,
-                 CFG_PER_ROAM_SCAN_RX_MIN_PACKETS_MIN,
-                 CFG_PER_ROAM_SCAN_RX_MIN_PACKETS_MAX),
-
-   REG_VARIABLE(CFG_PER_ROAM_SCAN_CCA_ENABLED, WLAN_PARAM_Integer,
-                 hdd_config_t, isPERRoamCCAEnabled,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_PER_ROAM_SCAN_CCA_ENABLED_DEFAULT,
-                 CFG_PER_ROAM_SCAN_CCA_ENABLED_MIN,
-                 CFG_PER_ROAM_SCAN_CCA_ENABLED_MAX),
 #endif
 
    REG_VARIABLE( CFG_ENABLE_ADAPT_RX_DRAIN_NAME, WLAN_PARAM_Integer,
@@ -2988,7 +2918,7 @@
                  CFG_ASD_PROBE_INTERVAL_MIN,
                  CFG_ASD_PROBE_INTERVAL_MAX),
 
-   REG_VARIABLE( CFG_ASD_TRIGGER_THRESHOLD_NAME, WLAN_PARAM_SignedInteger,
+   REG_VARIABLE( CFG_ASD_TRIGGER_THRESHOLD_NAME, WLAN_PARAM_Integer,
                  hdd_config_t, gAsdTriggerThreshold,
                  VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
                  CFG_ASD_TRIGGER_THRESHOLD_DEFAULT,
@@ -3066,12 +2996,12 @@
                  CFG_DEFAULT_RATE_INDEX_24GH_MIN,
                  CFG_DEFAULT_RATE_INDEX_24GH_MAX ),
 
-   REG_VARIABLE( CFG_SAP_ENABLE_11AC_NAME, WLAN_PARAM_Integer,
-                 hdd_config_t, sapEnable11AC,
+   REG_VARIABLE( CFG_SAP_DOT11_MODE_NAME, WLAN_PARAM_Integer,
+                 hdd_config_t, sapDot11Mode,
                  VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK,
-                 CFG_SAP_ENABLE_11AC_DEFAULT,
-                 CFG_SAP_ENABLE_11AC_MIN,
-                 CFG_SAP_ENABLE_11AC_MAX ),
+                 CFG_SAP_DOT11_MODE_DEFAULT,
+                 CFG_SAP_DOT11_MODE_MIN,
+                 CFG_SAP_DOT11_MODE_MAX ),
 
    REG_VARIABLE(CFG_RA_FILTER_ENABLE_NAME, WLAN_PARAM_Integer,
                 hdd_config_t, cfgRAFilterEnable,
@@ -3115,39 +3045,8 @@
                  CFG_WLAN_LOGGING_NUM_BUF_DEFAULT,
                  CFG_WLAN_LOGGING_NUM_BUF_MIN,
                  CFG_WLAN_LOGGING_NUM_BUF_MAX ),
-
-   REG_VARIABLE( CFG_WLAN_PKT_STATS_LOGGING_NAME, WLAN_PARAM_Integer,
-                 hdd_config_t, wlanPerPktStatsLogEnable,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_WLAN_PKT_STATS_LOGGING_DEFAULT,
-                 CFG_WLAN_PKT_STATS_LOGGING_DISABLE,
-                 CFG_WLAN_PKT_STATS_LOGGING_ENABLE ),
-
-   REG_VARIABLE( CFG_WLAN_PKT_STATS_NUM_BUF_NAME, WLAN_PARAM_Integer,
-                 hdd_config_t, wlanPerPktStatsNumBuf,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_WLAN_PKT_STATS_NUM_BUF_DEFAULT,
-                 CFG_WLAN_PKT_STATS_NUM_BUF_MIN,
-                 CFG_WLAN_PKT_STATS_NUM_BUF_MAX ),
-
 #endif //WLAN_LOGGING_SOCK_SVC_ENABLE
 
-   REG_VARIABLE( CFG_IGNORE_PEER_ERP_INFO_NAME, WLAN_PARAM_Integer,
-                  hdd_config_t, ignorePeerErpInfo,
-                  VAR_FLAGS_OPTIONAL |
-                  VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                  CFG_IGNORE_PEER_ERP_INFO_DEFAULT,
-                  CFG_IGNORE_PEER_ERP_INFO_MIN,
-                  CFG_IGNORE_PEER_ERP_INFO_MAX ),
-
-   REG_VARIABLE( CFG_IGNORE_PEER_HT_MODE_NAME, WLAN_PARAM_Integer,
-                  hdd_config_t, ignorePeerHTopMode,
-                  VAR_FLAGS_OPTIONAL |
-                  VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                  CFG_IGNORE_PEER_HT_MODE_DEFAULT,
-                  CFG_IGNORE_PEER_HT_MODE_MIN,
-                  CFG_IGNORE_PEER_HT_MODE_MAX ),
-
    REG_VARIABLE(CFG_INITIAL_DWELL_TIME_NAME, WLAN_PARAM_Integer,
                hdd_config_t, nInitialDwellTime,
                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@@ -3227,62 +3126,6 @@
                 CFG_ENABLE_MAC_ADDR_SPOOFING_MIN,
                 CFG_ENABLE_MAC_ADDR_SPOOFING_MAX),
 
-   REG_VARIABLE(CFG_DISABLE_P2P_MAC_ADDR_SPOOFING, WLAN_PARAM_Integer,
-                hdd_config_t, disableP2PMacSpoofing,
-                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                CFG_DISABLE_P2P_MAC_ADDR_SPOOFING_DEFAULT,
-                CFG_DISABLE_P2P_MAC_ADDR_SPOOFING_MIN,
-                CFG_DISABLE_P2P_MAC_ADDR_SPOOFING_MAX),
-
-   REG_VARIABLE(CFG_ENABLE_FATAL_EVENT_TRIGGER, WLAN_PARAM_Integer,
-                hdd_config_t, enableFatalEvent,
-                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                CFG_ENABLE_FATAL_EVENT_TRIGGER_DEFAULT,
-                CFG_ENABLE_FATAL_EVENT_TRIGGER_MIN,
-                CFG_ENABLE_FATAL_EVENT_TRIGGER_MAX),
-
-   REG_VARIABLE(CFG_ENABLE_MGMT_LOGGING, WLAN_PARAM_Integer,
-                hdd_config_t, enableMgmtLogging,
-                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                CFG_ENABLE_MGMT_LOGGING_DEFAULT,
-                CFG_ENABLE_MGMT_LOGGING_MIN,
-                CFG_ENABLE_MGMT_LOGGING_MAX),
-
-   REG_VARIABLE(CFG_ENABLE_BMUHW_TRACING, WLAN_PARAM_Integer,
-                hdd_config_t, enableBMUHWtracing,
-                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                CFG_ENABLE_BMUHW_TRACING_DEFAULT,
-                CFG_ENABLE_BMUHW_TRACING_MIN,
-                CFG_ENABLE_BMUHW_TRACING_MAX),
-
-   REG_VARIABLE(CFG_ENABLE_FW_LOGGING, WLAN_PARAM_Integer,
-                hdd_config_t, enableFWLogging,
-                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                CFG_ENABLE_FW_LOGGING_DEFAULT,
-                CFG_ENABLE_FW_LOGGING_MIN,
-                CFG_ENABLE_FW_LOGGING_MAX),
-
-   REG_VARIABLE(CFG_ENABLE_FW_CONTINIOUS_LOGGING, WLAN_PARAM_Integer,
-                hdd_config_t, enableContFWLogging,
-                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                CFG_ENABLE_FW_CONTINIOUS_LOGGING_DEFAULT,
-                CFG_ENABLE_FW_CONTINIOUS_LOGGING_MIN,
-                CFG_ENABLE_FW_CONTINIOUS_LOGGING_MAX),
-
-   REG_VARIABLE(CFG_MIN_LOGGING_BUFFER_SIZE, WLAN_PARAM_Integer,
-                hdd_config_t, minLoggingBufferSize,
-                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                CFG_MIN_LOGGING_BUFFER_SIZE_DEFAULT,
-                CFG_MIN_LOGGING_BUFFER_SIZE_MIN,
-                CFG_MIN_LOGGING_BUFFER_SIZE_MAX),
-
-   REG_VARIABLE(CFG_MAX_LOGGING_BUFFER_SIZE, WLAN_PARAM_Integer,
-                hdd_config_t, maxLoggingBufferSize,
-                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                CFG_MAX_LOGGING_BUFFER_SIZE_DEFAULT,
-                CFG_MAX_LOGGING_BUFFER_SIZE_MIN,
-                CFG_MAX_LOGGING_BUFFER_SIZE_MAX),
-
    REG_VARIABLE(CFG_ENABLE_CH_AVOID, WLAN_PARAM_Integer,
                  hdd_config_t, fenableCHAvoidance,
                  VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@@ -3296,16 +3139,6 @@
                 CFG_MAX_CONCURRENT_CONNECTIONS_DEFAULT,
                 CFG_MAX_CONCURRENT_CONNECTIONS_MIN,
                 CFG_MAX_CONCURRENT_CONNECTIONS_MAX ),
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-   REG_VARIABLE(CFG_ENABLE_HT_2040_COEX, WLAN_PARAM_Integer,
-                hdd_config_t, apHT40_24GEnabled,
-                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                CFG_ENABLE_HT_2040_COEX_DEFAULT,
-                CFG_ENABLE_HT_2040_COEX_MIN,
-                CFG_ENABLE_HT_2040_COEX_MAX ),
-#endif
-
    REG_VARIABLE( CFG_ENABLE_DYNAMIC_WMMPS_NAME, WLAN_PARAM_Integer,
                 hdd_config_t, enableDynamicWMMPS,
                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@@ -3362,6 +3195,14 @@
                 CFG_MAX_UAPSD_INACT_INTVL_MIN,
                 CFG_MAX_UAPSD_INACT_INTVL_MAX ),
 
+   REG_VARIABLE( CFG_DEBUG_DHCP, WLAN_PARAM_Integer,
+                  hdd_config_t, enableDhcpDebug,
+                  VAR_FLAGS_OPTIONAL |
+                  VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+                  CFG_DEBUG_DHCP_DEFAULT,
+                  CFG_DEBUG_DHCP_DISABLE,
+                  CFG_DEBUG_DHCP_ENABLE ),
+
    REG_VARIABLE( CFG_BURST_MODE_BE_TXOP_VALUE, WLAN_PARAM_Integer,
                   hdd_config_t, burstModeTXOPValue,
                   VAR_FLAGS_OPTIONAL |
@@ -3384,14 +3225,6 @@
                   CFG_ENABLE_DYNAMIC_RA_START_RATE_MIN,
                   CFG_ENABLE_DYNAMIC_RA_START_RATE_MAX),
 
-   REG_VARIABLE( CFG_P2P_LISTEN_DEFER_INTERVAL_NAME, WLAN_PARAM_Integer,
-                  hdd_config_t, gP2PListenDeferInterval,
-                  VAR_FLAGS_OPTIONAL |
-                  VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                  CFG_P2P_LISTEN_DEFER_INTERVAL_DEFAULT,
-                  CFG_P2P_LISTEN_DEFER_INTERVAL_MIN,
-                  CFG_P2P_LISTEN_DEFER_INTERVAL_MAX),
-
    REG_VARIABLE( CFG_BTC_ENABLE_IND_TIMER_VALUE, WLAN_PARAM_Integer,
                   hdd_config_t, btcEnableIndTimerVal,
                   VAR_FLAGS_OPTIONAL |
@@ -3407,297 +3240,6 @@
                  CFG_BTC_FAST_WLAN_CONN_PREF_MIN,
                  CFG_BTC_FAST_WLAN_CONN_PREF_MAX ),
 
-   REG_VARIABLE( CFG_ENABLE_RTSCTS_HTVHT_NAME, WLAN_PARAM_Integer,
-                  hdd_config_t, enableRtsCtsHtVht,
-                  VAR_FLAGS_OPTIONAL |
-                  VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                  CFG_ENABLE_RTSCTS_HTVHT_DEFAULT,
-                  CFG_ENABLE_RTSCTS_HTVHT_MIN,
-                  CFG_ENABLE_RTSCTS_HTVHT_MAX),
-
-   REG_VARIABLE( CFG_DXE_REPLENISH_RX_TIMER_VALUE, WLAN_PARAM_Integer,
-                  hdd_config_t, dxeReplenishRXTimerVal,
-                  VAR_FLAGS_OPTIONAL |
-                  VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                  CFG_DXE_REPLENISH_RX_TIMER_VALUE_DEFAULT,
-                  CFG_DXE_REPLENISH_RX_TIMER_VALUE_MIN,
-                  CFG_DXE_REPLENISH_RX_TIMER_VALUE_MAX ),
-
-   REG_VARIABLE( CFG_DXE_SSR_ENABLE, WLAN_PARAM_Integer,
-                  hdd_config_t, dxeSSREnable,
-                  VAR_FLAGS_OPTIONAL |
-                  VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                  CFG_DXE_SSR_ENABLE_DEFAULT,
-                  CFG_DXE_SSR_ENABLE_MIN,
-                  CFG_DXE_SSR_ENABLE_MAX ),
-
-   REG_VARIABLE( CFG_MULTICAST_HOST_FW_MSGS, WLAN_PARAM_Integer,
-                  hdd_config_t, multicast_host_msgs,
-                  VAR_FLAGS_OPTIONAL |
-                  VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                  CFG_MULTICAST_HOST_FW_MSGS_DEFAULT,
-                  CFG_MULTICAST_HOST_FW_MSGS_MIN,
-                  CFG_MULTICAST_HOST_FW_MSGS_MAX),
-
-   REG_VARIABLE( CFG_TOGGLE_ARP_BDRATES_NAME, WLAN_PARAM_Integer,
-                 hdd_config_t, toggleArpBDRates,
-                 VAR_FLAGS_OPTIONAL |
-                 VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_TOGGLE_ARP_BDRATES_DEFAULT,
-                 CFG_TOGGLE_ARP_BDRATES_MIN,
-                 CFG_TOGGLE_ARP_BDRATES_MAX),
-
-   REG_VARIABLE( CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN , WLAN_PARAM_Integer,
-                 hdd_config_t, btcStaticOppWlanIdleWlanLen,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_DEFAULT,
-                 CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_MIN,
-                 CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_MAX ),
-
-   REG_VARIABLE( CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN , WLAN_PARAM_Integer,
-                 hdd_config_t, btcStaticOppWlanIdleBtLen,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_DEFAULT,
-                 CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_MIN,
-                 CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_MAX ),
-
-   REG_VARIABLE( CFG_TCP_DELACK_COMPUTE_INTERVAL, WLAN_PARAM_Integer,
-                 hdd_config_t, tcpDelAckComputeInterval,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_TCP_DELACK_COMPUTE_INTERVAL_DEFAULT,
-                 CFG_TCP_DELACK_COMPUTE_INTERVAL_MIN,
-                 CFG_TCP_DELACK_COMPUTE_INTERVAL_MAX),
-
-   REG_VARIABLE( CFG_TCP_DELACK_THRESHOLD_HIGH, WLAN_PARAM_Integer,
-                hdd_config_t, tcpDelAckThresholdHigh,
-                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                CFG_TCP_DELACK_THRESHOLD_HIGH_DEFAULT,
-                CFG_TCP_DELACK_THRESHOLD_HIGH_MIN,
-                CFG_TCP_DELACK_THRESHOLD_HIGH_MAX ),
-
-   REG_VARIABLE( CFG_TCP_DELACK_THRESHOLD_LOW, WLAN_PARAM_Integer,
-                hdd_config_t, tcpDelAckThresholdLow,
-                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                CFG_TCP_DELACK_THRESHOLD_LOW_DEFAULT,
-                CFG_TCP_DELACK_THRESHOLD_LOW_MIN,
-                CFG_TCP_DELACK_THRESHOLD_LOW_MAX ),
-
-   REG_VARIABLE( CFG_LINK_FAIL_TIMEOUT_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, linkFailTimeout,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_LINK_FAIL_TIMEOUT_DEF,
-                 CFG_LINK_FAIL_TIMEOUT_MIN,
-                 CFG_LINK_FAIL_TIMEOUT_MAX ),
-
-   REG_VARIABLE( CFG_LINK_FAIL_TX_CNT_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, linkFailTxCnt,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_LINK_FAIL_TX_CNT_DEF,
-                 CFG_LINK_FAIL_TX_CNT_MIN,
-                 CFG_LINK_FAIL_TX_CNT_MAX ),
-
-   REG_VARIABLE( CFG_OPTIMIZE_CA_EVENT_NAME, WLAN_PARAM_Integer,
-                 hdd_config_t, gOptimizeCAevent,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_OPTIMIZE_CA_EVENT_DEFAULT,
-                 CFG_OPTIMIZE_CA_EVENT_DISABLE,
-                 CFG_OPTIMIZE_CA_EVENT_ENABLE ),
-
-   REG_VARIABLE(CFG_FWR_MEM_DUMP_NAME, WLAN_PARAM_Integer,
-                 hdd_config_t,enableFwrMemDump,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_FWR_MEM_DUMP_DEF,
-                 CFG_FWR_MEM_DUMP_MIN,
-                 CFG_FWR_MEM_DUMP_MAX),
-
-   REG_VARIABLE( CFG_ACTIVE_PASSIVE_CHAN_CONV_NAME, WLAN_PARAM_Integer,
-                 hdd_config_t, gActivePassiveChCon,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_ACTIVE_PASSIVE_CHAN_CONV_DEF,
-                 CFG_ACTIVE_PASSIVE_CHAN_CONV_MIN,
-                 CFG_ACTIVE_PASSIVE_CHAN_CONV_MAX ),
-
-   REG_VARIABLE( CFG_EXT_SCAN_CONC_MODE , WLAN_PARAM_Integer,
-                 hdd_config_t, cfgExtScanConcMode,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_EXT_SCAN_CONC_MODE_DEFAULT,
-                 CFG_EXT_SCAN_CONC_MODE_MIN,
-                 CFG_EXT_SCAN_CONC_MODE_MAX ),
-
-    REG_VARIABLE( CFG_RPS_CPU_MAP_NAME, WLAN_PARAM_HexInteger,
-                 hdd_config_t, rps_mask,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_RPS_CPU_MAP_DEFAULT,
-                 CFG_RPS_CPU_MAP_MIN,
-                 CFG_RPS_CPU_MAP_MAX),
-
-   REG_VARIABLE( CFG_WIFI_CONFIG_ENABLE, WLAN_PARAM_Integer,
-                 hdd_config_t, fEnableWifiConfig,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_WIFI_CONFIG_DEFAULT,
-                 CFG_WIFI_CONFIG_MIN,
-                 CFG_WIFI_CONFIG_MAX ),
-
-  REG_VARIABLE( CFG_ENABLE_CRASH_INJECT, WLAN_PARAM_Integer,
-                hdd_config_t, crash_inject_enabled,
-                VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                CFG_ENABLE_CRASH_INJECT_DEFAULT,
-                CFG_ENABLE_CRASH_INJECT_MIN,
-                CFG_ENABLE_CRASH_INJECT_MAX),
-
-  REG_VARIABLE( CFG_ENABLE_TCP_DELACK_NAME, WLAN_PARAM_Integer,
-                 hdd_config_t, enable_delack,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_ENABLE_TCP_DELACK_DEFAULT,
-                 CFG_ENABLE_TCP_DELACK_MIN,
-                 CFG_ENABLE_TCP_DELACK_MAX ),
-
-  REG_VARIABLE( CFG_DISABLE_BAR_WAKEUP_HOST_NAME, WLAN_PARAM_Integer,
-                 hdd_config_t, disableBarWakeUp,
-                 VAR_FLAGS_OPTIONAL |
-                 VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_DISABLE_BAR_WAKEUP_HOST_DEFAULT,
-                 CFG_DISABLE_BAR_WAKEUP_HOST_MIN,
-                 CFG_DISABLE_BAR_WAKEUP_HOST_MAX),
-
-  REG_VARIABLE( CFG_MAXCHAN_FOR_CHANTIME_CORR_NAME, WLAN_PARAM_Integer,
-                 hdd_config_t, max_chan_for_dwell_time_cfg,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_MAXCHAN_FOR_CHANTIME_CORR_DEFAULT,
-                 CFG_MAXCHAN_FOR_CHANTIME_CORR_MIN,
-                 CFG_MAXCHAN_FOR_CHANTIME_CORR_MAX ),
-
-  REG_VARIABLE(CFG_TDLS_ENABLE_DEFER_TIMER, WLAN_PARAM_Integer,
-               hdd_config_t, tdls_enable_defer_time,
-               VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_TDLS_ENABLE_DEFER_TIMER_DEFAULT,
-               CFG_TDLS_ENABLE_DEFER_TIMER_MIN,
-               CFG_TDLS_ENABLE_DEFER_TIMER_MAX),
-
-  REG_VARIABLE(CFG_SAR_BOFFSET_SET_CORRECTION_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, boffset_correction_enable,
-               VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_SAR_BOFFSET_SET_CORRECTION_DEFAULT,
-               CFG_SAR_BOFFSET_SET_CORRECTION_MIN,
-               CFG_SAR_BOFFSET_SET_CORRECTION_MAX),
-
-  REG_VARIABLE(CFG_ENABLE_EDCA_INI_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, enable_edca_params,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_ENABLE_EDCA_INI_DEFAULT,
-               CFG_ENABLE_EDCA_INI_MIN,
-               CFG_ENABLE_EDCA_INI_MAX),
-
-  REG_VARIABLE(CFG_EDCA_VO_CWMIN_VALUE_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, edca_vo_cwmin,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_EDCA_VO_CWMIN_VALUE_DEFAULT,
-               CFG_EDCA_VO_CWMIN_VALUE_MIN,
-               CFG_EDCA_VO_CWMIN_VALUE_MAX),
-
-  REG_VARIABLE(CFG_EDCA_VI_CWMIN_VALUE_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, edca_vi_cwmin,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_EDCA_VI_CWMIN_VALUE_DEFAULT,
-               CFG_EDCA_VI_CWMIN_VALUE_MIN,
-               CFG_EDCA_VI_CWMIN_VALUE_MAX),
-
-  REG_VARIABLE(CFG_EDCA_BK_CWMIN_VALUE_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, edca_bk_cwmin,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_EDCA_BK_CWMIN_VALUE_DEFAULT,
-               CFG_EDCA_BK_CWMIN_VALUE_MIN,
-               CFG_EDCA_BK_CWMIN_VALUE_MAX),
-
-  REG_VARIABLE(CFG_EDCA_BE_CWMIN_VALUE_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, edca_be_cwmin,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_EDCA_BE_CWMIN_VALUE_DEFAULT,
-               CFG_EDCA_BE_CWMIN_VALUE_MIN,
-               CFG_EDCA_BE_CWMIN_VALUE_MAX),
-
-  REG_VARIABLE(CFG_EDCA_VO_CWMAX_VALUE_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, edca_vo_cwmax,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_EDCA_VO_CWMAX_VALUE_DEFAULT,
-               CFG_EDCA_VO_CWMAX_VALUE_MIN,
-               CFG_EDCA_VO_CWMAX_VALUE_MAX),
-
-  REG_VARIABLE(CFG_EDCA_VI_CWMAX_VALUE_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, edca_vi_cwmax,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_EDCA_VI_CWMAX_VALUE_DEFAULT,
-               CFG_EDCA_VI_CWMAX_VALUE_MIN,
-               CFG_EDCA_VI_CWMAX_VALUE_MAX),
-
- REG_VARIABLE(CFG_EDCA_BK_CWMAX_VALUE_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, edca_bk_cwmax,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_EDCA_BK_CWMAX_VALUE_DEFAULT,
-               CFG_EDCA_BK_CWMAX_VALUE_MIN,
-               CFG_EDCA_BK_CWMAX_VALUE_MAX),
-
-  REG_VARIABLE(CFG_EDCA_BE_CWMAX_VALUE_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, edca_be_cwmax,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_EDCA_BE_CWMAX_VALUE_DEFAULT,
-               CFG_EDCA_BE_CWMAX_VALUE_MIN,
-               CFG_EDCA_BE_CWMAX_VALUE_MAX),
-
-  REG_VARIABLE(CFG_EDCA_VO_AIFS_VALUE_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, edca_vo_aifs,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_EDCA_VO_AIFS_VALUE_DEFAULT,
-               CFG_EDCA_VO_AIFS_VALUE_MIN,
-               CFG_EDCA_VO_AIFS_VALUE_MAX),
-
-  REG_VARIABLE(CFG_EDCA_VI_AIFS_VALUE_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, edca_vi_aifs,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_EDCA_VI_AIFS_VALUE_DEFAULT,
-               CFG_EDCA_VI_AIFS_VALUE_MIN,
-               CFG_EDCA_VI_AIFS_VALUE_MAX),
-
-  REG_VARIABLE(CFG_EDCA_BK_AIFS_VALUE_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, edca_bk_aifs,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_EDCA_BK_AIFS_VALUE_DEFAULT,
-               CFG_EDCA_BK_AIFS_VALUE_MIN,
-               CFG_EDCA_BK_AIFS_VALUE_MAX),
-
-  REG_VARIABLE(CFG_EDCA_BE_AIFS_VALUE_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, edca_be_aifs,
-               VAR_FLAGS_OPTIONAL |
-               VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_EDCA_BE_AIFS_VALUE_DEFAULT,
-               CFG_EDCA_BE_AIFS_VALUE_MIN,
-               CFG_EDCA_BE_AIFS_VALUE_MAX),
-
-  REG_VARIABLE( CFG_SEND_MGMT_PKT_VIA_WQ5_NAME , WLAN_PARAM_Integer,
-               hdd_config_t, sendMgmtPktViaWQ5,
-               VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_SEND_MGMT_PKT_VIA_WQ5_DEF,
-               CFG_SEND_MGMT_PKT_VIA_WQ5_MIN,
-               CFG_SEND_MGMT_PKT_VIA_WQ5_MAX ),
-
-  REG_VARIABLE(CFG_SAP_PROBE_RESP_OFFLOAD_NAME, WLAN_PARAM_Integer,
-               hdd_config_t, sap_probe_resp_offload,
-               VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-               CFG_SAP_PROBE_RESP_OFFLOAD_DEFAULT,
-               CFG_SAP_PROBE_RESP_OFFLOAD_MIN,
-               CFG_SAP_PROBE_RESP_OFFLOAD_MAX),
 };
 
 /*
@@ -3829,9 +3371,9 @@
       goto config_exit;
    }
 
-   hddLog(VOS_TRACE_LEVEL_INFO , "%s: qcom_cfg.ini Size %zu", __func__, fw->size);
+   hddLog(LOGE, "%s: qcom_cfg.ini Size %zu", __func__, fw->size);
 
-   buffer = (char*)vos_mem_vmalloc(fw->size);
+   buffer = (char*)vos_mem_malloc(fw->size);
 
    if(NULL == buffer) {
       hddLog(VOS_TRACE_LEVEL_FATAL, "%s: kmalloc failure",__func__);
@@ -3855,7 +3397,7 @@
        * buffer address and modifying the buffer value.
        */
       line = get_next_line(buffer, (pTemp + (fw->size-1)));
-      if(line >= (pTemp + fw->size)) {
+      if(line > (pTemp + fw->size)) {
          hddLog(VOS_TRACE_LEVEL_FATAL, "%s: INI file seems to be corrupted",
                   __func__);
          vos_status = VOS_STATUS_E_FAILURE;
@@ -3910,7 +3452,7 @@
 
 config_exit:
    release_firmware(fw);
-   vos_mem_vfree(pTemp);
+   vos_mem_free(pTemp);
    return vos_status;
 }
 
@@ -4034,7 +3576,6 @@
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [fFTResourceReqSupported] Value = [%u] ",pHddCtx->cfg_ini->fFTResourceReqSupported);
 #endif
 
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableRoamDelayStats] Value = [%u] ",pHddCtx->cfg_ini->gEnableRoamDelayStats);
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [nNeighborReassocRssiThreshold] Value = [%u] ",pHddCtx->cfg_ini->nNeighborReassocRssiThreshold);
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [nNeighborLookupRssiThreshold] Value = [%u] ",pHddCtx->cfg_ini->nNeighborLookupRssiThreshold);
@@ -4101,154 +3642,14 @@
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [overrideCountryCode] Value = [%s] ",pHddCtx->cfg_ini->overrideCountryCode);
 
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gAsdProbeInterval] Value = [%u]",pHddCtx->cfg_ini->gAsdProbeInterval);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gAsdTriggerThreshold] Value = [%hhd]",pHddCtx->cfg_ini->gAsdTriggerThreshold);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gAsdTriggerThreshold] Value = [%u]",pHddCtx->cfg_ini->gAsdTriggerThreshold);
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gAsdRTTRssiHystThreshold]Value = [%u]",pHddCtx->cfg_ini->gAsdRTTRssiHystThreshold);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-                    "Name = [gIgnorePeerErpInfo] Value = [%u] ",
-                                           pHddCtx->cfg_ini->ignorePeerErpInfo);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-                    "Name = [disableP2PMacSpoofing] Value = [%u] ",
-                                       pHddCtx->cfg_ini->disableP2PMacSpoofing);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-                    "Name = [enableFatalEvent] Value = [%u] ",
-                                       pHddCtx->cfg_ini->enableFatalEvent);
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gRoamtoDFSChannel] Value = [%u] ",pHddCtx->cfg_ini->allowDFSChannelRoam);
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gMaxConcurrentActiveSessions] Value = [%u] ", pHddCtx->cfg_ini->gMaxConcurrentActiveSessions);
-#ifdef WLAN_FEATURE_AP_HT40_24G
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gApHT4024G] Value = [%u]", pHddCtx->cfg_ini->apHT40_24GEnabled);
-#endif
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gAcsScanBandPreference] Value = [%u] ",pHddCtx->cfg_ini->acsScanBandPreference);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gACSBandSwitchThreshold] value = [%u]",pHddCtx->cfg_ini->acsBandSwitchThreshold);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gDeferScanTimeInterval] value = [%u]",pHddCtx->cfg_ini->nDeferScanTimeInterval);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gACSBandSwitchThreshold] value = [%u]\n",pHddCtx->cfg_ini->acsBandSwitchThreshold);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gDeferScanTimeInterval] value = [%u]\n",pHddCtx->cfg_ini->nDeferScanTimeInterval);
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableTDLSScan] value = [%u]\n",pHddCtx->cfg_ini->fEnableTDLSScan);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gDxeReplenishRXTimerVal] Value = [%u] ", pHddCtx->cfg_ini->dxeReplenishRXTimerVal);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gDxeSSREnable] Value = [%u] ", pHddCtx->cfg_ini->dxeSSREnable);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [toggleArpBDRates] Value = [%u] ", pHddCtx->cfg_ini->toggleArpBDRates);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [ExtScanConcMode] Value = [%u] ", pHddCtx->cfg_ini->cfgExtScanConcMode);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableForceTargetAssert] Value = [%u] ", pHddCtx->cfg_ini->crash_inject_enabled);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gTcpDelAckComputeInterval] Value = [%u] ",
-          pHddCtx->cfg_ini->tcpDelAckComputeInterval);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gTcpDelAckThresholdHigh] Value = [%u] ",
-          pHddCtx->cfg_ini->tcpDelAckThresholdHigh);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gTcpDelAckThresholdLow] Value = [%u] ",
-          pHddCtx->cfg_ini->tcpDelAckThresholdLow);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gEnableDelAck] Value = [%u] ",
-          pHddCtx->cfg_ini->enable_delack);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [disableBarWakeUp] Value = [%u] ",
-          pHddCtx->cfg_ini->disableBarWakeUp);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gMaxChannelForMoreDwellTime] Value = [%u] ",
-          pHddCtx->cfg_ini->max_chan_for_dwell_time_cfg);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-           "Name = [gTDLSEnableDeferTime] Value = [%u] ",
-           pHddCtx->cfg_ini->tdls_enable_defer_time);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_ENABLE_EDCA_INI_NAME,
-          pHddCtx->cfg_ini->enable_edca_params);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_EDCA_VO_CWMIN_VALUE_NAME,
-          pHddCtx->cfg_ini->edca_vo_cwmin);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_EDCA_VI_CWMIN_VALUE_NAME,
-          pHddCtx->cfg_ini->edca_vi_cwmin);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_EDCA_BK_CWMIN_VALUE_NAME,
-          pHddCtx->cfg_ini->edca_bk_cwmin);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_EDCA_BE_CWMIN_VALUE_NAME,
-          pHddCtx->cfg_ini->edca_be_cwmin);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_EDCA_VO_CWMAX_VALUE_NAME,
-          pHddCtx->cfg_ini->edca_vo_cwmax);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_EDCA_VI_CWMAX_VALUE_NAME,
-          pHddCtx->cfg_ini->edca_vi_cwmax);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_EDCA_BK_CWMAX_VALUE_NAME,
-          pHddCtx->cfg_ini->edca_bk_cwmax);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_EDCA_BE_CWMAX_VALUE_NAME,
-          pHddCtx->cfg_ini->edca_be_cwmax);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_EDCA_VO_AIFS_VALUE_NAME,
-          pHddCtx->cfg_ini->edca_vo_aifs);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_EDCA_VI_AIFS_VALUE_NAME,
-          pHddCtx->cfg_ini->edca_vi_aifs);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_EDCA_BK_AIFS_VALUE_NAME,
-          pHddCtx->cfg_ini->edca_bk_aifs);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [%s] Value = [%u] ",
-          CFG_EDCA_BE_AIFS_VALUE_NAME,
-          pHddCtx->cfg_ini->edca_be_aifs);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gSendMgmtPktViaWQ5] Value = [%u] ",
-          pHddCtx->cfg_ini->sendMgmtPktViaWQ5);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-            "Name = [%s] Value = [%u] ", CFG_SAP_PROBE_RESP_OFFLOAD_NAME,
-            pHddCtx->cfg_ini->sap_probe_resp_offload);
-
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gPERRoamStatsTime] Value = [%lu] ",
-          (long unsigned int)pHddCtx->cfg_ini->PERtimerThreshold);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gPERRoamRxMonitorEnabled] Value = [%u] ",
-          pHddCtx->cfg_ini->isPERRoamRxPathEnabled);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gPERRoamTriggerPercent] Value = [%u] ",
-          pHddCtx->cfg_ini->PERroamTriggerPercent);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gPERRoamRxPktThreshold] Value = [%u] ",
-          pHddCtx->cfg_ini->PERroamRxPktsThreshold);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gPERRoamCCAEnabled] Value = [%u] ",
-          pHddCtx->cfg_ini->isPERRoamCCAEnabled);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gPERRoamScanInterval] Value = [%lu] ",
-          (long unsigned int)pHddCtx->cfg_ini->waitPeriodForNextPERScan);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gPERRoamDownThresholdRate] Value = [%u] ",
-          pHddCtx->cfg_ini->rateDownThreshold);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gPERRoamEnable] Value = [%u] ",
-          pHddCtx->cfg_ini->isPERRoamEnabled);
-
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
-          "Name = [gPERRoamUpThresholdRate] Value = [%u] ",
-          pHddCtx->cfg_ini->rateUpThreshold);
-#endif
 }
 
 
@@ -4326,7 +3727,7 @@
       // ideally we want to return the config to the application
       // however the config is too big so we just printk() for now
 #ifdef RETURN_IN_BUFFER
-      if (curlen < buflen)
+      if (curlen <= buflen)
       {
          // copy string + '\0'
          memcpy(pCur, configStr, curlen+1);
@@ -5752,101 +5153,6 @@
       fStatus = FALSE;
       hddLog(LOGE, "Could not pass on WNI_CFG_BTC_FAST_WLAN_CONN_PREF ");
    }
-
-   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_ENABLE_RTSCTS_HTVHT,
-               pConfig->enableRtsCtsHtVht,
-               NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-   {
-       fStatus = FALSE;
-       hddLog(LOGE, "Could not pass on"
-               "WNI_CFG_ENABLE_RTSCTS_HTVHT to CCM");
-   }
-
-   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_TOGGLE_ARP_BDRATES,
-               pConfig->toggleArpBDRates,
-               NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-   {
-       fStatus = FALSE;
-       hddLog(LOGE, "Could not pass on"
-               "WNI_CFG_TOGGLE_ARP_BDRATES to CCM");
-   }
-
-   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN,
-                    pConfig->btcStaticOppWlanIdleWlanLen, NULL,
-                    eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-   {
-      fStatus = FALSE;
-      hddLog(LOGE, "Could not pass on WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN ");
-   }
-
-   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN,
-                    pConfig->btcStaticOppWlanIdleBtLen, NULL,
-                    eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-   {
-      fStatus = FALSE;
-      hddLog(LOGE, "Could not pass on WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN ");
-   }
-
-   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_LINK_FAIL_TIMEOUT,
-                    pConfig->linkFailTimeout, NULL,
-                    eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-   {
-      fStatus = FALSE;
-      hddLog(LOGE, "Could not pass on WNI_CFG_LINK_FAIL_TIMEOUT ");
-   }
-
-   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_LINK_FAIL_TX_CNT,
-                    pConfig->linkFailTxCnt, NULL,
-                    eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-   {
-      fStatus = FALSE;
-      hddLog(LOGE, "Could not pass on WNI_CFG_LINK_FAIL_TX_CNT ");
-   }
-   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_OPTIMIZE_CA_EVENT,
-                    pConfig->gOptimizeCAevent, NULL,
-                    eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-   {
-      fStatus = FALSE;
-      hddLog(LOGE, "Could not pass on WNI_CFG_OPTIMIZE_CA_EVENT ");
-   }
-   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_EXT_SCAN_CONC_MODE, pConfig->cfgExtScanConcMode,
-      NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-   {
-      fStatus = FALSE;
-      hddLog(LOGE, "Could not pass on WNI_CFG_EXT_SCAN_CONC_MODE to CCM");
-   }
-
-   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_ACTIVE_PASSIVE_CON,
-                    pConfig->gActivePassiveChCon, NULL,
-                    eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-   {
-      fStatus = FALSE;
-      hddLog(LOGE, "Could not pass on WNI_CFG_ACTIVE_PASSIVE_CON ");
-   }
-
-   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_ENABLE_MAC_ADDR_SPOOFING,
-                    pConfig->enableMacSpoofing, NULL,
-                    eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-   {
-      fStatus = FALSE;
-      hddLog(LOGE, "Could not pass on WNI_CFG_ENABLE_MAC_ADDR_SPOOFING ");
-   }
-
-   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_DISABLE_BAR_WAKE_UP_HOST,
-               pConfig->disableBarWakeUp,
-               NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-   {
-       fStatus = FALSE;
-       hddLog(LOGE, "Could not pass on WNI_CFG_DISABLE_BAR_WAKE_UP_HOST to CCM");
-   }
-
-   if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_SAR_BOFFSET_SET_CORRECTION,
-               pConfig->boffset_correction_enable,
-               NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-   {
-       fStatus = FALSE;
-       hddLog(LOGE, "Could not pass on WNI_CFG_SAR_BOFFSET_SET_CORRECTION to CCM");
-   }
    return fStatus;
 }
 
@@ -6029,20 +5335,8 @@
    smeConfig->csrConfig.isWESModeEnabled = pConfig->isWESModeEnabled;
 #endif
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-   smeConfig->csrConfig.isRoamOffloadScanEnabled =
-           pConfig->isRoamOffloadScanEnabled;
-   smeConfig->csrConfig.bFastRoamInConIniFeatureEnabled =
-           pConfig->bFastRoamInConIniFeatureEnabled;
-   smeConfig->csrConfig.isPERRoamEnabled =
-           pConfig->isPERRoamEnabled;
-   smeConfig->csrConfig.rateUpThreshold = pConfig->rateUpThreshold;
-   smeConfig->csrConfig.rateDownThreshold = pConfig->rateDownThreshold;
-   smeConfig->csrConfig.waitPeriodForNextPERScan =
-           pConfig->waitPeriodForNextPERScan;
-   smeConfig->csrConfig.PERtimerThreshold = pConfig->PERtimerThreshold;
-   smeConfig->csrConfig.isPERRoamCCAEnabled = pConfig->isPERRoamCCAEnabled;
-   smeConfig->csrConfig.PERroamTriggerPercent = pConfig->PERroamTriggerPercent;
-
+   smeConfig->csrConfig.isRoamOffloadScanEnabled = pConfig->isRoamOffloadScanEnabled;
+   smeConfig->csrConfig.bFastRoamInConIniFeatureEnabled = pConfig->bFastRoamInConIniFeatureEnabled;
 
    if (0 == smeConfig->csrConfig.isRoamOffloadScanEnabled)
    {
@@ -6059,13 +5353,10 @@
    smeConfig->csrConfig.neighborRoamConfig.nMaxNeighborRetries = pConfig->nMaxNeighborReqTries;
    smeConfig->csrConfig.neighborRoamConfig.nNeighborResultsRefreshPeriod = pConfig->nNeighborResultsRefreshPeriod;
    smeConfig->csrConfig.neighborRoamConfig.nEmptyScanRefreshPeriod = pConfig->nEmptyScanRefreshPeriod;
-   //Making Forced 5G roaming to tightly coupled with the gEnableFirstScan2GOnly
-   //=1 only, Also making sure if HW does not support 5G RF band then no need to
-   //enable this feature even though it is enabled in .ini.
-   if((pConfig->enableFirstScan2GOnly) && (pConfig->nBandCapability != eCSR_BAND_24))
+   //Making Forced 5G roaming to tightly coupled with the gEnableFirstScan2GOnly=1 only.
+   if(pConfig->enableFirstScan2GOnly)
    {
-       smeConfig->csrConfig.neighborRoamConfig.nNeighborInitialForcedRoamTo5GhEnable
-       = pConfig->nNeighborInitialForcedRoamTo5GhEnable;
+       smeConfig->csrConfig.neighborRoamConfig.nNeighborInitialForcedRoamTo5GhEnable = pConfig->nNeighborInitialForcedRoamTo5GhEnable;
    }
    hdd_string_to_u8_array( pConfig->neighborScanChanList,
                                         smeConfig->csrConfig.neighborRoamConfig.neighborScanChanList.channelList,
@@ -6086,14 +5377,7 @@
    smeConfig->csrConfig.enableTxLdpc = pConfig->enableTxLdpc;
 
    smeConfig->csrConfig.isAmsduSupportInAMPDU = pConfig->isAmsduSupportInAMPDU;
-   if(pConfig->nBandCapability != eCSR_BAND_24)
-   {
-       smeConfig->csrConfig.nSelect5GHzMargin = pConfig->nSelect5GHzMargin;
-   }
-   smeConfig->csrConfig.ignorePeerErpInfo = pConfig->ignorePeerErpInfo;
-   smeConfig->csrConfig.ignorePeerHTopMode = pConfig->ignorePeerHTopMode;
-   smeConfig->csrConfig.disableP2PMacSpoofing = pConfig->disableP2PMacSpoofing;
-   smeConfig->csrConfig.enableFatalEvent= pConfig->enableFatalEvent;
+   smeConfig->csrConfig.nSelect5GHzMargin = pConfig->nSelect5GHzMargin;
    smeConfig->csrConfig.initialScanSkipDFSCh = pConfig->initialScanSkipDFSCh;
 
    smeConfig->csrConfig.isCoalesingInIBSSAllowed =
@@ -6110,49 +5394,10 @@
 
    smeConfig->fEnableDebugLog = pHddCtx->cfg_ini->gEnableDebugLog;
    smeConfig->csrConfig.sendDeauthBeforeCon = pConfig->sendDeauthBeforeCon;
-   smeConfig->csrConfig.nOBSSScanWidthTriggerInterval =
-                        pConfig->nOBSSScanWidthTriggerInterval;
+
    smeConfig->fDeferIMPSTime = pHddCtx->cfg_ini->deferImpsTime;
    smeConfig->fBtcEnableIndTimerVal = pHddCtx->cfg_ini->btcEnableIndTimerVal;
-   smeConfig->csrConfig.roamDelayStatsEnabled = pHddCtx->cfg_ini->gEnableRoamDelayStats;
-   smeConfig->csrConfig.max_chan_for_dwell_time_cfg =
-                        pHddCtx->cfg_ini->max_chan_for_dwell_time_cfg;
 
-   smeConfig->csrConfig.enable_edca_params =
-                        pHddCtx->cfg_ini->enable_edca_params;
-
-   smeConfig->csrConfig.edca_vo_cwmin =
-                        pHddCtx->cfg_ini->edca_vo_cwmin;
-   smeConfig->csrConfig.edca_vi_cwmin =
-                        pHddCtx->cfg_ini->edca_vi_cwmin;
-   smeConfig->csrConfig.edca_bk_cwmin =
-                        pHddCtx->cfg_ini->edca_bk_cwmin;
-   smeConfig->csrConfig.edca_be_cwmin =
-                        pHddCtx->cfg_ini->edca_be_cwmin;
-
-   smeConfig->csrConfig.edca_vo_cwmax =
-                        pHddCtx->cfg_ini->edca_vo_cwmax;
-   smeConfig->csrConfig.edca_vi_cwmax =
-                        pHddCtx->cfg_ini->edca_vi_cwmax;
-   smeConfig->csrConfig.edca_bk_cwmax =
-                        pHddCtx->cfg_ini->edca_bk_cwmax;
-   smeConfig->csrConfig.edca_be_cwmax =
-                        pHddCtx->cfg_ini->edca_be_cwmax;
-
-   smeConfig->csrConfig.edca_vo_aifs =
-                        pHddCtx->cfg_ini->edca_vo_aifs;
-   smeConfig->csrConfig.edca_vi_aifs =
-                        pHddCtx->cfg_ini->edca_vi_aifs;
-   smeConfig->csrConfig.edca_bk_aifs =
-                        pHddCtx->cfg_ini->edca_bk_aifs;
-   smeConfig->csrConfig.edca_be_aifs =
-                        pHddCtx->cfg_ini->edca_be_aifs;
-
-
-   sme_set_mgmt_frm_via_wq5((tHalHandle)(pHddCtx->hHal),
-           pHddCtx->cfg_ini->sendMgmtPktViaWQ5);
-
-   vos_set_multicast_logging(pHddCtx->cfg_ini->multicast_host_msgs);
    halStatus = sme_UpdateConfig( pHddCtx->hHal, smeConfig);
    if ( !HAL_STATUS_SUCCESS( halStatus ) )
    {
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_cfg80211.c b/wlan/prima/CORE/HDD/src/wlan_hdd_cfg80211.c
index e1e564e..8e6ed3f 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -23,7 +23,6 @@
  * This file was originally distributed by Qualcomm Atheros, Inc.
  * under proprietary terms before Copyright ownership was assigned
  * to the Linux Foundation.
- *
  */
 
 
@@ -90,14 +89,13 @@
 #include "bap_hdd_misc.h"
 #endif
 #include <qc_sap_ioctl.h>
+#ifdef FEATURE_WLAN_TDLS
 #include "wlan_hdd_tdls.h"
 #include "wlan_hdd_wmm.h"
 #include "wlan_qct_wda.h"
+#endif
 #include "wlan_nv.h"
 #include "wlan_hdd_dev_pwr.h"
-#include "qwlan_version.h"
-#include "wlan_logging_sock_svc.h"
-
 
 #define g_mode_rates_size (12)
 #define a_mode_rates_size (8)
@@ -133,6 +131,12 @@
     .flags = flag, \
 }
 
+#ifndef WLAN_FEATURE_TDLS_DEBUG
+#define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_INFO
+#else
+#define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_ERROR
+#endif
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
 #define WLAN_AKM_SUITE_FT_8021X         0x000FAC03
 #define WLAN_AKM_SUITE_FT_PSK           0x000FAC04
@@ -173,16 +177,6 @@
  */
 #define EXTTDLS_EVENT_BUF_SIZE 4096
 
-/*
- * Values for Mac spoofing feature
- *
- */
-#define MAC_ADDR_SPOOFING_FW_HOST_DISABLE           0
-#define MAC_ADDR_SPOOFING_FW_HOST_ENABLE            1
-#define MAC_ADDR_SPOOFING_FW_ENABLE_HOST_DISABLE    2
-#define MAC_ADDR_SPOOFING_DEFER_INTERVAL            10 //in ms
-
-
 static const u32 hdd_cipher_suites[] =
 {
     WLAN_CIPHER_SUITE_WEP40,
@@ -209,7 +203,7 @@
             (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
 }
 
-const static struct ieee80211_channel hdd_channels_2_4_GHZ[] =
+static struct ieee80211_channel hdd_channels_2_4_GHZ[] =
 {
     HDD2GHZCHAN(2412, 1, 0) ,
     HDD2GHZCHAN(2417, 2, 0) ,
@@ -227,7 +221,14 @@
     HDD2GHZCHAN(2484, 14, 0) ,
 };
 
-const static struct ieee80211_channel hdd_channels_5_GHZ[] =
+static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] =
+{
+    HDD2GHZCHAN(2412, 1, 0) ,
+    HDD2GHZCHAN(2437, 6, 0) ,
+    HDD2GHZCHAN(2462, 11, 0) ,
+};
+
+static struct ieee80211_channel hdd_channels_5_GHZ[] =
 {
     HDD5GHZCHAN(4920, 240, 0) ,
     HDD5GHZCHAN(4940, 244, 0) ,
@@ -295,7 +296,7 @@
 
 static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ =
 {
-    .channels = NULL,
+    .channels = hdd_channels_2_4_GHZ,
     .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ),
     .band       = IEEE80211_BAND_2GHZ,
     .bitrates = g_mode_rates,
@@ -312,9 +313,28 @@
     .ht_cap.mcs.tx_params  = IEEE80211_HT_MCS_TX_DEFINED,
 };
 
+static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ =
+{
+    .channels = hdd_social_channels_2_4_GHZ,
+    .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ),
+    .band       = IEEE80211_BAND_2GHZ,
+    .bitrates = g_mode_rates,
+    .n_bitrates = g_mode_rates_size,
+    .ht_cap.ht_supported   = 1,
+    .ht_cap.cap            =  IEEE80211_HT_CAP_SGI_20
+                            | IEEE80211_HT_CAP_GRN_FLD
+                            | IEEE80211_HT_CAP_DSSSCCK40
+                            | IEEE80211_HT_CAP_LSIG_TXOP_PROT,
+    .ht_cap.ampdu_factor   = IEEE80211_HT_MAX_AMPDU_64K,
+    .ht_cap.ampdu_density  = IEEE80211_HT_MPDU_DENSITY_16,
+    .ht_cap.mcs.rx_mask    = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
+    .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ),
+    .ht_cap.mcs.tx_params  = IEEE80211_HT_MCS_TX_DEFINED,
+};
+
 static struct ieee80211_supported_band wlan_hdd_band_5_GHZ =
 {
-    .channels = NULL,
+    .channels = hdd_channels_5_GHZ,
     .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ),
     .band     = IEEE80211_BAND_5GHZ,
     .bitrates = a_mode_rates,
@@ -606,9 +626,6 @@
     }
 
     vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
-                       NULL,
-#endif
                        sizeof(tHddAvoidFreqList),
                        QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX,
                        GFP_KERNEL);
@@ -629,153 +646,6 @@
 }
 #endif /* FEATURE_WLAN_CH_AVOID */
 
-/*
- * FUNCTION: __wlan_hdd_cfg80211_nan_request
- * This is called when wlan driver needs to send vendor specific
- * nan request event.
- */
-static int __wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy,
-                                         struct wireless_dev *wdev,
-                                         void *data, int data_len)
-{
-    tNanRequestReq nan_req;
-    VOS_STATUS status;
-    int ret_val = -1;
-    struct net_device *dev = wdev->netdev;
-    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    hdd_context_t *pHddCtx = wiphy_priv(wiphy);
-
-    if (0 == data_len)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-                FL("NAN - Invalid Request, length = 0"));
-        return ret_val;
-    }
-
-    if (NULL == data)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-                FL("NAN - Invalid Request, data is NULL"));
-        return ret_val;
-    }
-
-    status = wlan_hdd_validate_context(pHddCtx);
-    if (0 != status)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-               FL("HDD context is not valid"));
-        return -EINVAL;
-    }
-
-    hddLog(LOG1, FL("Received NAN command"));
-    vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-        (tANI_U8 *)data, data_len);
-
-    /* check the NAN Capability */
-    if (TRUE != sme_IsFeatureSupportedByFW(NAN))
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-               FL("NAN is not supported by Firmware"));
-        return -EINVAL;
-    }
-
-    nan_req.request_data_len = data_len;
-    nan_req.request_data = data;
-
-    status = sme_NanRequest(hHal, &nan_req, pAdapter->sessionId);
-    if (VOS_STATUS_SUCCESS == status)
-    {
-        ret_val = 0;
-    }
-    return ret_val;
-}
-
-/*
- * FUNCTION: wlan_hdd_cfg80211_nan_request
- * Wrapper to protect the nan vendor command from ssr
- */
-static int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy,
-                                         struct wireless_dev *wdev,
-                                         void *data, int data_len)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_nan_request(wiphy, wdev, data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-/*
- * FUNCTION: wlan_hdd_cfg80211_nan_callback
- * This is a callback function and it gets called
- * when we need to report nan response event to
- * upper layers.
- */
-static void wlan_hdd_cfg80211_nan_callback(void* ctx, tSirNanEvent* msg)
-{
-    hdd_context_t *pHddCtx = (hdd_context_t *)ctx;
-    struct sk_buff *vendor_event;
-    int status;
-    tSirNanEvent *data;
-
-    ENTER();
-    if (NULL == msg)
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   FL(" msg received here is null"));
-        return;
-    }
-    data = msg;
-
-    status = wlan_hdd_validate_context(pHddCtx);
-
-    if (0 != status)
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   FL("HDD context is not valid"));
-        return;
-    }
-
-    vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
-                                   NULL,
-#endif
-                                   data->event_data_len +
-                                   NLMSG_HDRLEN,
-                                   QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX,
-                                   GFP_KERNEL);
-
-    if (!vendor_event)
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   FL("cfg80211_vendor_event_alloc failed"));
-        return;
-    }
-    if (nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_NAN,
-                data->event_data_len, data->event_data))
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   FL("QCA_WLAN_VENDOR_ATTR_NAN put fail"));
-        kfree_skb(vendor_event);
-        return;
-    }
-    cfg80211_vendor_event(vendor_event, GFP_KERNEL);
-    EXIT();
-}
-
-/*
- * FUNCTION: wlan_hdd_cfg80211_nan_init
- * This function is called to register the callback to sme layer
- */
-inline void wlan_hdd_cfg80211_nan_init(hdd_context_t *pHddCtx)
-{
-    sme_NanRegisterCallback(pHddCtx->hHal, wlan_hdd_cfg80211_nan_callback);
-}
-
-
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
 
 static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats,
@@ -841,8 +711,6 @@
 
     rateInfo = nla_nest_start(vendor_event,
                             QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO);
-    if(!rateInfo)
-        return FALSE;
     for (i = 0; i < stats->numRate; i++)
     {
         struct nlattr *rates;
@@ -850,8 +718,6 @@
                                             stats->rateStats +
                                        (i * sizeof(tSirWifiRateStat)));
         rates = nla_nest_start(vendor_event, i);
-        if(!rates)
-            return FALSE;
 
         if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event))
         {
@@ -1061,9 +927,6 @@
 
 
     if (nla_put_u32(vendor_event,
-                    QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE,
-                    QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_IFACE) ||
-        nla_put_u32(vendor_event,
                     QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX,
                     pWifiIfaceStat->beaconRx) ||
         nla_put_u32(vendor_event,
@@ -1086,63 +949,17 @@
                     pWifiIfaceStat->rssiAck))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
-               FL("QCA_WLAN_VENDOR_ATTR put fail"));
-               vos_mem_free(pWifiIfaceStatTL);
-        return FALSE;
-    }
-
-#ifdef FEATURE_EXT_LL_STAT
-   /*
-    * Ensure when EXT_LL_STAT is supported by both host and fwr,
-    * then host should send Leaky AP stats to upper layer,
-    * otherwise no need to send these stats.
-    */
-   if(sme_IsFeatureSupportedByFW(EXT_LL_STAT) &&
-      sme_IsFeatureSupportedByDriver(EXT_LL_STAT)
-     )
-   {
-       hddLog(VOS_TRACE_LEVEL_INFO,
-              FL("EXT_LL_STAT is supported by fwr and host %u %u %u %llu"),
-              pWifiIfaceStat->leakyApStat.is_leaky_ap,
-              pWifiIfaceStat->leakyApStat.avg_rx_frms_leaked,
-              pWifiIfaceStat->leakyApStat.rx_leak_window,
-              pWifiIfaceStat->leakyApStat.avg_bcn_spread);
-       if (nla_put_u32(vendor_event,
-               QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_DETECTED,
-               pWifiIfaceStat->leakyApStat.is_leaky_ap) ||
-           nla_put_u32(vendor_event,
-               QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_AVG_NUM_FRAMES_LEAKED,
-               pWifiIfaceStat->leakyApStat.avg_rx_frms_leaked) ||
-           nla_put_u32(vendor_event,
-               QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_GUARD_TIME,
-               pWifiIfaceStat->leakyApStat.rx_leak_window) ||
-           nla_put_u64(vendor_event,
-               QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_AVERAGE_TSF_OFFSET,
-               pWifiIfaceStat->leakyApStat.avg_bcn_spread))
-       {
-           hddLog(VOS_TRACE_LEVEL_ERROR,
-                  FL("EXT_LL_STAT put fail"));
-           vos_mem_free(pWifiIfaceStatTL);
-           return FALSE;
-       }
-   }
-#endif
-    wmmInfo = nla_nest_start(vendor_event,
-                            QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO);
-    if(!wmmInfo)
-    {
+                FL("QCA_WLAN_VENDOR_ATTR put fail"));
         vos_mem_free(pWifiIfaceStatTL);
         return FALSE;
     }
+
+    wmmInfo = nla_nest_start(vendor_event,
+                            QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO);
     for (i = 0; i < WIFI_AC_MAX; i++)
     {
         struct nlattr *wmmStats;
         wmmStats = nla_nest_start(vendor_event, i);
-        if(!wmmStats)
-        {
-            vos_mem_free(pWifiIfaceStatTL);
-            return FALSE;
-        }
         if (FALSE == put_wifi_wmm_ac_stat(
                                 &pWifiIfaceStat->AccessclassStats[i],
                                 vendor_event))
@@ -1250,17 +1067,18 @@
                                                    v_VOID_t *pData)
 {
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+    tpSirWifiRateStat   pWifiRateStat;
     tpSirWifiPeerStat   pWifiPeerStat;
     tpSirWifiPeerInfo   pWifiPeerInfo;
     struct nlattr *peerInfo;
     struct sk_buff *vendor_event;
     int status, i;
 
-    ENTER();
-
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid") );
         return;
     }
 
@@ -1269,6 +1087,70 @@
     hddLog(VOS_TRACE_LEVEL_INFO,
             "LL_STATS_PEER_ALL : numPeers %u",
             pWifiPeerStat->numPeers);
+    {
+        for (i = 0; i < pWifiPeerStat->numPeers; i++)
+        {
+            pWifiPeerInfo = (tpSirWifiPeerInfo)
+                ((uint8 *)pWifiPeerStat->peerInfo +
+                ( i * sizeof(tSirWifiPeerInfo)));
+
+            if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) {
+                    pWifiPeerInfo->type = WIFI_PEER_AP;
+            }
+            if (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) {
+                    pWifiPeerInfo->type = WIFI_PEER_P2P_GO;
+            }
+
+            hddLog(VOS_TRACE_LEVEL_INFO,
+                    " %d) LL_STATS Channel Stats "
+                    " Peer Type %u "
+                    " peerMacAddress  %pM "
+                    " capabilities 0x%x "
+                    " numRate %u ",
+                    i,
+                    pWifiPeerInfo->type,
+                    pWifiPeerInfo->peerMacAddress,
+                    pWifiPeerInfo->capabilities,
+                    pWifiPeerInfo->numRate);
+            {
+                int j;
+                for (j = 0; j < pWifiPeerInfo->numRate; j++)
+                {
+                    pWifiRateStat = (tpSirWifiRateStat)
+                        ((tANI_U8 *) pWifiPeerInfo->rateStats +
+                         ( j * sizeof(tSirWifiRateStat)));
+
+                    hddLog(VOS_TRACE_LEVEL_INFO,
+                            "   peer Rate Stats "
+                            "   preamble  %u "
+                            "   nss %u "
+                            "   bw %u "
+                            "   rateMcsIdx  %u "
+                            "   reserved %u "
+                            "   bitrate %u "
+                            "   txMpdu %u "
+                            "   rxMpdu %u "
+                            "   mpduLost %u "
+                            "   retries %u "
+                            "   retriesShort %u "
+                            "   retriesLong %u",
+                            pWifiRateStat->rate.preamble,
+                            pWifiRateStat->rate.nss,
+                            pWifiRateStat->rate.bw,
+                            pWifiRateStat->rate.rateMcsIdx,
+                            pWifiRateStat->rate.reserved,
+                            pWifiRateStat->rate.bitrate,
+                            pWifiRateStat->txMpdu,
+                            pWifiRateStat->rxMpdu,
+                            pWifiRateStat->mpduLost,
+                            pWifiRateStat->retries,
+                            pWifiRateStat->retriesShort,
+                            pWifiRateStat->retriesLong);
+                }
+            }
+        }
+    }
+
     /*
      * Allocate a size of 4096 for the peer stats comprising
      * each of size = sizeof (tSirWifiPeerInfo) + numRate *
@@ -1277,19 +1159,18 @@
      * that number of rates shall not exceed beyond 50 with
      * the sizeof (tSirWifiRateStat) being 32.
      */
-    vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy,
-            LL_STATS_EVENT_BUF_SIZE);
+    vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
+            LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN,
+            QCA_NL80211_VENDOR_SUBCMD_LL_PEER_INFO_STATS_INDEX,
+            GFP_KERNEL);
     if (!vendor_event)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
-                "%s: cfg80211_vendor_cmd_alloc_reply_skb failed",
+                "%s: cfg80211_vendor_event_alloc failed",
                 __func__);
         return;
     }
     if (nla_put_u32(vendor_event,
-                    QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE,
-                    QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_PEER) ||
-        nla_put_u32(vendor_event,
             QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS,
             pWifiPeerStat->numPeers))
     {
@@ -1301,31 +1182,15 @@
 
     peerInfo = nla_nest_start(vendor_event,
             QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO);
-    if(!peerInfo)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-                "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO put fail",
-                __func__);
-        kfree_skb(vendor_event);
-        return;
-    }
 
     pWifiPeerInfo = (tpSirWifiPeerInfo)  ((uint8 *)
                 pWifiPeerStat->peerInfo);
 
     for (i = 1; i <= pWifiPeerStat->numPeers; i++)
     {
-        int numRate = pWifiPeerInfo->numRate;
         struct nlattr *peers = nla_nest_start(vendor_event, i);
+        int numRate = pWifiPeerInfo->numRate;
 
-        if(!peers)
-        {
-            hddLog(VOS_TRACE_LEVEL_ERROR,
-                    "%s: peer stats put fail",
-                    __func__);
-            kfree_skb(vendor_event);
-            return;
-        }
         if (FALSE == put_wifi_peer_info(
                                      pWifiPeerInfo, vendor_event))
         {
@@ -1342,8 +1207,7 @@
         nla_nest_end(vendor_event, peers);
     }
     nla_nest_end(vendor_event, peerInfo);
-    cfg80211_vendor_cmd_reply(vendor_event);
-    EXIT();
+    cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 }
 
 /*
@@ -1360,11 +1224,11 @@
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     int status;
 
-    ENTER();
-
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid") );
         return;
     }
     /*
@@ -1374,12 +1238,14 @@
      * a call on the limit based on the data requirements on
      * interface statistics.
      */
-    vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy,
-           LL_STATS_EVENT_BUF_SIZE);
+    vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
+           LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN,
+           QCA_NL80211_VENDOR_SUBCMD_LL_IFACE_STATS_INDEX,
+           GFP_KERNEL);
     if (!vendor_event)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
-               FL("cfg80211_vendor_cmd_alloc_reply_skb failed") );
+               FL("cfg80211_vendor_event_alloc failed") );
         return;
     }
 
@@ -1407,9 +1273,94 @@
     hddLog(VOS_TRACE_LEVEL_INFO,
            "WMI_LINK_STATS_IFACE Data");
 
-    cfg80211_vendor_cmd_reply(vendor_event);
+    hddLog(VOS_TRACE_LEVEL_INFO,
+           "LL_STATS_IFACE: "
+           " Mode %u "
+           " MAC %pM "
+           " State %u "
+           " Roaming %u "
+           " capabilities 0x%x "
+           " SSID %s "
+           " BSSID %pM",
+           pWifiIfaceStat->info.mode,
+           pWifiIfaceStat->info.macAddr,
+           pWifiIfaceStat->info.state,
+           pWifiIfaceStat->info.roaming,
+           pWifiIfaceStat->info.capabilities,
+           pWifiIfaceStat->info.ssid,
+           pWifiIfaceStat->info.bssid);
 
-    EXIT();
+    hddLog(VOS_TRACE_LEVEL_INFO,
+           " AP country str: %c%c%c",
+           pWifiIfaceStat->info.apCountryStr[0],
+           pWifiIfaceStat->info.apCountryStr[1],
+           pWifiIfaceStat->info.apCountryStr[2]);
+
+
+    hddLog(VOS_TRACE_LEVEL_INFO,
+           " Country Str Association: %c%c%c",
+           pWifiIfaceStat->info.countryStr[0],
+           pWifiIfaceStat->info.countryStr[1],
+           pWifiIfaceStat->info.countryStr[2]);
+
+    hddLog(VOS_TRACE_LEVEL_INFO,
+           " beaconRx %u "
+           " mgmtRx %u "
+           " mgmtActionRx  %u "
+           " mgmtActionTx %u "
+           " rssiMgmt %d "
+           " rssiData %d "
+           " rssiAck  %d",
+           pWifiIfaceStat->beaconRx,
+           pWifiIfaceStat->mgmtRx,
+           pWifiIfaceStat->mgmtActionRx,
+           pWifiIfaceStat->mgmtActionTx,
+           pWifiIfaceStat->rssiMgmt,
+           pWifiIfaceStat->rssiData,
+           pWifiIfaceStat->rssiAck );
+
+
+    {
+        int i;
+        for (i = 0 ; i < WIFI_AC_MAX; i ++)
+        {
+            hddLog(VOS_TRACE_LEVEL_INFO,
+
+                   " %d) LL_STATS IFACE: "
+                   " ac:  %u  txMpdu: %u "
+                   " rxMpdu: %u txMcast: %u "
+                   " rxMcast: %u  rxAmpdu: %u "
+                   " txAmpdu:  %u  mpduLost: %u "
+                   " retries: %u  retriesShort: %u "
+                   " retriesLong: %u  contentionTimeMin: %u "
+                   " contentionTimeMax: %u  contentionTimeAvg: %u "
+                   " contentionNumSamples: %u",
+                   i,
+                   pWifiIfaceStat->AccessclassStats[i].ac,
+                   pWifiIfaceStat->AccessclassStats[i].txMpdu,
+                   pWifiIfaceStat->AccessclassStats[i].rxMpdu,
+                   pWifiIfaceStat->AccessclassStats[i].txMcast,
+                   pWifiIfaceStat->AccessclassStats[i].rxMcast,
+                   pWifiIfaceStat->AccessclassStats[i].rxAmpdu,
+                   pWifiIfaceStat->AccessclassStats[i].txAmpdu,
+                   pWifiIfaceStat->AccessclassStats[i].mpduLost,
+                   pWifiIfaceStat->AccessclassStats[i].retries,
+                   pWifiIfaceStat->
+                       AccessclassStats[i].retriesShort,
+                   pWifiIfaceStat->AccessclassStats[i].retriesLong,
+                   pWifiIfaceStat->
+                       AccessclassStats[i].contentionTimeMin,
+                   pWifiIfaceStat->
+                       AccessclassStats[i].contentionTimeMax,
+                   pWifiIfaceStat->
+                       AccessclassStats[i].contentionTimeAvg,
+                   pWifiIfaceStat->
+                       AccessclassStats[i].contentionNumSamples);
+
+        }
+    }
+
+    cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 }
 
 /*
@@ -1428,11 +1379,11 @@
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     struct nlattr *chList;
 
-    ENTER();
-
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid") );
         return;
     }
     pWifiRadioStat = (tpSirWifiRadioStat) pData;
@@ -1462,19 +1413,19 @@
      * sizeof (tSirWifiChannelStats) being 24 bytes.
      */
 
-    vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy,
-           LL_STATS_EVENT_BUF_SIZE);
+    vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
+           LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN ,
+           QCA_NL80211_VENDOR_SUBCMD_LL_RADIO_STATS_INDEX,
+           GFP_KERNEL);
+
     if (!vendor_event)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
-               FL("cfg80211_vendor_cmd_alloc_reply_skb failed") );
+               FL("cfg80211_vendor_event_alloc failed") );
         return;
     }
 
     if (nla_put_u32(vendor_event,
-             QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE,
-             QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_RADIO) ||
-        nla_put_u32(vendor_event,
              QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID,
              pWifiRadioStat->radio)      ||
         nla_put_u32(vendor_event,
@@ -1516,14 +1467,6 @@
 
     chList = nla_nest_start(vendor_event,
              QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO);
-    if(!chList)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-                "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO put fail",
-                __func__);
-        kfree_skb(vendor_event);
-        return;
-    }
     for (i = 0; i < pWifiRadioStat->numChannels; i++)
     {
         struct nlattr *chInfo;
@@ -1532,15 +1475,24 @@
                 pWifiRadioStat->channels +
                 (i * sizeof(tSirWifiChannelStats)));
 
+        hddLog(VOS_TRACE_LEVEL_INFO,
+               " %d) Channel Info"
+               "  width is %u "
+               "  CenterFreq %u "
+               "  CenterFreq0 %u "
+               "  CenterFreq1 %u "
+               "  onTime %u "
+               "  ccaBusyTime %u",
+               i,
+               pWifiChannelStats->channel.width,
+               pWifiChannelStats->channel.centerFreq,
+               pWifiChannelStats->channel.centerFreq0,
+               pWifiChannelStats->channel.centerFreq1,
+               pWifiChannelStats->onTime,
+               pWifiChannelStats->ccaBusyTime);
+
+
         chInfo = nla_nest_start(vendor_event, i);
-        if(!chInfo)
-        {
-            hddLog(VOS_TRACE_LEVEL_ERROR,
-                    "%s: failed to put chInfo",
-                    __func__);
-            kfree_skb(vendor_event);
-            return;
-        }
 
         if (nla_put_u32(vendor_event,
                 QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH,
@@ -1570,9 +1522,7 @@
     }
     nla_nest_end(vendor_event, chList);
 
-    cfg80211_vendor_cmd_reply(vendor_event);
-
-    EXIT();
+    cfg80211_vendor_event(vendor_event, GFP_KERNEL);
     return;
 }
 
@@ -1587,18 +1537,20 @@
 {
     hdd_context_t *pHddCtx = (hdd_context_t *)pCtx;
     hdd_adapter_t *pAdapter = NULL;
-    struct hdd_ll_stats_context *context;
     tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp;
     int status;
 
-    ENTER();
-
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return;
     }
 
+
+
     pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr);
     if (NULL == pAdapter)
     {
@@ -1617,52 +1569,37 @@
     case SIR_HAL_LL_STATS_RESULTS_RSP:
         {
             hddLog(VOS_TRACE_LEVEL_INFO,
-                    "LL_STATS RESP paramID = 0x%x, ifaceId = %u MAC: %pM "
-                    "respId = %u, moreResultToFollow = %u",
-                 linkLayerStatsResults->paramId, linkLayerStatsResults->ifaceId,
-                 macAddr, linkLayerStatsResults->respId,
-                 linkLayerStatsResults->moreResultToFollow);
-
-            spin_lock(&hdd_context_lock);
-            context = &pHddCtx->ll_stats_context;
-            /* validate response received from target */
-            if ((context->request_id != linkLayerStatsResults->respId) ||
-                !(context->request_bitmap & linkLayerStatsResults->paramId))
-            {
-                spin_unlock(&hdd_context_lock);
-                hddLog(LOGE,
-                   FL("Error : Request id %d response id %d request bitmap 0x%x"
-                      "response bitmap 0x%x"),
-                   context->request_id, linkLayerStatsResults->respId,
-                   context->request_bitmap, linkLayerStatsResults->paramId);
-                return;
-            }
-            spin_unlock(&hdd_context_lock);
-
+                    FL("RESPONSE SIR_HAL_LL_STATS_RESULTS_RSP") );
+            hddLog(VOS_TRACE_LEVEL_INFO,
+                    "LL_STATS RESULTS RESPONSE paramID = 0x%x",
+                    linkLayerStatsResults->paramId);
+            hddLog(VOS_TRACE_LEVEL_INFO,
+               "LL_STATS RESULTS RESPONSE ifaceId = %u MAC: %pM",
+               linkLayerStatsResults->ifaceId, macAddr);
+            hddLog(VOS_TRACE_LEVEL_INFO,
+                    "LL_STATS RESULTS RESPONSE respId = %u",
+                    linkLayerStatsResults->respId);
+            hddLog(VOS_TRACE_LEVEL_INFO,
+                    "LL_STATS RESULTS RESPONSE moreResultToFollow = %u",
+                    linkLayerStatsResults->moreResultToFollow);
+            hddLog(VOS_TRACE_LEVEL_INFO,
+                    "LL_STATS RESULTS RESPONSE result = %p",
+                    linkLayerStatsResults->result);
             if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO )
             {
                 hdd_link_layer_process_radio_stats(pAdapter,
                                 (v_VOID_t *)linkLayerStatsResults->result);
-                spin_lock(&hdd_context_lock);
-                context->request_bitmap &= ~(WMI_LINK_STATS_RADIO);
-                spin_unlock(&hdd_context_lock);
             }
             else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE )
             {
                 hdd_link_layer_process_iface_stats(pAdapter,
                                 (v_VOID_t *)linkLayerStatsResults->result);
-                spin_lock(&hdd_context_lock);
-                context->request_bitmap &= ~(WMI_LINK_STATS_IFACE);
-                spin_unlock(&hdd_context_lock);
             }
             else if ( linkLayerStatsResults->paramId &
                     WMI_LINK_STATS_ALL_PEER )
             {
                 hdd_link_layer_process_peer_stats(pAdapter,
                                 (v_VOID_t *)linkLayerStatsResults->result);
-                spin_lock(&hdd_context_lock);
-                context->request_bitmap &= ~(WMI_LINK_STATS_ALL_PEER);
-                spin_unlock(&hdd_context_lock);
             } /* WMI_LINK_STATS_ALL_PEER */
             else
             {
@@ -1670,20 +1607,12 @@
                         FL("INVALID LL_STATS_NOTIFY RESPONSE ***********"));
             }
 
-            spin_lock(&hdd_context_lock);
-            /* complete response event if all requests are completed */
-            if (0 == context->request_bitmap)
-                complete(&context->response_event);
-            spin_unlock(&hdd_context_lock);
-
             break;
         }
         default:
             hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType);
             break;
     }
-
-    EXIT();
     return;
 }
 
@@ -1697,10 +1626,10 @@
     { .type = NLA_U32 },
 };
 
-static int __wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy,
-                                            struct wireless_dev *wdev,
-                                            void *data,
-                                            int data_len)
+static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy,
+        struct wireless_dev *wdev,
+        void *data,
+        int data_len)
 {
     int status;
     struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX + 1];
@@ -1708,12 +1637,13 @@
     struct net_device *dev = wdev->netdev;
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     hdd_context_t *pHddCtx = wiphy_priv(wiphy);
-
-    ENTER();
+    hdd_station_ctx_t *pHddStaCtx;
 
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL;
     }
 
@@ -1767,11 +1697,15 @@
 
 
     hddLog(VOS_TRACE_LEVEL_INFO,
-           "LL_STATS_SET reqId = %d, MAC = %pM, mpduSizeThreshold = %d "
-           "Statistics Gathering  = %d ",
-           linkLayerStatsSetReq.reqId, linkLayerStatsSetReq.macAddr,
-           linkLayerStatsSetReq.mpduSizeThreshold,
-           linkLayerStatsSetReq.aggressiveStatisticsGathering);
+           "LL_STATS_SET reqId = %d", linkLayerStatsSetReq.reqId);
+    hddLog(VOS_TRACE_LEVEL_INFO,
+            "LL_STATS_SET MAC = %pM", linkLayerStatsSetReq.macAddr);
+    hddLog(VOS_TRACE_LEVEL_INFO,
+            "LL_STATS_SET mpduSizeThreshold = %d",
+            linkLayerStatsSetReq.mpduSizeThreshold);
+    hddLog(VOS_TRACE_LEVEL_INFO,
+            "LL_STATS_SET aggressive Statistics Gathering  = %d",
+            linkLayerStatsSetReq.aggressiveStatisticsGathering);
 
     if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB(
                                pHddCtx->hHal,
@@ -1783,6 +1717,21 @@
 
     }
 
+    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    if (VOS_STATUS_SUCCESS !=
+        WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+        pHddStaCtx->conn_info.staId[0], WIFI_STATS_IFACE))
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s:"
+                "WLANTL_ClearInterfaceStats Failed", __func__);
+        return -EINVAL;
+    }
+
+    pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0;
+    pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0;
+    pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0;
+    pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0;
+
     if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal,
                                             &linkLayerStatsSetReq))
     {
@@ -1793,22 +1742,8 @@
 
     pAdapter->isLinkLayerStatsSet = 1;
 
-    EXIT();
     return 0;
 }
-static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy,
-                                          struct wireless_dev *wdev,
-                                          void *data,
-                                          int data_len)
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_ll_stats_set(wiphy, wdev, data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
 
 const struct
 nla_policy
@@ -1827,26 +1762,23 @@
     [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 },
 };
 
-static int __wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy,
-                                            struct wireless_dev *wdev,
-                                            void *data,
-                                            int data_len)
+static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy,
+                                          struct wireless_dev *wdev,
+                                          void *data,
+                                          int data_len)
 {
-    unsigned long rc;
-    struct hdd_ll_stats_context *context;
     hdd_context_t *pHddCtx = wiphy_priv(wiphy);
     struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX + 1];
     tSirLLStatsGetReq linkLayerStatsGetReq;
     struct net_device *dev = wdev->netdev;
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     int status;
 
-    ENTER();
-
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL ;
     }
 
@@ -1856,14 +1788,6 @@
                "%s: HDD adapter is Null", __func__);
         return -ENODEV;
     }
-
-    if (pHddStaCtx == NULL)
-    {
-        hddLog(VOS_TRACE_LEVEL_FATAL,
-               "%s: HddStaCtx is Null", __func__);
-        return -ENODEV;
-    }
-
     /* check the LLStats Capability */
     if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) ||
          (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS)))
@@ -1876,19 +1800,12 @@
 
     if (!pAdapter->isLinkLayerStatsSet)
     {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
+        hddLog(VOS_TRACE_LEVEL_FATAL,
                "%s: isLinkLayerStatsSet : %d",
                __func__, pAdapter->isLinkLayerStatsSet);
         return -EINVAL;
     }
 
-    if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                  "%s: Roaming in progress, so unable to proceed this request", __func__);
-        return -EBUSY;
-    }
-
     if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX,
             (struct nlattr *)data,
             data_len, qca_wlan_vendor_ll_get_policy))
@@ -1923,17 +1840,13 @@
                pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t));
 
     hddLog(VOS_TRACE_LEVEL_INFO,
-           "LL_STATS_GET reqId = %d, MAC = %pM, paramIdMask = %d",
-           linkLayerStatsGetReq.reqId, linkLayerStatsGetReq.macAddr,
+           "LL_STATS_GET reqId = %d", linkLayerStatsGetReq.reqId);
+    hddLog(VOS_TRACE_LEVEL_INFO,
+           "LL_STATS_GET MAC = %pM", linkLayerStatsGetReq.macAddr);
+    hddLog(VOS_TRACE_LEVEL_INFO,
+           "LL_STATS_GET paramIdMask = %d",
            linkLayerStatsGetReq.paramIdMask);
 
-    spin_lock(&hdd_context_lock);
-    context = &pHddCtx->ll_stats_context;
-    context->request_id = linkLayerStatsGetReq.reqId;
-    context->request_bitmap = linkLayerStatsGetReq.paramIdMask;
-    INIT_COMPLETION(context->response_event);
-    spin_unlock(&hdd_context_lock);
-
     if (eHAL_STATUS_SUCCESS  != sme_LLStatsGetReq( pHddCtx->hHal,
                                                 &linkLayerStatsGetReq))
     {
@@ -1941,35 +1854,9 @@
                "sme_LLStatsGetReq Failed", __func__);
         return -EINVAL;
     }
-
-    rc = wait_for_completion_timeout(&context->response_event,
-            msecs_to_jiffies(WLAN_WAIT_TIME_LL_STATS));
-    if (!rc)
-    {
-        hddLog(LOGE,
-            FL("Target response timed out request id %d request bitmap 0x%x"),
-            context->request_id, context->request_bitmap);
-        return -ETIMEDOUT;
-    }
-
-    EXIT();
     return 0;
 }
 
-static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy,
-                                          struct wireless_dev *wdev,
-                                          void *data,
-                                          int data_len)
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_ll_stats_get(wiphy, wdev, data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 const struct
 nla_policy
 qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] =
@@ -1980,10 +1867,10 @@
     [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 },
 };
 
-static int __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy,
-                                              struct wireless_dev *wdev,
-                                              void *data,
-                                              int data_len)
+static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy,
+                                            struct wireless_dev *wdev,
+                                            void *data,
+                                            int data_len)
 {
     hdd_context_t *pHddCtx = wiphy_priv(wiphy);
     struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX + 1];
@@ -1994,11 +1881,11 @@
     u8 stopReq;
     int status;
 
-    ENTER();
-
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL;
     }
 
@@ -2058,11 +1945,14 @@
                pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t));
 
     hddLog(VOS_TRACE_LEVEL_INFO,
-            "LL_STATS_CLEAR reqId = %d, MAC = %pM,"
-            "statsClearReqMask = 0x%X, stopReq  = %d",
-            linkLayerStatsClearReq.reqId,
-            linkLayerStatsClearReq.macAddr,
-            linkLayerStatsClearReq.statsClearReqMask,
+            "LL_STATS_CLEAR reqId = %d", linkLayerStatsClearReq.reqId);
+    hddLog(VOS_TRACE_LEVEL_INFO,
+            "LL_STATS_CLEAR MAC = %pM", linkLayerStatsClearReq.macAddr);
+    hddLog(VOS_TRACE_LEVEL_INFO,
+            "LL_STATS_CLEAR statsClearReqMask = 0x%X",
+            linkLayerStatsClearReq.statsClearReqMask);
+    hddLog(VOS_TRACE_LEVEL_INFO,
+            "LL_STATS_CLEAR stopReq  = %d",
             linkLayerStatsClearReq.stopReq);
 
     if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal,
@@ -2119,25 +2009,8 @@
         }
         return -ENOMEM;
     }
-
-    EXIT();
     return -EINVAL;
 }
-static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy,
-                                            struct wireless_dev *wdev,
-                                            void *data,
-                                            int data_len)
-{
-   int ret = 0;
-
-   vos_ssr_protect(__func__);
-   ret = __wlan_hdd_cfg80211_ll_stats_clear(wiphy, wdev, data, data_len);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-
-
-}
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
 
 #ifdef WLAN_FEATURE_EXTSCAN
@@ -2160,21 +2033,13 @@
     [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 },
     [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] =
                                                             { .type = NLA_U8 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD] =
-                                                            { .type = NLA_U32 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT] =
-                                                            { .type = NLA_U32 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT] =
-                                                            { .type = NLA_U32 },
     [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] =
                                                             { .type = NLA_U32 },
     [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] =
                                                             { .type = NLA_U32 },
     [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] =
                                                             { .type = NLA_U32 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT] =
-                                                            { .type = NLA_U8 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS] =
+    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD] =
                                                             { .type = NLA_U8 },
     [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] =
                                                             { .type = NLA_U8 },
@@ -2193,219 +2058,128 @@
                                                             { .type = NLA_U32 },
     [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] =
                                                             { .type = NLA_U32 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE] =
-                                                            { .type = NLA_U32 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID] =
-                                                          { .type = NLA_BINARY,
-                                           .len = IEEE80211_MAX_SSID_LEN + 1 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_LOST_SSID_SAMPLE_SIZE] =
+    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] =
+                                                         { .type = NLA_U32 },
+    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]
+                                                         = { .type = NLA_U32 },
+    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] =
                                                            { .type = NLA_U32 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID] =
-                                                           { .type = NLA_U32 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_BAND] =
-                                                            { .type = NLA_U8 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_LOW] =
-                                                           { .type = NLA_S32 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_HIGH] =
-                                                           { .type = NLA_S32 },
-    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CONFIGURATION_FLAGS] =
-                                                           { .type = NLA_U32 },
+    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = { .type =
+                                                                     NLA_U32 },
 };
 
-/**
- * wlan_hdd_cfg80211_extscan_get_capabilities_rsp() - response from target
- * @ctx: hdd global context
- * @data: capabilities data
- *
- * Return: none
- */
-static void
-wlan_hdd_cfg80211_extscan_get_capabilities_rsp(void *ctx, void *pMsg)
-{
-    struct hdd_ext_scan_context *context;
-    hdd_context_t *pHddCtx  = (hdd_context_t *)ctx;
-    tSirEXTScanCapabilitiesEvent *data =
-                    (tSirEXTScanCapabilitiesEvent *) pMsg;
-
-    ENTER();
-
-    if (wlan_hdd_validate_context(pHddCtx))
-    {
-        return;
-    }
-
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
-        return;
-    }
-
-    vos_spin_lock_acquire(&hdd_context_lock);
-
-    context = &pHddCtx->ext_scan_context;
-    /* validate response received from target*/
-    if (context->request_id != data->requestId)
-    {
-        vos_spin_lock_release(&hdd_context_lock);
-        hddLog(LOGE,
-          FL("Target response id did not match: request_id %d resposne_id %d"),
-          context->request_id, data->requestId);
-        return;
-    }
-    else
-    {
-        context->capability_response = *data;
-        complete(&context->response_event);
-    }
-
-    vos_spin_lock_release(&hdd_context_lock);
-
-    return;
-}
-
-/*
- * define short names for the global vendor params
- * used by wlan_hdd_send_ext_scan_capability()
- */
-#define PARAM_REQUEST_ID \
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID
-#define PARAM_STATUS \
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS
-#define MAX_SCAN_CACHE_SIZE \
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE
-#define MAX_SCAN_BUCKETS \
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS
-#define MAX_AP_CACHE_PER_SCAN \
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN
-#define MAX_RSSI_SAMPLE_SIZE \
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE
-#define MAX_SCAN_RPT_THRHOLD \
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD
-#define MAX_HOTLIST_BSSIDS \
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_BSSIDS
-#define MAX_BSSID_HISTORY_ENTRIES \
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES
-#define MAX_HOTLIST_SSIDS \
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_SSIDS
-#define MAX_SIGNIFICANT_WIFI_CHANGE_APS \
-    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS
-
-static int wlan_hdd_send_ext_scan_capability(void *ctx)
+static void wlan_hdd_cfg80211_extscan_get_capabilities_ind(void *ctx, void *pMsg)
 {
     hdd_context_t *pHddCtx  = (hdd_context_t *)ctx;
     struct sk_buff *skb     = NULL;
-    int ret;
-    tSirEXTScanCapabilitiesEvent *data;
-    tANI_U32 nl_buf_len;
+    tpSirEXTScanCapabilitiesEvent pData =
+                    (tpSirEXTScanCapabilitiesEvent) pMsg;
 
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                                         "or pData(%p) is null"), pData);
+        return;
     }
 
-    data = &(pHddCtx->ext_scan_context.capability_response);
+    skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
+                        EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
+                        QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX,
+                        GFP_KERNEL);
 
-    nl_buf_len = NLMSG_HDRLEN;
-    nl_buf_len += (sizeof(data->requestId) + NLA_HDRLEN) +
-    (sizeof(data->status) + NLA_HDRLEN) +
-    (sizeof(data->scanCacheSize) + NLA_HDRLEN) +
-    (sizeof(data->scanBuckets) + NLA_HDRLEN) +
-    (sizeof(data->maxApPerScan) + NLA_HDRLEN) +
-    (sizeof(data->maxRssiSampleSize) + NLA_HDRLEN) +
-    (sizeof(data->maxScanReportingThreshold) + NLA_HDRLEN) +
-    (sizeof(data->maxHotlistAPs) + NLA_HDRLEN) +
-    (sizeof(data->maxBsidHistoryEntries) + NLA_HDRLEN) +
-    (sizeof(data->maxHotlistSSIDs) + NLA_HDRLEN);
-
-    skb = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, nl_buf_len);
-
-    if (!skb)
-    {
-        hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed"));
-        return -ENOMEM;
+    if (!skb) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                  FL("cfg80211_vendor_event_alloc failed"));
+        return;
     }
 
-    hddLog(LOG1, "Req Id (%u) Status (%u)", data->requestId, data->status);
-    hddLog(LOG1, "Scan cache size (%u) Scan buckets (%u) Max AP per scan (%u)",
-           data->scanCacheSize, data->scanBuckets, data->maxApPerScan);
-    hddLog(LOG1, "max_rssi_sample_size (%u) max_scan_reporting_threshold (%u)",
-           data->maxRssiSampleSize, data->maxScanReportingThreshold);
-    hddLog(LOG1, "max_hotlist_bssids (%u) max_bssid_history_entries (%u)"
-           "max_hotlist_ssids (%u)", data->maxHotlistAPs,
-           data->maxBsidHistoryEntries, data->maxHotlistSSIDs);
+    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId);
+    hddLog(VOS_TRACE_LEVEL_INFO, "Scan cache size (%u)", pData->scanCacheSize);
+    hddLog(VOS_TRACE_LEVEL_INFO, "Scan buckets (%u)", pData->scanBuckets);
+    hddLog(VOS_TRACE_LEVEL_INFO, "Max AP per scan (%u)", pData->maxApPerScan);
+    hddLog(VOS_TRACE_LEVEL_INFO, "maxRssiSampleSize (%u)",
+                                        pData->maxRssiSampleSize);
+    hddLog(VOS_TRACE_LEVEL_INFO, "maxScanReportingThreshold (%u)",
+                                        pData->maxScanReportingThreshold);
+    hddLog(VOS_TRACE_LEVEL_INFO, "maxHotlistAPs (%u)", pData->maxHotlistAPs);
+    hddLog(VOS_TRACE_LEVEL_INFO, "maxSignificantWifiChangeAPs (%u)",
+                                        pData->maxSignificantWifiChangeAPs);
+    hddLog(VOS_TRACE_LEVEL_INFO, "maxBsidHistoryEntries (%u)",
+                                        pData->maxBsidHistoryEntries);
 
-    if (nla_put_u32(skb, PARAM_REQUEST_ID, data->requestId) ||
-        nla_put_u32(skb, PARAM_STATUS, data->status) ||
-        nla_put_u32(skb, MAX_SCAN_CACHE_SIZE, data->scanCacheSize) ||
-        nla_put_u32(skb, MAX_SCAN_BUCKETS, data->scanBuckets) ||
-        nla_put_u32(skb, MAX_AP_CACHE_PER_SCAN,
-            data->maxApPerScan) ||
-        nla_put_u32(skb, MAX_RSSI_SAMPLE_SIZE,
-            data->maxRssiSampleSize) ||
-        nla_put_u32(skb, MAX_SCAN_RPT_THRHOLD,
-            data->maxScanReportingThreshold) ||
-        nla_put_u32(skb, MAX_HOTLIST_BSSIDS, data->maxHotlistAPs) ||
-        nla_put_u32(skb, MAX_BSSID_HISTORY_ENTRIES,
-            data->maxBsidHistoryEntries) ||
-        nla_put_u32(skb, MAX_HOTLIST_SSIDS, data->maxHotlistSSIDs) ||
-        nla_put_u32(skb, MAX_SIGNIFICANT_WIFI_CHANGE_APS, 0))
-    {
-        hddLog(LOGE, FL("nla put fail"));
+    if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
+           pData->requestId) ||
+        nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status) ||
+        nla_put_u32(skb,
+           QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE,
+           pData->scanCacheSize) ||
+        nla_put_u32(skb,
+           QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS,
+           pData->scanBuckets) ||
+        nla_put_u32(skb,
+           QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN,
+           pData->maxApPerScan) ||
+        nla_put_u32(skb,
+           QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE,
+           pData->maxRssiSampleSize) ||
+        nla_put_u32(skb,
+           QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD,
+           pData->maxScanReportingThreshold) ||
+        nla_put_u32(skb,
+           QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_APS,
+           pData->maxHotlistAPs) ||
+        nla_put_u32(skb,
+           QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS,
+           pData->maxSignificantWifiChangeAPs) ||
+        nla_put_u32(skb,
+           QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES,
+           pData->maxBsidHistoryEntries)) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail"));
         goto nla_put_failure;
     }
 
-    cfg80211_vendor_cmd_reply(skb);
-    return 0;
+    cfg80211_vendor_event(skb, GFP_KERNEL);
+    return;
 
 nla_put_failure:
     kfree_skb(skb);
-    return -EINVAL;;
+    return;
 }
 
-/*
- * done with short names for the global vendor params
- * used by wlan_hdd_send_ext_scan_capability()
- */
-#undef PARAM_REQUEST_ID
-#undef PARAM_STATUS
-#undef MAX_SCAN_CACHE_SIZE
-#undef MAX_SCAN_BUCKETS
-#undef MAX_AP_CACHE_PER_SCAN
-#undef MAX_RSSI_SAMPLE_SIZE
-#undef MAX_SCAN_RPT_THRHOLD
-#undef MAX_HOTLIST_BSSIDS
-#undef MAX_BSSID_HISTORY_ENTRIES
-#undef MAX_HOTLIST_SSIDS
 
 static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg)
 {
     tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg;
     hdd_context_t *pHddCtx         = (hdd_context_t *)ctx;
+    struct sk_buff *skb            = NULL;
     tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal );
-    struct hdd_ext_scan_context *context;
 
-    ENTER();
 
-    if (wlan_hdd_validate_context(pHddCtx))
-        return;
-
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                                         "or pData(%p) is null"), pData);
         return;
     }
 
+    skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
+                                  EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
+                                  QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START_INDEX,
+                                  GFP_KERNEL);
+
+    if (!skb) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                  FL("cfg80211_vendor_event_alloc failed"));
+        return;
+    }
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering "));
     hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId);
     hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status);
 
-    context = &pHddCtx->ext_scan_context;
-    spin_lock(&hdd_context_lock);
-    if (context->request_id == pData->requestId) {
-        context->response_status = pData->status ? -EINVAL : 0;
-        complete(&context->response_event);
+    if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
+                         pData->requestId) ||
+        nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail"));
+        goto nla_put_failure;
     }
-    spin_unlock(&hdd_context_lock);
 
     /*
      * Store the Request ID for comparing with the requestID obtained
@@ -2420,7 +2194,12 @@
     if (pData->status == 0)
         pMac->sme.extScanStartReqId = pData->requestId;
 
-    EXIT();
+
+    cfg80211_vendor_event(skb, GFP_KERNEL);
+    return;
+
+nla_put_failure:
+    kfree_skb(skb);
     return;
 }
 
@@ -2429,67 +2208,82 @@
 {
     tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg;
     hdd_context_t *pHddCtx        = (hdd_context_t *)ctx;
-    struct hdd_ext_scan_context *context;
+    struct sk_buff *skb           = NULL;
 
-    ENTER();
-
-    if (wlan_hdd_validate_context(pHddCtx)){
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                                         "or pData(%p) is null"), pData);
         return;
     }
 
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
+    skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
+                                    EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
+                                    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP_INDEX,
+                                    GFP_KERNEL);
+
+    if (!skb) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                  FL("cfg80211_vendor_event_alloc failed"));
         return;
     }
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering "));
+    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId);
 
-    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId,
-                                                        pData->status);
-
-    context = &pHddCtx->ext_scan_context;
-    spin_lock(&hdd_context_lock);
-    if (context->request_id == pData->requestId) {
-        context->response_status = pData->status ? -EINVAL : 0;
-        complete(&context->response_event);
+    if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
+                         pData->requestId) ||
+        nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail"));
+        goto nla_put_failure;
     }
-    spin_unlock(&hdd_context_lock);
 
-    EXIT();
+    cfg80211_vendor_event(skb, GFP_KERNEL);
+    return;
+
+nla_put_failure:
+    kfree_skb(skb);
     return;
 }
 
+
 static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx,
                                                         void *pMsg)
 {
     hdd_context_t *pHddCtx    = (hdd_context_t *)ctx;
+    struct sk_buff *skb       = NULL;
     tpSirEXTScanSetBssidHotListRspParams pData =
                     (tpSirEXTScanSetBssidHotListRspParams) pMsg;
-    struct hdd_ext_scan_context *context;
 
-    ENTER();
-
-    if (wlan_hdd_validate_context(pHddCtx)){
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                                         "or pData(%p) is null"), pData);
         return;
     }
+    skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
+                      EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
+                      QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST_INDEX,
+                      GFP_KERNEL);
 
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
+    if (!skb) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                  FL("cfg80211_vendor_event_alloc failed"));
         return;
     }
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering "));
+    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId);
+    hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status);
 
-    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId,
-                                                        pData->status);
-
-    context = &pHddCtx->ext_scan_context;
-    spin_lock(&hdd_context_lock);
-    if (context->request_id == pData->requestId) {
-        context->response_status = pData->status ? -EINVAL : 0;
-        complete(&context->response_event);
+    if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
+                         pData->requestId) ||
+        nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail"));
+        goto nla_put_failure;
     }
-    spin_unlock(&hdd_context_lock);
 
-    EXIT();
+    cfg80211_vendor_event(skb, GFP_KERNEL);
+    return;
+
+nla_put_failure:
+    kfree_skb(skb);
     return;
 }
 
@@ -2497,371 +2291,285 @@
                                                           void *pMsg)
 {
     hdd_context_t *pHddCtx  = (hdd_context_t *)ctx;
+    struct sk_buff *skb     = NULL;
     tpSirEXTScanResetBssidHotlistRspParams pData =
                     (tpSirEXTScanResetBssidHotlistRspParams) pMsg;
-    struct hdd_ext_scan_context *context;
 
-    ENTER();
-
-    if (wlan_hdd_validate_context(pHddCtx)) {
-        return;
-    }
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                                         "or pData(%p) is null"), pData);
         return;
     }
 
-    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId,
-                                                        pData->status);
+    skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
+                      EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
+                      QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST_INDEX,
+                      GFP_KERNEL);
 
-    context = &pHddCtx->ext_scan_context;
-    spin_lock(&hdd_context_lock);
-    if (context->request_id == pData->requestId) {
-        context->response_status = pData->status ? -EINVAL : 0;
-        complete(&context->response_event);
+    if (!skb) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                  FL("cfg80211_vendor_event_alloc failed"));
+        return;
     }
-    spin_unlock(&hdd_context_lock);
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering "));
+    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId);
 
-    EXIT();
+    if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
+                         pData->requestId) ||
+        nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail"));
+        goto nla_put_failure;
+    }
+
+    cfg80211_vendor_event(skb, GFP_KERNEL);
+    return;
+
+nla_put_failure:
+    kfree_skb(skb);
     return;
 }
 
-static void wlan_hdd_cfg80211_extscan_set_ssid_hotlist_rsp(void *ctx,
-                                                        void *pMsg)
-{
-    hdd_context_t *pHddCtx    = (hdd_context_t *)ctx;
-    tpSirEXTScanSetSsidHotListRspParams pData =
-                    (tpSirEXTScanSetSsidHotListRspParams) pMsg;
-    struct hdd_ext_scan_context *context;
 
-    if (wlan_hdd_validate_context(pHddCtx)){
-        return;
-    }
-
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
-        return;
-    }
-
-    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId,
-                                                        pData->status);
-
-    context = &pHddCtx->ext_scan_context;
-    spin_lock(&hdd_context_lock);
-    if (context->request_id == pData->requestId) {
-        context->response_status = pData->status ? -EINVAL : 0;
-        complete(&context->response_event);
-    }
-    spin_unlock(&hdd_context_lock);
-
-    return;
-}
-
-static void wlan_hdd_cfg80211_extscan_reset_ssid_hotlist_rsp(void *ctx,
-                                                          void *pMsg)
+static void wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(void *ctx,
+                                                              void *pMsg)
 {
     hdd_context_t *pHddCtx  = (hdd_context_t *)ctx;
-    tpSirEXTScanResetSsidHotlistRspParams pData =
-                    (tpSirEXTScanResetSsidHotlistRspParams) pMsg;
-    struct hdd_ext_scan_context *context;
+    struct sk_buff *skb     = NULL;
+    tpSirEXTScanSetSignificantChangeRspParams pData =
+                    (tpSirEXTScanSetSignificantChangeRspParams) pMsg;
 
-    if (wlan_hdd_validate_context(pHddCtx)) {
-        return;
-    }
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                                         "or pData(%p) is null"), pData);
         return;
     }
 
-    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId,
-                                                        pData->status);
+    skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
+                EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
+                QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE_INDEX,
+                GFP_KERNEL);
 
-    context = &pHddCtx->ext_scan_context;
-    spin_lock(&hdd_context_lock);
-    if (context->request_id == pData->requestId) {
-        context->response_status = pData->status ? -EINVAL : 0;
-        complete(&context->response_event);
+    if (!skb) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                  FL("cfg80211_vendor_event_alloc failed"));
+        return;
     }
-    spin_unlock(&hdd_context_lock);
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering "));
+    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId);
+    hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status);
 
+    if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
+                         pData->requestId) ||
+        nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail"));
+        goto nla_put_failure;
+    }
+
+    cfg80211_vendor_event(skb, GFP_KERNEL);
+    return;
+
+nla_put_failure:
+    kfree_skb(skb);
     return;
 }
 
 
+static void wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(void *ctx,
+                                                                void *pMsg)
+{
+    hdd_context_t *pHddCtx  = (hdd_context_t *)ctx;
+    struct sk_buff *skb     = NULL;
+    tpSirEXTScanResetSignificantChangeRspParams pData =
+                    (tpSirEXTScanResetSignificantChangeRspParams) pMsg;
+
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                                         "or pData(%p) is null"), pData);
+        return;
+    }
+
+    skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
+              EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
+              QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE_INDEX,
+              GFP_KERNEL);
+
+    if (!skb) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                  FL("cfg80211_vendor_event_alloc failed"));
+        return;
+    }
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering "));
+    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId);
+    hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status);
+
+    if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
+                         pData->requestId) ||
+        nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail"));
+        goto nla_put_failure;
+    }
+
+    cfg80211_vendor_event(skb, GFP_KERNEL);
+    return;
+
+nla_put_failure:
+    kfree_skb(skb);
+    return;
+}
+
 static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx,
                                                        void *pMsg)
 {
     hdd_context_t *pHddCtx = (hdd_context_t *)ctx;
     struct sk_buff *skb    = NULL;
-    tANI_U32 i = 0, j, resultsPerEvent, scan_id_index;
+    tANI_U32 i = 0, j, resultsPerEvent;
     tANI_S32 totalResults;
     tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg;
-    tpSirWifiScanResult pSirWifiScanResult, head_ptr;
-    struct hdd_ext_scan_context *context;
-    bool ignore_cached_results = false;
-    tExtscanCachedScanResult *result;
-    struct nlattr *nla_results;
-    tANI_U16 ieLength= 0;
-    tANI_U8  *ie = NULL;
+    tpSirWifiScanResult pSirWifiScanResult;
 
-    ENTER();
-
-    if (wlan_hdd_validate_context(pHddCtx))
-        return;
-
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                                         "or pData(%p) is null"), pData);
         return;
     }
+    totalResults = pData->numOfAps;
+    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId);
+    hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps);
+    hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData);
 
-    spin_lock(&hdd_context_lock);
-    context = &pHddCtx->ext_scan_context;
-    ignore_cached_results = context->ignore_cached_results;
-    spin_unlock(&hdd_context_lock);
+    do{
+        resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ?
+                EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults);
+        totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND;
 
-    if (ignore_cached_results) {
-        hddLog(LOGE,
-               FL("Ignore the cached results received after timeout"));
-        return;
-    }
+        skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
+                EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
+                QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS_INDEX,
+                GFP_KERNEL);
 
-    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u More Data %u No of scan ids %u",
-           pData->requestId, pData->moreData, pData->scanResultSize);
+        if (!skb) {
+            hddLog(VOS_TRACE_LEVEL_ERROR,
+                    FL("cfg80211_vendor_event_alloc failed"));
+            return;
+        }
 
-    result = (tExtscanCachedScanResult *)&(pData->result);
+        hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent);
 
-    for (scan_id_index = 0; scan_id_index < pData->scanResultSize;
-                                                   scan_id_index++) {
-         result+= scan_id_index;
+        if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
+                    pData->requestId) ||
+                nla_put_u32(skb,
+                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE,
+                    resultsPerEvent)) {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
+            goto fail;
+        }
+        if (nla_put_u8(skb,
+                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA,
+                    pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 )))
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
+            goto fail;
+        }
 
-         totalResults = result->num_results;
-         hddLog(VOS_TRACE_LEVEL_INFO, "scan_id %u flags %u Num results %u",
-                result->scan_id, result->flags, totalResults);
-         i = 0;
+        if (resultsPerEvent) {
+            struct nlattr *aps;
 
-        do{
-            resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ?
-                    EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults);
-            totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND;
-
-            skb = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy,
-                                     EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN);
-
-            if (!skb) {
-                hddLog(VOS_TRACE_LEVEL_ERROR,
-                        FL("cfg80211_vendor_event_alloc failed"));
-                return;
-            }
-
-            hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent);
-
-            if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
-                        pData->requestId) ||
-                    nla_put_u32(skb,
-                        QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE,
-                        resultsPerEvent)) {
-                hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                goto fail;
-            }
-            if (nla_put_u8(skb,
-                        QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA,
-                        pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 )))
+            aps = nla_nest_start(skb,
+                            QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST);
+            if (!aps)
             {
                 hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
                 goto fail;
             }
 
-            if (nla_put_u32(skb,
-                QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_SCAN_ID,
-                result->scan_id)) {
-                hddLog(LOGE, FL("put fail"));
-                goto fail;
-            }
+            for (j = 0; j < resultsPerEvent; j++, i++) {
+                struct nlattr *ap;
+                pSirWifiScanResult =  (tpSirWifiScanResult) ((tANI_U8 *)
+                        pData->ap + ( i* sizeof(tSirWifiScanResult)));
 
-            nla_results = nla_nest_start(skb,
-                          QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_LIST);
-            if (!nla_results)
-                goto fail;
+                hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) "
+                        "Ssid (%s)"
+                        "Bssid: %pM "
+                        "Channel (%u)"
+                        "Rssi (%d)"
+                        "RTT (%u)"
+                        "RTT_SD (%u)",
+                        i,
+                        pSirWifiScanResult->ts,
+                        pSirWifiScanResult->ssid,
+                        pSirWifiScanResult->bssid,
+                        pSirWifiScanResult->channel,
+                        pSirWifiScanResult->rssi,
+                        pSirWifiScanResult->rtt,
+                        pSirWifiScanResult->rtt_sd);
 
-            if (resultsPerEvent) {
-                struct nlattr *aps;
-                struct nlattr *nla_result;
-
-                nla_result = nla_nest_start(skb, scan_id_index);
-                if(!nla_result)
-                   goto fail;
-
-                if (nla_put_u32(skb,
-                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_SCAN_ID,
-                    result->scan_id) ||
-                    nla_put_u32(skb,
-                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_FLAGS,
-                    result->flags) ||
-                    nla_put_u32(skb,
-                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE,
-                    totalResults)) {
-                    hddLog(LOGE, FL("put fail"));
-                    goto fail;
-                }
-
-                aps = nla_nest_start(skb,
-                                QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST);
-                if (!aps)
+                ap = nla_nest_start(skb, j + 1);
+                if (!ap)
                 {
                     hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
                     goto fail;
                 }
 
-                head_ptr = (tpSirWifiScanResult) &(result->ap);
-
-                for (j = 0; j < resultsPerEvent; j++, i++) {
-                    struct nlattr *ap;
-                    pSirWifiScanResult = head_ptr + i;
-
-                    /*
-                     * Firmware returns timestamp from extscan_start till
-                     * BSSID was cached (in micro seconds). Add this with
-                     * time gap between system boot up to extscan_start
-                     * to derive the time since boot when the
-                     * BSSID was cached.
-                     */
-                    pSirWifiScanResult->ts +=
-                                     pHddCtx->extscan_start_time_since_boot;
-                    hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) "
-                            "Ssid (%s)"
-                            "Bssid: %pM "
-                            "Channel (%u)"
-                            "Rssi (%d)"
-                            "RTT (%u)"
-                            "RTT_SD (%u)"
-                            "Beacon Period %u"
-                            "Capability 0x%x "
-                            "Ie length %d",
-                            i,
-                            pSirWifiScanResult->ts,
-                            pSirWifiScanResult->ssid,
-                            pSirWifiScanResult->bssid,
-                            pSirWifiScanResult->channel,
-                            pSirWifiScanResult->rssi,
-                            pSirWifiScanResult->rtt,
-                            pSirWifiScanResult->rtt_sd,
-                            pSirWifiScanResult->beaconPeriod,
-                            pSirWifiScanResult->capability,
-                            ieLength);
-
-                    ap = nla_nest_start(skb, j + 1);
-                    if (!ap)
-                    {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                        goto fail;
-                    }
-
-                    if (nla_put_u64(skb,
-                        QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP,
-                        pSirWifiScanResult->ts) )
-                    {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                        goto fail;
-                    }
-                    if (nla_put(skb,
-                             QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID,
-                             sizeof(pSirWifiScanResult->ssid),
-                            pSirWifiScanResult->ssid) )
-                    {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                        goto fail;
-                    }
-                    if (nla_put(skb,
-                            QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID,
-                            sizeof(pSirWifiScanResult->bssid),
-                            pSirWifiScanResult->bssid) )
-                    {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                        goto fail;
-                    }
-                    if (nla_put_u32(skb,
-                           QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL,
-                            pSirWifiScanResult->channel) )
-                    {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                        goto fail;
-                    }
-                    if (nla_put_s32(skb,
-                            QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI,
-                            pSirWifiScanResult->rssi) )
-                    {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                        goto fail;
-                    }
-                    if (nla_put_u32(skb,
-                              QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT,
-                              pSirWifiScanResult->rtt) )
-                    {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                        goto fail;
-                    }
-                    if (nla_put_u32(skb,
-                            QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD,
-                            pSirWifiScanResult->rtt_sd))
-                    {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                        goto fail;
-                    }
-                    if (nla_put_u32(skb,
-                            QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD,
-                            pSirWifiScanResult->beaconPeriod))
-                    {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                        goto fail;
-                    }
-                    if (nla_put_u32(skb,
-                            QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY,
-                            pSirWifiScanResult->capability))
-                    {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                        goto fail;
-                    }
-                    if (nla_put_u32(skb,
-                            QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH,
-                            ieLength))
-                    {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                        goto fail;
-                    }
-
-                    if (ieLength)
-                        if (nla_put(skb,
-                            QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA,
-                            ieLength, ie)) {
-                            hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
-                            goto fail;
-                        }
-
-                    nla_nest_end(skb, ap);
+                if (nla_put_u64(skb,
+                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP,
+                    pSirWifiScanResult->ts) )
+                {
+                    hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
+                    goto fail;
                 }
-                nla_nest_end(skb, aps);
-                nla_nest_end(skb, nla_result);
+                if (nla_put(skb,
+                         QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID,
+                         sizeof(pSirWifiScanResult->ssid),
+                        pSirWifiScanResult->ssid) )
+                {
+                    hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
+                    goto fail;
+                }
+                if (nla_put(skb,
+                        QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID,
+                        sizeof(pSirWifiScanResult->bssid),
+                        pSirWifiScanResult->bssid) )
+                {
+                    hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
+                    goto fail;
+                }
+                if (nla_put_u32(skb,
+                       QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL,
+                        pSirWifiScanResult->channel) )
+                {
+                    hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
+                    goto fail;
+                }
+                if (nla_put_s32(skb,
+                        QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI,
+                        pSirWifiScanResult->rssi) )
+                {
+                    hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
+                    goto fail;
+                }
+                if (nla_put_u32(skb,
+                          QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT,
+                          pSirWifiScanResult->rtt) )
+                {
+                    hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
+                    goto fail;
+                }
+                if (nla_put_u32(skb,
+                        QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD,
+                        pSirWifiScanResult->rtt_sd))
+                {
+                    hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
+                    goto fail;
+                }
+
+                nla_nest_end(skb, ap);
             }
+            nla_nest_end(skb, aps);
 
-         nla_nest_end(skb, nla_results);
+        }
+        cfg80211_vendor_event(skb, GFP_KERNEL);
+    } while (totalResults > 0);
 
-         cfg80211_vendor_cmd_reply(skb);
-
-        } while (totalResults > 0);
-    }
-
-    if (!pData->moreData) {
-        spin_lock(&hdd_context_lock);
-        context->response_status = 0;
-        complete(&context->response_event);
-        spin_unlock(&hdd_context_lock);
-    }
-
-    EXIT();
     return;
 fail:
     kfree_skb(skb);
@@ -2871,48 +2579,33 @@
 static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx,
                                                       void *pMsg)
 {
-    tpSirEXTScanHotlistMatch pData = (tpSirEXTScanHotlistMatch) pMsg;
+    tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg;
     hdd_context_t *pHddCtx         = (hdd_context_t *)ctx;
     struct sk_buff *skb            = NULL;
-    tANI_U32 i, index;
+    tANI_U32 i;
 
-    ENTER();
-
-    if (wlan_hdd_validate_context(pHddCtx)) {
-        hddLog(LOGE,
-               FL("HDD context is not valid or response"));
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                                         "or pData(%p) is null"), pData);
         return;
     }
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
-        return;
-    }
-
-    if (pData->bss_found)
-        index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX;
-    else
-        index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST_INDEX;
 
     skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
-                      NULL,
-#endif
                       EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
-                      index, GFP_KERNEL);
+                      QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX,
+                      GFP_KERNEL);
 
     if (!skb) {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                   FL("cfg80211_vendor_event_alloc failed"));
         return;
     }
-
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering "));
     hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId);
-    hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numHotlistBss);
+    hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps);
     hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData);
-    hddLog(VOS_TRACE_LEVEL_INFO, "ap_found %u", pData->bss_found);
 
-    for (i = 0; i < pData->numHotlistBss; i++) {
+    for (i = 0; i < pData->numOfAps; i++) {
         hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) "
                               "Ssid (%s) "
                               "Bssid (" MAC_ADDRESS_STR ") "
@@ -2921,24 +2614,24 @@
                               "RTT (%u) "
                               "RTT_SD (%u) ",
                               i,
-                              pData->bssHotlist[i].ts,
-                              pData->bssHotlist[i].ssid,
-                              MAC_ADDR_ARRAY(pData->bssHotlist[i].bssid),
-                              pData->bssHotlist[i].channel,
-                              pData->bssHotlist[i].rssi,
-                              pData->bssHotlist[i].rtt,
-                              pData->bssHotlist[i].rtt_sd);
+                              pData->ap[i].ts,
+                              pData->ap[i].ssid,
+                              MAC_ADDR_ARRAY(pData->ap[i].bssid),
+                              pData->ap[i].channel,
+                              pData->ap[i].rssi,
+                              pData->ap[i].rtt,
+                              pData->ap[i].rtt_sd);
     }
 
     if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
                       pData->requestId) ||
         nla_put_u32(skb,
                     QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE,
-                      pData->numHotlistBss)) {
+                      pData->numOfAps)) {
         hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
         goto fail;
     }
-    if (pData->numHotlistBss) {
+    if (pData->numOfAps) {
         struct nlattr *aps;
 
         aps = nla_nest_start(skb,
@@ -2946,7 +2639,7 @@
         if (!aps)
             goto fail;
 
-        for (i = 0; i < pData->numHotlistBss; i++) {
+        for (i = 0; i < pData->numOfAps; i++) {
             struct nlattr *ap;
 
             ap = nla_nest_start(skb, i + 1);
@@ -2955,27 +2648,27 @@
 
             if (nla_put_u64(skb,
                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP,
-                    pData->bssHotlist[i].ts) ||
+                    pData->ap[i].ts) ||
                 nla_put(skb,
                      QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID,
-                     sizeof(pData->bssHotlist[i].ssid),
-                     pData->bssHotlist[i].ssid) ||
+                     sizeof(pData->ap[i].ssid),
+                     pData->ap[i].ssid) ||
                 nla_put(skb,
                      QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID,
-                     sizeof(pData->bssHotlist[i].bssid),
-                     pData->bssHotlist[i].bssid) ||
+                     sizeof(pData->ap[i].bssid),
+                     pData->ap[i].bssid) ||
                 nla_put_u32(skb,
                      QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL,
-                     pData->bssHotlist[i].channel) ||
+                     pData->ap[i].channel) ||
                 nla_put_s32(skb,
                      QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI,
-                     pData->bssHotlist[i].rssi) ||
+                     pData->ap[i].rssi) ||
                 nla_put_u32(skb,
                      QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT,
-                     pData->bssHotlist[i].rtt) ||
+                     pData->ap[i].rtt) ||
                 nla_put_u32(skb,
                      QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD,
-                     pData->bssHotlist[i].rtt_sd))
+                     pData->ap[i].rtt_sd))
                 goto fail;
 
               nla_nest_end(skb, ap);
@@ -2989,7 +2682,6 @@
     }
 
     cfg80211_vendor_event(skb, GFP_KERNEL);
-    EXIT();
     return;
 
 fail:
@@ -2997,157 +2689,103 @@
     return;
 
 }
-
-/**
- * wlan_hdd_cfg80211_extscan_hotlist_ssid_match_ind() -
- *	Handle an SSID hotlist match event
- * @ctx: HDD context registered with SME
- * @event: The SSID hotlist match event
- *
- * This function will take an SSID match event that was generated by
- * firmware and will convert it into a cfg80211 vendor event which is
- * sent to userspace.
- *
- * Return: none
- */
-static void
-wlan_hdd_cfg80211_extscan_hotlist_ssid_match_ind(void *ctx,
-                                                void *pMsg)
+static void wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(void *ctx,
+                                                                   void *pMsg)
 {
-   hdd_context_t *hdd_ctx = ctx;
-   struct sk_buff *skb;
-   tANI_U32 i, index;
-   tpSirEXTScanSsidHotlistMatch pData = (tpSirEXTScanSsidHotlistMatch) pMsg;
+    hdd_context_t *pHddCtx  = (hdd_context_t *)ctx;
+    struct sk_buff *skb     = NULL;
+    tANI_U32 i, j;
+    tpSirWifiSignificantChangeEvent pData =
+                                     (tpSirWifiSignificantChangeEvent) pMsg;
 
-   ENTER();
-
-   if (wlan_hdd_validate_context(hdd_ctx)) {
-       hddLog(LOGE,
-              FL("HDD context is not valid or response"));
-       return;
-   }
-   if (!pMsg)
-   {
-       hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
-       return;
-   }
-
-    if (pData->ssid_found) {
-        index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND_INDEX;
-        hddLog(LOG1, "SSID hotlist found");
-    } else {
-        index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST_INDEX;
-        hddLog(LOG1, "SSID hotlist lost");
-    }
-
-    skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
-                       NULL,
-#endif
-          EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
-          index, GFP_KERNEL);
-
-    if (!skb) {
-        hddLog(LOGE, FL("cfg80211_vendor_event_alloc failed"));
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                                         "or pData(%p) is null"), pData);
         return;
     }
-    hddLog(LOG1, "Req Id %u, Num of SSIDs %u, More Data (%u)",
-           pData->requestId, pData->numHotlistSsid, pData->moreData);
+    skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
+                    EXTSCAN_EVENT_BUF_SIZE,
+                    QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE_INDEX,
+                    GFP_KERNEL);
 
-    for (i = 0; i < pData->numHotlistSsid; i++) {
-         hddLog(LOG1, "[i=%d] Timestamp %llu "
-               "Ssid: %s "
-               "Bssid (" MAC_ADDRESS_STR ") "
-               "Channel %u "
-               "Rssi %d "
-               "RTT %u "
-               "RTT_SD %u",
-               i,
-               pData->ssidHotlist[i].ts,
-               pData->ssidHotlist[i].ssid,
-               MAC_ADDR_ARRAY(pData->ssidHotlist[i].bssid),
-               pData->ssidHotlist[i].channel,
-               pData->ssidHotlist[i].rssi,
-               pData->ssidHotlist[i].rtt,
-               pData->ssidHotlist[i].rtt_sd);
-   }
+    if (!skb) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                  FL("cfg80211_vendor_event_alloc failed"));
+        return;
+    }
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering "));
+    hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId);
+    hddLog(VOS_TRACE_LEVEL_INFO, "total List Size %u ", pData->numSigRssiBss);
+    hddLog(VOS_TRACE_LEVEL_INFO, " CUrrent List size  (%u)",
+            pData->numSigRssiBss);
+    hddLog(VOS_TRACE_LEVEL_INFO, "moreData (%u)", pData->moreData);
 
-    if (nla_put_u32(skb,
-            QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
-            pData->requestId) ||
-        nla_put_u32(skb,
-            QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE,
-            pData->numHotlistSsid)) {
-        hddLog(LOGE, FL("put fail"));
+    for (i = 0; i < pData->numSigRssiBss; i++) {
+        hddLog(VOS_TRACE_LEVEL_INFO , "Rssi List [%d] BSSID: (%pM) Channel %u "
+                " num RSSI %u ",
+                i, pData->sigRssiResult[i].bssid,
+                pData->sigRssiResult[i].channel,
+                pData->sigRssiResult[i].numRssi);
+
+        for (j = 0; j < pData->sigRssiResult[i].numRssi; j++){
+
+            hddLog(VOS_TRACE_LEVEL_INFO,
+                    " [%d]",
+                    pData->sigRssiResult[i].rssi[j]);
+
+        }
+    }
+
+
+    if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
+                pData->requestId) ||
+            nla_put_u32(skb,
+                QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE,
+                pData->numSigRssiBss)) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail"));
         goto fail;
     }
 
-    if (pData->numHotlistSsid) {
+    if (pData->numSigRssiBss) {
         struct nlattr *aps;
-        aps = nla_nest_start(skb,
-                   QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST);
-        if (!aps) {
-            hddLog(LOGE, FL("nest fail"));
+        aps = nla_nest_start(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST);
+        if (!aps)
             goto fail;
-        }
-
-        for (i = 0; i < pData->numHotlistSsid; i++) {
+        for (i = 0; i < pData->numSigRssiBss; i++) {
             struct nlattr *ap;
 
             ap = nla_nest_start(skb, i);
-            if (!ap) {
-                hddLog(LOGE, FL("nest fail"));
+            if (!ap)
                 goto fail;
-            }
-
-            if (nla_put_u64(skb,
-                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP,
-                    pData->ssidHotlist[i].ts) ||
+            if (nla_put(skb,
+                 QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_BSSID,
+                 sizeof(tSirMacAddr), pData->sigRssiResult[i].bssid) ||
+                nla_put_u32(skb,
+                 QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_CHANNEL,
+                 pData->sigRssiResult[i].channel) ||
+                nla_put_u32(skb,
+                 QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_NUM_RSSI,
+                 pData->sigRssiResult[i].numRssi) ||
                 nla_put(skb,
-                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID,
-                    sizeof(pData->ssidHotlist[i].ssid),
-                    pData->ssidHotlist[i].ssid) ||
-                nla_put(skb,
-                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID,
-                    sizeof(pData->ssidHotlist[i].bssid),
-                    pData->ssidHotlist[i].bssid) ||
-                nla_put_u32(skb,
-                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL,
-                    pData->ssidHotlist[i].channel) ||
-                nla_put_s32(skb,
-                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI,
-                    pData->ssidHotlist[i].rssi) ||
-                nla_put_u32(skb,
-                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT,
-                    pData->ssidHotlist[i].rtt) ||
-                nla_put_u32(skb,
-                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD,
-                    pData->ssidHotlist[i].rtt_sd)) {
-                hddLog(LOGE, FL("put fail"));
+                 QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_RSSI_LIST,
+                 sizeof(s32) * pData->sigRssiResult[i].numRssi,
+                 pData->sigRssiResult[i].rssi))
                 goto fail;
-            }
             nla_nest_end(skb, ap);
         }
         nla_nest_end(skb, aps);
-
         if (nla_put_u8(skb,
-                   QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA,
-                   pData->moreData)) {
-            hddLog(LOGE, FL("put fail"));
+                    QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA,
+                    pData->moreData))
             goto fail;
-        }
     }
-
     cfg80211_vendor_event(skb, GFP_KERNEL);
     return;
-
 fail:
     kfree_skb(skb);
     return;
-
 }
 
-
 static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx,
                                                            void *pMsg)
 {
@@ -3156,32 +2794,13 @@
     tpSirWifiFullScanResultEvent pData =
         (tpSirWifiFullScanResultEvent) (pMsg);
 
-    ENTER();
-
-    if (wlan_hdd_validate_context(pHddCtx)) {
-        hddLog(LOGE,
-               FL("HDD context is not valid or response"));
-        return;
-    }
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
-        return;
-    }
-
-    /*
-         * If the full scan result including IE data exceeds NL 4K size
-         * limitation, drop that beacon/probe rsp frame.
-         */
-    if ((sizeof(*pData) + pData->ieLength) >= EXTSCAN_EVENT_BUF_SIZE) {
-        hddLog(LOGE, FL("Frame exceeded NL size limilation, drop it!"));
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                    "or pData(%p) is null"), pData);
         return;
     }
 
     skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
-            NULL,
-#endif
             EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
             QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX,
             GFP_KERNEL);
@@ -3192,6 +2811,7 @@
         return;
     }
 
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering "));
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId);
     hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData);
     hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) "
@@ -3200,19 +2820,14 @@
                 "Channel (%u)"
                 "Rssi (%d)"
                 "RTT (%u)"
-                "RTT_SD (%u)"
-                "Bcn Period %d"
-                "Capability 0x%X "),
+                "RTT_SD (%u)"),
             pData->ap.ts,
             pData->ap.ssid,
             MAC_ADDR_ARRAY(pData->ap.bssid),
             pData->ap.channel,
             pData->ap.rssi,
             pData->ap.rtt,
-            pData->ap.rtt_sd,
-            pData->ap.beaconPeriod,
-            pData->ap.capability);
-
+            pData->ap.rtt_sd);
     hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength);
     if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
                 pData->requestId) ||
@@ -3243,27 +2858,20 @@
             pData->ap.capability) ||
         nla_put_u32(skb,
                 QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH,
-            pData->ieLength) ||
-        nla_put_u8(skb,
-                QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA,
-            pData->moreData))
+            pData->ieLength))
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail"));
+        goto nla_put_failure;
+    }
+    if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA,
+                pData->ieLength,
+                pData->ie))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail"));
         goto nla_put_failure;
     }
 
-    if (pData->ieLength) {
-        if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA,
-                    pData->ieLength,
-                    pData->ie))
-        {
-            hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail"));
-            goto nla_put_failure;
-        }
-    }
-
     cfg80211_vendor_event(skb, GFP_KERNEL);
-    EXIT();
     return;
 
 nla_put_failure:
@@ -3279,23 +2887,13 @@
     tpSirEXTScanResultsAvailableIndParams pData =
                     (tpSirEXTScanResultsAvailableIndParams) pMsg;
 
-    ENTER();
-
-    if (wlan_hdd_validate_context(pHddCtx)){
-        hddLog(LOGE,
-               FL("HDD context is not valid or response"));
-        return;
-    }
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                                         "or pData(%p) is null"), pData);
         return;
     }
 
     skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
-                NULL,
-#endif
                 EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
                 QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX,
                 GFP_KERNEL);
@@ -3306,6 +2904,7 @@
         return;
     }
 
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering "));
     hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId);
     hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)",
                                   pData->numResultsAvailable);
@@ -3319,7 +2918,6 @@
     }
 
     cfg80211_vendor_event(skb, GFP_KERNEL);
-    EXIT();
     return;
 
 nla_put_failure:
@@ -3334,23 +2932,13 @@
     tpSirEXTScanProgressIndParams pData =
                                    (tpSirEXTScanProgressIndParams) pMsg;
 
-    ENTER();
-
-    if (wlan_hdd_validate_context(pHddCtx)){
-        hddLog(LOGE,
-               FL("HDD context is not valid or response"));
-        return;
-    }
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
+    if (wlan_hdd_validate_context(pHddCtx) || !pData) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "
+                                         "or pData(%p) is null"), pData);
         return;
     }
 
     skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
-                            NULL,
-#endif
                             EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
                             QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX,
                             GFP_KERNEL);
@@ -3360,7 +2948,7 @@
                   FL("cfg80211_vendor_event_alloc failed"));
         return;
     }
-    hddLog(VOS_TRACE_LEVEL_INFO, FL("Request Id (%u) "), pData->requestId);
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering "));
     hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)",
             pData->extScanEventType);
     hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)",
@@ -3379,7 +2967,6 @@
     }
 
     cfg80211_vendor_event(skb, GFP_KERNEL);
-    EXIT();
     return;
 
 nla_put_failure:
@@ -3392,9 +2979,8 @@
 {
     hdd_context_t *pHddCtx = (hdd_context_t *)ctx;
 
-    ENTER();
-
     if (wlan_hdd_validate_context(pHddCtx)) {
+        hddLog(VOS_TRACE_LEVEL_INFO, FL("HDD context is not valid"));
         return;
     }
 
@@ -3423,16 +3009,15 @@
         wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg);
         break;
 
-    case SIR_HAL_EXTSCAN_SET_SSID_HOTLIST_RSP:
-        wlan_hdd_cfg80211_extscan_set_ssid_hotlist_rsp(ctx, pMsg);
+    case SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP:
+        wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(ctx, pMsg);
         break;
 
-    case SIR_HAL_EXTSCAN_RESET_SSID_HOTLIST_RSP:
-        wlan_hdd_cfg80211_extscan_reset_ssid_hotlist_rsp(ctx, pMsg);
+    case SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP:
+        wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(ctx, pMsg);
         break;
-
     case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP:
-        wlan_hdd_cfg80211_extscan_get_capabilities_rsp(ctx, pMsg);
+        wlan_hdd_cfg80211_extscan_get_capabilities_ind(ctx, pMsg);
         break;
     case SIR_HAL_EXTSCAN_PROGRESS_IND:
         wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg);
@@ -3446,8 +3031,8 @@
     case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND:
         wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg);
         break;
-    case SIR_HAL_EXTSCAN_SSID_HOTLIST_MATCH_IND:
-        wlan_hdd_cfg80211_extscan_hotlist_ssid_match_ind(ctx, pMsg);
+    case SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND:
+        wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(ctx, pMsg);
         break;
     case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND:
         wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg);
@@ -3456,12 +3041,11 @@
         hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType);
         break;
     }
-    EXIT();
 }
 
-static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy,
-                                                        struct wireless_dev *wdev,
-                                                        void *data, int dataLen)
+static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy,
+                                        struct wireless_dev *wdev,
+                                        void *data, int dataLen)
 {
     tSirGetEXTScanCapabilitiesReqParams reqMsg;
     struct net_device *dev                     = wdev->netdev;
@@ -3470,21 +3054,18 @@
     struct nlattr
         *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
     eHalStatus status;
-    struct hdd_ext_scan_context *context;
-    unsigned long rc;
-    int ret;
 
-    ENTER();
-
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering"));
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL;
     }
     /* check the EXTScan Capability */
     if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)))
+         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                FL("EXTScan not enabled/supported by Firmware"));
@@ -3504,6 +3085,7 @@
         return -EINVAL;
     }
 
+
     reqMsg.requestId = nla_get_u32(
               tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId);
@@ -3511,12 +3093,6 @@
     reqMsg.sessionId = pAdapter->sessionId;
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId);
 
-    vos_spin_lock_acquire(&hdd_context_lock);
-    context = &pHddCtx->ext_scan_context;
-    context->request_id = reqMsg.requestId;
-    INIT_COMPLETION(context->response_event);
-    vos_spin_lock_release(&hdd_context_lock);
-
     status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg);
     if (!HAL_STATUS_SUCCESS(status)) {
         hddLog(VOS_TRACE_LEVEL_ERROR,
@@ -3524,39 +3100,13 @@
         return -EINVAL;
     }
 
-    rc = wait_for_completion_timeout(&context->response_event,
-             msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN));
-    if (!rc) {
-        hddLog(LOGE, FL("Target response timed out"));
-        return -ETIMEDOUT;
-    }
-
-    ret = wlan_hdd_send_ext_scan_capability(pHddCtx);
-    if (ret)
-        hddLog(LOGE, FL("Failed to send ext scan capability to user space"));
-
-    return ret;
-
-    EXIT();
     return 0;
 }
 
-static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy,
-                                                      struct wireless_dev *wdev,
-                                                  void *data, int dataLen)
-{
-   int ret = 0;
 
-   vos_ssr_protect(__func__);
-   ret = __wlan_hdd_cfg80211_extscan_get_capabilities(wiphy, wdev, data, dataLen);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
-static int __wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy,
-                                                struct wireless_dev *wdev,
-                                                void *data, int dataLen)
+static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy,
+                                        struct wireless_dev *wdev,
+                                        void *data, int dataLen)
 {
     tSirEXTScanGetCachedResultsReqParams reqMsg;
     struct net_device *dev                      = wdev->netdev;
@@ -3565,26 +3115,17 @@
     struct nlattr
             *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
     eHalStatus status;
-    struct hdd_ext_scan_context *context;
-    unsigned long rc;
-    int retval;
-
-    ENTER();
-
-    if (VOS_FTM_MODE == hdd_get_conparam()) {
-        hddLog(LOGE, FL("Command not allowed in FTM mode"));
-        return -EINVAL;
-    }
 
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL;
     }
     /* check the EXTScan Capability */
     if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)))
+         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                FL("EXTScan not enabled/supported by Firmware"));
@@ -3623,54 +3164,19 @@
 
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush);
 
-    spin_lock(&hdd_context_lock);
-    context = &pHddCtx->ext_scan_context;
-    context->request_id = reqMsg.requestId;
-    context->ignore_cached_results = false;
-    INIT_COMPLETION(context->response_event);
-    spin_unlock(&hdd_context_lock);
-
     status = sme_getCachedResults(pHddCtx->hHal, &reqMsg);
     if (!HAL_STATUS_SUCCESS(status)) {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                FL("sme_getCachedResults failed(err=%d)"), status);
         return -EINVAL;
     }
-
-    rc = wait_for_completion_timeout(&context->response_event,
-            msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN));
-    if (!rc) {
-        hddLog(LOGE, FL("Target response timed out"));
-        retval = -ETIMEDOUT;
-        spin_lock(&hdd_context_lock);
-        context->ignore_cached_results = true;
-        spin_unlock(&hdd_context_lock);
-    } else {
-        spin_lock(&hdd_context_lock);
-        retval = context->response_status;
-        spin_unlock(&hdd_context_lock);
-    }
-
-    EXIT();
-    return retval;
+    return 0;
 
 failed:
     return -EINVAL;
 }
-static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy,
-                                                struct wireless_dev *wdev,
-                                                void *data, int dataLen)
-{
-   int ret = 0;
 
-   vos_ssr_protect(__func__);
-   ret = __wlan_hdd_cfg80211_extscan_get_cached_results(wiphy, wdev, data, dataLen);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
-static int __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy,
                                         struct wireless_dev *wdev,
                                         void *data, int dataLen)
 {
@@ -3686,27 +3192,17 @@
     eHalStatus status;
     tANI_U8 i = 0;
     int rem;
-    struct hdd_ext_scan_context *context;
-    tANI_U32 request_id;
-    unsigned long rc;
-    int retval;
-
-    ENTER();
-
-    if (VOS_FTM_MODE == hdd_get_conparam()) {
-        hddLog(LOGE, FL("Command not allowed in FTM mode"));
-        return -EINVAL;
-    }
 
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL;
     }
     /* check the EXTScan Capability */
     if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)))
+         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                FL("EXTScan not enabled/supported by Firmware"));
@@ -3743,22 +3239,12 @@
         goto fail;
     }
 
-    /* Parse and fetch lost ap sample size */
-    if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE]) {
-        hddLog(LOGE, FL("attr lost ap sample size failed"));
-        goto fail;
-    }
-
-    pReqMsg->lostBssidSampleSize = nla_get_u32(
-              tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE]);
-    hddLog(LOG1, FL("Lost ap sample size %d"), pReqMsg->lostBssidSampleSize);
-
     pReqMsg->sessionId = pAdapter->sessionId;
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId);
 
-    pReqMsg->numBssid = nla_get_u32(
+    pReqMsg->numAp = nla_get_u32(
               tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]);
-    hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numBssid);
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp);
 
     nla_for_each_nested(apTh,
                 tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) {
@@ -3797,15 +3283,18 @@
             tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]);
         hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"),
                                          pReqMsg->ap[i].high);
+
+        /* Parse and fetch channel */
+        if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed"));
+            goto fail;
+        }
+        pReqMsg->ap[i].channel = nla_get_u32(
+              tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]);
+        hddLog(VOS_TRACE_LEVEL_INFO,
+                FL("Channel (%u)"), pReqMsg->ap[i].channel);
         i++;
     }
-
-    context = &pHddCtx->ext_scan_context;
-    spin_lock(&hdd_context_lock);
-    INIT_COMPLETION(context->response_event);
-    context->request_id = request_id = pReqMsg->requestId;
-    spin_unlock(&hdd_context_lock);
-
     status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg);
     if (!HAL_STATUS_SUCCESS(status)) {
         hddLog(VOS_TRACE_LEVEL_ERROR,
@@ -3814,397 +3303,183 @@
         return -EINVAL;
     }
 
-    /* request was sent -- wait for the response */
-    rc = wait_for_completion_timeout(&context->response_event,
-                                     msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN));
-
-    if (!rc) {
-       hddLog(LOGE, FL("sme_SetBssHotlist timed out"));
-       retval = -ETIMEDOUT;
-    } else {
-       spin_lock(&hdd_context_lock);
-       if (context->request_id == request_id)
-          retval = context->response_status;
-       else
-          retval = -EINVAL;
-       spin_unlock(&hdd_context_lock);
-    }
-
     vos_mem_free(pReqMsg);
-    EXIT();
-    return retval;
+
+    return 0;
 
 fail:
     vos_mem_free(pReqMsg);
     return -EINVAL;
 }
 
-static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy,
                                         struct wireless_dev *wdev,
                                         void *data, int dataLen)
 {
-   int ret = 0;
-
-   vos_ssr_protect(__func__);
-   ret = __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(wiphy, wdev, data,
-                                                       dataLen);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
-/*
- * define short names for the global vendor params
- * used by wlan_hdd_cfg80211_extscan_set_ssid_hotlist()
- */
-#define PARAM_MAX \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX
-#define PARAM_REQUEST_ID \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID
-#define PARAMS_LOST_SSID_SAMPLE_SIZE \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_LOST_SSID_SAMPLE_SIZE
-#define PARAMS_NUM_SSID \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID
-#define THRESHOLD_PARAM \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM
-#define PARAM_SSID \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID
-#define PARAM_BAND \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_BAND
-#define PARAM_RSSI_LOW \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_LOW
-#define PARAM_RSSI_HIGH \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_HIGH
-
-/**
- * __wlan_hdd_cfg80211_extscan_set_ssid_hotlist() - set ssid hot list
- * @wiphy: Pointer to wireless phy
- * @wdev: Pointer to wireless device
- * @data: Pointer to data
- * @data_len: Data length
- *
- * Return: 0 on success, negative errno on failure
- */
-static int
-__wlan_hdd_cfg80211_extscan_set_ssid_hotlist(struct wiphy *wiphy,
-                       struct wireless_dev *wdev,
-                       void *data,
-                       int data_len)
-{
-    tSirEXTScanSetSsidHotListReqParams *request;
-    struct net_device *dev = wdev->netdev;
-    hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
-    struct nlattr *tb[PARAM_MAX + 1];
-    struct nlattr *tb2[PARAM_MAX + 1];
-    struct nlattr *ssids;
-    struct hdd_ext_scan_context *context;
-    uint32_t request_id;
-    char ssid_string[SIR_MAC_MAX_SSID_LENGTH + 1] = {'\0'};
-    int ssid_len;
+    tpSirEXTScanSetSignificantChangeReqParams pReqMsg = NULL;
+    struct net_device *dev                  = wdev->netdev;
+    hdd_adapter_t *pAdapter                 = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_context_t *pHddCtx                  = wiphy_priv(wiphy);
+    struct nlattr
+        *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
+    struct nlattr
+        *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
+    struct nlattr *apTh;
     eHalStatus status;
-    int i, rem, retval;
-    unsigned long rc;
+    int i = 0;
+    int rem;
 
-    ENTER();
-
-    if (VOS_FTM_MODE == hdd_get_conparam()) {
-        hddLog(LOGE, FL("Command not allowed in FTM mode"));
+    status = wlan_hdd_validate_context(pHddCtx);
+    if (0 != status)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL;
     }
-
-    retval = wlan_hdd_validate_context(hdd_ctx);
-    if (0 != retval) {
-        hddLog(LOGE, FL("HDD context is not valid"));
-        return -EINVAL;
-    }
-
     /* check the EXTScan Capability */
-    if ( (TRUE != hdd_ctx->cfg_ini->fEnableEXTScan) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)))
+    if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
+         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                FL("EXTScan not enabled/supported by Firmware"));
         return -EINVAL;
     }
 
-    if (nla_parse(tb, PARAM_MAX,
-        data, data_len,
-              wlan_hdd_extscan_config_policy)) {
-        hddLog(LOGE, FL("Invalid ATTR"));
-        return -EINVAL;
-    }
-
-    request = vos_mem_malloc(sizeof(*request));
-    if (!request) {
-        hddLog(LOGE, FL("vos_mem_malloc failed"));
-        return -ENOMEM;
-    }
-
-    /* Parse and fetch request Id */
-    if (!tb[PARAM_REQUEST_ID]) {
-        hddLog(LOGE, FL("attr request id failed"));
-        goto fail;
-    }
-
-    request->request_id = nla_get_u32(tb[PARAM_REQUEST_ID]);
-    hddLog(LOG1, FL("Request Id %d"), request->request_id);
-
-    /* Parse and fetch lost SSID sample size */
-    if (!tb[PARAMS_LOST_SSID_SAMPLE_SIZE]) {
-        hddLog(LOGE, FL("attr number of Ssid failed"));
-        goto fail;
-    }
-    request->lost_ssid_sample_size =
-        nla_get_u32(tb[PARAMS_LOST_SSID_SAMPLE_SIZE]);
-    hddLog(LOG1, FL("Lost SSID Sample Size %d"),
-           request->lost_ssid_sample_size);
-
-    /* Parse and fetch number of hotlist SSID */
-    if (!tb[PARAMS_NUM_SSID]) {
-        hddLog(LOGE, FL("attr number of Ssid failed"));
-        goto fail;
-    }
-    request->ssid_count = nla_get_u32(tb[PARAMS_NUM_SSID]);
-    hddLog(LOG1, FL("Number of SSID %d"), request->ssid_count);
-
-    request->session_id = adapter->sessionId;
-    hddLog(LOG1, FL("Session Id (%d)"), request->session_id);
-
-    i = 0;
-    nla_for_each_nested(ssids, tb[THRESHOLD_PARAM], rem) {
-        if (i >= WLAN_EXTSCAN_MAX_HOTLIST_SSIDS) {
-            hddLog(LOGE,
-                   FL("Too Many SSIDs, %d exceeds %d"),
-                   i, WLAN_EXTSCAN_MAX_HOTLIST_SSIDS);
-            break;
-        }
-        if (nla_parse(tb2, PARAM_MAX,
-                  nla_data(ssids), nla_len(ssids),
-                  wlan_hdd_extscan_config_policy)) {
-            hddLog(LOGE, FL("nla_parse failed"));
-            goto fail;
-        }
-
-        /* Parse and fetch SSID */
-        if (!tb2[PARAM_SSID]) {
-            hddLog(LOGE, FL("attr ssid failed"));
-            goto fail;
-        }
-        nla_memcpy(ssid_string,
-               tb2[PARAM_SSID],
-               sizeof(ssid_string));
-        hddLog(LOG1, FL("SSID %s"),
-               ssid_string);
-        ssid_len = strlen(ssid_string);
-        memcpy(request->ssid[i].ssid.ssId, ssid_string, ssid_len);
-        request->ssid[i].ssid.length = ssid_len;
-        request->ssid[i].ssid.ssId[ssid_len] = '\0';
-        hddLog(LOG1, FL("After copying SSID %s"),
-               request->ssid[i].ssid.ssId);
-        hddLog(LOG1, FL("After copying length: %d"),
-                        ssid_len);
-
-        /* Parse and fetch low RSSI */
-        if (!tb2[PARAM_BAND]) {
-            hddLog(LOGE, FL("attr band failed"));
-            goto fail;
-        }
-        request->ssid[i].band = nla_get_u8(tb2[PARAM_BAND]);
-        hddLog(LOG1, FL("band %d"), request->ssid[i].band);
-
-        /* Parse and fetch low RSSI */
-        if (!tb2[PARAM_RSSI_LOW]) {
-            hddLog(LOGE, FL("attr low RSSI failed"));
-            goto fail;
-        }
-        request->ssid[i].rssi_low = nla_get_s32(tb2[PARAM_RSSI_LOW]);
-        hddLog(LOG1, FL("RSSI low %d"), request->ssid[i].rssi_low);
-
-        /* Parse and fetch high RSSI */
-        if (!tb2[PARAM_RSSI_HIGH]) {
-            hddLog(LOGE, FL("attr high RSSI failed"));
-            goto fail;
-        }
-        request->ssid[i].rssi_high = nla_get_u32(tb2[PARAM_RSSI_HIGH]);
-        hddLog(LOG1, FL("RSSI high %d"), request->ssid[i].rssi_high);
-        i++;
-    }
-
-    context = &hdd_ctx->ext_scan_context;
-    spin_lock(&hdd_context_lock);
-    INIT_COMPLETION(context->response_event);
-    context->request_id = request_id = request->request_id;
-    spin_unlock(&hdd_context_lock);
-
-    status = sme_set_ssid_hotlist(hdd_ctx->hHal, request);
-    if (!HAL_STATUS_SUCCESS(status)) {
-        hddLog(LOGE,
-               FL("sme_set_ssid_hotlist failed(err=%d)"), status);
-        goto fail;
-    }
-
-    vos_mem_free(request);
-
-    /* request was sent -- wait for the response */
-    rc = wait_for_completion_timeout(&context->response_event,
-                      msecs_to_jiffies
-                         (WLAN_WAIT_TIME_EXTSCAN));
-    if (!rc) {
-        hddLog(LOGE, FL("sme_set_ssid_hotlist timed out"));
-        retval = -ETIMEDOUT;
-    } else {
-        spin_lock(&hdd_context_lock);
-        if (context->request_id == request_id)
-            retval = context->response_status;
-        else
-            retval = -EINVAL;
-        spin_unlock(&hdd_context_lock);
-    }
-
-    return retval;
-
-fail:
-    vos_mem_free(request);
-    return -EINVAL;
-}
-
-/*
- * done with short names for the global vendor params
- * used by wlan_hdd_cfg80211_extscan_set_ssid_hotlist()
- */
-#undef PARAM_MAX
-#undef PARAM_REQUEST_ID
-#undef PARAMS_NUM_SSID
-#undef THRESHOLD_PARAM
-#undef PARAM_SSID
-#undef PARAM_BAND
-#undef PARAM_RSSI_LOW
-#undef PARAM_RSSI_HIGH
-
-static int wlan_hdd_cfg80211_extscan_set_ssid_hotlist(struct wiphy *wiphy,
-                                        struct wireless_dev *wdev,
-                                        void *data, int dataLen)
-{
-   int ret = 0;
-
-   vos_ssr_protect(__func__);
-   ret = __wlan_hdd_cfg80211_extscan_set_ssid_hotlist(wiphy, wdev, data,
-                                                       dataLen);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
-static int
-__wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(struct wiphy *wiphy,
-                         struct wireless_dev *wdev,
-                         void *data,
-                         int data_len)
-{
-    tSirEXTScanResetSsidHotlistReqParams request;
-    struct net_device *dev = wdev->netdev;
-    hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
-    struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
-    struct hdd_ext_scan_context *context;
-    uint32_t request_id;
-    eHalStatus status;
-    int retval;
-    unsigned long rc;
-
-    ENTER();
-
-    if (VOS_FTM_MODE == hdd_get_conparam()) {
-        hddLog(LOGE, FL("Command not allowed in FTM mode"));
-        return -EINVAL;
-    }
-
-    retval = wlan_hdd_validate_context(hdd_ctx);
-    if (0 != retval) {
-        hddLog(LOGE, FL("HDD context is not valid"));
-        return -EINVAL;
-    }
-
-    /* check the EXTScan Capability */
-    if ( (TRUE != hdd_ctx->cfg_ini->fEnableEXTScan) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)))
-    {
-        hddLog(LOGE,
-               FL("EXTScan not enabled/supported by Firmware"));
-        return -EINVAL;
-    }
-
     if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
-        data, data_len,
-               wlan_hdd_extscan_config_policy)) {
-        hddLog(LOGE, FL("Invalid ATTR"));
+                    data, dataLen,
+                    wlan_hdd_extscan_config_policy)) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR"));
         return -EINVAL;
     }
 
     /* Parse and fetch request Id */
     if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) {
-        hddLog(LOGE, FL("attr request id failed"));
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed"));
         return -EINVAL;
     }
+    pReqMsg = (tpSirEXTScanSetSignificantChangeReqParams)
+                                     vos_mem_malloc(sizeof(*pReqMsg));
+    if (!pReqMsg) {
+       hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed"));
+       return -ENOMEM;
+    }
 
-    request.requestId = nla_get_u32(
-            tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
-    request.sessionId = adapter->sessionId;
-    hddLog(LOG1, FL("Request Id %d Session Id %d"), request.requestId,
-           request.sessionId);
 
-    context = &hdd_ctx->ext_scan_context;
-    spin_lock(&hdd_context_lock);
-    INIT_COMPLETION(context->response_event);
-    context->request_id = request_id = request.requestId;
-    spin_unlock(&hdd_context_lock);
 
-    status = sme_reset_ssid_hotlist(hdd_ctx->hHal, &request);
+    pReqMsg->requestId = nla_get_u32(
+              tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId);
+
+    /* Parse and fetch RSSI sample size */
+    if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE])
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr RSSI sample size failed"));
+        goto fail;
+    }
+    pReqMsg->rssiSampleSize = nla_get_u32(
+    tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]);
+    hddLog(VOS_TRACE_LEVEL_INFO,
+               FL("RSSI sample size (%u)"), pReqMsg->rssiSampleSize);
+
+    /* Parse and fetch lost AP sample size */
+    if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE])
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr lost AP sample size failed"));
+        goto fail;
+    }
+    pReqMsg->lostApSampleSize = nla_get_u32(
+    tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]);
+    hddLog(VOS_TRACE_LEVEL_INFO,
+               FL("Lost AP sample size (%u)"), pReqMsg->lostApSampleSize);
+    /* Parse and fetch minimum Breaching */
+    if (!tb
+    [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr minBreaching failed"));
+        goto fail;
+    }
+    pReqMsg->minBreaching = nla_get_u32(
+      tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]);
+    hddLog(VOS_TRACE_LEVEL_INFO, FL(" Breaching (%d)"), pReqMsg->minBreaching);
+
+    /* Parse and fetch number of APs */
+    if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed"));
+        goto fail;
+    }
+    pReqMsg->numAp = nla_get_u32(
+            tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]);
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp);
+
+    pReqMsg->sessionId = pAdapter->sessionId;
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId);
+
+    nla_for_each_nested(apTh,
+                tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) {
+        if(nla_parse(tb2,
+                QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
+                nla_data(apTh), nla_len(apTh),
+                NULL)) {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed"));
+            goto fail;
+        }
+
+        /* Parse and fetch MAC address */
+        if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed"));
+            goto fail;
+        }
+        memcpy(pReqMsg->ap[i].bssid, nla_data(
+                tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]),
+                sizeof(tSirMacAddr));
+
+        /* Parse and fetch low RSSI */
+        if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed"));
+            goto fail;
+        }
+        pReqMsg->ap[i].low = nla_get_s32(
+             tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]);
+        hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low);
+
+        /* Parse and fetch high RSSI */
+        if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed"));
+            goto fail;
+        }
+        pReqMsg->ap[i].high = nla_get_s32(
+            tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]);
+        hddLog(VOS_TRACE_LEVEL_INFO,
+                                    FL("RSSI High (%d)"), pReqMsg->ap[i].high);
+
+        /* Parse and fetch channel */
+        if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed"));
+            goto fail;
+        }
+        pReqMsg->ap[i].channel = nla_get_u32(
+              tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]);
+        hddLog(VOS_TRACE_LEVEL_INFO,
+                           FL("Channel (%u)"), pReqMsg->ap[i].channel);
+        i++;
+    }
+
+    status = sme_SetSignificantChange(pHddCtx->hHal, pReqMsg);
     if (!HAL_STATUS_SUCCESS(status)) {
-        hddLog(LOGE,
-               FL("sme_reset_ssid_hotlist failed(err=%d)"), status);
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                  FL("sme_SetSignificantChange failed(err=%d)"), status);
+        vos_mem_free(pReqMsg);
         return -EINVAL;
     }
+    vos_mem_free(pReqMsg);
+    hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting"));
+    return 0;
 
-    /* request was sent -- wait for the response */
-    rc = wait_for_completion_timeout(&context->response_event,
-                     msecs_to_jiffies
-                     (WLAN_WAIT_TIME_EXTSCAN));
-    if (!rc) {
-        hddLog(LOGE, FL("sme_reset_ssid_hotlist timed out"));
-        retval = -ETIMEDOUT;
-    } else {
-        spin_lock(&hdd_context_lock);
-        if (context->request_id == request_id)
-            retval = context->response_status;
-        else
-            retval = -EINVAL;
-        spin_unlock(&hdd_context_lock);
-    }
-
-    return retval;
+fail:
+    vos_mem_free(pReqMsg);
+    return -EINVAL;
 }
 
-static int
-wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(struct wiphy *wiphy,
-                     struct wireless_dev *wdev,
-                     void *data,
-                     int data_len)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(wiphy, wdev,
-                            data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-static int __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy,
                                         struct wireless_dev *wdev,
                                         void *data, int dataLen)
 {
@@ -4212,18 +3487,26 @@
     tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
     tANI_U8 numChannels                                  = 0;
     struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
-    tANI_U32 requestId, maxChannels;
+    tANI_U32 requestId;
     tWifiBand wifiBand;
     eHalStatus status;
     struct sk_buff *replySkb;
     tANI_U8 i;
-    int ret;
 
-    ENTER();
-
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering"));
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
+        return -EINVAL;
+    }
+    /* check the EXTScan Capability */
+    if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
+         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("EXTScan not enabled/supported by Firmware"));
         return -EINVAL;
     }
 
@@ -4253,16 +3536,6 @@
      tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]);
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand);
 
-    /* Parse and fetch max channels */
-    if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS])
-    {
-        hddLog(LOGE, FL("attr max channels failed"));
-        return -EINVAL;
-    }
-    maxChannels = nla_get_u32(
-     tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]);
-    hddLog(VOS_TRACE_LEVEL_INFO, FL("Max channels %d"), maxChannels);
-
     status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal),
                                         wifiBand, ChannelList,
                                         &numChannels);
@@ -4271,10 +3544,7 @@
            FL("sme_GetValidChannelsByBand failed (err=%d)"), status);
         return -EINVAL;
     }
-
-    numChannels = VOS_MIN(numChannels, maxChannels);
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels);
-
     for (i = 0; i < numChannels; i++)
         hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]);
 
@@ -4298,317 +3568,44 @@
         return -EINVAL;
     }
 
-    ret = cfg80211_vendor_cmd_reply(replySkb);
-
-    EXIT();
-    return ret;
+    return cfg80211_vendor_cmd_reply(replySkb);
 }
 
-static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy,
-                                        struct wireless_dev *wdev,
-                                        void *data, int dataLen)
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev, data,
-                                                         dataLen);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-static int hdd_extscan_start_fill_bucket_channel_spec(
-            hdd_context_t *pHddCtx,
-            tpSirEXTScanStartReqParams pReqMsg,
-            struct nlattr **tb)
-{
-    struct nlattr *bucket[
-        QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
-    struct nlattr *channel[
-        QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
-    struct nlattr *buckets;
-    struct nlattr *channels;
-    int rem1, rem2;
-    eHalStatus status;
-    tANI_U8 bktIndex, j, numChannels;
-    tANI_U32 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
-    tANI_U32 passive_max_chn_time, active_max_chn_time;
-
-    bktIndex = 0;
-
-    nla_for_each_nested(buckets,
-            tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) {
-        if (nla_parse(bucket,
-            QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
-            nla_data(buckets), nla_len(buckets), NULL)) {
-            hddLog(LOGE, FL("nla_parse failed"));
-            return -EINVAL;
-        }
-
-        /* Parse and fetch bucket spec */
-        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) {
-            hddLog(LOGE, FL("attr bucket index failed"));
-            return -EINVAL;
-        }
-        pReqMsg->buckets[bktIndex].bucket = nla_get_u8(
-            bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]);
-        hddLog(LOG1, FL("Bucket spec Index %d"),
-               pReqMsg->buckets[bktIndex].bucket);
-
-        /* Parse and fetch wifi band */
-        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) {
-            hddLog(LOGE, FL("attr wifi band failed"));
-            return -EINVAL;
-        }
-        pReqMsg->buckets[bktIndex].band = nla_get_u8(
-            bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]);
-        hddLog(LOG1, FL("Wifi band %d"),
-               pReqMsg->buckets[bktIndex].band);
-
-        /* Parse and fetch period */
-        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) {
-            hddLog(LOGE, FL("attr period failed"));
-            return -EINVAL;
-        }
-        pReqMsg->buckets[bktIndex].period = nla_get_u32(
-        bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]);
-        hddLog(LOG1, FL("period %d"),
-           pReqMsg->buckets[bktIndex].period);
-
-        /* Parse and fetch report events */
-        if (!bucket[
-            QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) {
-            hddLog(LOGE, FL("attr report events failed"));
-            return -EINVAL;
-        }
-        pReqMsg->buckets[bktIndex].reportEvents = nla_get_u8(
-            bucket[
-            QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]);
-        hddLog(LOG1, FL("report events %d"),
-            pReqMsg->buckets[bktIndex].reportEvents);
-
-        /* Parse and fetch max period */
-        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD]) {
-            hddLog(LOGE, FL("attr max period failed"));
-            return -EINVAL;
-        }
-        pReqMsg->buckets[bktIndex].max_period = nla_get_u32(
-            bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD]);
-        hddLog(LOG1, FL("max period %u"),
-            pReqMsg->buckets[bktIndex].max_period);
-
-        /* Parse and fetch exponent */
-        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT]) {
-            hddLog(LOGE, FL("attr exponent failed"));
-            return -EINVAL;
-        }
-        pReqMsg->buckets[bktIndex].exponent = nla_get_u32(
-            bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT]);
-        hddLog(LOG1, FL("exponent %u"),
-            pReqMsg->buckets[bktIndex].exponent);
-
-        /* Parse and fetch step count */
-        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT]) {
-            hddLog(LOGE, FL("attr step count failed"));
-            return -EINVAL;
-        }
-        pReqMsg->buckets[bktIndex].step_count = nla_get_u32(
-            bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT]);
-        hddLog(LOG1, FL("Step count %u"),
-            pReqMsg->buckets[bktIndex].step_count);
-
-        ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &passive_max_chn_time);
-        ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &active_max_chn_time);
-
-        /* Framework shall pass the channel list if the input WiFi band is
-               * WIFI_BAND_UNSPECIFIED.
-               * If the input WiFi band is specified (any value other than
-               * WIFI_BAND_UNSPECIFIED) then driver populates the channel list
-               */
-        if (pReqMsg->buckets[bktIndex].band != WIFI_BAND_UNSPECIFIED) {
-            numChannels = 0;
-            hddLog(LOG1, "WiFi band is specified, driver to fill channel list");
-            status = sme_GetValidChannelsByBand(pHddCtx->hHal,
-                        pReqMsg->buckets[bktIndex].band,
-                        chanList, &numChannels);
-            if (!HAL_STATUS_SUCCESS(status)) {
-                hddLog(LOGE,
-                       FL("sme_GetValidChannelsByBand failed (err=%d)"),
-                       status);
-                return -EINVAL;
-            }
-
-            pReqMsg->buckets[bktIndex].numChannels =
-               VOS_MIN(numChannels, WLAN_EXTSCAN_MAX_CHANNELS);
-            hddLog(LOG1, FL("Num channels %d"),
-                   pReqMsg->buckets[bktIndex].numChannels);
-
-            for (j = 0; j < pReqMsg->buckets[bktIndex].numChannels;
-                 j++) {
-                pReqMsg->buckets[bktIndex].channels[j].channel =
-                            chanList[j];
-                pReqMsg->buckets[bktIndex].channels[j].
-                            chnlClass = 0;
-                if (CSR_IS_CHANNEL_DFS(
-                    vos_freq_to_chan(chanList[j]))) {
-                    pReqMsg->buckets[bktIndex].channels[j].
-                                passive = 1;
-                    pReqMsg->buckets[bktIndex].channels[j].
-                                dwellTimeMs = passive_max_chn_time;
-                } else {
-                    pReqMsg->buckets[bktIndex].channels[j].
-                        passive = 0;
-                    pReqMsg->buckets[bktIndex].channels[j].
-                        dwellTimeMs = active_max_chn_time;
-                }
-
-                hddLog(LOG1,
-                    "Channel %u Passive %u Dwell time %u ms",
-                    pReqMsg->buckets[bktIndex].channels[j].channel,
-                    pReqMsg->buckets[bktIndex].channels[j].passive,
-                    pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs);
-            }
-
-            bktIndex++;
-            continue;
-        }
-
-        /* Parse and fetch number of channels */
-        if (!bucket[
-            QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) {
-            hddLog(LOGE, FL("attr num channels failed"));
-            return -EINVAL;
-        }
-
-        pReqMsg->buckets[bktIndex].numChannels =
-        nla_get_u32(bucket[
-        QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]);
-        hddLog(LOG1, FL("num channels %d"),
-               pReqMsg->buckets[bktIndex].numChannels);
-
-        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) {
-            hddLog(LOGE, FL("attr channel spec failed"));
-            return -EINVAL;
-        }
-
-        j = 0;
-        nla_for_each_nested(channels,
-            bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) {
-            if (nla_parse(channel,
-                QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
-                nla_data(channels), nla_len(channels),
-                wlan_hdd_extscan_config_policy)) {
-                hddLog(LOGE, FL("nla_parse failed"));
-                return -EINVAL;
-           }
-
-            /* Parse and fetch channel */
-            if (!channel[
-                QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) {
-                hddLog(LOGE, FL("attr channel failed"));
-                return -EINVAL;
-            }
-            pReqMsg->buckets[bktIndex].channels[j].channel =
-                nla_get_u32(channel[
-                QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]);
-            hddLog(LOG1, FL("channel %u"),
-                   pReqMsg->buckets[bktIndex].channels[j].channel);
-
-            /* Parse and fetch dwell time */
-            if (!channel[
-                QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) {
-                hddLog(LOGE, FL("attr dwelltime failed"));
-                return -EINVAL;
-            }
-            pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs =
-                nla_get_u32(channel[
-                QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]);
-
-            hddLog(LOG1, FL("Dwell time (%u ms)"),
-                pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs);
-
-
-            /* Parse and fetch channel spec passive */
-            if (!channel[
-                QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) {
-                hddLog(LOGE,
-                       FL("attr channel spec passive failed"));
-                return -EINVAL;
-            }
-            pReqMsg->buckets[bktIndex].channels[j].passive =
-                nla_get_u8(channel[
-                QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]);
-            hddLog(LOG1, FL("Chnl spec passive %u"),
-                pReqMsg->buckets[bktIndex].channels[j].passive);
-
-            j++;
-       }
-
-       bktIndex++;
-    }
-
-    return 0;
-}
-
-
-/*
- * define short names for the global vendor params
- * used by wlan_hdd_cfg80211_extscan_start()
- */
-#define PARAM_MAX \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX
-#define PARAM_REQUEST_ID \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID
-#define PARAM_BASE_PERIOD \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD
-#define PARAM_MAX_AP_PER_SCAN \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN
-#define PARAM_RPT_THRHLD_PERCENT \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT
-#define PARAM_RPT_THRHLD_NUM_SCANS \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS
-#define PARAM_NUM_BUCKETS \
-QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS
-
-static int __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy,
                                         struct wireless_dev *wdev,
                                         void *data, int dataLen)
 {
     tpSirEXTScanStartReqParams pReqMsg = NULL;
-    struct net_device *dev             = wdev->netdev;
-    hdd_adapter_t *pAdapter            = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t *pHddCtx             = wiphy_priv(wiphy);
-    struct nlattr *tb[PARAM_MAX + 1];
-    int retval;
+    struct net_device *dev                  = wdev->netdev;
+    hdd_adapter_t *pAdapter                 = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_context_t *pHddCtx                  = wiphy_priv(wiphy);
+    struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
+    struct nlattr *bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
+    struct nlattr *channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
+    struct nlattr *buckets;
+    struct nlattr *channels;
+    int rem1;
+    int rem2;
     eHalStatus status;
-    tANI_U32 request_id;
-    struct hdd_ext_scan_context *context;
-    unsigned long rc;
-
-    ENTER();
-
-    if (VOS_FTM_MODE == hdd_get_conparam()) {
-        hddLog(LOGE, FL("Command not allowed in FTM mode"));
-        return -EINVAL;
-    }
+    tANI_U32 j = 0, index = 0;
 
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL;
     }
     /* check the EXTScan Capability */
     if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)))
+         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                FL("EXTScan not enabled/supported by Firmware"));
         return -EINVAL;
     }
 
-    if (nla_parse(tb, PARAM_MAX,
+    if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
                     data, dataLen,
                     wlan_hdd_extscan_config_policy)) {
         hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR"));
@@ -4616,7 +3613,7 @@
     }
 
     /* Parse and fetch request Id */
-    if (!tb[PARAM_REQUEST_ID]) {
+    if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) {
         hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed"));
         return -EINVAL;
     }
@@ -4629,59 +3626,49 @@
     }
 
     pReqMsg->requestId = nla_get_u32(
-              tb[PARAM_REQUEST_ID]);
+              tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId);
 
     pReqMsg->sessionId = pAdapter->sessionId;
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId);
 
     /* Parse and fetch base period */
-    if (!tb[PARAM_BASE_PERIOD]) {
+    if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]) {
         hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed"));
         goto fail;
     }
     pReqMsg->basePeriod = nla_get_u32(
-              tb[PARAM_BASE_PERIOD]);
+              tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]);
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"),
                                          pReqMsg->basePeriod);
 
     /* Parse and fetch max AP per scan */
-    if (!tb[PARAM_MAX_AP_PER_SCAN]) {
+    if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]) {
         hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed"));
         goto fail;
     }
     pReqMsg->maxAPperScan = nla_get_u32(
-             tb[PARAM_MAX_AP_PER_SCAN]);
+             tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]);
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"),
                                          pReqMsg->maxAPperScan);
 
     /* Parse and fetch report threshold */
-    if (!tb[PARAM_RPT_THRHLD_PERCENT]) {
+    if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]) {
         hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed"));
         goto fail;
     }
-    pReqMsg->reportThresholdPercent = nla_get_u8(
-            tb[PARAM_RPT_THRHLD_PERCENT]);
+    pReqMsg->reportThreshold = nla_get_u8(
+            tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]);
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"),
-                                     pReqMsg->reportThresholdPercent);
-
-    /* Parse and fetch report threshold num scans */
-    if (!tb[PARAM_RPT_THRHLD_NUM_SCANS]) {
-        hddLog(LOGE, FL("attr report_threshold num scans failed"));
-        goto fail;
-    }
-    pReqMsg->reportThresholdNumScans = nla_get_u8(
-        tb[PARAM_RPT_THRHLD_NUM_SCANS]);
-    hddLog(LOG1, FL("Report Threshold num scans %d"),
-                     pReqMsg->reportThresholdNumScans);
+                                         pReqMsg->reportThreshold);
 
     /* Parse and fetch number of buckets */
-    if (!tb[PARAM_NUM_BUCKETS]) {
+    if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]) {
         hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed"));
         goto fail;
     }
     pReqMsg->numBuckets = nla_get_u8(
-                 tb[PARAM_NUM_BUCKETS]);
+                 tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]);
     if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) {
         hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets "
           "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS);
@@ -4689,83 +3676,140 @@
     }
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"),
                                          pReqMsg->numBuckets);
-
     if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) {
         hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed"));
         goto fail;
     }
 
-    pReqMsg->homeAwayTime = pHddCtx->cfg_ini->nRestTimeConc;
+    nla_for_each_nested(buckets,
+                tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) {
+        if(nla_parse(bucket,
+            QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
+            nla_data(buckets), nla_len(buckets), NULL)) { //policy
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed"));
+            goto fail;
+        }
 
-    if (hdd_extscan_start_fill_bucket_channel_spec(pHddCtx, pReqMsg, tb))
-        goto fail;
+        /* Parse and fetch bucket spec */
+        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket index failed"));
+            goto fail;
+        }
 
-    context = &pHddCtx->ext_scan_context;
-    spin_lock(&hdd_context_lock);
-    INIT_COMPLETION(context->response_event);
-    context->request_id = request_id = pReqMsg->requestId;
-    spin_unlock(&hdd_context_lock);
+        pReqMsg->buckets[index].bucket = nla_get_u8(
+                bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]);
 
+        hddLog(VOS_TRACE_LEVEL_INFO, FL("Bucket spec Index (%d)"),
+                pReqMsg->buckets[index].bucket);
+
+        /* Parse and fetch wifi band */
+        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed"));
+            goto fail;
+        }
+        pReqMsg->buckets[index].band = nla_get_u8(
+                         bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]);
+        hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"),
+                           pReqMsg->buckets[index].band);
+
+        /* Parse and fetch period */
+        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr period failed"));
+            goto fail;
+        }
+        pReqMsg->buckets[index].period = nla_get_u32(
+                       bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]);
+        hddLog(VOS_TRACE_LEVEL_INFO, FL("period (%d)"),
+                           pReqMsg->buckets[index].period);
+
+        /* Parse and fetch report events */
+        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report events failed"));
+            goto fail;
+        }
+        pReqMsg->buckets[index].reportEvents = nla_get_u8(
+                bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]);
+        hddLog(VOS_TRACE_LEVEL_INFO, FL("report events (%d)"),
+                           pReqMsg->buckets[index].reportEvents);
+
+        /* Parse and fetch number of channels */
+        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS])
+        {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr num channels failed"));
+            goto fail;
+        }
+        pReqMsg->buckets[index].numChannels = nla_get_u32(
+            bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]);
+        hddLog(VOS_TRACE_LEVEL_INFO, FL("num channels (%d)"),
+                           pReqMsg->buckets[index].numChannels);
+
+        if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) {
+            hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel spec failed"));
+            goto fail;
+        }
+
+        j = 0;
+        nla_for_each_nested(channels,
+                      bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) {
+            if(nla_parse(channel,
+                QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
+                nla_data(channels), nla_len(channels),
+                NULL)) { //wlan_hdd_extscan_config_policy here
+                hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed"));
+                goto fail;
+            }
+
+            /* Parse and fetch channel */
+            if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) {
+                hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed"));
+                goto fail;
+            }
+            pReqMsg->buckets[index].channels[j].channel = nla_get_u32(
+                   channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]);
+            hddLog(VOS_TRACE_LEVEL_INFO, FL("channel (%u)"),
+                         pReqMsg->buckets[index].channels[j].channel);
+
+            /* Parse and fetch dwell time */
+            if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) {
+                hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dwelltime failed"));
+                goto fail;
+            }
+            pReqMsg->buckets[index].channels[j].dwellTimeMs = nla_get_u32(
+                 channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]);
+            hddLog(VOS_TRACE_LEVEL_INFO, FL("Dwell time (%u ms)"),
+                     pReqMsg->buckets[index].channels[j].dwellTimeMs);
+
+            /* Parse and fetch channel spec passive */
+            if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) {
+                hddLog(VOS_TRACE_LEVEL_ERROR,
+                                     FL("attr channel spec passive failed"));
+                goto fail;
+            }
+            pReqMsg->buckets[index].channels[j].passive = nla_get_u8(
+                   channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]);
+            hddLog(VOS_TRACE_LEVEL_INFO, FL("Chnl spec passive (%u)"),
+                     pReqMsg->buckets[index].channels[j].passive);
+            j++;
+        }
+        index++;
+    }
     status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg);
     if (!HAL_STATUS_SUCCESS(status)) {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                      FL("sme_EXTScanStart failed(err=%d)"), status);
-        goto fail;
-    }
-
-    pHddCtx->extscan_start_time_since_boot = vos_get_monotonic_boottime();
-
-    /* request was sent -- wait for the response */
-    rc = wait_for_completion_timeout(&context->response_event,
-                msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN));
-
-    if (!rc) {
-        hddLog(LOGE, FL("sme_ExtScanStart timed out"));
-        retval = -ETIMEDOUT;
-    } else {
-        spin_lock(&hdd_context_lock);
-        if (context->request_id == request_id)
-            retval = context->response_status;
-        else
-            retval = -EINVAL;
-        spin_unlock(&hdd_context_lock);
+        vos_mem_free(pReqMsg);
+        return -EINVAL;
     }
 
     vos_mem_free(pReqMsg);
-    EXIT();
-    return retval;
+    return 0;
 
 fail:
     vos_mem_free(pReqMsg);
     return -EINVAL;
 }
 
-/*
- * done with short names for the global vendor params
- * used by wlan_hdd_cfg80211_extscan_start()
- */
-#undef PARAM_MAX
-#undef PARAM_REQUEST_ID
-#undef PARAM_BASE_PERIOD
-#undef PARAMS_MAX_AP_PER_SCAN
-#undef PARAMS_RPT_THRHLD_PERCENT
-#undef PARAMS_RPT_THRHLD_NUM_SCANS
-#undef PARAMS_NUM_BUCKETS
-
-static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy,
-                                        struct wireless_dev *wdev,
-                                        void *data, int dataLen)
-{
-   int ret = 0;
-
-   vos_ssr_protect(__func__);
-   ret = __wlan_hdd_cfg80211_extscan_start(wiphy, wdev, data, dataLen);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
-static int __wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy,
                                         struct wireless_dev *wdev,
                                         void *data, int dataLen)
 {
@@ -4775,27 +3819,17 @@
     hdd_context_t *pHddCtx                  = wiphy_priv(wiphy);
     struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
     eHalStatus status;
-    int retval;
-    unsigned long rc;
-    struct hdd_ext_scan_context *context;
-    tANI_U32 request_id;
-
-    ENTER();
-
-    if (VOS_FTM_MODE == hdd_get_conparam()) {
-        hddLog(LOGE, FL("Command not allowed in FTM mode"));
-        return -EINVAL;
-    }
 
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL;
     }
     /* check the EXTScan Capability */
     if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)))
+         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                FL("EXTScan not enabled/supported by Firmware"));
@@ -4822,12 +3856,6 @@
     reqMsg.sessionId = pAdapter->sessionId;
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId);
 
-    context = &pHddCtx->ext_scan_context;
-    spin_lock(&hdd_context_lock);
-    INIT_COMPLETION(context->response_event);
-    context->request_id = request_id = reqMsg.requestId;
-    spin_unlock(&hdd_context_lock);
-
     status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg);
     if (!HAL_STATUS_SUCCESS(status)) {
         hddLog(VOS_TRACE_LEVEL_ERROR,
@@ -4835,42 +3863,10 @@
         return -EINVAL;
     }
 
-    /* request was sent -- wait for the response */
-    rc = wait_for_completion_timeout(&context->response_event,
-                 msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN));
-
-    if (!rc) {
-        hddLog(LOGE, FL("sme_ExtScanStop timed out"));
-        retval = -ETIMEDOUT;
-    } else {
-        spin_lock(&hdd_context_lock);
-        if (context->request_id == request_id)
-            retval = context->response_status;
-        else
-            retval = -EINVAL;
-        spin_unlock(&hdd_context_lock);
-    }
-
-    return retval;
-
-    EXIT();
     return 0;
 }
 
-static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy,
-                                        struct wireless_dev *wdev,
-                                        void *data, int dataLen)
-{
-   int ret = 0;
-
-   vos_ssr_protect(__func__);
-   ret = __wlan_hdd_cfg80211_extscan_stop(wiphy, wdev, data, dataLen);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
-static int __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy,
                                         struct wireless_dev *wdev,
                                         void *data, int dataLen)
 {
@@ -4880,28 +3876,17 @@
     hdd_context_t *pHddCtx                       = wiphy_priv(wiphy);
     struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
     eHalStatus status;
-    struct hdd_ext_scan_context *context;
-    tANI_U32 request_id;
-    unsigned long rc;
-    int retval;
-
-    ENTER();
-
-    if (VOS_FTM_MODE == hdd_get_conparam()) {
-        hddLog(LOGE, FL("Command not allowed in FTM mode"));
-        return -EINVAL;
-    }
 
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
-        hddLog(LOGE, FL("HDD context is not valid"));
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL;
     }
     /* check the EXTScan Capability */
     if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) ||
-         (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)))
+         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                FL("EXTScan not enabled/supported by Firmware"));
@@ -4928,12 +3913,6 @@
     reqMsg.sessionId = pAdapter->sessionId;
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId);
 
-    context = &pHddCtx->ext_scan_context;
-    spin_lock(&hdd_context_lock);
-    INIT_COMPLETION(context->response_event);
-    context->request_id = request_id = reqMsg.requestId;
-    spin_unlock(&hdd_context_lock);
-
     status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg);
     if (!HAL_STATUS_SUCCESS(status)) {
         hddLog(VOS_TRACE_LEVEL_ERROR,
@@ -4941,37 +3920,70 @@
         return -EINVAL;
     }
 
-    /* request was sent -- wait for the response */
-    rc = wait_for_completion_timeout(&context->response_event,
-                                     msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN));
-    if (!rc) {
-       hddLog(LOGE, FL("sme_ResetBssHotlist timed out"));
-       retval = -ETIMEDOUT;
-    } else {
-       spin_lock(&hdd_context_lock);
-       if (context->request_id == request_id)
-          retval = context->response_status;
-       else
-          retval = -EINVAL;
-       spin_unlock(&hdd_context_lock);
-    }
-
-    EXIT();
-    return retval;
+    return 0;
 }
 
-static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_extscan_reset_significant_change(
+                                        struct wiphy *wiphy,
                                         struct wireless_dev *wdev,
                                         void *data, int dataLen)
 {
-   int ret = 0;
+    tSirEXTScanResetSignificantChangeReqParams reqMsg;
+    struct net_device *dev                       = wdev->netdev;
+    hdd_adapter_t *pAdapter                      = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_context_t *pHddCtx                       = wiphy_priv(wiphy);
+    struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
+    eHalStatus status;
 
-   vos_ssr_protect(__func__);
-   ret = __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(wiphy, wdev, data, dataLen);
-   vos_ssr_unprotect(__func__);
+    hddLog(VOS_TRACE_LEVEL_INFO, FL(" Entering"));
+    status = wlan_hdd_validate_context(pHddCtx);
+    if (0 != status)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
+        return -EINVAL;
+    }
+    /* check the EXTScan Capability */
+    if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
+         (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("EXTScan not enabled/supported by Firmware"));
+        return -EINVAL;
+    }
 
-   return ret;
+    if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
+                    data, dataLen,
+                    wlan_hdd_extscan_config_policy)) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR"));
+        return -EINVAL;
+    }
+
+    /* Parse and fetch request Id */
+    if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed"));
+        return -EINVAL;
+    }
+
+
+    reqMsg.requestId = nla_get_u32(
+              tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId);
+
+    reqMsg.sessionId = pAdapter->sessionId;
+    hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId);
+
+    status = sme_ResetSignificantChange(pHddCtx->hHal, &reqMsg);
+    if (!HAL_STATUS_SUCCESS(status)) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                   FL("sme_ResetSignificantChange failed(err=%d)"), status);
+        return -EINVAL;
+    }
+
+    hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting"));
+    return 0;
 }
+
 #endif /* WLAN_FEATURE_EXTSCAN */
 
 /*EXT TDLS*/
@@ -5026,7 +4038,7 @@
     [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = {.type = NLA_UNSPEC },
 };
 
-static int __wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy,
         struct wireless_dev *wdev,
         void *data,
         int data_len)
@@ -5035,17 +4047,16 @@
     hdd_context_t *pHddCtx      = wiphy_priv(wiphy);
     struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1];
 
-    ENTER();
-
     if (0 != wlan_hdd_validate_context(pHddCtx)){
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("hdd Ctx invalid while spoof macAddr"));
         return -EINVAL;
     }
-    if (0 == pHddCtx->cfg_ini->enableMacSpoofing) {
-        hddLog(VOS_TRACE_LEVEL_INFO, FL("MAC_SPOOFED_SCAN disabled in ini"));
+    if (FALSE == pHddCtx->cfg_ini->enableMacSpoofing) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN disabled in ini"));
         return -ENOTSUPP;
-    }
+     }
     if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){
-        hddLog(VOS_TRACE_LEVEL_INFO, FL("MAC_SPOOFED_SCAN not supported by FW"));
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN not supported by FW"));
         return -ENOTSUPP;
     }
 
@@ -5065,43 +4076,28 @@
                 tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]),
             VOS_MAC_ADDR_LAST_3_BYTES);
 
-    pHddCtx->spoofMacAddr.isEnabled = TRUE;
-
-    vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, nla_data(
+    vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,nla_data(
             tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]),
             VOS_MAC_ADDR_FIRST_3_BYTES);
-    if ((pHddCtx->spoofMacAddr.randomMacAddr.bytes[0] == 0) &&
-        (pHddCtx->spoofMacAddr.randomMacAddr.bytes[1] == 0) &&
-        (pHddCtx->spoofMacAddr.randomMacAddr.bytes[2] == 0))
-    {
-            hddLog(LOG1, FL("ZERO MAC OUI Recieved. Disabling Spoofing"));
-            vos_mem_zero(pHddCtx->spoofMacAddr.randomMacAddr.bytes,
-                                                        VOS_MAC_ADDRESS_LEN);
-            pHddCtx->spoofMacAddr.isEnabled = FALSE;
+
+    if (VOS_STATUS_SUCCESS != vos_randomize_n_bytes(
+        (void *)(&pHddCtx->spoofMacAddr.randomMacAddr.bytes[3]),
+        VOS_MAC_ADDR_LAST_3_BYTES)) {
+        hddLog(LOGE, FL("Failed to generate random Mac Addr"));
+    }
+    vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        pHddCtx->spoofMacAddr.randomMacAddr.bytes,
+            VOS_MAC_ADDR_SIZE);
+
+    if (eHAL_STATUS_SUCCESS != sme_SpoofMacAddrReq(pHddCtx->hHal,
+                &pHddCtx->spoofMacAddr.randomMacAddr)) {
+        hddLog(LOGE, FL("Failed to send Spoof Mac Addr to FW"));
     }
 
-    schedule_delayed_work(&pHddCtx->spoof_mac_addr_work,
-                          msecs_to_jiffies(MAC_ADDR_SPOOFING_DEFER_INTERVAL));
-
-    EXIT();
     return 0;
 }
 
-static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy,
-        struct wireless_dev *wdev,
-        void *data,
-        int data_len)
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_set_spoofed_mac_oui(wiphy, wdev, data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-static int __wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy,
                                                 struct wireless_dev *wdev,
                                                 void *data,
                                                 int data_len)
@@ -5117,22 +4113,14 @@
     tANI_S32 global_operating_class = 0;
     tANI_S32 channel = 0;
     struct sk_buff *skb         = NULL;
-    int retVal;
-
-    ENTER();
-
-    if (!pAdapter) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL"));
-        return -EINVAL;
-    }
 
     ret = wlan_hdd_validate_context(pHddCtx);
     if (0 != ret) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context"));
+
         return -EINVAL;
     }
     if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled"));
+
         return -ENOTSUPP;
     }
     if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX,
@@ -5153,8 +4141,13 @@
            sizeof(peer));
     hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer));
 
-    wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason);
+    ret = wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason);
 
+    if (0 != ret) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("get status Failed"));
+        return -EINVAL;
+    }
     skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
                                               4 * sizeof(s32) +
                                               NLMSG_HDRLEN);
@@ -5187,66 +4180,35 @@
         goto nla_put_failure;
     }
 
-    retVal = cfg80211_vendor_cmd_reply(skb);
-    EXIT();
-    return retVal;
+    return cfg80211_vendor_cmd_reply(skb);
 
 nla_put_failure:
     kfree_skb(skb);
     return -EINVAL;
 }
 
-static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy,
-                                                struct wireless_dev *wdev,
-                                                void *data,
-                                                int data_len)
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_exttdls_get_status(wiphy, wdev, data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-static int wlan_hdd_cfg80211_exttdls_callback(
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                              const tANI_U8* mac,
-#else
-                                              tANI_U8* mac,
-#endif
+static int wlan_hdd_cfg80211_exttdls_callback(tANI_U8* mac,
                                               tANI_S32 state,
                                               tANI_S32 reason,
                                               void *ctx)
 {
     hdd_adapter_t* pAdapter       = (hdd_adapter_t*)ctx;
+    hdd_context_t *pHddCtx        = WLAN_HDD_GET_CTX(pAdapter);
     struct sk_buff *skb           = NULL;
     tANI_S32 global_operating_class = 0;
     tANI_S32 channel = 0;
-    hdd_context_t *pHddCtx;
 
-    ENTER();
-
-    if (!pAdapter) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL"));
-        return -EINVAL;
-    }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     if (wlan_hdd_validate_context(pHddCtx)) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context"));
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid "));
         return -EINVAL;
     }
 
     if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled"));
+
         return -ENOTSUPP;
     }
-    skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
-                            NULL,
-#endif
+    skb = cfg80211_vendor_event_alloc(
+                            pHddCtx->wiphy,
                             EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN,
                             QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX,
                             GFP_KERNEL);
@@ -5286,7 +4248,6 @@
     }
 
     cfg80211_vendor_event(skb, GFP_KERNEL);
-    EXIT();
     return (0);
 
 nla_put_failure:
@@ -5294,40 +4255,27 @@
     return -EINVAL;
 }
 
-static int __wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy,
                                             struct wireless_dev *wdev,
                                             void *data,
                                             int data_len)
 {
     u8 peer[6]                                 = {0};
     struct net_device *dev                     = wdev->netdev;
+    hdd_adapter_t *pAdapter                    = WLAN_HDD_GET_PRIV_PTR(dev);
     hdd_context_t *pHddCtx                     = wiphy_priv(wiphy);
     struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1];
     eHalStatus status;
     tdls_req_params_t   pReqMsg = {0};
-    int ret;
-    hdd_adapter_t *pAdapter;
-
-    ENTER();
-
-    if (!dev) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL"));
-        return -EINVAL;
-    }
-
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (!pAdapter) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL"));
-        return -EINVAL;
-    }
 
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context"));
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL;
     }
     if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled"));
+
         return -ENOTSUPP;
     }
     if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX,
@@ -5388,62 +4336,31 @@
     hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"),
                                      pReqMsg.min_bandwidth_kbps);
 
-    ret = wlan_hdd_tdls_extctrl_config_peer(pAdapter,
+    return (wlan_hdd_tdls_extctrl_config_peer(pAdapter,
                                  peer,
-                                 &pReqMsg,
-                                 wlan_hdd_cfg80211_exttdls_callback);
-
-    EXIT();
-    return ret;
+                                 wlan_hdd_cfg80211_exttdls_callback));
 }
 
-static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy,
-                                            struct wireless_dev *wdev,
-                                            void *data,
-                                            int data_len)
-{
-   int ret = 0;
-
-   vos_ssr_protect(__func__);
-   ret = __wlan_hdd_cfg80211_exttdls_enable(wiphy, wdev, data, data_len);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
-static int __wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy,
                                              struct wireless_dev *wdev,
                                              void *data,
                                              int data_len)
 {
     u8 peer[6]                                 = {0};
     struct net_device *dev                     = wdev->netdev;
+    hdd_adapter_t *pAdapter                    = WLAN_HDD_GET_PRIV_PTR(dev);
     hdd_context_t *pHddCtx                     = wiphy_priv(wiphy);
     struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1];
     eHalStatus status;
-    int ret;
-    hdd_adapter_t *pAdapter;
-
-    ENTER();
-
-    if (!dev) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL"));
-        return -EINVAL;
-    }
-
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (!pAdapter) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL"));
-        return -EINVAL;
-    }
 
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context"));
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL;
     }
     if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled"));
+
         return -ENOTSUPP;
     }
     if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX,
@@ -5463,28 +4380,11 @@
                 sizeof(peer));
     hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer));
 
-    ret = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer);
-
-    EXIT();
-    return ret;
-}
-
-static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy,
-                                             struct wireless_dev *wdev,
-                                             void *data,
-                                             int data_len)
-{
-   int ret = 0;
-
-   vos_ssr_protect(__func__);
-   ret = __wlan_hdd_cfg80211_exttdls_disable(wiphy, wdev, data, data_len);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
+    return (wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer));
 }
 
 static int
-__wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy,
+wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy,
                                          struct wireless_dev *wdev,
                                          void *data, int data_len)
 {
@@ -5493,15 +4393,7 @@
     hdd_context_t *pHddCtx      = wiphy_priv(wiphy);
     struct sk_buff *skb         = NULL;
     tANI_U32       fset         = 0;
-    int ret = 0;
 
-    ENTER();
-
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
     if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) {
         hddLog(LOG1, FL("Infra Station mode is supported by driver"));
         fset |= WIFI_FEATURE_INFRA;
@@ -5523,22 +4415,20 @@
     /* Soft-AP is supported currently by default */
     fset |= WIFI_FEATURE_SOFT_AP;
 
-    /* HOTSPOT is a supplicant feature, enable it by default */
-    fset |= WIFI_FEATURE_HOTSPOT;
-
 #ifdef WLAN_FEATURE_EXTSCAN
     if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) &&
-            sme_IsFeatureSupportedByFW(EXTENDED_SCAN) &&
-            sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)) {
-        hddLog(LOG1, FL("Enhanced EXTScan is supported by firmware"));
+            sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) {
+        hddLog(LOG1, FL("EXTScan is supported by firmware"));
         fset |= WIFI_FEATURE_EXTSCAN;
     }
 #endif
 
+#ifdef WLAN_FEATURE_NAN
     if (sme_IsFeatureSupportedByFW(NAN)) {
         hddLog(LOG1, FL("NAN is supported by firmware"));
         fset |= WIFI_FEATURE_NAN;
     }
+#endif
 
     /* D2D RTT is not supported currently by default */
     if (sme_IsFeatureSupportedByFW(RTT)) {
@@ -5546,11 +4436,6 @@
         fset |= WIFI_FEATURE_D2AP_RTT;
     }
 
-   if (sme_IsFeatureSupportedByFW(RTT3)) {
-        hddLog(LOG1, FL("RTT3 is supported by firmware"));
-        fset |= WIFI_FEATURE_RTT3;
-    }
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
     if (fset & WIFI_FEATURE_EXTSCAN) {
         hddLog(LOG1, FL("Batch scan is supported as extscan is supported"));
@@ -5587,11 +4472,6 @@
     fset |= WIFI_FEATURE_AP_STA;
 #endif
 
-#ifdef WLAN_FEATURE_LINK_LAYER_STATS
-        fset |= WIFI_FEATURE_LINK_LAYER_STATS;
-        hddLog(LOG1, FL("Link layer stats is supported by driver"));
-#endif
-
     skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) +
                                               NLMSG_HDRLEN);
 
@@ -5606,9 +4486,7 @@
         goto nla_put_failure;
     }
 
-    ret = cfg80211_vendor_cmd_reply(skb);
-    EXIT();
-    return ret;
+    return cfg80211_vendor_cmd_reply(skb);
 
 nla_put_failure:
     kfree_skb(skb);
@@ -5616,103 +4494,7 @@
 }
 
 static int
-wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy,
-                                         struct wireless_dev *wdev,
-                                         void *data, int data_len)
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_get_supported_features(wiphy, wdev, data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-
-static const struct
-nla_policy
-qca_wlan_vendor_wifi_logger_get_ring_data_policy
-[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1] = {
-    [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID]
-        = {.type = NLA_U32 },
-};
-
-static int
-    __wlan_hdd_cfg80211_wifi_logger_get_ring_data(struct wiphy *wiphy,
-                                                      struct wireless_dev *wdev,
-                                                      void *data,
-                                                      int data_len)
-{
-    int ret;
-    VOS_STATUS status;
-    uint32_t ring_id;
-    hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
-    struct nlattr *tb
-        [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1];
-
-    ENTER();
-
-    ret = wlan_hdd_validate_context(hdd_ctx);
-    if (0 != ret) {
-        return ret;
-    }
-
-    if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX,
-            data, data_len,
-            qca_wlan_vendor_wifi_logger_get_ring_data_policy)) {
-        hddLog(LOGE, FL("Invalid attribute"));
-        return -EINVAL;
-    }
-
-    /* Parse and fetch ring id */
-    if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID]) {
-        hddLog(LOGE, FL("attr ATTR failed"));
-        return -EINVAL;
-    }
-
-    ring_id = nla_get_u32(
-            tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID]);
-
-    hddLog(LOG1, FL("Bug report triggered by framework"));
-
-    status = vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL,
-                WLAN_LOG_INDICATOR_FRAMEWORK,
-                WLAN_LOG_REASON_CODE_FRAMEWORK,
-                TRUE, TRUE
-                );
-    if (VOS_STATUS_SUCCESS != status) {
-        hddLog(LOGE, FL("Failed to trigger bug report"));
-
-        return -EINVAL;
-    }
-
-    return 0;
-
-
-}
-
-
-static int
-    wlan_hdd_cfg80211_wifi_logger_get_ring_data(struct wiphy *wiphy,
-                                                      struct wireless_dev *wdev,
-                                                      void *data,
-                                                      int data_len)
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_wifi_logger_get_ring_data(wiphy,
-            wdev, data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-
-}
-
-
-static int
-__wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy,
+wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy,
                                          struct wireless_dev *wdev,
                                          void *data, int data_len)
 {
@@ -5720,17 +4502,9 @@
     uint8_t i, feature_sets, max_feature_sets;
     struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX + 1];
     struct sk_buff *reply_skb;
-    hdd_context_t *pHddCtx = wiphy_priv(wiphy);
-    int ret;
 
     ENTER();
 
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
     if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX,
                   data, data_len, NULL)) {
         hddLog(LOGE, FL("Invalid ATTR"));
@@ -5748,15 +4522,19 @@
 
     /* Fill feature combination matrix */
     feature_sets = 0;
+    if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err;
     feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA |
                                          WIFI_FEATURE_P2P;
 
+    if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err;
     feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA |
                                          WIFI_FEATURE_SOFT_AP;
 
+    if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err;
     feature_set_matrix[feature_sets++] = WIFI_FEATURE_P2P |
                                          WIFI_FEATURE_SOFT_AP;
 
+    if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err;
     feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA |
                                          WIFI_FEATURE_SOFT_AP |
                                          WIFI_FEATURE_P2P;
@@ -5785,212 +4563,17 @@
             return -EINVAL;
         }
 
-        ret = cfg80211_vendor_cmd_reply(reply_skb);
-        EXIT();
-        return ret;
+        return cfg80211_vendor_cmd_reply(reply_skb);
     }
     hddLog(LOGE, FL("Feature set matrix: buffer alloc fail"));
     return -ENOMEM;
 
+max_buffer_err:
+    hddLog(LOGE, FL("Feature set max buffer size reached. feature_sets(%d) max(%d)"),
+           feature_sets, WLAN_HDD_MAX_FEATURE_SET);
+    return -EINVAL;
 }
 
-static int
-wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy,
-                                         struct wireless_dev *wdev,
-                                         void *data, int data_len)
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_get_concurrency_matrix(wiphy, wdev, data,
-                                                     data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-
-static int
-__wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
-                                    struct wireless_dev *wdev,
-                                    void *data, int data_len)
-{
-    hdd_context_t *pHddCtx = wiphy_priv(wiphy);
-    int ret;
-    ENTER();
-
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
-    if( !pHddCtx->cfg_ini->enableFwrMemDump ||
-       (FALSE == sme_IsFeatureSupportedByFW(MEMORY_DUMP_SUPPORTED)))
-    {
-       hddLog(VOS_TRACE_LEVEL_INFO, FL("FW dump Logging not supported"));
-       return -EINVAL;
-    }
-    /*call common API for FW mem dump req*/
-    ret = wlan_hdd_fw_mem_dump_req(pHddCtx);
-
-    if (!ret)
-    {
-        /*indicate to userspace the status of fw mem dump */
-        wlan_indicate_mem_dump_complete(true);
-    }
-    else
-    {
-        /*else send failure to userspace */
-        wlan_indicate_mem_dump_complete(false);
-    }
-    EXIT();
-    return ret;
-}
-
-/**
- * wlan_hdd_cfg80211_get_fw_mem_dump() - Get FW memory dump
- * @wiphy:   pointer to wireless wiphy structure.
- * @wdev:    pointer to wireless_dev structure.
- * @data:    Pointer to the NL data.
- * @data_len:Length of @data
- *
- * This is called when wlan driver needs to get the firmware memory dump
- * via vendor specific command.
- *
- * Return:   0 on success, error number otherwise.
- */
-
-static int
-wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
-                                              struct wireless_dev *wdev,
-                                         void *data, int data_len)
-{
-    int ret = 0;
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_get_fw_mem_dump(wiphy, wdev, data,
-                                        data_len);
-    vos_ssr_unprotect(__func__);
-    return ret;
-}
-
-static const struct
-nla_policy
-qca_wlan_vendor_wifi_logger_start_policy
-[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1] = {
-   [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID]
-     = {.type = NLA_U32 },
-     [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL]
-        = {.type = NLA_U32 },
-     [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS]
-          = {.type = NLA_U32 },
-};
-
-/**
- * __wlan_hdd_cfg80211_wifi_logger_start() - This function is used to enable
- * or disable the collection of packet statistics from the firmware
- * @wiphy:    WIPHY structure pointer
- * @wdev:     Wireless device structure pointer
- * @data:     Pointer to the data received
- * @data_len: Length of the data received
- *
- * This function is used to enable or disable the collection of packet
- * statistics from the firmware
- *
- * Return: 0 on success and errno on failure
- */
-static int __wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy,
-                       struct wireless_dev *wdev,
-                        void *data,
-                                int data_len)
-{
-    eHalStatus status;
-    hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
-    struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1];
-    tAniWifiStartLog start_log;
-
-    status = wlan_hdd_validate_context(hdd_ctx);
-    if (0 != status) {
-        return -EINVAL;
-    }
-
-     if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX,
-             data, data_len,
-            qca_wlan_vendor_wifi_logger_start_policy)) {
-        hddLog(LOGE, FL("Invalid attribute"));
-        return -EINVAL;
-    }
-
-    /* Parse and fetch ring id */
-    if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID]) {
-        hddLog(LOGE, FL("attr ATTR failed"));
-        return -EINVAL;
-    }
-    start_log.ringId = nla_get_u32(
-           tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID]);
-    hddLog(LOG1, FL("Ring ID=%d"), start_log.ringId);
-
-    /* Parse and fetch verbose level */
-    if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL]) {
-        hddLog(LOGE, FL("attr verbose_level failed"));
-        return -EINVAL;
-    }
-    start_log.verboseLevel = nla_get_u32(
-         tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL]);
-    hddLog(LOG1, FL("verbose_level=%d"), start_log.verboseLevel);
-
-    /* Parse and fetch flag */
-    if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS]) {
-        hddLog(LOGE, FL("attr flag failed"));
-        return -EINVAL;
-    }
-    start_log.flag = nla_get_u32(
-        tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS]);
-    hddLog(LOG1, FL("flag=%d"), start_log.flag);
-
-    if ((RING_ID_PER_PACKET_STATS == start_log.ringId) &&
-                 (!hdd_ctx->cfg_ini->wlanPerPktStatsLogEnable ||
-        !vos_isPktStatsEnabled()))
-
-    {
-       hddLog(LOGE, FL("per pkt stats not enabled"));
-       return -EINVAL;
-    }
-
-    vos_set_ring_log_level(start_log.ringId, start_log.verboseLevel);
-    return 0;
-}
-
-/**
- * wlan_hdd_cfg80211_wifi_logger_start() - Wrapper function used to enable
- * or disable the collection of packet statistics from the firmware
- * @wiphy:    WIPHY structure pointer
- * @wdev:     Wireless device structure pointer
- * @data:     Pointer to the data received
- * @data_len: Length of the data received
- *
- * This function is used to enable or disable the collection of packet
- * statistics from the firmware
- *
- * Return: 0 on success and errno on failure
- */
-static int wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy,
-                        struct wireless_dev *wdev,
-                        void *data,
-                        int data_len)
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-
-    ret = __wlan_hdd_cfg80211_wifi_logger_start(wiphy,
-          wdev, data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-
 static const struct nla_policy
 wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX
  +1] =
@@ -5998,7 +4581,7 @@
     [QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 },
 };
 
-static int __wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy,
                                             struct wireless_dev *wdev,
                                             void *data,
                                             int data_len)
@@ -6011,10 +4594,10 @@
     eHalStatus status;
     u32 dfsFlag = 0;
 
-    ENTER();
-
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
         return -EINVAL;
     }
     if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX,
@@ -6039,26 +4622,9 @@
 
     sme_disable_dfs_channel(hHal, dfsFlag);
     sme_FilterScanResults(hHal, pAdapter->sessionId);
-
-    EXIT();
     return 0;
 }
 
-static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy,
-                                            struct wireless_dev *wdev,
-                                            void *data,
-                                            int data_len)
-{
-   int ret = 0;
-
-   vos_ssr_protect(__func__);
-   ret = __wlan_hdd_cfg80211_disable_dfs_channels(wiphy, wdev, data, data_len);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-
-}
-
 const struct
 nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] =
 {
@@ -6066,7 +4632,7 @@
     [QCA_WLAN_VENDOR_ATTR_MAC_ADDR]       = { .type = NLA_UNSPEC },
 };
 
-static int __wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy,
             struct wireless_dev *wdev, void *data, int data_len)
 {
 
@@ -6077,11 +4643,10 @@
     v_U32_t isFwrRoamEnabled = FALSE;
     int ret;
 
-    ENTER();
-
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret) {
-        return ret;
+    if (NULL == pHddCtx) {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               FL("HDD context is not valid"));
+        return -EINVAL;
     }
 
     ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX,
@@ -6116,1303 +4681,9 @@
 
     //Update roaming
     status = sme_ConfigFwrRoaming((tHalHandle)(pHddCtx->hHal), isFwrRoamEnabled);
-    if (!HAL_STATUS_SUCCESS(status)) {
-        hddLog(LOGE,
-           FL("sme_ConfigFwrRoaming failed (err=%d)"), status);
-        return -EINVAL;
-    }
-    EXIT();
-    return 0;
+    return status;
 }
 
-static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy,
-            struct wireless_dev *wdev, void *data, int data_len)
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_firmware_roaming(wiphy, wdev, data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-static const struct
-nla_policy
-qca_wlan_vendor_get_wifi_info_policy[
-         QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX +1] = {
-    [QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION] = {.type = NLA_U8 },
-    [QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION] = {.type = NLA_U8 },
-};
-
-
-/**
- * __wlan_hdd_cfg80211_get_wifi_info() - Get the wifi driver related info
- * @wiphy:   pointer to wireless wiphy structure.
- * @wdev:    pointer to wireless_dev structure.
- * @data:    Pointer to the data to be passed via vendor interface
- * @data_len:Length of the data to be passed
- *
- * This is called when wlan driver needs to send wifi driver related info
- * (driver/fw version) to the user space application upon request.
- *
- * Return:   Return the Success or Failure code.
- */
-static int __wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy,
-                                  struct wireless_dev *wdev,
-                              void *data, int data_len)
-{
-    hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
-    struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX + 1];
-    tSirVersionString version;
-    uint32 version_len;
-    uint8 attr;
-    int status;
-    struct sk_buff *reply_skb = NULL;
-
-    if (VOS_FTM_MODE == hdd_get_conparam()) {
-        hddLog(LOGE, FL("Command not allowed in FTM mode"));
-        return -EINVAL;
-    }
-
-    status = wlan_hdd_validate_context(hdd_ctx);
-    if (0 != status) {
-        hddLog(LOGE, FL("HDD context is not valid"));
-        return -EINVAL;
-    }
-
-    if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX, data,
-        data_len, qca_wlan_vendor_get_wifi_info_policy)) {
-        hddLog(LOGE, FL("WIFI_INFO_GET NL CMD parsing failed"));
-        return -EINVAL;
-    }
-
-    if (tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION]) {
-        hddLog(LOG1, FL("Rcvd req for Driver version Driver version is %s"),
-                                                          QWLAN_VERSIONSTR);
-        strlcpy(version, QWLAN_VERSIONSTR, sizeof(version));
-        attr = QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION;
-    } else if (tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION]) {
-        hddLog(LOG1, FL("Rcvd req for FW version FW version is %s"),
-                                               hdd_ctx->fw_Version);
-        strlcpy(version, hdd_ctx->fw_Version, sizeof(version));
-        attr = QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION;
-    } else {
-        hddLog(LOGE, FL("Invalid attribute in get wifi info request"));
-        return -EINVAL;
-    }
-
-    version_len = strlen(version);
-    reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
-    version_len + NLA_HDRLEN + NLMSG_HDRLEN);
-    if (!reply_skb) {
-        hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed"));
-        return -ENOMEM;
-    }
-
-    if (nla_put(reply_skb, attr, version_len, version)) {
-        hddLog(LOGE, FL("nla put fail"));
-        kfree_skb(reply_skb);
-        return -EINVAL;
-    }
-
-    return cfg80211_vendor_cmd_reply(reply_skb);
-}
-
-/**
- * __wlan_hdd_cfg80211_get_wifi_info() - Get the wifi driver related info
- * @wiphy:   pointer to wireless wiphy structure.
- * @wdev:    pointer to wireless_dev structure.
- * @data:    Pointer to the data to be passed via vendor interface
- * @data_len:Length of the data to be passed
- * @data_len: Length of the data received
- *
- * This function is used to enable or disable the collection of packet
- * statistics from the firmware
- *
- * Return: 0 on success and errno on failure
- */
-
-static int
-wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy,
-                                  struct wireless_dev *wdev,
-                              void *data, int data_len)
-
-
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_get_wifi_info(wiphy,
-          wdev, data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-
-/*
- * define short names for the global vendor params
- * used by __wlan_hdd_cfg80211_monitor_rssi()
- */
-#define PARAM_MAX QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX
-#define PARAM_REQUEST_ID QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID
-#define PARAM_CONTROL QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL
-#define PARAM_MIN_RSSI QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MIN_RSSI
-#define PARAM_MAX_RSSI QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX_RSSI
-
-/**---------------------------------------------------------------------------
-
-  \brief hdd_rssi_monitor_start_done - callback to be executed when rssi
-                                       monitor start is completed successfully.
-
-  \return -  None
-
-  --------------------------------------------------------------------------*/
-void hdd_rssi_monitor_start_done(void *fwRssiMonitorCbContext, VOS_STATUS status)
-{
-   hdd_context_t* pHddCtx = (hdd_context_t*)fwRssiMonitorCbContext;
-
-   if (NULL == pHddCtx)
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,
-                 "%s: HDD context is NULL",__func__);
-      return;
-   }
-
-   if (VOS_STATUS_SUCCESS == status)
-   {
-      hddLog(VOS_TRACE_LEVEL_INFO, FL("Rssi Monitor start successful"));
-   }
-   else
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR, FL("Rssi Monitor start not successful"));
-   }
-
-   return;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief hdd_rssi_monitor_stop_done - callback to be executed when rssi monitor
-                                      stop is completed successfully.
-
-  \return -  None
-
-  --------------------------------------------------------------------------*/
-void hdd_rssi_monitor_stop_done(void *fwRssiMonitorCbContext, VOS_STATUS status)
-{
-   hdd_context_t* pHddCtx = (hdd_context_t*)fwRssiMonitorCbContext;
-
-   if (NULL == pHddCtx)
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,
-                 "%s: HDD context is NULL",__func__);
-      return;
-   }
-
-   if (VOS_STATUS_SUCCESS == status)
-   {
-      hddLog(VOS_TRACE_LEVEL_INFO, FL("Rssi Monitor stop successful"));
-   }
-   else
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR, FL("Rssi Monitor stop not successful"));
-   }
-
-   return;
-}
-
-/**
- * __wlan_hdd_cfg80211_monitor_rssi() - monitor rssi
- * @wiphy: Pointer to wireless phy
- * @wdev: Pointer to wireless device
- * @data: Pointer to data
- * @data_len: Data length
- *
- * Return: 0 on success, negative errno on failure
- */
-
-static int
-__wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy,
-                                 struct wireless_dev *wdev,
-                                 void *data,
-                                 int data_len)
-{
-        struct net_device *dev = wdev->netdev;
-        hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-        hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
-        hdd_station_ctx_t *pHddStaCtx;
-        struct nlattr *tb[PARAM_MAX + 1];
-        tpSirRssiMonitorReq pReq;
-        eHalStatus status;
-        int ret;
-        uint32_t control;
-        static const struct nla_policy policy[PARAM_MAX + 1] = {
-                        [PARAM_REQUEST_ID] = { .type = NLA_U32 },
-                        [PARAM_CONTROL] = { .type = NLA_U32 },
-                        [PARAM_MIN_RSSI] = { .type = NLA_S8 },
-                        [PARAM_MAX_RSSI] = { .type = NLA_S8 },
-        };
-
-        ENTER();
-
-        ret = wlan_hdd_validate_context(hdd_ctx);
-        if (0 != ret) {
-                return -EINVAL;
-        }
-
-        if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) {
-                hddLog(LOGE, FL("Not in Connected state!"));
-                return -ENOTSUPP;
-        }
-
-        if (nla_parse(tb, PARAM_MAX, data, data_len, policy)) {
-                hddLog(LOGE, FL("Invalid ATTR"));
-                return -EINVAL;
-        }
-
-        if (!tb[PARAM_REQUEST_ID]) {
-                hddLog(LOGE, FL("attr request id failed"));
-                return -EINVAL;
-        }
-
-        if (!tb[PARAM_CONTROL]) {
-                hddLog(LOGE, FL("attr control failed"));
-                return -EINVAL;
-        }
-
-        pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-
-        pReq = vos_mem_malloc(sizeof(tSirRssiMonitorReq));
-        if(NULL == pReq)
-        {
-            hddLog(LOGE,
-                 FL("vos_mem_alloc failed "));
-            return eHAL_STATUS_FAILED_ALLOC;
-        }
-        vos_mem_set(pReq, sizeof(tSirRssiMonitorReq), 0);
-
-        pReq->requestId = nla_get_u32(tb[PARAM_REQUEST_ID]);
-        pReq->sessionId = pAdapter->sessionId;
-        pReq->rssiMonitorCbContext = hdd_ctx;
-        control = nla_get_u32(tb[PARAM_CONTROL]);
-        vos_mem_copy( &pReq->currentBssId, pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN);
-
-        hddLog(LOG1, FL("Request Id: %u Session_id: %d Control: %d"),
-                        pReq->requestId, pReq->sessionId, control);
-
-        if (control == QCA_WLAN_RSSI_MONITORING_START) {
-                if (!tb[PARAM_MIN_RSSI]) {
-                        hddLog(LOGE, FL("attr min rssi failed"));
-                        goto fail;
-                }
-
-                if (!tb[PARAM_MAX_RSSI]) {
-                        hddLog(LOGE, FL("attr max rssi failed"));
-                        goto fail;
-                }
-
-                pReq->minRssi = nla_get_s8(tb[PARAM_MIN_RSSI]);
-                pReq->maxRssi = nla_get_s8(tb[PARAM_MAX_RSSI]);
-                pReq->rssiMonitorCallback = hdd_rssi_monitor_start_done;
-
-                if (!(pReq->minRssi < pReq->maxRssi)) {
-                        hddLog(LOGW, FL("min_rssi: %d must be less than max_rssi: %d"),
-                                        pReq->minRssi, pReq->maxRssi);
-                        goto fail;
-                }
-                hddLog(LOG1, FL("Min_rssi: %d Max_rssi: %d"),
-                       pReq->minRssi, pReq->maxRssi);
-                status = sme_StartRssiMonitoring(hdd_ctx->hHal, pReq);
-
-        }
-        else if (control == QCA_WLAN_RSSI_MONITORING_STOP) {
-                pReq->rssiMonitorCallback = hdd_rssi_monitor_stop_done;
-                status = sme_StopRssiMonitoring(hdd_ctx->hHal, pReq);
-        }
-        else {
-                hddLog(LOGE, FL("Invalid control cmd: %d"), control);
-                goto fail;
-        }
-
-        if (!HAL_STATUS_SUCCESS(status)) {
-                hddLog(LOGE,
-                        FL("sme_set_rssi_monitoring failed(err=%d)"), status);
-                goto fail;
-        }
-
-        return 0;
-fail:
-        vos_mem_free(pReq);
-        return -EINVAL;
-}
-
-/*
- * done with short names for the global vendor params
- * used by __wlan_hdd_cfg80211_monitor_rssi()
- */
-#undef PARAM_MAX
-#undef PARAM_CONTROL
-#undef PARAM_REQUEST_ID
-#undef PARAM_MAX_RSSI
-#undef PARAM_MIN_RSSI
-
-/**
- * wlan_hdd_cfg80211_monitor_rssi() - SSR wrapper to rssi monitoring
- * @wiphy:    wiphy structure pointer
- * @wdev:     Wireless device structure pointer
- * @data:     Pointer to the data received
- * @data_len: Length of @data
- *
- * Return: 0 on success; errno on failure
- */
-static int
-wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy, struct wireless_dev *wdev,
-                               void *data, int data_len)
-{
-        int ret;
-
-        vos_ssr_protect(__func__);
-        ret = __wlan_hdd_cfg80211_monitor_rssi(wiphy, wdev, data, data_len);
-        vos_ssr_unprotect(__func__);
-
-        return ret;
-}
-
-/**
- * hdd_rssi_threshold_breached_cb() - rssi breached NL event
- * @hddctx: HDD context
- * @data: rssi breached event data
- *
- * This function reads the rssi breached event %data and fill in the skb with
- * NL attributes and send up the NL event.
- * This callback execute in atomic context and must not invoke any
- * blocking calls.
- *
- * Return: none
- */
-void hdd_rssi_threshold_breached_cb(void *hddctx,
-                                 struct rssi_breach_event *data)
-{
-        hdd_context_t *pHddCtx  = (hdd_context_t *)hddctx;
-        int status;
-        struct sk_buff *skb;
-
-        ENTER();
-        status = wlan_hdd_validate_context(pHddCtx);
-
-        if (0 != status) {
-                return;
-        }
-
-        if (!data) {
-                hddLog(LOGE, FL("data is null"));
-                return;
-        }
-
-        skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
-                                  NULL,
-#endif
-                                  EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
-                                  QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX,
-                                  GFP_KERNEL);
-
-        if (!skb) {
-                hddLog(LOGE, FL("cfg80211_vendor_event_alloc failed"));
-                return;
-        }
-
-        hddLog(LOG1, "Req Id: %u Current rssi: %d",
-                        data->request_id, data->curr_rssi);
-        hddLog(LOG1, "Current BSSID: "MAC_ADDRESS_STR,
-                        MAC_ADDR_ARRAY(data->curr_bssid.bytes));
-
-        if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID,
-                data->request_id) ||
-            nla_put(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_BSSID,
-                sizeof(data->curr_bssid), data->curr_bssid.bytes) ||
-            nla_put_s8(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_RSSI,
-                data->curr_rssi)) {
-                hddLog(LOGE, FL("nla put fail"));
-                goto fail;
-        }
-
-        cfg80211_vendor_event(skb, GFP_KERNEL);
-        return;
-
-fail:
-        kfree_skb(skb);
-        return;
-}
-
-
-
-/**
- * __wlan_hdd_cfg80211_setband() - set band
- * @wiphy: Pointer to wireless phy
- * @wdev: Pointer to wireless device
- * @data: Pointer to data
- * @data_len: Data length
- *
- * Return: 0 on success, negative errno on failure
- */
-static int
-__wlan_hdd_cfg80211_setband(struct wiphy *wiphy,
-                            struct wireless_dev *wdev,
-                            void *data,
-                            int data_len)
-{
-    struct net_device *dev = wdev->netdev;
-    hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
-    struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1];
-    int ret;
-    static const struct nla_policy policy[QCA_WLAN_VENDOR_ATTR_MAX + 1]
-                = {[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE] = { .type = NLA_U32 }};
-
-    ENTER();
-
-    ret = wlan_hdd_validate_context(hdd_ctx);
-    if (0 != ret) {
-        hddLog(LOGE, FL("HDD context is not valid"));
-        return ret;
-    }
-
-    if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len,
-                  policy)) {
-        hddLog(LOGE, FL("Invalid ATTR"));
-        return -EINVAL;
-    }
-
-    if (!tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE]) {
-        hddLog(LOGE, FL("attr QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE failed"));
-        return -EINVAL;
-    }
-
-    hdd_ctx->isSetBandByNL = TRUE;
-    ret = hdd_setBand(dev,
-                       nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE]));
-    hdd_ctx->isSetBandByNL = FALSE;
-
-    EXIT();
-    return ret;
-}
-
-/**
- * wlan_hdd_cfg80211_setband() - Wrapper to offload packets
- * @wiphy:    wiphy structure pointer
- * @wdev:     Wireless device structure pointer
- * @data:     Pointer to the data received
- * @data_len: Length of @data
- *
- * Return: 0 on success; errno on failure
- */
-static int wlan_hdd_cfg80211_setband(struct wiphy *wiphy,
-                                     struct wireless_dev *wdev,
-                                     void *data,
-                                     int data_len)
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_setband(wiphy,
-                    wdev, data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
-/**
- * hdd_map_req_id_to_pattern_id() - map request id to pattern id
- * @hdd_ctx: HDD context
- * @request_id: [input] request id
- * @pattern_id: [output] pattern id
- *
- * This function loops through request id to pattern id array
- * if the slot is available, store the request id and return pattern id
- * if entry exists, return the pattern id
- *
- * Return: 0 on success and errno on failure
- */
-static int hdd_map_req_id_to_pattern_id(hdd_context_t *hdd_ctx,
-        uint32_t request_id,
-        uint8_t *pattern_id)
-{
-    uint32_t i;
-
-    mutex_lock(&hdd_ctx->op_ctx.op_lock);
-    for (i = 0; i < MAXNUM_PERIODIC_TX_PTRNS; i++)
-    {
-        if (hdd_ctx->op_ctx.op_table[i].request_id == 0)
-        {
-            hdd_ctx->op_ctx.op_table[i].request_id = request_id;
-            *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id;
-            mutex_unlock(&hdd_ctx->op_ctx.op_lock);
-            return 0;
-        } else if (hdd_ctx->op_ctx.op_table[i].request_id ==
-                request_id) {
-            *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id;
-            mutex_unlock(&hdd_ctx->op_ctx.op_lock);
-            return 0;
-        }
-    }
-    mutex_unlock(&hdd_ctx->op_ctx.op_lock);
-    return -EINVAL;
-}
-
-/**
- * hdd_unmap_req_id_to_pattern_id() - unmap request id to pattern id
- * @hdd_ctx: HDD context
- * @request_id: [input] request id
- * @pattern_id: [output] pattern id
- *
- * This function loops through request id to pattern id array
- * reset request id to 0 (slot available again) and
- * return pattern id
- *
- * Return: 0 on success and errno on failure
- */
-static int hdd_unmap_req_id_to_pattern_id(hdd_context_t *hdd_ctx,
-        uint32_t request_id,
-        uint8_t *pattern_id)
-{
-    uint32_t i;
-
-    mutex_lock(&hdd_ctx->op_ctx.op_lock);
-    for (i = 0; i < MAXNUM_PERIODIC_TX_PTRNS; i++)
-    {
-        if (hdd_ctx->op_ctx.op_table[i].request_id == request_id)
-        {
-            hdd_ctx->op_ctx.op_table[i].request_id = 0;
-            *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id;
-            mutex_unlock(&hdd_ctx->op_ctx.op_lock);
-            return 0;
-        }
-    }
-    mutex_unlock(&hdd_ctx->op_ctx.op_lock);
-    return -EINVAL;
-}
-
-
-/*
- * define short names for the global vendor params
- * used by __wlan_hdd_cfg80211_offloaded_packets()
- */
-#define PARAM_MAX QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_MAX
-#define PARAM_REQUEST_ID \
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_REQUEST_ID
-#define PARAM_CONTROL \
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SENDING_CONTROL
-#define PARAM_IP_PACKET \
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_IP_PACKET_DATA
-#define PARAM_SRC_MAC_ADDR \
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SRC_MAC_ADDR
-#define PARAM_DST_MAC_ADDR \
-    QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_DST_MAC_ADDR
-#define PARAM_PERIOD QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_PERIOD
-
-/**
- * wlan_hdd_add_tx_ptrn() - add tx pattern
- * @adapter: adapter pointer
- * @hdd_ctx: hdd context
- * @tb: nl attributes
- *
- * This function reads the NL attributes and forms a AddTxPtrn message
- * posts it to SME.
- *
- */
-static int
-wlan_hdd_add_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx,
-        struct nlattr **tb)
-{
-    struct sSirAddPeriodicTxPtrn *add_req;
-    eHalStatus status;
-    uint32_t request_id, ret, len;
-    uint8_t pattern_id = 0;
-    v_MACADDR_t dst_addr;
-    uint16_t eth_type = htons(ETH_P_IP);
-
-    if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(adapter)))
-    {
-        hddLog(LOGE, FL("Not in Connected state!"));
-        return -ENOTSUPP;
-    }
-
-    add_req = vos_mem_malloc(sizeof(*add_req));
-    if (!add_req)
-    {
-        hddLog(LOGE, FL("memory allocation failed"));
-        return -ENOMEM;
-    }
-
-    /* Parse and fetch request Id */
-    if (!tb[PARAM_REQUEST_ID])
-    {
-        hddLog(LOGE, FL("attr request id failed"));
-        goto fail;
-    }
-
-    request_id = nla_get_u32(tb[PARAM_REQUEST_ID]);
-    hddLog(LOG1, FL("Request Id: %u"), request_id);
-    if (request_id == 0)
-    {
-        hddLog(LOGE, FL("request_id cannot be zero"));
-        goto fail;
-    }
-
-    if (!tb[PARAM_PERIOD])
-    {
-        hddLog(LOGE, FL("attr period failed"));
-        goto fail;
-    }
-    add_req->usPtrnIntervalMs = nla_get_u32(tb[PARAM_PERIOD]);
-    hddLog(LOG1, FL("Period: %u ms"), add_req->usPtrnIntervalMs);
-    if (add_req->usPtrnIntervalMs == 0)
-    {
-        hddLog(LOGE, FL("Invalid interval zero, return failure"));
-        goto fail;
-    }
-
-    if (!tb[PARAM_SRC_MAC_ADDR])
-    {
-        hddLog(LOGE, FL("attr source mac address failed"));
-        goto fail;
-    }
-    nla_memcpy(add_req->macAddress, tb[PARAM_SRC_MAC_ADDR],
-            VOS_MAC_ADDR_SIZE);
-    hddLog(LOG1, "input src mac address: "MAC_ADDRESS_STR,
-            MAC_ADDR_ARRAY(add_req->macAddress));
-
-    if (memcmp(add_req->macAddress, adapter->macAddressCurrent.bytes,
-                VOS_MAC_ADDR_SIZE))
-    {
-        hddLog(LOGE,
-            FL("input src mac address and connected ap bssid are different"));
-        goto fail;
-    }
-
-    if (!tb[PARAM_DST_MAC_ADDR])
-    {
-        hddLog(LOGE, FL("attr dst mac address failed"));
-        goto fail;
-    }
-    nla_memcpy(dst_addr.bytes, tb[PARAM_DST_MAC_ADDR], VOS_MAC_ADDR_SIZE);
-    hddLog(LOG1, "input dst mac address: "MAC_ADDRESS_STR,
-            MAC_ADDR_ARRAY(dst_addr.bytes));
-
-    if (!tb[PARAM_IP_PACKET])
-    {
-        hddLog(LOGE, FL("attr ip packet failed"));
-        goto fail;
-    }
-    add_req->ucPtrnSize = nla_len(tb[PARAM_IP_PACKET]);
-    hddLog(LOG1, FL("IP packet len: %u"), add_req->ucPtrnSize);
-
-    if (add_req->ucPtrnSize < 0 ||
-            add_req->ucPtrnSize > (PERIODIC_TX_PTRN_MAX_SIZE -
-                HDD_ETH_HEADER_LEN))
-    {
-        hddLog(LOGE, FL("Invalid IP packet len: %d"),
-                add_req->ucPtrnSize);
-        goto fail;
-    }
-
-    len = 0;
-    vos_mem_copy(&add_req->ucPattern[0], dst_addr.bytes, VOS_MAC_ADDR_SIZE);
-    len += VOS_MAC_ADDR_SIZE;
-    vos_mem_copy(&add_req->ucPattern[len], add_req->macAddress,
-            VOS_MAC_ADDR_SIZE);
-    len += VOS_MAC_ADDR_SIZE;
-    vos_mem_copy(&add_req->ucPattern[len], &eth_type, 2);
-    len += 2;
-
-    /*
-     * This is the IP packet, add 14 bytes Ethernet (802.3) header
-     * ------------------------------------------------------------
-     * | 14 bytes Ethernet (802.3) header | IP header and payload |
-     * ------------------------------------------------------------
-     */
-    vos_mem_copy(&add_req->ucPattern[len],
-            nla_data(tb[PARAM_IP_PACKET]),
-            add_req->ucPtrnSize);
-    add_req->ucPtrnSize += len;
-
-    VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-            add_req->ucPattern, add_req->ucPtrnSize);
-
-    ret = hdd_map_req_id_to_pattern_id(hdd_ctx, request_id, &pattern_id);
-    if (ret)
-    {
-        hddLog(LOGW, FL("req id to pattern id failed (ret=%d)"), ret);
-        goto fail;
-    }
-    add_req->ucPtrnId = pattern_id;
-    hddLog(LOG1, FL("pattern id: %d"), add_req->ucPtrnId);
-
-    status = sme_AddPeriodicTxPtrn(hdd_ctx->hHal, add_req);
-    if (!HAL_STATUS_SUCCESS(status))
-    {
-        hddLog(LOGE,
-                FL("sme_AddPeriodicTxPtrn failed (err=%d)"), status);
-        goto fail;
-    }
-
-    EXIT();
-    vos_mem_free(add_req);
-    return 0;
-
-fail:
-    vos_mem_free(add_req);
-    return -EINVAL;
-}
-
-/**
- * wlan_hdd_del_tx_ptrn() - delete tx pattern
- * @adapter: adapter pointer
- * @hdd_ctx: hdd context
- * @tb: nl attributes
- *
- * This function reads the NL attributes and forms a DelTxPtrn message
- * posts it to SME.
- *
- */
-static int
-wlan_hdd_del_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx,
-        struct nlattr **tb)
-{
-    struct sSirDelPeriodicTxPtrn *del_req;
-    eHalStatus status;
-    uint32_t request_id, ret;
-    uint8_t pattern_id = 0;
-
-    /* Parse and fetch request Id */
-    if (!tb[PARAM_REQUEST_ID])
-    {
-        hddLog(LOGE, FL("attr request id failed"));
-        return -EINVAL;
-    }
-    request_id = nla_get_u32(tb[PARAM_REQUEST_ID]);
-    if (request_id == 0)
-    {
-        hddLog(LOGE, FL("request_id cannot be zero"));
-        return -EINVAL;
-    }
-
-    ret = hdd_unmap_req_id_to_pattern_id(hdd_ctx, request_id, &pattern_id);
-    if (ret)
-    {
-        hddLog(LOGW, FL("req id to pattern id failed (ret=%d)"), ret);
-        return -EINVAL;
-    }
-
-    del_req = vos_mem_malloc(sizeof(*del_req));
-    if (!del_req)
-    {
-        hddLog(LOGE, FL("memory allocation failed"));
-        return -ENOMEM;
-    }
-
-    vos_mem_set(del_req, sizeof(*del_req), 0);
-    vos_mem_copy(del_req->macAddress, adapter->macAddressCurrent.bytes,
-            VOS_MAC_ADDR_SIZE);
-    hddLog(LOG1, MAC_ADDRESS_STR, MAC_ADDR_ARRAY(del_req->macAddress));
-    del_req->ucPatternIdBitmap |= (0x1 << pattern_id);
-    hddLog(LOG1, FL("Request Id: %u Pattern id: %d, bitmap %04x"),
-         request_id, pattern_id, del_req->ucPatternIdBitmap);
-
-    status = sme_DelPeriodicTxPtrn(hdd_ctx->hHal, del_req);
-    if (!HAL_STATUS_SUCCESS(status))
-    {
-        hddLog(LOGE,
-                FL("sme_DelPeriodicTxPtrn failed (err=%d)"), status);
-        goto fail;
-    }
-
-    EXIT();
-    vos_mem_free(del_req);
-    return 0;
-
-fail:
-    vos_mem_free(del_req);
-    return -EINVAL;
-}
-
-
-/**
- * __wlan_hdd_cfg80211_offloaded_packets() - send offloaded packets
- * @wiphy: Pointer to wireless phy
- * @wdev: Pointer to wireless device
- * @data: Pointer to data
- * @data_len: Data length
- *
- * Return: 0 on success, negative errno on failure
- */
-static int
-__wlan_hdd_cfg80211_offloaded_packets(struct wiphy *wiphy,
-        struct wireless_dev *wdev,
-        void *data,
-        int data_len)
-{
-    struct net_device *dev = wdev->netdev;
-    hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
-    struct nlattr *tb[PARAM_MAX + 1];
-    uint8_t control;
-    int ret;
-    static const struct nla_policy policy[PARAM_MAX + 1] =
-    {
-        [PARAM_REQUEST_ID] = { .type = NLA_U32 },
-        [PARAM_CONTROL] = { .type = NLA_U32 },
-        [PARAM_SRC_MAC_ADDR] = { .type = NLA_BINARY,
-            .len = VOS_MAC_ADDR_SIZE },
-        [PARAM_DST_MAC_ADDR] = { .type = NLA_BINARY,
-            .len = VOS_MAC_ADDR_SIZE },
-        [PARAM_PERIOD] = { .type = NLA_U32 },
-    };
-
-    ENTER();
-
-    ret = wlan_hdd_validate_context(hdd_ctx);
-    if (0 != ret)
-    {
-        hddLog(LOGE, FL("HDD context is not valid"));
-        return ret;
-    }
-
-    if (!sme_IsFeatureSupportedByFW(WLAN_PERIODIC_TX_PTRN))
-    {
-        hddLog(LOGE,
-            FL("Periodic Tx Pattern Offload feature is not supported in FW!"));
-        return -ENOTSUPP;
-    }
-
-    if (nla_parse(tb, PARAM_MAX, data, data_len, policy))
-    {
-        hddLog(LOGE, FL("Invalid ATTR"));
-        return -EINVAL;
-    }
-
-    if (!tb[PARAM_CONTROL])
-    {
-        hddLog(LOGE, FL("attr control failed"));
-        return -EINVAL;
-    }
-    control = nla_get_u32(tb[PARAM_CONTROL]);
-    hddLog(LOG1, FL("Control: %d"), control);
-
-    if (control == WLAN_START_OFFLOADED_PACKETS)
-        return wlan_hdd_add_tx_ptrn(adapter, hdd_ctx, tb);
-    else if (control == WLAN_STOP_OFFLOADED_PACKETS)
-        return wlan_hdd_del_tx_ptrn(adapter, hdd_ctx, tb);
-    else
-    {
-        hddLog(LOGE, FL("Invalid control: %d"), control);
-        return -EINVAL;
-    }
-}
-
-/*
- * done with short names for the global vendor params
- * used by __wlan_hdd_cfg80211_offloaded_packets()
- */
-#undef PARAM_MAX
-#undef PARAM_REQUEST_ID
-#undef PARAM_CONTROL
-#undef PARAM_IP_PACKET
-#undef PARAM_SRC_MAC_ADDR
-#undef PARAM_DST_MAC_ADDR
-#undef PARAM_PERIOD
-
-/**
- * wlan_hdd_cfg80211_offloaded_packets() - Wrapper to offload packets
- * @wiphy:    wiphy structure pointer
- * @wdev:     Wireless device structure pointer
- * @data:     Pointer to the data received
- * @data_len: Length of @data
- *
- * Return: 0 on success; errno on failure
- */
-static int wlan_hdd_cfg80211_offloaded_packets(struct wiphy *wiphy,
-        struct wireless_dev *wdev,
-        void *data,
-        int data_len)
-{
-    int ret = 0;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_offloaded_packets(wiphy,
-            wdev, data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-#endif
-
-static const struct
-nla_policy
-qca_wlan_vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_MAX+1] = {
-    [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC },
-};
-
-/**
- * wlan_hdd_cfg80211_get_link_properties() - This function is used to
- * get link properties like nss, rate flags and operating frequency for
- * the connection with the given peer.
- * @wiphy:    WIPHY structure pointer
- * @wdev:     Wireless device structure pointer
- * @data:     Pointer to the data received
- * @data_len: Length of the data received
- *
- * This function return the above link properties on success.
- *
- * Return: 0 on success and errno on failure
- */
-static int wlan_hdd_cfg80211_get_link_properties(struct wiphy *wiphy,
-        struct wireless_dev *wdev,
-        void *data,
-        int data_len)
-{
-    hdd_context_t       *hdd_ctx = wiphy_priv(wiphy);
-    struct net_device   *dev = wdev->netdev;
-    hdd_adapter_t       *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_station_ctx_t   *hdd_sta_ctx;
-    struct nlattr       *tb[QCA_WLAN_VENDOR_ATTR_MAX+1];
-    uint8_t             peer_mac[VOS_MAC_ADDR_SIZE];
-    uint32_t            sta_id;
-    struct sk_buff      *reply_skb;
-    uint32_t            rate_flags = 0;
-    uint8_t             nss;
-    uint8_t             final_rate_flags = 0;
-    uint32_t            freq;
-    v_CONTEXT_t pVosContext = NULL;
-    ptSapContext pSapCtx = NULL;
-
-    if (0 != wlan_hdd_validate_context(hdd_ctx)) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid"));
-        return -EINVAL;
-    }
-
-    if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len,
-                qca_wlan_vendor_attr_policy)) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid attribute"));
-        return -EINVAL;
-    }
-
-    if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-                FL("Attribute peerMac not provided for mode=%d"),
-                adapter->device_mode);
-        return -EINVAL;
-    }
-
-    memcpy(peer_mac, nla_data(tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]),
-            sizeof(peer_mac));
-    hddLog(VOS_TRACE_LEVEL_INFO,
-            FL("peerMac="MAC_ADDRESS_STR" for device_mode:%d"),
-            MAC_ADDR_ARRAY(peer_mac), adapter->device_mode);
-
-    if (adapter->device_mode == WLAN_HDD_INFRA_STATION ||
-            adapter->device_mode == WLAN_HDD_P2P_CLIENT) {
-        hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-        if ((hdd_sta_ctx->conn_info.connState !=
-                    eConnectionState_Associated) ||
-                !vos_mem_compare(hdd_sta_ctx->conn_info.bssId, peer_mac,
-                    VOS_MAC_ADDRESS_LEN)) {
-            hddLog(VOS_TRACE_LEVEL_ERROR,
-                    FL("Not Associated to mac "MAC_ADDRESS_STR),
-                    MAC_ADDR_ARRAY(peer_mac));
-            return -EINVAL;
-        }
-
-        nss  = 1; //pronto supports only one spatial stream
-        freq = vos_chan_to_freq(
-                hdd_sta_ctx->conn_info.operationChannel);
-        rate_flags = hdd_sta_ctx->conn_info.rate_flags;
-
-    } else if (adapter->device_mode == WLAN_HDD_P2P_GO ||
-            adapter->device_mode == WLAN_HDD_SOFTAP) {
-
-          pVosContext = ( WLAN_HDD_GET_CTX(adapter))->pvosContext;
-          pSapCtx = VOS_GET_SAP_CB(pVosContext);
-          if(pSapCtx == NULL){
-                 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   FL("psapCtx is NULL"));
-                     return -ENOENT;
-          }
-
-
-        for (sta_id = 0; sta_id < WLAN_MAX_STA_COUNT; sta_id++) {
-            if (pSapCtx->aStaInfo[sta_id].isUsed &&
-                    !vos_is_macaddr_broadcast(
-                        &pSapCtx->aStaInfo[sta_id].macAddrSTA) &&
-                    vos_mem_compare(
-                        &pSapCtx->aStaInfo[sta_id].macAddrSTA,
-                        peer_mac, VOS_MAC_ADDRESS_LEN))
-                break;
-        }
-
-        if (WLAN_MAX_STA_COUNT == sta_id) {
-            hddLog(VOS_TRACE_LEVEL_ERROR,
-                    FL("No active peer with mac="MAC_ADDRESS_STR),
-                    MAC_ADDR_ARRAY(peer_mac));
-            return -EINVAL;
-        }
-
-        nss  = 1; //pronto supports only one spatial stream
-        freq = vos_chan_to_freq(
-                (WLAN_HDD_GET_AP_CTX_PTR(adapter))->operatingChannel);
-        rate_flags = pSapCtx->aStaInfo[sta_id].rate_flags;
-    } else {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-                FL("Not Associated! with mac"MAC_ADDRESS_STR),
-                MAC_ADDR_ARRAY(peer_mac));
-        return -EINVAL;
-    }
-
-    if (!(rate_flags & eHAL_TX_RATE_LEGACY)) {
-        if (rate_flags & eHAL_TX_RATE_VHT80) {
-            final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS;
-            final_rate_flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH;
-        } else if (rate_flags & eHAL_TX_RATE_VHT40) {
-            final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS;
-            final_rate_flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
-        } else if (rate_flags & eHAL_TX_RATE_VHT20) {
-            final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS;
-        } else if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) {
-            final_rate_flags |= RATE_INFO_FLAGS_MCS;
-            if (rate_flags & eHAL_TX_RATE_HT40)
-                final_rate_flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
-        }
-
-        if (rate_flags & eHAL_TX_RATE_SGI) {
-            if (!(final_rate_flags & RATE_INFO_FLAGS_VHT_MCS))
-                final_rate_flags |= RATE_INFO_FLAGS_MCS;
-            final_rate_flags |= RATE_INFO_FLAGS_SHORT_GI;
-        }
-    }
-
-    reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
-            sizeof(u8) + sizeof(u8) + sizeof(u32) + NLMSG_HDRLEN);
-
-    if (NULL == reply_skb) {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-                FL("getLinkProperties: skb alloc failed"));
-        return -EINVAL;
-    }
-
-    if (nla_put_u8(reply_skb,
-                QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_NSS,
-                nss) ||
-            nla_put_u8(reply_skb,
-                QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_RATE_FLAGS,
-                final_rate_flags) ||
-            nla_put_u32(reply_skb,
-                QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_FREQ,
-                freq)) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_put failed"));
-        kfree_skb(reply_skb);
-        return -EINVAL;
-    }
-
-    return cfg80211_vendor_cmd_reply(reply_skb);
-}
-
-#define PARAM_WIFICONFIG_MAX QCA_WLAN_VENDOR_ATTR_CONFIG_MAX
-#define PARAM_MODULATED_DTIM QCA_WLAN_VENDOR_ATTR_CONFIG_MODULATED_DTIM
-#define PARAM_STATS_AVG_FACTOR QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR
-#define PARAM_GUARD_TIME QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME
-#define PARAM_BCNMISS_PENALTY_PARAM_COUNT \
-        QCA_WLAN_VENDOR_ATTR_CONFIG_PENALIZE_AFTER_NCONS_BEACON_MISS
-
-/**
- * __wlan_hdd_cfg80211_wifi_configuration_set() - Wifi configuration
- * vendor command
- *
- * @wiphy: wiphy device pointer
- * @wdev: wireless device pointer
- * @data: Vendor command data buffer
- * @data_len: Buffer length
- *
- * Handles QCA_WLAN_VENDOR_ATTR_CONFIG_MAX.
- *
- * Return: EOK or other error codes.
- */
-
-static int __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
-                            struct wireless_dev *wdev,
-                            void *data,
-                            int data_len)
-{
-    struct net_device *dev = wdev->netdev;
-    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t *pHddCtx  = wiphy_priv(wiphy);
-    hdd_station_ctx_t *pHddStaCtx;
-    struct nlattr *tb[PARAM_WIFICONFIG_MAX + 1];
-    tpSetWifiConfigParams pReq;
-    tModifyRoamParamsReqParams modifyRoamParamsReq;
-    eHalStatus status;
-    int ret_val;
-    static const struct nla_policy policy[PARAM_WIFICONFIG_MAX + 1] = {
-                        [PARAM_STATS_AVG_FACTOR] = { .type = NLA_U16 },
-                        [PARAM_MODULATED_DTIM] = { .type = NLA_U32 },
-                        [PARAM_GUARD_TIME] = { .type = NLA_U32},
-                        [PARAM_BCNMISS_PENALTY_PARAM_COUNT] =
-                                             { .type = NLA_U32},
-    };
-
-    ENTER();
-
-    if (VOS_FTM_MODE == hdd_get_conparam()) {
-        hddLog(LOGE, FL("Command not allowed in FTM mode"));
-        return -EINVAL;
-    }
-
-    ret_val = wlan_hdd_validate_context(pHddCtx);
-    if (ret_val) {
-        return ret_val;
-    }
-
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-
-    if (nla_parse(tb, PARAM_WIFICONFIG_MAX, data, data_len, policy)) {
-               hddLog(LOGE, FL("Invalid ATTR"));
-               return -EINVAL;
-    }
-
-    /* check the Wifi Capability */
-    if ( (TRUE != pHddCtx->cfg_ini->fEnableWifiConfig) &&
-         (TRUE != sme_IsFeatureSupportedByFW(WIFI_CONFIG)))
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-               FL("WIFICONFIG not supported by Firmware"));
-        return -EINVAL;
-    }
-
-    if (tb[PARAM_BCNMISS_PENALTY_PARAM_COUNT]) {
-        modifyRoamParamsReq.param = WIFI_CONFIG_SET_BCNMISS_PENALTY_COUNT;
-        modifyRoamParamsReq.value =
-        nla_get_u32(tb[PARAM_BCNMISS_PENALTY_PARAM_COUNT]);
-
-        if (eHAL_STATUS_SUCCESS !=
-                sme_setBcnMissPenaltyCount(pHddCtx->hHal,&modifyRoamParamsReq))
-        {
-            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed", __func__);
-            ret_val = -EINVAL;
-        }
-        return ret_val;
-    }
-
-    /* Moved this down in order to provide provision to set beacon
-     * miss penalty count irrespective of connection state.
-     */
-    if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) {
-                hddLog(LOGE, FL("Not in Connected state!"));
-                return -ENOTSUPP;
-    }
-
-    pReq = vos_mem_malloc(sizeof(tSetWifiConfigParams));
-
-    if (!pReq) {
-      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-             "%s: Not able to allocate memory for tSetWifiConfigParams",
-             __func__);
-       return eHAL_STATUS_E_MALLOC_FAILED;
-   }
-
-   vos_mem_set(pReq, sizeof(tSetWifiConfigParams), 0);
-
-   pReq->sessionId = pAdapter->sessionId;
-   vos_mem_copy( &pReq->bssId, pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN);
-
-    if (tb[PARAM_MODULATED_DTIM]) {
-       pReq->paramValue = nla_get_u32(
-            tb[PARAM_MODULATED_DTIM]);
-       hddLog(LOG1, FL("Modulated DTIM: pReq->paramValue:%d "),
-                                        pReq->paramValue);
-       pHddCtx->cfg_ini->enableDynamicDTIM = pReq->paramValue;
-       hdd_set_pwrparams(pHddCtx);
-    if (BMPS == pmcGetPmcState(pHddCtx->hHal)) {
-       hddLog( LOG1, FL("WifiConfig: Requesting FullPower!"));
-
-       sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                            iw_full_power_cbfn, pAdapter,
-                            eSME_FULL_PWR_NEEDED_BY_HDD);
-       }
-       else
-       {
-            hddLog( LOG1, FL("WifiConfig Not in BMPS state"));
-       }
-    }
-
-    if (tb[PARAM_STATS_AVG_FACTOR]) {
-        pReq->paramType = WIFI_CONFIG_SET_AVG_STATS_FACTOR;
-        pReq->paramValue = nla_get_u16(
-            tb[PARAM_STATS_AVG_FACTOR]);
-        hddLog(LOG1, FL("AVG_STATS_FACTOR pReq->paramType:%d,pReq->paramValue:%d "),
-                                        pReq->paramType, pReq->paramValue);
-        status = sme_set_wificonfig_params(pHddCtx->hHal, pReq);
-
-        if (eHAL_STATUS_SUCCESS != status)
-        {
-            vos_mem_free(pReq);
-            pReq = NULL;
-            ret_val = -EPERM;
-            return ret_val;
-        }
-    }
-
-
-    if (tb[PARAM_GUARD_TIME]) {
-        pReq->paramType = WIFI_CONFIG_SET_GUARD_TIME;
-        pReq->paramValue = nla_get_u32(
-            tb[PARAM_GUARD_TIME]);
-       hddLog(LOG1, FL("GUARD_TIME pReq->paramType:%d,pReq->paramValue:%d "),
-                                        pReq->paramType, pReq->paramValue);
-        status = sme_set_wificonfig_params(pHddCtx->hHal, pReq);
-
-        if (eHAL_STATUS_SUCCESS != status)
-        {
-            vos_mem_free(pReq);
-            pReq = NULL;
-            ret_val = -EPERM;
-            return ret_val;
-        }
-
-    }
-
-    EXIT();
-    return ret_val;
-}
-
-/**
- * wlan_hdd_cfg80211_wifi_configuration_set() - Wifi configuration
- * vendor command
- *
- * @wiphy: wiphy device pointer
- * @wdev: wireless device pointer
- * @data: Vendor command data buffer
- * @data_len: Buffer length
- *
- * Handles QCA_WLAN_VENDOR_ATTR_CONFIG_MAX.
- *
- * Return: EOK or other error codes.
- */
-static int wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
-                            struct wireless_dev *wdev,
-                            void *data,
-                            int data_len)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_wifi_configuration_set(wiphy, wdev,
-                             data, data_len);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
 const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] =
 {
     {
@@ -7423,16 +4694,6 @@
                  WIPHY_VENDOR_CMD_NEED_RUNNING,
         .doit = wlan_hdd_cfg80211_firmware_roaming
     },
-
-    {
-        .info.vendor_id = QCA_NL80211_VENDOR_ID,
-        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN,
-        .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-                 WIPHY_VENDOR_CMD_NEED_NETDEV |
-                 WIPHY_VENDOR_CMD_NEED_RUNNING,
-        .doit = wlan_hdd_cfg80211_nan_request
-    },
-
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
     {
         .info.vendor_id = QCA_NL80211_VENDOR_ID,
@@ -7519,19 +4780,19 @@
     },
     {
         .info.vendor_id = QCA_NL80211_VENDOR_ID,
-        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SSID_HOTLIST,
+        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE,
         .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
                  WIPHY_VENDOR_CMD_NEED_NETDEV |
                  WIPHY_VENDOR_CMD_NEED_RUNNING,
-        .doit = wlan_hdd_cfg80211_extscan_set_ssid_hotlist
+        .doit = wlan_hdd_cfg80211_extscan_set_significant_change
     },
     {
         .info.vendor_id = QCA_NL80211_VENDOR_ID,
-        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SSID_HOTLIST,
+        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE,
         .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
                  WIPHY_VENDOR_CMD_NEED_NETDEV |
                  WIPHY_VENDOR_CMD_NEED_RUNNING,
-        .doit = wlan_hdd_cfg80211_extscan_reset_ssid_hotlist
+        .doit = wlan_hdd_cfg80211_extscan_reset_significant_change
     },
 #endif /* WLAN_FEATURE_EXTSCAN */
 /*EXT TDLS*/
@@ -7586,79 +4847,6 @@
                  WIPHY_VENDOR_CMD_NEED_NETDEV,
         .doit = wlan_hdd_cfg80211_get_concurrency_matrix
     },
-    {
-        .info.vendor_id = QCA_NL80211_VENDOR_ID,
-        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP,
-        .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-                 WIPHY_VENDOR_CMD_NEED_NETDEV |
-                 WIPHY_VENDOR_CMD_NEED_RUNNING,
-        .doit = wlan_hdd_cfg80211_get_fw_mem_dump
-    },
-    {
-        .info.vendor_id = QCA_NL80211_VENDOR_ID,
-        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SETBAND,
-        .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-            WIPHY_VENDOR_CMD_NEED_NETDEV |
-            WIPHY_VENDOR_CMD_NEED_RUNNING,
-        .doit = wlan_hdd_cfg80211_setband
-    },
-    {
-         .info.vendor_id = QCA_NL80211_VENDOR_ID,
-         .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_START,
-         .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-                  WIPHY_VENDOR_CMD_NEED_NETDEV,
-         .doit = wlan_hdd_cfg80211_wifi_logger_start
-    },
-    {
-        .info.vendor_id = QCA_NL80211_VENDOR_ID,
-        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO,
-        .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-                 WIPHY_VENDOR_CMD_NEED_NETDEV|
-                  WIPHY_VENDOR_CMD_NEED_RUNNING,
-        .doit = wlan_hdd_cfg80211_get_wifi_info
-    },
-    {
-        .info.vendor_id = QCA_NL80211_VENDOR_ID,
-        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_RING_DATA,
-        .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-                 WIPHY_VENDOR_CMD_NEED_NETDEV |
-                 WIPHY_VENDOR_CMD_NEED_RUNNING,
-        .doit = wlan_hdd_cfg80211_wifi_logger_get_ring_data
-    },
-    {
-        .info.vendor_id = QCA_NL80211_VENDOR_ID,
-        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI,
-        .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-                 WIPHY_VENDOR_CMD_NEED_NETDEV |
-                 WIPHY_VENDOR_CMD_NEED_RUNNING,
-        .doit = wlan_hdd_cfg80211_monitor_rssi
-    },
-#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
-    {
-        .info.vendor_id = QCA_NL80211_VENDOR_ID,
-        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_OFFLOADED_PACKETS,
-        .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-            WIPHY_VENDOR_CMD_NEED_NETDEV |
-            WIPHY_VENDOR_CMD_NEED_RUNNING,
-        .doit = wlan_hdd_cfg80211_offloaded_packets
-    },
-#endif
-    {
-        .info.vendor_id = QCA_NL80211_VENDOR_ID,
-        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES,
-        .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-            WIPHY_VENDOR_CMD_NEED_NETDEV |
-            WIPHY_VENDOR_CMD_NEED_RUNNING,
-        .doit = wlan_hdd_cfg80211_get_link_properties
-    },
-    {
-        .info.vendor_id = QCA_NL80211_VENDOR_ID,
-        .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION,
-        .flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-                 WIPHY_VENDOR_CMD_NEED_NETDEV |
-                 WIPHY_VENDOR_CMD_NEED_RUNNING,
-        .doit = wlan_hdd_cfg80211_wifi_configuration_set
-    }
 };
 
 /* vendor specific events */
@@ -7746,19 +4934,15 @@
     },
     {
         .vendor_id = QCA_NL80211_VENDOR_ID,
-        .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SSID_HOTLIST
+        .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE
     },
     {
         .vendor_id = QCA_NL80211_VENDOR_ID,
-        .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SSID_HOTLIST
+        .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE
     },
-    [QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND_INDEX] = {
+    {
         .vendor_id = QCA_NL80211_VENDOR_ID,
-        .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND
-    },
-    [QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST_INDEX] = {
-        .vendor_id = QCA_NL80211_VENDOR_ID,
-        .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST
+        .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE
     },
 #endif /* WLAN_FEATURE_EXTSCAN */
 /*EXT TDLS*/
@@ -7766,30 +4950,6 @@
         .vendor_id = QCA_NL80211_VENDOR_ID,
         .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE
     },
-    [QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP_INDEX] = {
-        .vendor_id = QCA_NL80211_VENDOR_ID,
-        .subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP
-    },
-
-
-    {
-        .vendor_id = QCA_NL80211_VENDOR_ID,
-        .subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN
-    },
-
-    {
-        .vendor_id = QCA_NL80211_VENDOR_ID,
-        .subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO,
-    },
-    [QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX] = {
-        .vendor_id = QCA_NL80211_VENDOR_ID,
-        .subcmd = QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI
-    },
-    [QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST_INDEX] = {
-        .vendor_id = QCA_NL80211_VENDOR_ID,
-        .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST
-    },
-
 };
 
 /*
@@ -7906,11 +5066,8 @@
 
     /* This will disable updating of NL channels from passive to
      * active if a beacon is received on passive channel. */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-    wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS;
-#else
     wiphy->flags |=   WIPHY_FLAG_DISABLE_BEACON_HINTS;
-#endif
+
 
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
@@ -7918,11 +5075,7 @@
                  |  WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD
                  |  WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL
                     | WIPHY_FLAG_OFFCHAN_TX;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-    wiphy->regulatory_flags = REGULATORY_COUNTRY_IE_IGNORE;
-#else
-     wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE;
-#endif
+    wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE;
 #endif
 
 #if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
@@ -7952,10 +5105,6 @@
     }
 #endif/*FEATURE_WLAN_SCAN_PNO*/
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-    wiphy->features |= NL80211_FEATURE_HT_IBSS;
-#endif
-
 #ifdef CONFIG_ENABLE_LINUX_REG
     /* even with WIPHY_FLAG_CUSTOM_REGULATORY,
        driver can still register regulatory callback and
@@ -7970,21 +5119,16 @@
 
     wiphy->max_scan_ssids = MAX_SCAN_SSID;
 
-    wiphy->max_scan_ie_len = SIR_MAC_MAX_ADD_IE_LENGTH;
+    wiphy->max_scan_ie_len = SIR_MAC_MAX_IE_LENGTH;
 
     wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS;
 
     /* Supports STATION & AD-HOC modes right now */
-    wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)
-                            | BIT(NL80211_IFTYPE_ADHOC)
-                            | BIT(NL80211_IFTYPE_P2P_CLIENT)
-                            | BIT(NL80211_IFTYPE_P2P_GO)
-                            | BIT(NL80211_IFTYPE_AP);
-
-    if (VOS_MONITOR_MODE == hdd_get_conparam())
-    {
-        wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
-    }
+    wiphy->interface_modes =   BIT(NL80211_IFTYPE_STATION)
+                             | BIT(NL80211_IFTYPE_ADHOC)
+                             | BIT(NL80211_IFTYPE_P2P_CLIENT)
+                             | BIT(NL80211_IFTYPE_P2P_GO)
+                             | BIT(NL80211_IFTYPE_AP);
 
     if( pCfg->advertiseConcurrentOperation )
     {
@@ -8009,6 +5153,7 @@
     {
         wlan_hdd_band_2_4_GHZ.ht_cap.cap     &= ~IEEE80211_HT_CAP_SGI_20;
         wlan_hdd_band_5_GHZ.ht_cap.cap       &= ~IEEE80211_HT_CAP_SGI_20;
+        wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20;
     }
 
     if( !pCfg->ShortGI40MhzEnable )
@@ -8020,51 +5165,19 @@
     {
         wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
     }
-    /*
-     * In case of static linked driver at the time of driver unload,
-     * module exit doesn't happens. Module cleanup helps in cleaning
-     * of static memory.
-     * If driver load happens statically, at the time of driver unload,
-     * wiphy flags don't get reset because of static memory.
-     * It's better not to store channel in static memory.
-     */
-    wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ;
-    wiphy->bands[IEEE80211_BAND_2GHZ]->channels =
-        (struct ieee80211_channel *)vos_mem_malloc(sizeof(hdd_channels_2_4_GHZ));
-    if (wiphy->bands[IEEE80211_BAND_2GHZ]->channels == NULL)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-                FL("Not enough memory to allocate channels"));
-        return -ENOMEM;
-    }
-    vos_mem_copy(wiphy->bands[IEEE80211_BAND_2GHZ]->channels,
-            &hdd_channels_2_4_GHZ[0],
-            sizeof(hdd_channels_2_4_GHZ));
 
-    if (true == hdd_is_5g_supported(pHddCtx))
-    {
-        wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ;
-        wiphy->bands[IEEE80211_BAND_5GHZ]->channels =
-            (struct ieee80211_channel *)vos_mem_malloc(sizeof(hdd_channels_5_GHZ));
-        if (wiphy->bands[IEEE80211_BAND_5GHZ]->channels == NULL)
-        {
-            hddLog(VOS_TRACE_LEVEL_ERROR,
-                    FL("Not enough memory to allocate channels"));
-            vos_mem_free(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
-            wiphy->bands[IEEE80211_BAND_2GHZ]->channels = NULL;
-            return -ENOMEM;
-        }
-        vos_mem_copy(wiphy->bands[IEEE80211_BAND_5GHZ]->channels,
-                &hdd_channels_5_GHZ[0],
-                sizeof(hdd_channels_5_GHZ));
-    }
+   wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ;
+   if (true == hdd_is_5g_supported(pHddCtx))
+   {
+       wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ;
+   }
 
    for (i = 0; i < IEEE80211_NUM_BANDS; i++)
    {
 
        if (NULL == wiphy->bands[i])
        {
-          hddLog(VOS_TRACE_LEVEL_INFO,"%s: wiphy->bands[i] is NULL, i = %d",
+          hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d",
                  __func__, i);
           continue;
        }
@@ -8157,15 +5270,16 @@
        }
     }
 }
+
 /* This function registers for all frame which supplicant is interested in */
 void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter)
 {
     tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
     /* Register for all P2P action, public action etc frames */
     v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4);
+
     ENTER();
-    /* Register frame indication call back */
-    sme_register_mgmt_frame_ind_callback(hHal, hdd_indicate_mgmt_frame);
+
    /* Right now we are registering these frame when driver is getting
       initialized. Once we will move to 2.6.37 kernel, in which we have
       frame register ops, we will move this code as a part of that */
@@ -8251,7 +5365,7 @@
 
 #ifdef FEATURE_WLAN_WAPI
 void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index,
-                                     const u8 *mac_addr, const u8 *key , int key_Len)
+                                     const u8 *mac_addr, u8 *key , int key_Len)
 {
     hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     tCsrRoamSetKey  setKey;
@@ -8423,16 +5537,10 @@
 
 }
 
-v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
-                                     const v_U8_t *pIes,
-#else
-                                     v_U8_t *pIes,
-#endif
-                                     int length, v_U8_t eid)
+v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid)
 {
     int left = length;
-    v_U8_t *ptr =  (v_U8_t *)pIes;
+    v_U8_t *ptr = pIes;
     v_U8_t elem_id,elem_len;
 
     while(left >= 2)
@@ -8971,10 +6079,10 @@
 }
 
 /**
- * FUNCTION: __wlan_hdd_cfg80211_set_channel
+ * FUNCTION: wlan_hdd_cfg80211_set_channel
  * This function is used to set the channel number
  */
-static int __wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev,
+static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev,
                                    struct ieee80211_channel *chan,
                                    enum nl80211_channel_type channel_type
                                  )
@@ -8988,6 +6096,7 @@
 
     ENTER();
 
+
     if( NULL == dev )
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
@@ -9006,8 +6115,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -9119,21 +6231,6 @@
     return status;
 }
 
-static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy,
-                                          struct net_device *dev,
-                                          struct ieee80211_channel *chan,
-                                          enum nl80211_channel_type channel_type
-                                        )
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
 static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter,
                             struct beacon_parameters *params)
@@ -9141,8 +6238,7 @@
 static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter,
                                        struct cfg80211_beacon_data *params,
                                        const u8 *ssid, size_t ssid_len,
-                                       enum nl80211_hidden_ssid hidden_ssid,
-                                       v_U8_t auth_type)
+                                       enum nl80211_hidden_ssid hidden_ssid)
 #endif
 {
     tsap_Config_t *pConfig;
@@ -9166,8 +6262,9 @@
     tSmeConfigParams *psmeConfig;
     v_BOOL_t MFPCapable = VOS_FALSE;
     v_BOOL_t MFPRequired = VOS_FALSE;
-    v_BOOL_t sapEnable11AC =
-             (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapEnable11AC;
+    eHddDot11Mode sapDot11Mode =
+            (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapDot11Mode;
+
     ENTER();
 
     iniConfig = pHddCtx->cfg_ini;
@@ -9246,22 +6343,7 @@
     {
         pConfig->ieee80211d = 0;
     }
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
-    if (params->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM)
-        pConfig->authType = eSAP_OPEN_SYSTEM;
-    else if (params->auth_type == NL80211_AUTHTYPE_SHARED_KEY)
-        pConfig->authType = eSAP_SHARED_KEY;
-    else
-        pConfig->authType = eSAP_AUTO_SWITCH;
-#else
-    if (auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM)
-        pConfig->authType = eSAP_OPEN_SYSTEM;
-    else if (auth_type == NL80211_AUTHTYPE_SHARED_KEY)
-        pConfig->authType = eSAP_SHARED_KEY;
-    else
-        pConfig->authType = eSAP_AUTO_SWITCH;
-#endif
+    pConfig->authType = eSAP_AUTO_SWITCH;
 
     capab_info = pMgmt_frame->u.beacon.capab_info;
 
@@ -9476,14 +6558,17 @@
 
 #ifdef WLAN_FEATURE_11AC
     /* Overwrite the hostapd setting for HW mode only for 11ac.
-     * This is valid only if mode is set to 11n in hostapd, sapEnable11AC
-     * is set in .ini and 11ac is supported by both host and firmware.
+     * This is valid only if mode is set to 11n in hostapd, either AUTO or
+     * 11ac in .ini and 11ac is supported by both host and firmware.
      * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode)
      */
     if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) ||
          (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) &&
-         (sapEnable11AC) && (sme_IsFeatureSupportedByDriver(DOT11AC)) &&
-         (sme_IsFeatureSupportedByFW(DOT11AC)) )
+        (( sapDot11Mode == eHDD_DOT11_MODE_AUTO ) ||
+         ( sapDot11Mode == eHDD_DOT11_MODE_11ac ) ||
+         ( sapDot11Mode == eHDD_DOT11_MODE_11ac_ONLY ) ) &&
+         (sme_IsFeatureSupportedByDriver(DOT11AC)) &&
+          (sme_IsFeatureSupportedByFW(DOT11AC)) )
     {
         v_U32_t operatingBand = 0;
         pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac;
@@ -9509,6 +6594,12 @@
     }
 #endif
 
+    if ( AUTO_CHANNEL_SELECT != pConfig->channel )
+    {
+        sme_SelectCBMode(hHal,
+            sapConvertSapPhyModeToCsrPhyMode(pConfig->SapHw_mode),
+            pConfig->channel);
+    }
     // ht_capab is not what the name conveys,this is used for protection bitmap
     pConfig->ht_capab =
                  (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection;
@@ -9565,18 +6656,8 @@
     psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams));
     if ( NULL != psmeConfig)
     {
-        vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams));
         sme_GetConfigParam(hHal, psmeConfig);
         pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP)
-          || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO))
-          && pHddCtx->cfg_ini->apHT40_24GEnabled)
-        {
-            psmeConfig->csrConfig.apHT40_24GEnabled = 1;
-            sme_UpdateConfig (hHal, psmeConfig);
-        }
-#endif
         vos_mem_free(psmeConfig);
     }
     pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold;
@@ -9632,7 +6713,7 @@
 }
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
-static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy,
                                         struct net_device *dev,
                                         struct beacon_parameters *params)
 {
@@ -9651,8 +6732,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -9695,20 +6779,7 @@
     return status;
 }
 
-static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy,
-                                        struct net_device *dev,
-                                        struct beacon_parameters *params)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy,
                                         struct net_device *dev,
                                         struct beacon_parameters *params)
 {
@@ -9718,7 +6789,6 @@
     int status;
 
     ENTER();
-
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                      TRACE_CODE_HDD_CFG80211_SET_BEACON,
                      pAdapter->sessionId, pHddStaCtx->conn_info.authType));
@@ -9728,8 +6798,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -9766,32 +6839,20 @@
     return status;
 }
 
-static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy,
-                                        struct net_device *dev,
-                                        struct beacon_parameters *params)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
-static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy,
                                         struct net_device *dev)
 #else
-static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy,
                                       struct net_device *dev)
 #endif
 {
     hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
     hdd_context_t  *pHddCtx    = NULL;
     hdd_scaninfo_t *pScanInfo  = NULL;
+    hdd_adapter_t  *staAdapter = NULL;
     VOS_STATUS status;
     long ret;
 
@@ -9809,11 +6870,26 @@
                      pAdapter->sessionId, pAdapter->device_mode));
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
+    staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION);
+    if (NULL == staAdapter)
+    {
+        staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT);
+        if (NULL == staAdapter)
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
+                      "%s: HDD adapter context for STA/P2P-CLI is Null",
+                      __func__);
+        }
+    }
+
     pScanInfo =  &pHddCtx->scan_info;
 
     hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)",
@@ -9924,35 +7000,9 @@
     return status;
 }
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
-static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy,
-                                        struct net_device *dev)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-#else
-static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
-                                      struct net_device *dev)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-#endif
-
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0))
 
-static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
                                       struct net_device *dev,
                                       struct cfg80211_ap_settings *params)
 {
@@ -9962,10 +7012,10 @@
 
     ENTER();
 
-    if (NULL == dev || NULL == params)
+    if (NULL == dev)
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   "%s: Device or params is Null", __func__);
+                   "%s: Device is Null", __func__);
         return -ENODEV;
     }
 
@@ -9989,8 +7039,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -10014,16 +7067,7 @@
             return -EALREADY;
         }
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
-        status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,
-                                                    &new,
-                                                    &params->beacon);
-#else
-        status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,
-                                                    &new,
-                                                    &params->beacon,
-                                                    params->dtim_period);
-#endif
+        status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, &params->beacon, params->dtim_period);
 
         if (status != 0)
         {
@@ -10041,28 +7085,15 @@
 #endif
 #endif
         status = wlan_hdd_cfg80211_start_bss(pAdapter, &params->beacon, params->ssid,
-                                             params->ssid_len, params->hidden_ssid,
-                                             params->auth_type);
+                                             params->ssid_len, params->hidden_ssid);
     }
 
     EXIT();
     return status;
 }
 
-static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
-                                      struct net_device *dev,
-                                      struct cfg80211_ap_settings *params)
-{
-    int ret;
 
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy,
                                         struct net_device *dev,
                                         struct cfg80211_beacon_data *params)
 {
@@ -10080,8 +7111,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -10111,29 +7145,16 @@
 
        pAdapter->sessionCtx.ap.beacon = new;
 
-       status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0,
-                                   pAdapter->sessionCtx.ap.sapConfig.authType);
+       status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0);
     }
 
     EXIT();
     return status;
 }
 
-static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy,
-                                        struct net_device *dev,
-                                        struct cfg80211_beacon_data *params)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_change_beacon(wiphy, dev, params);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0))
 
+
 static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy,
                                       struct net_device *dev,
                                       struct bss_parameters *params)
@@ -10151,11 +7172,15 @@
         return -ENODEV;
     }
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
     ret = wlan_hdd_validate_context(pHddCtx);
     if (0 != ret)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return ret;
     }
+
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                      TRACE_CODE_HDD_CFG80211_CHANGE_BSS,
                      pAdapter->sessionId, params->ap_isolate));
@@ -10244,8 +7269,11 @@
                      TRACE_CODE_HDD_CFG80211_CHANGE_IFACE,
                      pAdapter->sessionId, type));
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -10281,21 +7309,6 @@
     /* Reset the current device mode bit mask*/
     wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode);
 
-    if ((pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) &&
-        ((type == NL80211_IFTYPE_P2P_CLIENT) ||
-         (type == NL80211_IFTYPE_P2P_GO)))
-    {
-        /* Notify Mode change in case of concurrency.
-         * Below function invokes TDLS teardown Functionality Since TDLS is
-         * not Supported in case of concurrency i.e Once P2P session
-         * is detected disable offchannel and teardown TDLS links
-         */
-        hddLog(LOG1,
-               FL("Device mode = %d Interface type = %d"),
-               pAdapter->device_mode, type);
-        hdd_tdls_notify_mode_change(pAdapter, pHddCtx);
-    }
-
     if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION)
       || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
       || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE)
@@ -10330,11 +7343,6 @@
                 //Check for sub-string p2p to confirm its a p2p interface
                 if (NULL != strstr(ndev->name,"p2p"))
                 {
-#ifdef FEATURE_WLAN_TDLS
-                   mutex_lock(&pHddCtx->tdls_lock);
-                   wlan_hdd_tdls_exit(pAdapter, TRUE);
-                   mutex_unlock(&pHddCtx->tdls_lock);
-#endif
                     pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ?
                                 WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT;
                 }
@@ -10353,14 +7361,6 @@
                     hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode);
                 pAdapter->device_mode = WLAN_HDD_IBSS;
                 wdev->iftype = type;
-                hdd_set_ibss_ops( pAdapter );
-                hdd_ibss_init_tx_rx( pAdapter );
-
-                status = hdd_sta_id_hash_attach(pAdapter);
-                if (VOS_STATUS_SUCCESS != status) {
-                     hddLog(VOS_TRACE_LEVEL_ERROR,
-                            FL("Failed to initialize hash for IBSS"));
-                }
                 break;
 
             case NL80211_IFTYPE_AP:
@@ -10390,7 +7390,7 @@
                     if (pP2pAdapter)
                     {
                         hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE);
-                        hdd_deinit_adapter(pHddCtx, pP2pAdapter, TRUE);
+                        hdd_deinit_adapter(pHddCtx, pP2pAdapter);
                         hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE);
                     }
                 }
@@ -10413,7 +7413,7 @@
                 mutex_lock(&pHddCtx->tdls_lock);
 #endif
                 //De-init the adapter.
-                hdd_deinit_adapter( pHddCtx, pAdapter, TRUE);
+                hdd_deinit_adapter( pHddCtx, pAdapter );
                 memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx));
                 pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ?
                                    WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO;
@@ -10492,14 +7492,6 @@
                 }
                 hdd_set_conparam(1);
 
-                status = hdd_sta_id_hash_attach(pAdapter);
-                if (VOS_STATUS_SUCCESS != status)
-                {
-                    hddLog(VOS_TRACE_LEVEL_ERROR,
-                           FL("Failed to initialize hash for AP"));
-                    return -EINVAL;
-                }
-
                 /*interface type changed update in wiphy structure*/
                 if(wdev)
                 {
@@ -10540,7 +7532,7 @@
                  */
                 mutex_lock(&pHddCtx->tdls_lock);
 #endif
-                hdd_deinit_adapter( pHddCtx, pAdapter, TRUE);
+                hdd_deinit_adapter( pHddCtx, pAdapter );
                 wdev->iftype = type;
                 //Check for sub-string p2p to confirm its a p2p interface
                 if (NULL != strstr(ndev->name,"p2p"))
@@ -10674,34 +7666,17 @@
 
 #ifdef FEATURE_WLAN_TDLS
 static int wlan_hdd_tdls_add_station(struct wiphy *wiphy,
-          struct net_device *dev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-          const u8 *mac,
-#else
-          u8 *mac,
-#endif
-          bool update, tCsrStaParams *StaParams)
+          struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams)
 {
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     hdd_context_t *pHddCtx = wiphy_priv(wiphy);
+    VOS_STATUS status;
     hddTdlsPeer_t *pTdlsPeer;
     long ret;
     tANI_U16 numCurrTdlsPeers;
-    hdd_adapter_t *pAdapter;
-    VOS_STATUS status;
 
     ENTER();
 
-    if (!dev) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL"));
-        return -EINVAL;
-    }
-
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (!pAdapter) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL"));
-        return -EINVAL;
-    }
-
     if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini)
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -10712,7 +7687,7 @@
     if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) ||
         (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode))
     {
-         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+         VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                     "%s: TDLS mode is disabled OR not enabled in FW."
                     MAC_ADDRESS_STR " Request declined.",
                     __func__, MAC_ADDR_ARRAY(mac));
@@ -10730,14 +7705,12 @@
         return -EBUSY;
     }
 
-    mutex_lock(&pHddCtx->tdls_lock);
     pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac);
 
     if ( NULL == pTdlsPeer ) {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+        VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid",
                __func__, MAC_ADDR_ARRAY(mac), update);
-        mutex_unlock(&pHddCtx->tdls_lock);
         return -EINVAL;
     }
 
@@ -10746,11 +7719,10 @@
         ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) ||
          (TDLS_STA_INDEX_VALID(pTdlsPeer->staId))))
     {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                    "%s: " MAC_ADDRESS_STR
                    " link_status %d. staId %d. add station ignored.",
                    __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId);
-        mutex_unlock(&pHddCtx->tdls_lock);
         return 0;
     }
     /* in change station, we accept only when staId is valid */
@@ -10758,19 +7730,16 @@
         ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) ||
          (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId))))
     {
-        tANI_U16 staId = pTdlsPeer->staId;
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+        VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                    "%s: " MAC_ADDRESS_STR
                    " link status %d. staId %d. change station %s.",
-                   __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, staId,
-                   (TDLS_STA_INDEX_VALID(staId)) ? "ignored" : "declined");
-        mutex_unlock(&pHddCtx->tdls_lock);
-        return (TDLS_STA_INDEX_VALID(staId)) ? 0 : -EPERM;
+                   __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId,
+                   (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined");
+        return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM;
     }
-    mutex_unlock(&pHddCtx->tdls_lock);
 
     /* when others are on-going, we want to change link_status to idle */
-    if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE, TRUE))
+    if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE))
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                    "%s: " MAC_ADDRESS_STR
@@ -10796,17 +7765,14 @@
     else
     {
         hddTdlsPeer_t *pTdlsPeer;
-        mutex_lock(&pHddCtx->tdls_lock);
-        pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE);
+        pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
         if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer))
         {
-            mutex_unlock(&pHddCtx->tdls_lock);
             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                        "%s: " MAC_ADDRESS_STR " already connected. Request declined.",
                        __func__, MAC_ADDR_ARRAY(mac));
             return -EPERM;
         }
-        mutex_unlock(&pHddCtx->tdls_lock);
     }
     if (0 == update)
         wlan_hdd_tdls_set_link_status(pAdapter,
@@ -10817,23 +7783,23 @@
     /* debug code */
     if (NULL != StaParams)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                   "%s: TDLS Peer Parameters.", __func__);
         if(StaParams->htcap_present)
         {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                       "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo);
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                       "ht_capa->extended_capabilities: %0x",
                       StaParams->HTCap.extendedHtCapInfo);
         }
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                   "params->capability: %0x",StaParams->capability);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                   "params->ext_capab_len: %0x",StaParams->extn_capability[0]);
         if(StaParams->vhtcap_present)
         {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                       "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x",
                       StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest,
                       StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest);
@@ -10842,7 +7808,7 @@
             int i = 0;
             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:");
             for (i = 0; i < sizeof(StaParams->supported_rates); i++)
-               VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+               VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                           "[%d]: %x ", i, StaParams->supported_rates[i]);
         }
     }  /* end debug code */
@@ -10857,58 +7823,24 @@
 
     if (!update)
     {
-        /*Before adding sta make sure that device exited from BMPS*/
-        if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter)))
-        {
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                       "%s: Adding tdls peer sta. Disable BMPS", __func__);
-            status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION);
-            if (status != VOS_STATUS_SUCCESS) {
-                hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS"));
-            }
-        }
-
-        ret = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter),
+        status = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter),
                 pAdapter->sessionId, mac);
-        if (ret != eHAL_STATUS_SUCCESS) {
-            hddLog(VOS_TRACE_LEVEL_ERROR,
-                    FL("Failed to add TDLS peer STA. Enable Bmps"));
-            wlan_hdd_tdls_check_bmps(pAdapter);
-            return -EPERM;
-        }
     }
     else
     {
-        ret = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter),
+        status = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter),
                                        pAdapter->sessionId, mac, StaParams);
-        if (ret != eHAL_STATUS_SUCCESS) {
-            hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to change TDLS peer STA params"));
-            return -EPERM;
-        }
     }
 
     ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp,
            msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA));
 
-    mutex_lock(&pHddCtx->tdls_lock);
-    pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE);
-
-    if ((pTdlsPeer != NULL) &&
-         (pTdlsPeer->link_status == eTDLS_LINK_TEARING))
-    {
-         hddLog(VOS_TRACE_LEVEL_ERROR,
-                FL("peer link status %u"), pTdlsPeer->link_status);
-         mutex_unlock(&pHddCtx->tdls_lock);
-         goto error;
-    }
-    mutex_unlock(&pHddCtx->tdls_lock);
-
     if (ret <= 0)
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                 "%s: timeout waiting for tdls add station indication %ld",
                 __func__, ret);
-        goto error;
+        return -EPERM;
     }
 
     if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus)
@@ -10930,17 +7862,13 @@
 }
 #endif
 
-static int __wlan_hdd_change_station(struct wiphy *wiphy,
+static int wlan_hdd_change_station(struct wiphy *wiphy,
                                          struct net_device *dev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                         const u8 *mac,
-#else
                                          u8 *mac,
-#endif
                                          struct station_parameters *params)
 {
     VOS_STATUS status = VOS_STATUS_SUCCESS;
-    hdd_adapter_t *pAdapter;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
     hdd_context_t *pHddCtx;
     hdd_station_ctx_t *pHddStaCtx;
     v_MACADDR_t STAMacAddress;
@@ -10949,12 +7877,9 @@
     tCsrStaParams StaParams = {0};
     tANI_U8 isBufSta = 0;
     tANI_U8 isOffChannelSupported = 0;
-    tANI_U8 isQosWmmSta = FALSE;
 #endif
-
     ENTER();
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     if ((NULL == pAdapter))
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
@@ -10970,6 +7895,8 @@
     ret = wlan_hdd_validate_context(pHddCtx);
     if (0 != ret)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return ret;
     }
 
@@ -10981,6 +7908,7 @@
                   "invalid HDD station context");
         return -EINVAL;
     }
+
     vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t));
 
     if ((pAdapter->device_mode == WLAN_HDD_SOFTAP)
@@ -11087,22 +8015,9 @@
                     isOffChannelSupported = 1;
                 }
             }
-
-            if (pHddCtx->cfg_ini->fEnableTDLSWmmMode &&
-                   (params->sta_flags_set & BIT(NL80211_STA_FLAG_WME))) {
-
-                /* TDLS Peer is WME/QoS capable */
-                isQosWmmSta = TRUE;
-            }
-
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                      "%s: TDLS Peer is QOS capable isQosWmmSta= %d HTcapPresent= %d",
-                      __func__, isQosWmmSta, StaParams.htcap_present);
-
             status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac,
                                                   &StaParams, isBufSta,
-                                                  isOffChannelSupported,
-                                                  isQosWmmSta);
+                                                  isOffChannelSupported);
 
             if (VOS_STATUS_SUCCESS != status) {
                 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -11123,27 +8038,6 @@
     return status;
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
-static int wlan_hdd_change_station(struct wiphy *wiphy,
-                                         struct net_device *dev,
-                                         const u8 *mac,
-                                         struct station_parameters *params)
-#else
-static int wlan_hdd_change_station(struct wiphy *wiphy,
-                                         struct net_device *dev,
-                                         u8 *mac,
-                                         struct station_parameters *params)
-#endif
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_change_station(wiphy, dev, mac, params);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 /*
  * FUNCTION: __wlan_hdd_cfg80211_add_key
  * This function is used to initialize the key information
@@ -11181,8 +8075,11 @@
                       pAdapter->sessionId, params->key_len));
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -11524,7 +8421,7 @@
      * variable.
      */
     vos_mem_zero(&setKey, sizeof(setKey));
-    EXIT();
+
     return status;
 }
 
@@ -11598,6 +8495,8 @@
     ret = wlan_hdd_validate_context(pHddCtx);
     if (0 != ret)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return ret;
     }
 
@@ -11654,7 +8553,6 @@
     params.seq = NULL;
     params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0];
     callback(cookie, &params);
-    EXIT();
     return 0;
 }
 
@@ -11691,18 +8589,18 @@
 }
 
 /*
- * FUNCTION: __wlan_hdd_cfg80211_del_key
+ * FUNCTION: wlan_hdd_cfg80211_del_key
  * This function is used to delete the key information
  */
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy,
                                       struct net_device *ndev,
                                       u8 key_index,
                                       bool pairwise,
                                       const u8 *mac_addr
                                     )
 #else
-static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy,
                                       struct net_device *ndev,
                                       u8 key_index,
                                       const u8 *mac_addr
@@ -11799,35 +8697,6 @@
     return status;
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy,
-                                      struct net_device *ndev,
-                                      u8 key_index,
-                                      bool pairwise,
-                                      const u8 *mac_addr
-                                    )
-#else
-static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy,
-                                      struct net_device *ndev,
-                                      u8 key_index,
-                                      const u8 *mac_addr
-                                    )
-#endif
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-    ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise,
-                                    mac_addr);
-#else
-    ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr);
-#endif
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 /*
  * FUNCTION: __wlan_hdd_cfg80211_set_default_key
  * This function is used to set the default tx key index
@@ -11885,8 +8754,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -11970,7 +8842,7 @@
             pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT;
         }
     }
-    EXIT();
+
     return status;
 }
 
@@ -12017,6 +8889,8 @@
     int rssi = 0;
     struct cfg80211_bss *bss = NULL;
 
+    ENTER();
+
     if( NULL == pBssDesc )
     {
         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__);
@@ -12055,51 +8929,13 @@
 
     rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100;
 
-    return cfg80211_inform_bss(wiphy, chan,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                CFG80211_BSS_FTYPE_UNKNOWN,
-#endif
-                pBssDesc->bssId,
+    return cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId,
                 le64_to_cpu(*(__le64 *)pBssDesc->timeStamp),
                 pBssDesc->capabilityInfo,
                 pBssDesc->beaconInterval, ie, ie_length,
                 rssi, GFP_KERNEL );
 }
 
-/*
- * wlan_hdd_cfg80211_update_bss_list :to inform nl80211
- * interface that BSS might have been lost.
- * @pAdapter: adaptor
- * @bssid: bssid which might have been lost
- *
- * Return: bss which is unlinked from kernel cache
- */
-struct cfg80211_bss* wlan_hdd_cfg80211_update_bss_list(
-   hdd_adapter_t *pAdapter, tSirMacAddr bssid)
-{
-    struct net_device *dev = pAdapter->dev;
-    struct wireless_dev *wdev = dev->ieee80211_ptr;
-    struct wiphy *wiphy = wdev->wiphy;
-    struct cfg80211_bss *bss = NULL;
-
-    bss = cfg80211_get_bss(wiphy, NULL, bssid,
-                           NULL,
-                           0,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) && !defined(WITH_BACKPORTS) \
-     && !defined(IEEE80211_PRIVACY)
-                           WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
-#else
-                           IEEE80211_BSS_TYPE_ESS, IEEE80211_PRIVACY_ANY);
-#endif
-    if (bss == NULL) {
-        hddLog(LOGE, FL("BSS not present"));
-    } else {
-        hddLog(LOG1, FL("cfg80211_unlink_bss called for BSSID "
-               MAC_ADDRESS_STR), MAC_ADDR_ARRAY(bssid));
-        cfg80211_unlink_bss(wiphy, bss);
-    }
-    return bss;
-}
 
 
 /*
@@ -12144,11 +8980,22 @@
     struct timespec ts;
 #endif
 
-
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
+    /*bss_update is not allowed during wlan driver loading or unloading*/
+    if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx))
+    {
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "%s:Loading_unloading in Progress. Ignore!!!",__func__);
+         return NULL;
+    }
+
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return NULL;
     }
 
@@ -12189,7 +9036,7 @@
     qie_age->oui_2      = QCOM_OUI2;
     qie_age->oui_3      = QCOM_OUI3;
     qie_age->type       = QCOM_VENDOR_IE_AGE_TYPE;
-    qie_age->age        = vos_timer_get_system_time() - bss_desc->nReceivedTime;
+    qie_age->age        = vos_timer_get_system_ticks() - bss_desc->nReceivedTime;
 #endif
 
     memcpy(mgmt->u.probe_resp.variable, ie, ie_length);
@@ -12241,9 +9088,7 @@
      */
     if(chan == NULL)
     {
-       hddLog(VOS_TRACE_LEVEL_ERROR,
-           FL("chan pointer is NULL, chan_no: %d freq: %d"),
-           chan_no, freq);
+       hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__);
        kfree(mgmt);
        return NULL;
     }
@@ -12254,8 +9099,7 @@
              pAdapter->sessionCtx.station.conn_info.connState ) &&
              ( VOS_TRUE == vos_mem_compare(bss_desc->bssId,
                              pAdapter->sessionCtx.station.conn_info.bssId,
-                             WNI_CFG_BSSID_LEN)) &&
-                             (pHddCtx->hdd_wlan_suspended == FALSE))
+                             WNI_CFG_BSSID_LEN)))
     {
        /* supplicant takes the signal strength in terms of mBm(100*dBm) */
        rssi = (pAdapter->rssi * 100);
@@ -12266,8 +9110,8 @@
     }
 
     hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d"
-          " RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid),
-                      vos_freq_to_chan(chan->center_freq), (int)(rssi/100));
+          "RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid),
+                               chan->center_freq, (int)(rssi/100));
 
     bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt,
             frame_len, rssi, GFP_KERNEL);
@@ -12323,11 +9167,10 @@
     tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
     tCsrScanResultInfo *pScanResult;
     eHalStatus status = 0;
-    int ret;
     tScanResultHandle pResult;
     struct cfg80211_bss *bss_status = NULL;
     hdd_context_t *pHddCtx;
-    bool is_p2p_scan = false;
+
     ENTER();
 
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
@@ -12335,19 +9178,24 @@
                        NO_SESSION, pAdapter->sessionId));
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
+
+    if (pHddCtx->isLogpInProgress)
     {
-        return ret;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s:LOGP in Progress. Ignore!!!",__func__);
+        return -EAGAIN;
     }
 
-    if (pAdapter->request != NULL)
+
+    /*bss_update is not allowed during wlan driver loading or unloading*/
+    if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx))
     {
-        if ((pAdapter->request->n_ssids == 1)
-                && (pAdapter->request->ssids != NULL)
-                && vos_mem_compare(&pAdapter->request->ssids[0], "DIRECT-", 7))
-            is_p2p_scan = true;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s:Loading_unloading in Progress. Ignore!!!",__func__);
+        return VOS_STATUS_E_PERM;
     }
+
+
     /*
      * start getting scan results and populate cgf80211 BSS database
      */
@@ -12358,8 +9206,6 @@
     {
         hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d",
                                                       __func__, status);
-        wlan_hdd_get_frame_logs(pAdapter,
-                                WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR);
         return status;
     }
 
@@ -12377,12 +9223,7 @@
          * ieee80211_mgmt(probe response) and passing to c
          * fg80211_inform_bss_frame.
          * */
-        if(is_p2p_scan && (pScanResult->ssId.ssId != NULL) &&
-                !vos_mem_compare( pScanResult->ssId.ssId, "DIRECT-", 7) )
-        {
-            pScanResult = sme_ScanResultGetNext(hHal, pResult);
-            continue; //Skip the non p2p bss entries
-        }
+
         bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter,
                 &pScanResult->BssDescriptor);
 
@@ -12405,7 +9246,7 @@
     }
 
     sme_ScanResultPurge(hHal, pResult);
-    is_p2p_scan = false;
+
     return 0;
 }
 
@@ -12603,34 +9444,16 @@
     struct net_device *dev = (struct net_device *) pContext;
     //struct wireless_dev *wdev = dev->ieee80211_ptr;
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
-    hdd_scaninfo_t *pScanInfo;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+    hdd_scaninfo_t *pScanInfo = &pHddCtx->scan_info;
     struct cfg80211_scan_request *req = NULL;
     int ret = 0;
     bool aborted = false;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-    bool iface_down = false;
-#endif
     long waitRet = 0;
     tANI_U8 i;
-    hdd_context_t *pHddCtx;
 
     ENTER();
 
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    if (NULL == pHddCtx) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is Null"));
-        return 0;
-    }
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-    if (!(pAdapter->dev->flags & IFF_UP))
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Interface is down"));
-        iface_down = true;
-    }
-#endif
-    pScanInfo = &pHddCtx->scan_info;
-
     hddLog(VOS_TRACE_LEVEL_INFO,
             "%s called with halHandle = %p, pContext = %p,"
             "scanID = %d, returned status = %d",
@@ -12665,15 +9488,12 @@
                 (int) scanId);
     }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-    if (!iface_down)
-#endif
-    {
-        ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy,
+    ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy,
                                         pAdapter);
-        if (0 > ret)
-            hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__);
-    }
+
+    if (0 > ret)
+        hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__);
+
 
     /* If any client wait scan result through WEXT
      * send scan done event to client */
@@ -12703,18 +9523,18 @@
 
     /* Get the Scan Req */
     req = pAdapter->request;
-    pAdapter->request = NULL;
 
-    /* Scan is no longer pending */
-    pScanInfo->mScanPending = VOS_FALSE;
-
-    if (!req || req->wiphy == NULL)
+    if (!req)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL");
-        complete(&pScanInfo->abortscan_event_var);
+        pScanInfo->mScanPending = VOS_FALSE;
         goto allow_suspend;
     }
 
+    pAdapter->request = NULL;
+    /* Scan is no longer pending */
+    pScanInfo->mScanPending = VOS_FALSE;
+
     /* last_scan_timestamp is used to decide if new scan
      * is needed or not on station interface. If last station
      *  scan time and new station scan time is less then
@@ -12744,39 +9564,24 @@
     {
          aborted = true;
     }
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-    if (!iface_down)
-#endif
-        cfg80211_scan_done(req, aborted);
-
+    cfg80211_scan_done(req, aborted);
     complete(&pScanInfo->abortscan_event_var);
 
 allow_suspend:
-    if ((pHddCtx->cfg_ini->enableMacSpoofing == MAC_ADDR_SPOOFING_FW_HOST_ENABLE
-       ) && (pHddCtx->spoofMacAddr.isEnabled
-         ||  pHddCtx->spoofMacAddr.isReqDeferred)) {
-        /* Generate new random mac addr for next scan */
-        hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr");
-
-        schedule_delayed_work(&pHddCtx->spoof_mac_addr_work,
-                           msecs_to_jiffies(MAC_ADDR_SPOOFING_DEFER_INTERVAL));
-    }
-
     /* release the wake lock at the end of the scan*/
-    hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN);
+    hdd_allow_suspend();
 
     /* Acquire wakelock to handle the case where APP's tries to suspend
      * immediatly after the driver gets connect request(i.e after scan)
      * from supplicant, this result in app's is suspending and not able
      * to process the connect request to AP */
-    hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN);
+    hdd_prevent_suspend_timeout(1000);
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-    if (!iface_down)
-#endif
 #ifdef FEATURE_WLAN_TDLS
+    if (!(eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode))
+    {
         wlan_hdd_tdls_scan_done_callback(pAdapter);
+    }
 #endif
 
     EXIT();
@@ -12828,7 +9633,7 @@
                 return VOS_TRUE;
             }
             if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
-                 smeNeighborMiddleOfRoaming(WLAN_HDD_GET_HAL_CTX(pAdapter)))
+                 smeNeighborRoamIsHandoffInProgress(WLAN_HDD_GET_HAL_CTX(pAdapter)))
             {
                 hddLog(VOS_TRACE_LEVEL_ERROR,
                        "%s: %p(%d) Reassociation is in progress", __func__,
@@ -12854,20 +9659,12 @@
             else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) ||
                     (WLAN_HDD_P2P_GO == pAdapter->device_mode))
             {
-                v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-                ptSapContext pSapCtx = NULL;
-                pSapCtx = VOS_GET_SAP_CB(pVosContext);
-                if(pSapCtx == NULL){
-                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                            FL("psapCtx is NULL"));
-                    return VOS_FALSE;
-                }
                 for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++)
                 {
-                    if ((pSapCtx->aStaInfo[staId].isUsed) &&
-                            (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState))
+                    if ((pAdapter->aStaInfo[staId].isUsed) &&
+                            (WLANTL_STA_CONNECTED == pAdapter->aStaInfo[staId].tlSTAState))
                     {
-                        staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]);
+                        staMac = (v_U8_t *) &(pAdapter->aStaInfo[staId].macAddrSTA.bytes[0]);
 
                         hddLog(VOS_TRACE_LEVEL_ERROR,
                                "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the "
@@ -12884,27 +9681,6 @@
     return VOS_FALSE;
 }
 
-/**
- * csr_scan_request_assign_bssid() - Set the BSSID received from Supplicant
- *                                   to the Scan request
- * @scanRequest: Pointer to the csr scan request
- * @request: Pointer to the scan request from supplicant
- *
- * Return: None
- */
-#ifdef CFG80211_SCAN_BSSID
-static inline void csr_scan_request_assign_bssid(tCsrScanRequest *scanRequest,
-					struct cfg80211_scan_request *request)
-{
-	vos_mem_copy(scanRequest->bssid, request->bssid, VOS_MAC_ADDR_SIZE);
-}
-#else
-static inline void csr_scan_request_assign_bssid(tCsrScanRequest *scanRequest,
-					struct cfg80211_scan_request *request)
-{
-}
-#endif
-
 /*
  * FUNCTION: __wlan_hdd_cfg80211_scan
  * this scan respond to scan trigger and update cfg80211 scan database
@@ -12927,8 +9703,6 @@
     hdd_scaninfo_t *pScanInfo = NULL;
     v_U8_t* pP2pIe = NULL;
     int ret = 0;
-    v_U8_t *pWpsIe=NULL;
-    bool is_p2p_scan = false;
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
     struct net_device *dev = NULL;
@@ -12947,13 +9721,17 @@
 
     ENTER();
 
+
     hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)",
            __func__, hdd_device_modetoString(pAdapter->device_mode),
                                              pAdapter->device_mode);
 
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -12994,14 +9772,6 @@
         return -EBUSY;
     }
 
-    // Don't allow scan if PNO scan is going on.
-    if (pHddCtx->isPnoEnable)
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                   FL("pno scan in progress"));
-        return -EBUSY;
-    }
-
     //Don't Allow Scan and return busy if Remain On
     //Channel and action frame is pending
     //Otherwise Cancel Remain On Channel and allow Scan
@@ -13011,6 +9781,29 @@
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__);
         return -EBUSY;
     }
+#ifdef FEATURE_WLAN_TDLS
+    /* if tdls disagree scan right now, return immediately.
+       tdls will schedule the scan when scan is allowed. (return SUCCESS)
+       or will reject the scan if any TDLS is in progress. (return -EBUSY)
+    */
+    status = wlan_hdd_tdls_scan_callback (pAdapter,
+                                          wiphy,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+                                          dev,
+#endif
+                                          request);
+    if(status <= 0)
+    {
+        if(!status)
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress."
+                  "scan rejected  %d", __func__, status);
+        else
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d",
+                                          __func__, status);
+
+        return status;
+    }
+#endif
 
     if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock))
     {
@@ -13037,6 +9830,10 @@
 
     vos_mem_zero( &scanRequest, sizeof(scanRequest));
 
+    hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d",
+           (int)request->n_ssids);
+
+
     /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1.
      * Becasue of this, driver is assuming that this is not wildcard scan and so
      * is not aging out the scan results.
@@ -13093,8 +9890,6 @@
     scanRequest.minChnTime = cfg_param->nActiveMinChnTime;
     scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime;
 
-    csr_scan_request_assign_bssid(&scanRequest, request);
-
     /* set BSSType to default type */
     scanRequest.BSSType = eCSR_BSS_TYPE_ANY;
 
@@ -13147,42 +9942,31 @@
      * This rule is not applicable if scan is p2p scan.
      * This condition will work only in case when last request no of channels
      * and channels are exactly same as new request.
-     * This should be done only in connected state
-     * Scan shouldn't be defered for WPS scan case.
      */
-
-    pWpsIe = wlan_hdd_get_wps_ie_ptr((v_U8_t*)request->ie,request->ie_len);
-    /* if wps ie is NULL , then only defer scan */
-    if ( pWpsIe == NULL &&
-        (VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx)))
+    if (pScanInfo->last_scan_timestamp !=0 &&
+           (FALSE == request->no_cck) && // no_cck is set during p2p find.
+          ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval))
     {
-        if ( pScanInfo->last_scan_timestamp !=0 &&
-             ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval))
-        {
-            if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 &&
-               (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) &&
-                vos_mem_compare(pScanInfo->last_scan_channelList,
-                           channelList, pScanInfo->last_scan_numChannels))
-            {
-                hddLog(VOS_TRACE_LEVEL_WARN,
-                     " New and old station scan time differ is less then %u",
-                pHddCtx->cfg_ini->nDeferScanTimeInterval);
+        if (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels &&
+               vos_mem_compare(pScanInfo->last_scan_channelList,
+                     channelList, pScanInfo->last_scan_numChannels))
+       {
+           hddLog(VOS_TRACE_LEVEL_WARN,
+                " New and old station scan time differ is less then %u",
+            pHddCtx->cfg_ini->nDeferScanTimeInterval);
 
-                ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy,
+           ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy,
                                         pAdapter);
 
-                hddLog(VOS_TRACE_LEVEL_WARN,
-                    "Return old cached scan as all channels and no of channels are same");
+           hddLog(VOS_TRACE_LEVEL_WARN,
+                "Return old cached scan as all channels"
+                "and no of channles are same");
+           if (0 > ret)
+                hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__);
 
-                if (0 > ret)
-                    hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__);
-
-                cfg80211_scan_done(request, eCSR_SCAN_SUCCESS);
-
-                status = eHAL_STATUS_SUCCESS;
-                goto free_mem;
-            }
-        }
+           cfg80211_scan_done(request, eCSR_SCAN_SUCCESS);
+           return eHAL_STATUS_SUCCESS ;
+       }
     }
 
     /* Flush the scan results(only p2p beacons) for STA scan and P2P
@@ -13196,13 +9980,8 @@
      * the AP doesnt respond to our probe req then association
      * fails which is not desired
      */
-    if ((request->n_ssids == 1)
-            && (request->ssids != NULL)
-            && vos_mem_compare(&request->ssids[0], "DIRECT-", 7))
-        is_p2p_scan = true;
 
-    if( is_p2p_scan ||
-            (request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN) )
+    if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN )
     {
         hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results");
         sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter),
@@ -13224,7 +10003,7 @@
             (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ||
             (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))
         {
-            if (request->ie_len <= SIR_MAC_MAX_ADD_IE_LENGTH)
+            if ( request->ie_len <= SIR_MAC_MAX_IE_LENGTH)
             {
                 pwextBuf->roamProfile.nAddIEScanLength = request->ie_len;
                 memcpy( pwextBuf->roamProfile.addIEScan,
@@ -13298,30 +10077,6 @@
 
     INIT_COMPLETION(pScanInfo->scan_req_completion_event);
 
-#ifdef FEATURE_WLAN_TDLS
-    /* if tdls disagree scan right now, return immediately.
-       tdls will schedule the scan when scan is allowed. (return SUCCESS)
-       or will reject the scan if any TDLS is in progress. (return -EBUSY)
-     */
-    status = wlan_hdd_tdls_scan_callback (pAdapter,
-                                          wiphy,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
-                                          dev,
-#endif
-                                          request);
-    if (status <= 0)
-    {
-       if (!status)
-           hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress."
-                  "scan rejected  %d", __func__, status);
-       else
-           hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d",
-                                          __func__, status);
-       hdd_wlan_block_scan_by_tdls();
-       goto free_mem;
-    }
-#endif
-
     /* acquire the wakelock to avoid the apps suspend during the scan. To
      * address the following issues.
      * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in
@@ -13330,7 +10085,7 @@
      * 2) Connected scenario: If we allow the suspend during the scan, RIVA will
      * be stuck in full power because of resume BMPS
      */
-    hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN);
+    hdd_prevent_suspend();
 
     hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
            "requestType %d, scanType %d, minChnTime %d, maxChnTime %d,"
@@ -13339,28 +10094,6 @@
            scanRequest.minChnTime, scanRequest.maxChnTime,
            scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch);
 
-    if (pHddCtx->spoofMacAddr.isEnabled &&
-        pHddCtx->cfg_ini->enableMacSpoofing == 1)
-    {
-        hddLog(VOS_TRACE_LEVEL_INFO,
-                        "%s: MAC Spoofing enabled for current scan", __func__);
-        /* Updating SelfSta Mac Addr in TL which will be used to get staidx
-         * to fill TxBds for probe request during current scan
-         */
-        status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext,
-            &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent);
-
-        if(status != VOS_STATUS_SUCCESS)
-        {
-            hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN);
-            status = -EFAULT;
-#ifdef FEATURE_WLAN_TDLS
-        wlan_hdd_tdls_scan_done_callback(pAdapter);
-#endif
-            goto free_mem;
-        }
-    }
-    wlan_hdd_get_frame_logs(pAdapter, WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR);
     status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter),
                               pAdapter->sessionId, &scanRequest, &scanId,
                               &hdd_cfg80211_scan_done_callback, dev );
@@ -13378,11 +10111,7 @@
         } else {
                 status = -EIO;
         }
-        hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN);
-
-#ifdef FEATURE_WLAN_TDLS
-        wlan_hdd_tdls_scan_done_callback(pAdapter);
-#endif
+        hdd_allow_suspend();
         goto free_mem;
     }
 
@@ -13403,6 +10132,7 @@
       vos_mem_free( channelList );
 
     EXIT();
+
     return status;
 }
 
@@ -13456,15 +10186,10 @@
           hddDot11Mode = iniDot11Mode;
           break;
     }
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    if (operationChannel > SIR_11B_CHANNEL_END)
-#endif
-    {
-        /* This call decides required channel bonding mode */
-        sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal),
+     /* This call decides required channel bonding mode */
+    sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal),
                      hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode),
                      operationChannel);
-    }
 }
 
 /*
@@ -13472,8 +10197,7 @@
  * This function is used to start the association process
  */
 int wlan_hdd_cfg80211_connect_start( hdd_adapter_t  *pAdapter,
-        const u8 *ssid, size_t ssid_len, const u8 *bssid,
-        const u8 *bssid_hint, u8 operatingChannel)
+        const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel)
 {
     int status = 0;
     hdd_wext_state_t *pWextState;
@@ -13481,7 +10205,6 @@
     v_U32_t roamId;
     tCsrRoamProfile *pRoamProfile;
     eCsrAuthType RSNAuthType;
-    const u8 *pValidBssid = NULL;
 
     ENTER();
 
@@ -13491,6 +10214,8 @@
     status = wlan_hdd_validate_context(pHddCtx);
     if (status)
     {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "%s: HDD context is not valid!", __func__);
         return status;
     }
 
@@ -13507,8 +10232,6 @@
         hdd_station_ctx_t *pHddStaCtx;
         pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
 
-        wlan_hdd_get_frame_logs(pAdapter, WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR);
-
         if (HDD_WMM_USER_MODE_NO_QOS ==
                         (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode)
         {
@@ -13531,22 +10254,14 @@
 
         if (bssid)
         {
-            pValidBssid = bssid;
-        }
-        else if (bssid_hint)
-        {
-            pValidBssid = bssid_hint;
-        }
-        if (pValidBssid)
-        {
             pRoamProfile->BSSIDs.numOfBSSIDs = 1;
-            vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), pValidBssid,
+            vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid,
                     WNI_CFG_BSSID_LEN);
             /* Save BSSID in seperate variable as well, as RoamProfile
                BSSID is getting zeroed out in the association process. And in
                case of join failure we should send valid BSSID to supplicant
              */
-            vos_mem_copy((void *)(pWextState->req_bssId), pValidBssid,
+            vos_mem_copy((void *)(pWextState->req_bssId), bssid,
                     WNI_CFG_BSSID_LEN);
         }
         else
@@ -13624,29 +10339,18 @@
             hdd_select_cbmode(pAdapter,operatingChannel);
         }
 
-       /*
-        * Change conn_state to connecting before sme_RoamConnect(),
-        * because sme_RoamConnect() has a direct path to call
-        * hdd_smeRoamCallback(), which will change the conn_state
-        * If direct path, conn_state will be accordingly changed
-        * to NotConnected or Associated by either
-        * hdd_AssociationCompletionHandler() or hdd_DisConnectHandler()
-        * in sme_RoamCallback()
-        * if sme_RomConnect is to be queued,
-        * Connecting state will remain until it is completed.
-        * If connection state is not changed,
-        * connection state will remain in eConnectionState_NotConnected state.
-        * In hdd_AssociationCompletionHandler, "hddDisconInProgress" is set to true
-        * if conn state is eConnectionState_NotConnected.
-        * If "hddDisconInProgress" is set to true then cfg80211 layer is not
-        * informed of connect result indication which is an issue.
-        */
-
+        /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect()
+         * has a direct path to call hdd_smeRoamCallback(), which will change the conn_state
+         * If direct path, conn_state will be accordingly changed to NotConnected or Associated
+         * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback()
+         * if sme_RomConnect is to be queued, Connecting state will remain until it is completed.
+         */
         if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode ||
             WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)
         {
             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                   FL("Set HDD connState to eConnectionState_Connecting"));
+                   "%s: Set HDD connState to eConnectionState_Connecting",
+                   __func__);
             hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
                                                  eConnectionState_Connecting);
         }
@@ -13658,9 +10362,8 @@
              WLAN_HDD_P2P_CLIENT == pAdapter->device_mode))
 
         {
-            hddLog(VOS_TRACE_LEVEL_ERROR,
-                        FL("sme_RoamConnect (session %d) failed with status %d. -> NotConnected"),
-                        pAdapter->sessionId, status);
+            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with "
+                                      "status %d. -> NotConnected", __func__, pAdapter->sessionId, status);
             /* change back to NotAssociated */
             hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
                                              eConnectionState_NotConnected);
@@ -13818,7 +10521,7 @@
 
     if (!cipher)
     {
-        hddLog(VOS_TRACE_LEVEL_INFO, "%s: received cipher %d - considering none",
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none",
                 __func__, cipher);
         encryptionType = eCSR_ENCRYPT_TYPE_NONE;
     }
@@ -13892,20 +10595,12 @@
  * This function is used to parse WPA/RSN IE's.
  */
 int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                              const u8 *ie,
-#else
                               u8 *ie,
-#endif
                               size_t ie_len
                               )
 {
     hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-    const u8 *genie = ie;
-#else
     u8 *genie = ie;
-#endif
     v_U16_t remLen = ie_len;
 #ifdef FEATURE_WLAN_WAPI
     v_U32_t akmsuite[MAX_NUM_AKM_SUITES];
@@ -13946,7 +10641,7 @@
                     hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)",
                             __func__, eLen + 2);
 
-                    if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
+                    if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
                     {
                        hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. "
                                                       "Need bigger buffer space");
@@ -13976,7 +10671,7 @@
                     hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)",
                             __func__, eLen + 2);
 
-                    if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
+                    if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
                     {
                        hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE "
                                                       "Need bigger buffer space");
@@ -14000,7 +10695,7 @@
                     hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)",
                             __func__, eLen + 2);
 
-                    if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
+                    if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
                     {
                        hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE "
                                                       "Need bigger buffer space");
@@ -14024,7 +10719,7 @@
                     hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)",
                             __func__, eLen + 2);
 
-                    if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
+                    if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
                     {
                         hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE "
                                "Need bigger buffer space");
@@ -14045,7 +10740,7 @@
                     hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)",
                             __func__, eLen + 2);
 
-                    if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
+                    if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
                     {
                         hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE "
                                "Need bigger buffer space");
@@ -14060,13 +10755,12 @@
                     pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length;
                 }
 
-                 /* Update only for WPA IE */
-                if (!memcmp(genie, WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) &&
-                       (WLAN_HDD_IBSS == pAdapter->device_mode)) {
+                break;
+                if (WLAN_HDD_IBSS == pAdapter->device_mode) {
 
                    /* populating as ADDIE in beacon frames */
                    if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                       WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, (u8 *)genie - 2, eLen + 2,
+                       WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2,
                        NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS)
                    {
                        if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter),
@@ -14169,6 +10863,15 @@
                                 "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM");
                        }
                    }
+                   else
+                   {
+                      // Reset WNI_CFG_PROBE_RSP Flags
+                      wlan_hdd_reset_prob_rspies(pAdapter);
+
+                      hddLog(VOS_TRACE_LEVEL_INFO,
+                            "%s: No Probe Response IE received in set beacon",
+                            __func__);
+                   }
                 } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */
                 break;
             case DOT11F_EID_RSN:
@@ -14178,25 +10881,14 @@
                 pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE;
                 pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len;
                 break;
-
-                /* Appending extended capabilities with Interworking or
-                 * bsstransition bit set in Assoc Req.
-                 *
-                 * In assoc req this EXT Cap will only be taken into account if
-                 * interworkingService or bsstransition bit is set to 1.
-                 * Driver is only interested in interworkingService and
-                 * bsstransition capability from supplicant.
-                 * If in future any other EXT Cap info is
-                 * required from supplicat, it needs to be handled while
-                 * sending Assoc Req in LIM.
-                 */
+                /* Appending Extended Capabilities with Interworking bit set in Assoc Req */
             case DOT11F_EID_EXTCAP:
                 {
                     v_U16_t curAddIELen = pWextState->assocAddIE.length;
                     hddLog (VOS_TRACE_LEVEL_INFO, "%s Set Extended CAPS IE(len %d)",
                             __func__, eLen + 2);
 
-                    if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
+                    if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) )
                     {
                        hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE "
                                                       "Need bigger buffer space");
@@ -14265,13 +10957,7 @@
  * Parse the received IE to find the WPA IE
  *
  */
-static bool hdd_isWPAIEPresent(
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
-                               const u8 *ie,
-#else
-                               u8 *ie,
-#endif
-                               u8 ie_len)
+static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len)
 {
     v_U8_t eLen = 0;
     v_U16_t remLen = ie_len;
@@ -14307,9 +10993,9 @@
  * This function is used to initialize the security
  * parameters during connect operation.
  */
-int wlan_hdd_cfg80211_set_privacy(hdd_adapter_t *pAdapter,
+int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter,
                                    struct cfg80211_connect_params *req
-                                  )
+                                   )
 {
     int status = 0;
     hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
@@ -14454,109 +11140,48 @@
 static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter )
 {
     long ret = 0;
-    int status, result = 0;
     hdd_station_ctx_t *pHddStaCtx;
     eMib_dot11DesiredBssType connectedBssType;
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
     pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
 
     hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType );
 
     if((eMib_dot11DesiredBssType_independent == connectedBssType) ||
       (eConnectionState_Associated == pHddStaCtx->conn_info.connState) ||
-      (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) ||
       (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState))
     {
-        spin_lock_bh(&pAdapter->lock_for_active_session);
-        if (eConnectionState_Associated ==  pHddStaCtx->conn_info.connState)
-        {
-            wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode);
-        }
-        spin_unlock_bh(&pAdapter->lock_for_active_session);
-        hdd_connSetConnectionState(pHddStaCtx,
-                     eConnectionState_Disconnecting);
         /* Issue disconnect to CSR */
         INIT_COMPLETION(pAdapter->disconnect_comp_var);
-        status = sme_RoamDisconnect(WLAN_HDD_GET_HAL_CTX(pAdapter),
+        if( eHAL_STATUS_SUCCESS ==
+              sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter),
                         pAdapter->sessionId,
-                        eCSR_DISCONNECT_REASON_UNSPECIFIED);
-        if(eHAL_STATUS_CMD_NOT_QUEUED == status) {
-            hddLog(LOG1,
-             FL("Already disconnected or connect was in sme/roam pending list and removed by disconnect"));
-        } else if ( 0 != status ) {
-            hddLog(LOGE,
-               FL("csrRoamDisconnect failure, returned %d"),
-               (int)status );
-            result = -EINVAL;
-            goto disconnected;
-        }
-        ret = wait_for_completion_timeout(
+                        eCSR_DISCONNECT_REASON_UNSPECIFIED ) )
+        {
+            ret = wait_for_completion_interruptible_timeout(
                          &pAdapter->disconnect_comp_var,
                          msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
-        if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status)) {
-            hddLog(LOGE,
-              "%s: Failed to disconnect, timed out", __func__);
-            result = -ETIMEDOUT;
+            if (0 >=  ret)
+            {
+                hddLog(LOGE, FL("Failed to receive disconnect event"));
+                return -EALREADY;
+            }
         }
     }
     else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState)
     {
-        ret = wait_for_completion_timeout(
+        ret = wait_for_completion_interruptible_timeout(
                      &pAdapter->disconnect_comp_var,
                      msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
-        if (!ret)
+        if (0 >= ret)
         {
             hddLog(LOGE, FL("Failed to receive disconnect event"));
-            result = -ETIMEDOUT;
+            return -EALREADY;
         }
     }
-disconnected:
-    hddLog(LOG1,
-          FL("Set HDD connState to eConnectionState_NotConnected"));
-    pHddStaCtx->conn_info.connState = eConnectionState_NotConnected;
-    return result;
-}
 
-/**
- * wlan_hdd_reassoc_bssid_hint() - Start reassociation if bssid is present
- * @adapter: Pointer to the HDD adapter
- * @req: Pointer to the structure cfg_connect_params receieved from user space
- *
- * This function will start reassociation if bssid hint, channel hint and
- * previous bssid parameters are present in the connect request
- *
- * Return: success if reassociation is happening
- *         Error code if reassociation is not permitted or not happening
- */
-#ifdef CFG80211_CONNECT_PREV_BSSID
-static int wlan_hdd_reassoc_bssid_hint(hdd_adapter_t *adapter,
-				struct cfg80211_connect_params *req)
-{
-	int status = -EPERM;
-	if (req->bssid_hint && req->channel_hint && req->prev_bssid) {
-		hddLog(VOS_TRACE_LEVEL_INFO,
-			FL("REASSOC Attempt on channel %d to "MAC_ADDRESS_STR),
-			req->channel_hint->hw_value,
-			MAC_ADDR_ARRAY(req->bssid_hint));
-		status  = hdd_reassoc(adapter, req->bssid_hint,
-					req->channel_hint->hw_value,
-					CONNECT_CMD_USERSPACE);
-	}
-	return status;
+    return 0;
 }
-#else
-static int wlan_hdd_reassoc_bssid_hint(hdd_adapter_t *adapter,
-				struct cfg80211_connect_params *req)
-{
-	return -EPERM;
-}
-#endif
 
 /*
  * FUNCTION: __wlan_hdd_cfg80211_connect
@@ -14568,13 +11193,6 @@
                                       )
 {
     int status;
-    u16 channel;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) || \
-             defined(CFG80211_BSSID_HINT_BACKPORT)
-    const u8 *bssid_hint = req->bssid_hint;
-#else
-    const u8 *bssid_hint = NULL;
-#endif
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev );
     VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL;
     hdd_context_t *pHddCtx = NULL;
@@ -14598,15 +11216,18 @@
     }
 
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
-    status = wlan_hdd_reassoc_bssid_hint(pAdapter, req);
-    if (0 == status)
-        return status;
-
+    if (vos_max_concurrent_connections_reached()) {
+        hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections"));
+        return -ECONNREFUSED;
+    }
 
 #ifdef WLAN_BTAMP_FEATURE
     //Infra connect not supported when AMP traffic is on.
@@ -14634,11 +11255,6 @@
                 " connection"));
         return -EALREADY;
     }
-    /* Check for max concurrent connections after doing disconnect if any*/
-    if (vos_max_concurrent_connections_reached()) {
-        hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections"));
-        return -ECONNREFUSED;
-    }
 
     /*initialise security parameters*/
     status = wlan_hdd_cfg80211_set_privacy(pAdapter, req);
@@ -14649,30 +11265,19 @@
                 __func__);
         return status;
     }
-
-    if (pHddCtx->spoofMacAddr.isEnabled)
+    if ( req->channel )
     {
-        hddLog(VOS_TRACE_LEVEL_INFO,
-                        "%s: MAC Spoofing enabled ", __func__);
-        /* Updating SelfSta Mac Addr in TL which will be used to get staidx
-         * to fill TxBds for probe request during SSID scan which may happen
-         * as part of connect command
-         */
-        status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext,
-            &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent);
-        if (status != VOS_STATUS_SUCCESS)
-            return -ECONNREFUSED;
+        status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid,
+                                                  req->ssid_len, req->bssid,
+                                                  req->channel->hw_value);
+    }
+    else
+    {
+        status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid,
+                                                  req->ssid_len, req->bssid, 0);
     }
 
-    if (req->channel)
-        channel = req->channel->hw_value;
-    else
-        channel = 0;
-    status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid,
-                                             req->ssid_len, req->bssid,
-                                             bssid_hint, channel);
-
-    if (0 != status)
+    if (0 > status)
     {
         //ReEnable BMPS if disabled
         if((VOS_STATUS_SUCCESS == exitbmpsStatus) &&
@@ -14716,18 +11321,15 @@
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     long ret;
 
-    ENTER();
-
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
-    /* Indicate sme of disconnect so that in progress connection or preauth
-     * can be aborted
-     */
-    sme_abortConnection(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                            pAdapter->sessionId);
+
     pHddCtx->isAmpAllowed = VOS_TRUE;
 
     /* Need to apply spin lock before decreasing active sessions
@@ -14754,50 +11356,47 @@
      * the tx frames after BSS/STA has been deleted and will not send
      * back a response resulting in WDI timeout
      */
-    hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
     netif_tx_disable(pAdapter->dev);
     netif_carrier_off(pAdapter->dev);
 
     /*issue disconnect*/
     status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter),
                                  pAdapter->sessionId, reason);
-    if(eHAL_STATUS_CMD_NOT_QUEUED == status)
-    {
-        hddLog(LOG1,
-            FL("Already disconnected or connect was in sme/roam pending list and removed by disconnect"));
+     if(eHAL_STATUS_CMD_NOT_QUEUED == status)
+     {
+        hddLog(VOS_TRACE_LEVEL_INFO,
+             FL("status = %d, already disconnected"),
+                     (int)status );
+
     }
     else if ( 0 != status )
     {
-        hddLog(LOGE,
-               FL("csrRoamDisconnect failure, returned %d"),
-               (int)status);
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               "%s csrRoamDisconnect failure, returned %d",
+               __func__, (int)status );
         result = -EINVAL;
         goto disconnected;
     }
-    ret = wait_for_completion_timeout(
+    ret = wait_for_completion_interruptible_timeout(
                 &pAdapter->disconnect_comp_var,
                 msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
-    if (!ret && (eHAL_STATUS_CMD_NOT_QUEUED != status))
+    if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status ))
     {
-        hddLog(LOGE,
+        hddLog(VOS_TRACE_LEVEL_ERROR,
               "%s: Failed to disconnect, timed out", __func__);
         result = -ETIMEDOUT;
     }
+    else if (ret == -ERESTARTSYS)
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               "%s: Failed to disconnect, wait interrupted", __func__);
+        result = -ERESTARTSYS;
+    }
 disconnected:
-     hddLog(LOG1,
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
               FL("Set HDD connState to eConnectionState_NotConnected"));
     pHddStaCtx->conn_info.connState = eConnectionState_NotConnected;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
-    /* Sending disconnect event to userspace for kernel version < 3.11
-     * is handled by __cfg80211_disconnect call to __cfg80211_disconnected
-     */
-    hddLog(LOG1, FL("Send disconnected event to userspace"));
 
-    wlan_hdd_cfg80211_indicate_disconnect(pAdapter->dev, true,
-                                          WLAN_REASON_UNSPECIFIED);
-#endif
-
-    EXIT();
     return result;
 }
 
@@ -14812,36 +11411,17 @@
                                          )
 {
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
+    tCsrRoamProfile  *pRoamProfile =
+                    &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile;
     int status;
-    tCsrRoamProfile  *pRoamProfile;
-    hdd_station_ctx_t *pHddStaCtx;
-    hdd_context_t *pHddCtx;
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 #ifdef FEATURE_WLAN_TDLS
     tANI_U8 staIdx;
 #endif
 
     ENTER();
 
-    if (!pAdapter) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL"));
-        return -EINVAL;
-    }
-
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    if (!pHddStaCtx) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is NULL"));
-        return -EINVAL;
-    }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    status = wlan_hdd_validate_context(pHddCtx);
-    if (0 != status)
-    {
-        return status;
-    }
-
-    pRoamProfile = &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile;
-
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                      TRACE_CODE_HDD_CFG80211_DISCONNECT,
                      pAdapter->sessionId, reason));
@@ -14852,6 +11432,15 @@
     hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d",
             __func__, reason);
 
+    status = wlan_hdd_validate_context(pHddCtx);
+
+    if (0 != status)
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
+        return status;
+    }
+
     if (NULL != pRoamProfile)
     {
         /*issue disconnect request to SME, if station is in connected state*/
@@ -14891,7 +11480,7 @@
                 hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId,
                                    eCSR_SCAN_ABORT_DEFAULT);
             }
-            wlan_hdd_cancel_existing_remain_on_channel(pAdapter);
+
 #ifdef FEATURE_WLAN_TDLS
             /* First clean up the tdls peers if any */
             for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++)
@@ -14901,18 +11490,13 @@
                 {
                     uint8 *mac;
                     mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes;
-                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                    VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                             "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR,
                             __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId,
                             MAC_ADDR_ARRAY(mac));
-                    status = sme_DeleteTdlsPeerSta(
-                                              WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                              pAdapter->sessionId,
-                                              mac);
-                    if (status != eHAL_STATUS_SUCCESS) {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA"));
-                        return -EPERM;
-                    }
+                    sme_DeleteTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                          pAdapter->sessionId,
+                                          mac);
                 }
             }
 #endif
@@ -14938,7 +11522,6 @@
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__);
     }
 
-    EXIT();
     return status;
 }
 
@@ -15055,9 +11638,9 @@
     hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
     tCsrRoamProfile          *pRoamProfile;
     int status;
+    bool alloc_bssid = VOS_FALSE;
     hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    tSirMacAddr bssid;
 
     ENTER();
 
@@ -15070,8 +11653,11 @@
                                    pAdapter->device_mode);
 
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -15113,7 +11699,6 @@
                   "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__);
            return -EIO;
        }
-       vos_mem_copy((v_U8_t *)bssid, (v_U8_t *)params->bssid, sizeof(bssid));
     }
     else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0)
     {
@@ -15124,10 +11709,17 @@
                     "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__);
             return -EIO;
         }
-
-        vos_mem_copy((v_U8_t *)bssid,
+        params->bssid = vos_mem_malloc(sizeof(VOS_MAC_ADDR_SIZE));
+        if (!params->bssid)
+        {
+            hddLog (VOS_TRACE_LEVEL_ERROR,
+                    "%s:Failed memory allocation", __func__);
+            return -EIO;
+        }
+        vos_mem_copy((v_U8_t *)params->bssid,
                      (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0],
-                      sizeof(bssid));
+                     VOS_MAC_ADDR_SIZE);
+        alloc_bssid = VOS_TRUE;
     }
 
     /* Set Channel */
@@ -15194,14 +11786,22 @@
 
     /* Issue connect start */
     status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid,
-            params->ssid_len, (const u8 *)&bssid, NULL,
+            params->ssid_len, params->bssid,
             pHddStaCtx->conn_info.operationChannel);
 
     if (0 > status)
+    {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__);
+        return status;
+    }
 
-    EXIT();
-    return status;
+    if (NULL != params->bssid &&
+        pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 &&
+        alloc_bssid == VOS_TRUE)
+    {
+        vos_mem_free(params->bssid);
+    }
+    return 0;
 }
 
 static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy,
@@ -15231,9 +11831,6 @@
     tCsrRoamProfile *pRoamProfile;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     int status;
-#ifdef WLAN_FEATURE_RMC
-    tANI_U8 addIE[WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN] = {0};
-#endif
 
     ENTER();
 
@@ -15241,8 +11838,11 @@
                      TRACE_CODE_HDD_CFG80211_LEAVE_IBSS,
                       pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE));
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -15266,47 +11866,11 @@
         return -EINVAL;
     }
 
-#ifdef WLAN_FEATURE_RMC
-    /* Clearing add IE of beacon */
-    if (ccmCfgSetStr(pHddCtx->hHal,
-        WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, &addIE[0],
-        WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN,
-        NULL, eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS)
-    {
-        hddLog (VOS_TRACE_LEVEL_ERROR,
-                "%s: unable to clear PROBE_RSP_BCN_ADDNIE_DATA", __func__);
-        return -EINVAL;
-    }
-    if (ccmCfgSetInt(pHddCtx->hHal,
-        WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0, NULL,
-        eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS)
-    {
-        hddLog (VOS_TRACE_LEVEL_ERROR,
-                "%s: unable to clear WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG",
-                __func__);
-        return -EINVAL;
-    }
-
-    // Reset WNI_CFG_PROBE_RSP Flags
-    wlan_hdd_reset_prob_rspies(pAdapter);
-
-    if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                     WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 0,NULL,
-                     eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-    {
-        hddLog (VOS_TRACE_LEVEL_ERROR,
-                "%s: unable to clear WNI_CFG_PROBE_RSP_ADDNIE_FLAG",
-                __func__);
-        return -EINVAL;
-    }
-#endif
-
     /* Issue Disconnect request */
     INIT_COMPLETION(pAdapter->disconnect_comp_var);
     sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId,
                                   eCSR_DISCONNECT_REASON_IBSS_LEAVE);
 
-    EXIT();
     return 0;
 }
 
@@ -15336,14 +11900,15 @@
     int status;
 
     ENTER();
-
-    MTRACE(vos_trace(VOS_MODULE_ID_HDD,
+     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                       TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS,
                        NO_SESSION, wiphy->rts_threshold));
-
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -15450,7 +12015,6 @@
         }
     }
 
-    EXIT();
     return 0;
 }
 
@@ -15488,13 +12052,15 @@
     int status;
 
     ENTER();
-
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                       TRACE_CODE_HDD_CFG80211_SET_TXPOWER,
                       NO_SESSION, type ));
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -15535,7 +12101,6 @@
        return -EIO;
     }
 
-    EXIT();
     return 0;
 }
 
@@ -15568,10 +12133,10 @@
 }
 
 /*
- * FUNCTION: __wlan_hdd_cfg80211_get_txpower
+ * FUNCTION: wlan_hdd_cfg80211_get_txpower
  * This function is used to read the txpower
  */
-static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
+static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
                                          struct wireless_dev *wdev,
 #endif
@@ -15585,8 +12150,11 @@
     ENTER();
 
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         *dbm = 0;
         return status;
     }
@@ -15598,9 +12166,6 @@
         return -ENOENT;
     }
 
-    MTRACE(vos_trace(VOS_MODULE_ID_HDD,
-                     TRACE_CODE_HDD_CFG80211_GET_TXPOWER,
-                     pAdapter->sessionId, pAdapter->device_mode));
     wlan_hdd_get_classAstats(pAdapter);
     *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr;
 
@@ -15608,32 +12173,8 @@
     return 0;
 }
 
-static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
-                                         struct wireless_dev *wdev,
-#endif
-                                         int *dbm)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_get_txpower(wiphy,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
-                                          wdev,
-#endif
-                                          dbm);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                          const u8* mac,
-#else
-                                          u8* mac,
-#endif
-                                          struct station_info *sinfo)
+                                   u8* mac, struct station_info *sinfo)
 {
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
     hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
@@ -15683,17 +12224,21 @@
     }
 
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
-    wlan_hdd_get_station_stats(pAdapter);
-    rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags;
 
     wlan_hdd_get_rssi(pAdapter, &sinfo->signal);
     sinfo->filled |= STATION_INFO_SIGNAL;
 
+    wlan_hdd_get_station_stats(pAdapter);
+    rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags;
+
     /*overwrite rate_flags if MAX link-speed need to be reported*/
     if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) ||
         (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed &&
@@ -15923,16 +12468,16 @@
                         if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i])
                         {
                             currentRate = supported_mcs_rate[j].supported_rate[rateFlag];
-                            maxMCSIdx   = supported_mcs_rate[j].beacon_rate_index;
                             break;
                         }
                     }
                     if ((j < temp) && (currentRate > maxRate))
                     {
                         maxRate     = currentRate;
+                        maxSpeedMCS = 1;
+                        maxMCSIdx   = supported_mcs_rate[j].beacon_rate_index;
                     }
                 }
-                maxSpeedMCS = 1;
             }
         }
 
@@ -16077,32 +12622,15 @@
        STATION_INFO_TX_RETRIES |
        STATION_INFO_TX_FAILED;
 
-    sinfo->rx_packets = pAdapter->hdd_stats.summary_stat.rx_frm_cnt;
-    sinfo->filled |= STATION_INFO_RX_PACKETS;
-
-    if (rate_flags & eHAL_TX_RATE_LEGACY)
-        hddLog(LOG1, FL("Reporting RSSI:%d legacy rate %d pkt cnt tx %d rx %d"),
-               sinfo->signal, sinfo->txrate.legacy, sinfo->tx_packets,
-               sinfo->rx_packets);
-    else
-        hddLog(LOG1,
-               FL("Reporting RSSI:%d MCS rate %d flags 0x%x pkt cnt tx %d rx %d"),
-               sinfo->signal, sinfo->txrate.mcs, sinfo->txrate.flags,
-               sinfo->tx_packets, sinfo->rx_packets);
-
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                      TRACE_CODE_HDD_CFG80211_GET_STA,
                       pAdapter->sessionId, maxRate));
        EXIT();
        return 0;
 }
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
-static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
-                                   const u8* mac, struct station_info *sinfo)
-#else
+
 static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
                                    u8* mac, struct station_info *sinfo)
-#endif
 {
     int ret;
 
@@ -16135,8 +12663,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -16164,13 +12695,13 @@
      **/
     vos_status =  wlan_hdd_enter_bmps(pAdapter, !mode);
 
+    EXIT();
     if (VOS_STATUS_E_FAILURE == vos_status)
     {
          VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                    "%s: failed to enter bmps mode", __func__);
         return -EINVAL;
     }
-    EXIT();
     return 0;
 }
 
@@ -16185,30 +12716,18 @@
 
     return ret;
 }
-
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
-                                           struct net_device *netdev,
-                                           u8 key_index)
+static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
+                         struct net_device *netdev,
+                         u8 key_index)
 {
     ENTER();
     return 0;
 }
-
-static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
-                                         struct net_device *netdev,
-                                         u8 key_index)
-{
-    int ret;
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index);
-    vos_ssr_unprotect(__func__);
-    return ret;
-}
 #endif //LINUX_VERSION_CODE
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-static int __wlan_hdd_set_txq_params(struct wiphy *wiphy,
+static int wlan_hdd_set_txq_params(struct wiphy *wiphy,
                    struct net_device *dev,
                    struct ieee80211_txq_params *params)
 {
@@ -16216,7 +12735,7 @@
     return 0;
 }
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-static int __wlan_hdd_set_txq_params(struct wiphy *wiphy,
+static int wlan_hdd_set_txq_params(struct wiphy *wiphy,
                    struct ieee80211_txq_params *params)
 {
     ENTER();
@@ -16224,31 +12743,6 @@
 }
 #endif //LINUX_VERSION_CODE
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-static int wlan_hdd_set_txq_params(struct wiphy *wiphy,
-                                   struct net_device *dev,
-                                   struct ieee80211_txq_params *params)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_set_txq_params(wiphy, dev, params);
-    vos_ssr_unprotect(__func__);
-    return ret;
-}
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-static int wlan_hdd_set_txq_params(struct wiphy *wiphy,
-                   struct ieee80211_txq_params *params)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_set_txq_params(wiphy, params);
-    vos_ssr_unprotect(__func__);
-    return ret;
-}
-#endif
-
 static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
                                        struct net_device *dev,
                                        struct tagCsrDelStaParams *pDelStaParams)
@@ -16258,8 +12752,6 @@
     VOS_STATUS vos_status;
     int status;
     v_U8_t staId;
-    v_CONTEXT_t pVosContext = NULL;
-    ptSapContext pSapCtx = NULL;
 
     ENTER();
 
@@ -16275,8 +12767,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -16284,23 +12779,16 @@
        || (WLAN_HDD_P2P_GO == pAdapter->device_mode)
        )
     {
-        pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-        pSapCtx = VOS_GET_SAP_CB(pVosContext);
-        if(pSapCtx == NULL){
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 FL("psapCtx is NULL"));
-            return -ENOENT;
-        }
         if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr))
         {
             v_U16_t i;
             for(i = 0; i < WLAN_MAX_STA_COUNT; i++)
             {
-                if ((pSapCtx->aStaInfo[i].isUsed) &&
-                    (!pSapCtx->aStaInfo[i].isDeauthInProgress))
+                if ((pAdapter->aStaInfo[i].isUsed) &&
+                    (!pAdapter->aStaInfo[i].isDeauthInProgress))
                 {
                     vos_mem_copy(pDelStaParams->peerMacAddr,
-                                 pSapCtx->aStaInfo[i].macAddrSTA.bytes,
+                                 pAdapter->aStaInfo[i].macAddrSTA.bytes,
                                  ETHER_ADDR_LEN);
 
                     hddLog(VOS_TRACE_LEVEL_INFO,
@@ -16310,7 +12798,7 @@
                             MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr));
                     vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams);
                     if (VOS_IS_STATUS_SUCCESS(vos_status))
-                        pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE;
+                        pAdapter->aStaInfo[i].isDeauthInProgress = TRUE;
                 }
             }
         }
@@ -16328,7 +12816,7 @@
                 return -ENOENT;
             }
 
-            if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE)
+            if( pAdapter->aStaInfo[staId].isDeauthInProgress == TRUE)
             {
                 hddLog(VOS_TRACE_LEVEL_INFO,
                        "%s: Skip this DEL STA as deauth is in progress::"
@@ -16337,7 +12825,7 @@
                 return -ENOENT;
             }
 
-            pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE;
+            pAdapter->aStaInfo[staId].isDeauthInProgress = TRUE;
 
             hddLog(VOS_TRACE_LEVEL_INFO,
                                 "%s: Delete STA with MAC::"
@@ -16348,7 +12836,7 @@
             vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams);
             if (!VOS_IS_STATUS_SUCCESS(vos_status))
             {
-                pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE;
+                pAdapter->aStaInfo[staId].isDeauthInProgress = FALSE;
                 hddLog(VOS_TRACE_LEVEL_INFO,
                                 "%s: STA removal failed for ::"
                                 MAC_ADDRESS_STR,
@@ -16370,14 +12858,9 @@
                                          struct net_device *dev,
                                          struct station_del_parameters *param)
 #else
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
-static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
-                                         struct net_device *dev, const u8 *mac)
-#else
 static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
                                          struct net_device *dev, u8 *mac)
 #endif
-#endif
 {
     int ret;
     struct tagCsrDelStaParams delStaParams;
@@ -16387,7 +12870,6 @@
 #ifdef CFG80211_DEL_STA_V2
     if (NULL == param) {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__);
-        vos_ssr_unprotect(__func__);
         return -EINVAL;
     }
 
@@ -16406,36 +12888,14 @@
 }
 
 static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy,
-                                           struct net_device *dev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                           const u8 *mac,
-#else
-                                           u8 *mac,
-#endif
-                                           struct station_parameters *params)
+          struct net_device *dev, u8 *mac, struct station_parameters *params)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
     int status = -EPERM;
 #ifdef FEATURE_WLAN_TDLS
     u32 mask, set;
-
     ENTER();
 
-    pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    status = wlan_hdd_validate_context(pHddCtx);
-    if (0 != status)
-    {
-        return status;
-    }
-
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                      TRACE_CODE_HDD_CFG80211_ADD_STA,
                      pAdapter->sessionId, params->listen_interval));
@@ -16443,9 +12903,11 @@
 
     set = params->sta_flags_set;
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+#ifdef WLAN_FEATURE_TDLS_DEBUG
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR,
                __func__, mask, set, MAC_ADDR_ARRAY(mac));
+#endif
 
     if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) {
         if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) {
@@ -16453,18 +12915,11 @@
         }
     }
 #endif
-    EXIT();
     return status;
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
-static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy,
-          struct net_device *dev, const u8 *mac,
-          struct station_parameters *params)
-#else
 static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy,
           struct net_device *dev, u8 *mac, struct station_parameters *params)
-#endif
 {
     int ret;
 
@@ -16486,8 +12941,6 @@
     hdd_context_t *pHddCtx;
     tPmkidCacheInfo pmk_id;
 
-    ENTER();
-
     // Validate pAdapter
     if ( NULL == pAdapter )
     {
@@ -16511,8 +12964,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -16530,7 +12986,6 @@
                      TRACE_CODE_HDD_CFG80211_SET_PMKSA,
                      pAdapter->sessionId, result));
 
-    EXIT();
     return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL;
 }
 
@@ -16555,8 +13010,6 @@
     hdd_context_t *pHddCtx;
     int status = 0;
 
-    ENTER();
-
     /* Validate pAdapter */
     if (NULL == pAdapter)
     {
@@ -16579,17 +13032,17 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
     /*Retrieve halHandle*/
     halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter);
 
-    MTRACE(vos_trace(VOS_MODULE_ID_HDD,
-                     TRACE_CODE_HDD_CFG80211_DEL_PMKSA,
-                     pAdapter->sessionId, 0));
     /* Delete the PMKID CSR cache */
     if (eHAL_STATUS_SUCCESS !=
         sme_RoamDelPMKIDfromCache(halHandle,
@@ -16599,8 +13052,7 @@
         status = -EINVAL;
     }
 
-    EXIT();
-    return status;
+   return status;
 }
 
 
@@ -16624,7 +13076,7 @@
     hdd_context_t *pHddCtx;
     int status = 0;
 
-    ENTER();
+    hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: flushing PMKSA ",__func__);
 
     /* Validate pAdapter */
     if (NULL == pAdapter)
@@ -16636,8 +13088,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+       hddLog(VOS_TRACE_LEVEL_ERROR,
+              "%s: HDD context is not valid", __func__);
        return status;
     }
 
@@ -16650,7 +13105,7 @@
         hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache"));
         status = -EINVAL;
     }
-    EXIT();
+
     return status;
 }
 
@@ -16676,25 +13131,22 @@
     hdd_context_t *pHddCtx;
     int ret = 0;
 
-    ENTER();
-
     if (NULL == pAdapter)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__);
         return -ENODEV;
     }
+
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     ret = wlan_hdd_validate_context(pHddCtx);
     if (0 != ret)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return ret;
     }
+
     pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    if (NULL == pHddStaCtx)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: STA Context is NULL", __func__);
-        return -EINVAL;
-    }
 
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                      TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES,
@@ -16716,8 +13168,6 @@
     sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId,
                   (const u8 *)ftie->ie,
                   ftie->ie_len);
-
-    EXIT();
     return 0;
 }
 
@@ -16776,14 +13226,7 @@
 
     if (0 > ret)
         hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__);
-    else
-    {
-       /* Acquire wakelock to handle the case where APP's tries to suspend
-        * immediatly after the driver gets connect request(i.e after pno)
-        * from supplicant, this result in app's is suspending and not able
-        * to process the connect request to AP */
-        hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN);
-    }
+
     cfg80211_sched_scan_results(pHddCtx->wiphy);
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
             "%s: cfg80211 scan result database updated", __func__);
@@ -16832,8 +13275,6 @@
     hdd_adapter_t *pAdapter = callbackContext;
     hdd_context_t *pHddCtx;
 
-    ENTER();
-
     if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -16844,6 +13285,8 @@
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     if (0 != wlan_hdd_validate_context(pHddCtx))
     {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  FL("HDD context is not valid"));
         return;
     }
 
@@ -16856,7 +13299,6 @@
 
     pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY;
     complete(&pAdapter->pno_comp_var);
-    EXIT();
 }
 
 /*
@@ -16867,7 +13309,7 @@
           struct net_device *dev, struct cfg80211_sched_scan_request *request)
 {
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    tSirPNOScanReq pnoRequest = {0};
+    tpSirPNOScanReq pPnoRequest = NULL;
     hdd_context_t *pHddCtx;
     tHalHandle hHal;
     v_U32_t i, indx, num_ch, tempInterval, j;
@@ -16879,8 +13321,6 @@
     hdd_config_t *pConfig = NULL;
     v_U32_t num_ignore_dfs_ch = 0;
 
-    ENTER();
-
     if (NULL == pAdapter)
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
@@ -16893,6 +13333,8 @@
 
     if (0 != ret)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return -EINVAL;
     }
 
@@ -16904,9 +13346,6 @@
                   "%s: HAL context  is Null!!!", __func__);
         return -EINVAL;
     }
-    MTRACE(vos_trace(VOS_MODULE_ID_HDD,
-                     TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START,
-                     pAdapter->sessionId, pAdapter->device_mode));
     sme_ScanFlushResult(hHal, pAdapter->sessionId);
     ret = wlan_hdd_scan_abort(pAdapter);
     if (ret < 0)
@@ -16939,15 +13378,25 @@
 
     pHddCtx->isPnoEnable = TRUE;
 
-    pnoRequest.enable = 1; /*Enable PNO */
-    pnoRequest.ucNetworksCount = request->n_match_sets;
+    pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq));
+    if (NULL == pPnoRequest)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                  "%s: vos_mem_malloc failed", __func__);
+        pHddCtx->isPnoEnable = FALSE;
+        return -ENOMEM;
+    }
 
-    if (( !pnoRequest.ucNetworksCount ) ||
-        ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS ))
+    memset(pPnoRequest, 0, sizeof (tSirPNOScanReq));
+    pPnoRequest->enable = 1; /*Enable PNO */
+    pPnoRequest->ucNetworksCount = request->n_match_sets;
+
+    if (( !pPnoRequest->ucNetworksCount ) ||
+        ( pPnoRequest->ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS ))
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: Network input is not correct %d Max Network supported is %d",
-                   __func__, pnoRequest.ucNetworksCount,
+                   __func__, pPnoRequest->ucNetworksCount,
                    SIR_PNO_MAX_SUPP_NETWORKS);
         ret = -EINVAL;
         goto error;
@@ -17012,64 +13461,51 @@
             goto error;
         }
      }
-
-    pnoRequest.aNetworks =
-             vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount);
-    if (pnoRequest.aNetworks == NULL)
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-            FL("failed to allocate memory aNetworks %u"),
-                (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount);
-        goto error;
-    }
-    vos_mem_zero(pnoRequest.aNetworks,
-                 sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount);
-
     /* Filling per profile  params */
-    for (i = 0; i < pnoRequest.ucNetworksCount; i++)
+    for (i = 0; i < pPnoRequest->ucNetworksCount; i++)
     {
-        pnoRequest.aNetworks[i].ssId.length =
+        pPnoRequest->aNetworks[i].ssId.length =
                request->match_sets[i].ssid.ssid_len;
 
-        if (( 0 == pnoRequest.aNetworks[i].ssId.length ) ||
-            ( pnoRequest.aNetworks[i].ssId.length > 32 ) )
+        if (( 0 == pPnoRequest->aNetworks[i].ssId.length ) ||
+            ( pPnoRequest->aNetworks[i].ssId.length > 32 ) )
         {
             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                       "%s: SSID Len %d is not correct for network %d",
-                      __func__, pnoRequest.aNetworks[i].ssId.length, i);
+                      __func__, pPnoRequest->aNetworks[i].ssId.length, i);
             ret = -EINVAL;
             goto error;
         }
 
-        memcpy(pnoRequest.aNetworks[i].ssId.ssId,
+        memcpy(pPnoRequest->aNetworks[i].ssId.ssId,
                request->match_sets[i].ssid.ssid,
                request->match_sets[i].ssid.ssid_len);
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                   "%s: SSID of network %d is %s ",  __func__,
-                   i, pnoRequest.aNetworks[i].ssId.ssId);
-        pnoRequest.aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/
-        pnoRequest.aNetworks[i].encryption     = 0; /*eED_ANY*/
-        pnoRequest.aNetworks[i].bcastNetwType  = 0; /*eBCAST_UNKNOWN*/
+                   i, pPnoRequest->aNetworks[i].ssId.ssId);
+        pPnoRequest->aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/
+        pPnoRequest->aNetworks[i].encryption     = 0; /*eED_ANY*/
+        pPnoRequest->aNetworks[i].bcastNetwType  = 0; /*eBCAST_UNKNOWN*/
 
         /*Copying list of valid channel into request */
-        memcpy(pnoRequest.aNetworks[i].aChannels, valid_ch, num_ch);
-        pnoRequest.aNetworks[i].ucChannelCount = num_ch;
+        memcpy(pPnoRequest->aNetworks[i].aChannels, valid_ch, num_ch);
+        pPnoRequest->aNetworks[i].ucChannelCount = num_ch;
 
-        pnoRequest.aNetworks[i].rssiThreshold = 0; //Default value
+        pPnoRequest->aNetworks[i].rssiThreshold = 0; //Default value
     }
 
     for (i = 0; i < request->n_ssids; i++)
     {
         j = 0;
-        while (j < pnoRequest.ucNetworksCount)
+        while (j < pPnoRequest->ucNetworksCount)
         {
-            if ((pnoRequest.aNetworks[j].ssId.length ==
+            if ((pPnoRequest->aNetworks[j].ssId.length ==
                  request->ssids[i].ssid_len) &&
-                 (0 == memcmp(pnoRequest.aNetworks[j].ssId.ssId,
+                 (0 == memcmp(pPnoRequest->aNetworks[j].ssId.ssId,
                             request->ssids[i].ssid,
-                            pnoRequest.aNetworks[j].ssId.length)))
+                            pPnoRequest->aNetworks[j].ssId.length)))
             {
-                pnoRequest.aNetworks[j].bcastNetwType = eBCAST_HIDDEN;
+                pPnoRequest->aNetworks[j].bcastNetwType = eBCAST_HIDDEN;
                 break;
             }
             j++;
@@ -17080,38 +13516,15 @@
               request->n_ssids);
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
               "request->ie_len = %zu", request->ie_len);
-
-    pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE);
-    if (pnoRequest.p24GProbeTemplate == NULL)
+    if ((0 < request->ie_len) && (NULL != request->ie))
     {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-            FL("failed to allocate memory p24GProbeTemplate %u"),
-                SIR_PNO_MAX_PB_REQ_SIZE);
-        goto error;
-    }
+        pPnoRequest->us24GProbeTemplateLen = request->ie_len;
+        memcpy(&pPnoRequest->p24GProbeTemplate, request->ie,
+                pPnoRequest->us24GProbeTemplateLen);
 
-    pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE);
-    if (pnoRequest.p5GProbeTemplate == NULL)
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-            FL("failed to allocate memory p5GProbeTemplate %u"),
-                SIR_PNO_MAX_PB_REQ_SIZE);
-        goto error;
-    }
-
-    vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE);
-    vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE);
-
-    if ((0 < request->ie_len) && (request->ie_len <= SIR_PNO_MAX_PB_REQ_SIZE) &&
-        (NULL != request->ie))
-    {
-        pnoRequest.us24GProbeTemplateLen = request->ie_len;
-        memcpy(pnoRequest.p24GProbeTemplate, request->ie,
-                pnoRequest.us24GProbeTemplateLen);
-
-        pnoRequest.us5GProbeTemplateLen = request->ie_len;
-        memcpy(pnoRequest.p5GProbeTemplate, request->ie,
-                pnoRequest.us5GProbeTemplateLen);
+        pPnoRequest->us5GProbeTemplateLen = request->ie_len;
+        memcpy(&pPnoRequest->p5GProbeTemplate, request->ie,
+                pPnoRequest->us5GProbeTemplateLen);
     }
 
     /* Driver gets only one time interval which is hardcoded in
@@ -17124,39 +13537,39 @@
      * till PNO is disabled.
      */
     if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue)
-        pnoRequest.scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE;
+        pPnoRequest->scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE;
     else
-        pnoRequest.scanTimers.ucScanTimersCount =
+        pPnoRequest->scanTimers.ucScanTimersCount =
                                                HDD_PNO_SCAN_TIMERS_SET_MULTIPLE;
 
     tempInterval = (request->interval)/1000;
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
               "Base scan interval = %d PNOScanTimerRepeatValue = %d",
               tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue);
-    for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++)
+    for ( i = 0; i < pPnoRequest->scanTimers.ucScanTimersCount; i++)
     {
-        pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat =
+        pPnoRequest->scanTimers.aTimerValues[i].uTimerRepeat =
                                  pHddCtx->cfg_ini->configPNOScanTimerRepeatValue;
-        pnoRequest.scanTimers.aTimerValues[i].uTimerValue = tempInterval;
+        pPnoRequest->scanTimers.aTimerValues[i].uTimerValue = tempInterval;
         tempInterval *= 2;
     }
     //Repeat last timer until pno disabled.
-    pnoRequest.scanTimers.aTimerValues[i-1].uTimerRepeat = 0;
+    pPnoRequest->scanTimers.aTimerValues[i-1].uTimerRepeat = 0;
 
-    pnoRequest.modePNO = SIR_PNO_MODE_IMMEDIATE;
+    pPnoRequest->modePNO = SIR_PNO_MODE_IMMEDIATE;
 
     INIT_COMPLETION(pAdapter->pno_comp_var);
-    pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb;
-    pnoRequest.callbackContext = pAdapter;
+    pPnoRequest->statusCallback = hdd_cfg80211_sched_scan_start_status_cb;
+    pPnoRequest->callbackContext = pAdapter;
     pAdapter->pno_req_status = 0;
 
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
               "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d",
-              pAdapter->sessionId, pnoRequest.enable, pnoRequest.modePNO,
-                                pnoRequest.scanTimers.ucScanTimersCount);
+              pAdapter->sessionId, pPnoRequest->enable, pPnoRequest->modePNO,
+                                pPnoRequest->scanTimers.ucScanTimersCount);
 
     status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                              &pnoRequest, pAdapter->sessionId,
+                              pPnoRequest, pAdapter->sessionId,
                               hdd_cfg80211_sched_scan_done_callback, pAdapter);
     if (eHAL_STATUS_SUCCESS != status)
     {
@@ -17178,23 +13591,18 @@
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   FL("Timed out waiting for PNO to be Enabled"));
         ret = 0;
+        goto error;
     }
 
+    vos_mem_free(pPnoRequest);
     ret = pAdapter->pno_req_status;
     return ret;
 
 error:
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
               FL("PNO scanRequest offloaded ret = %d"), ret);
+    vos_mem_free(pPnoRequest);
     pHddCtx->isPnoEnable = FALSE;
-    if (pnoRequest.aNetworks)
-        vos_mem_free(pnoRequest.aNetworks);
-    if (pnoRequest.p24GProbeTemplate)
-        vos_mem_free(pnoRequest.p24GProbeTemplate);
-    if (pnoRequest.p5GProbeTemplate)
-        vos_mem_free(pnoRequest.p5GProbeTemplate);
-
-    EXIT();
     return ret;
 }
 
@@ -17225,7 +13633,7 @@
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     hdd_context_t *pHddCtx;
     tHalHandle hHal;
-    tSirPNOScanReq pnoRequest = {0};
+    tpSirPNOScanReq pPnoRequest = NULL;
     int ret = 0;
 
     ENTER();
@@ -17259,7 +13667,6 @@
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: LOGP in Progress. Ignore!!!", __func__);
-        pHddCtx->isPnoEnable = FALSE;
         return ret;
     }
 
@@ -17278,18 +13685,19 @@
         return -EINVAL;
     }
 
-    pnoRequest.enable = 0; /* Disable PNO */
-    pnoRequest.ucNetworksCount = 0;
+    pPnoRequest = (tpSirPNOScanReq) vos_mem_malloc(sizeof (tSirPNOScanReq));
+    if (NULL == pPnoRequest)
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s: vos_mem_malloc failed", __func__);
+        return -ENOMEM;
+    }
 
-    MTRACE(vos_trace(VOS_MODULE_ID_HDD,
-                     TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP,
-                     pAdapter->sessionId, pAdapter->device_mode));
+    memset(pPnoRequest, 0, sizeof (tSirPNOScanReq));
+    pPnoRequest->enable = 0; /* Disable PNO */
+    pPnoRequest->ucNetworksCount = 0;
 
-    INIT_COMPLETION(pAdapter->pno_comp_var);
-    pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb;
-    pnoRequest.callbackContext = pAdapter;
-    pAdapter->pno_req_status = 0;
-    status = sme_SetPreferredNetworkList(hHal, &pnoRequest,
+    status = sme_SetPreferredNetworkList(hHal, pPnoRequest,
                                 pAdapter->sessionId,
                                 NULL, pAdapter);
     if (eHAL_STATUS_SUCCESS != status)
@@ -17299,26 +13707,12 @@
         ret = -EINVAL;
         goto error;
     }
-    ret = wait_for_completion_timeout(
-                 &pAdapter->pno_comp_var,
-                  msecs_to_jiffies(WLAN_WAIT_TIME_PNO));
-    if (0 >= ret)
-    {
-        // Did not receive the response for PNO disable in time.
-        // Assuming the PNO disable was success.
-        // Returning error from here, because we timeout, results
-        // in side effect of Wifi (Wifi Setting) not to work.
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("Timed out waiting for PNO to be disabled"));
-        ret = 0;
-    }
-
-    ret = pAdapter->pno_req_status;
-    pHddCtx->isPnoEnable = (ret == 0) ? FALSE : TRUE;
+    pHddCtx->isPnoEnable = FALSE;
 
 error:
     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                    FL("PNO scan disabled ret = %d"), ret);
+    vos_mem_free(pPnoRequest);
 
     EXIT();
     return ret;
@@ -17344,70 +13738,32 @@
 
 #ifdef FEATURE_WLAN_TDLS
 #if TDLS_MGMT_VERSION2
-static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
-                                         struct net_device *dev,
-                                         u8 *peer, u8 action_code,
-                                         u8 dialog_token,
-                                         u16 status_code, u32 peer_capability,
-                                         const u8 *buf, size_t len)
-#else /* TDLS_MGMT_VERSION2 */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS)
-static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
-                                         struct net_device *dev,
-                                         const u8 *peer, u8 action_code,
-                                         u8 dialog_token, u16 status_code,
-                                         u32 peer_capability, bool initiator,
-                                         const u8 *buf, size_t len)
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
-static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
-                                         struct net_device *dev,
-                                         const u8 *peer, u8 action_code,
-                                         u8 dialog_token, u16 status_code,
-                                         u32 peer_capability, const u8 *buf,
-                                         size_t len)
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
-static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
-                                         struct net_device *dev,
-                                         u8 *peer, u8 action_code,
-                                         u8 dialog_token,
-                                         u16 status_code, u32 peer_capability,
-                                         const u8 *buf, size_t len)
+static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
+                     u8 *peer, u8 action_code,  u8 dialog_token,
+                      u16 status_code, u32 peer_capability, const u8 *buf, size_t len)
 #else
-static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
-                                         struct net_device *dev,
-                                         u8 *peer, u8 action_code,
-                                         u8 dialog_token,
-                                         u16 status_code, const u8 *buf,
-                                         size_t len)
-#endif
+static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
+                     u8 *peer, u8 action_code,  u8 dialog_token,
+                     u16 status_code, const u8 *buf, size_t len)
 #endif
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_context_t *pHddCtx = wiphy_priv(wiphy);
+    u8 peerMac[6];
     VOS_STATUS status;
     int max_sta_failed = 0;
     int responder;
     long rc;
     int ret;
-    hddTdlsPeer_t *pTdlsPeer;
-#if !(TDLS_MGMT_VERSION2) && (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0))
+#if !(TDLS_MGMT_VERSION2)
     u32 peer_capability = 0;
 #endif
     tANI_U16 numCurrTdlsPeers;
-    hdd_station_ctx_t *pHddStaCtx = NULL;
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                      TRACE_CODE_HDD_CFG80211_TDLS_MGMT,
                      pAdapter->sessionId, action_code));
-
-    pHddCtx = wiphy_priv(wiphy);
     if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini)
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -17426,57 +13782,27 @@
         return -EBUSY;
     }
 
-    if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx))
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Unloading/Loading in Progress. Ignore!!!", __func__);
-        return -EAGAIN;
-    }
-
     if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode)
     {
-         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+         VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                     "%s: TDLS mode is disabled OR not enabled in FW."
                     MAC_ADDRESS_STR " action %d declined.",
                     __func__, MAC_ADDR_ARRAY(peer), action_code);
         return -ENOTSUPP;
     }
 
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-
-    if( NULL == pHddStaCtx )
-    {
-       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-               "%s: HDD station context NULL ",__func__);
-       return -EINVAL;
-    }
-
-    /* STA should be connected and authenticated
-     * before sending any TDLS frames
-     */
-    if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) ||
-        (FALSE == pHddStaCtx->conn_info.uIsAuthenticated))
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "STA is not connected or unauthenticated. "
-                "connState %u, uIsAuthenticated %u",
-                pHddStaCtx->conn_info.connState,
-                pHddStaCtx->conn_info.uIsAuthenticated);
-        return -EAGAIN;
-    }
-
     /* other than teardown frame, other mgmt frames are not sent if disabled */
     if (SIR_MAC_TDLS_TEARDOWN != action_code)
     {
        /* if tdls_mode is disabled to respond to peer's request */
         if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)
         {
-             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+             VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                         "%s: " MAC_ADDRESS_STR
                         " TDLS mode is disabled. action %d declined.",
                         __func__, MAC_ADDR_ARRAY(peer), action_code);
 
-             return -ENOTSUPP;
+        return -ENOTSUPP;
         }
 
         if (vos_max_concurrent_connections_reached())
@@ -17488,7 +13814,7 @@
 
     if (WLAN_IS_TDLS_SETUP_ACTION(action_code))
     {
-        if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE, TRUE))
+        if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE))
         {
             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                        "%s: " MAC_ADDRESS_STR
@@ -17534,32 +13860,33 @@
         }
         else
         {
-            mutex_lock(&pHddCtx->tdls_lock);
-            pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
+            hddTdlsPeer_t *pTdlsPeer;
+            pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE);
             if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer))
             {
-                mutex_unlock(&pHddCtx->tdls_lock);
                 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                         "%s:" MAC_ADDRESS_STR " already connected. action %d declined.",
                         __func__, MAC_ADDR_ARRAY(peer), action_code);
                 return -EPERM;
             }
-            mutex_unlock(&pHddCtx->tdls_lock);
         }
     }
+    vos_mem_copy(peerMac, peer, 6);
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+#ifdef WLAN_FEATURE_TDLS_DEBUG
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                "%s: " MAC_ADDRESS_STR " action %d, dialog_token %d status %d, len = %zu",
                "tdls_mgmt", MAC_ADDR_ARRAY(peer),
                action_code, dialog_token, status_code, len);
+#endif
 
     /*Except teardown responder will not be used so just make 0*/
     responder = 0;
     if (SIR_MAC_TDLS_TEARDOWN == action_code)
     {
 
-       mutex_lock(&pHddCtx->tdls_lock);
-       pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
+       hddTdlsPeer_t *pTdlsPeer;
+       pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE);
 
        if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer))
             responder = pTdlsPeer->is_responder;
@@ -17569,51 +13896,24 @@
                     "%s: " MAC_ADDRESS_STR " peer doesn't exist or not connected %d dialog_token %d status %d, len = %zu",
                     __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status,
                      dialog_token, status_code, len);
-           mutex_unlock(&pHddCtx->tdls_lock);
            return -EPERM;
        }
-       mutex_unlock(&pHddCtx->tdls_lock);
-    }
-
-    /* Discard TDLS setup if peer is removed by user app */
-    if ((pHddCtx->cfg_ini->fTDLSExternalControl) &&
-        ((SIR_MAC_TDLS_SETUP_REQ == action_code) ||
-        (SIR_MAC_TDLS_SETUP_CNF == action_code) ||
-        (SIR_MAC_TDLS_DIS_REQ == action_code))) {
-
-        mutex_lock(&pHddCtx->tdls_lock);
-        pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
-        if (pTdlsPeer && (FALSE == pTdlsPeer->isForcedPeer)) {
-            mutex_unlock(&pHddCtx->tdls_lock);
-            hddLog(LOGE, FL("TDLS External Control enabled, but peer "
-                   MAC_ADDRESS_STR " is not forced, so reject the action code %d"),
-                   MAC_ADDR_ARRAY(peer), action_code);
-            return -EINVAL;
-        }
-        mutex_unlock(&pHddCtx->tdls_lock);
     }
 
     /* For explicit trigger of DIS_REQ come out of BMPS for
        successfully receiving DIS_RSP from peer. */
     if ((SIR_MAC_TDLS_SETUP_RSP == action_code) ||
-        (SIR_MAC_TDLS_SETUP_CNF== action_code) ||
         (SIR_MAC_TDLS_DIS_RSP == action_code) ||
         (SIR_MAC_TDLS_DIS_REQ == action_code))
     {
         if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter)))
         {
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                        "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code);
-            status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION);
-            if (status != VOS_STATUS_SUCCESS) {
-                hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS"));
-            }
+            hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION);
         }
-        if (SIR_MAC_TDLS_DIS_REQ != action_code) {
-            if (0 != wlan_hdd_tdls_set_cap(pAdapter, peer, eTDLS_CAP_SUPPORTED)) {
-                hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS capabilities"));
-            }
-        }
+        if (SIR_MAC_TDLS_DIS_REQ != action_code)
+            wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED);
     }
 
     /* make sure doesn't call send_mgmt() while it is pending */
@@ -17629,10 +13929,8 @@
     pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC;
     INIT_COMPLETION(pAdapter->tdls_mgmt_comp);
 
-    status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter),
-            pAdapter->sessionId, peer, action_code, dialog_token,
-            status_code, peer_capability, (tANI_U8 *)buf, len,
-            responder);
+    status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId,
+              peerMac, action_code, dialog_token, status_code, peer_capability, (tANI_U8 *)buf, len, responder);
 
     if (VOS_STATUS_SUCCESS != status)
     {
@@ -17643,10 +13941,6 @@
         goto tx_failed;
     }
 
-    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-            "%s: Wait for tdls_mgmt_comp. Timeout %u ms", __func__,
-            WAIT_TIME_TDLS_MGMT);
-
     rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp,
                                                         msecs_to_jiffies(WAIT_TIME_TDLS_MGMT));
 
@@ -17663,21 +13957,10 @@
                       "%s: LOGP in Progress. Ignore!!!", __func__);
             return -EAGAIN;
         }
-        if (rc <= 0)
-            vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                 WLAN_LOG_INDICATOR_HOST_DRIVER,
-                 WLAN_LOG_REASON_HDD_TIME_OUT,
-                 TRUE, TRUE);
 
         ret = -EINVAL;
         goto tx_failed;
     }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "%s: Mgmt Tx Completion status %ld TxCompletion %u",
-                __func__, rc, pAdapter->mgmtTxCompletionStatus);
-    }
 
     if (max_sta_failed)
     {
@@ -17687,15 +13970,11 @@
 
     if (SIR_MAC_TDLS_SETUP_RSP == action_code)
     {
-        if (0 != wlan_hdd_tdls_set_responder(pAdapter, peer, TRUE)) {
-            hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response"));
-        }
+        wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE);
     }
     else if (SIR_MAC_TDLS_SETUP_CNF == action_code)
     {
-        if (0 != wlan_hdd_tdls_set_responder(pAdapter, peer, FALSE)) {
-            hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response"));
-        }
+        wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE);
     }
 
     return 0;
@@ -17715,84 +13994,14 @@
     return ret;
 }
 
-#if TDLS_MGMT_VERSION2
-static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
-                                       u8 *peer, u8 action_code,  u8 dialog_token,
-                                       u16 status_code, u32 peer_capability,
-                                       const u8 *buf, size_t len)
-#else  /* TDLS_MGMT_VERSION2 */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0))
-static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
-                                       struct net_device *dev,
-                                       const u8 *peer, u8 action_code,
-                                       u8 dialog_token, u16 status_code,
-                                       u32 peer_capability, bool initiator,
-                                       const u8 *buf, size_t len)
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
-static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
-                                       struct net_device *dev,
-                                       const u8 *peer, u8 action_code,
-                                       u8 dialog_token, u16 status_code,
-                                       u32 peer_capability, const u8 *buf,
-                                       size_t len)
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
-static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
-                                       struct net_device *dev,
-                                       u8 *peer, u8 action_code,
-                                       u8 dialog_token,
-                                       u16 status_code, u32 peer_capability,
-                                       const u8 *buf, size_t len)
-#else
-static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
-                                       u8 *peer, u8 action_code,  u8 dialog_token,
-                                       u16 status_code, const u8 *buf, size_t len)
-#endif
-#endif
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-#if TDLS_MGMT_VERSION2
-    ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code,
-                                        dialog_token, status_code,
-                                        peer_capability, buf, len);
-#else /* TDLS_MGMT_VERSION2 */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS)
-    ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code,
-                                        dialog_token, status_code,
-                                        peer_capability, initiator,
-                                        buf, len);
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
-    ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code,
-                                        dialog_token, status_code,
-                                        peer_capability, buf, len);
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
-    ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code,
-                                        dialog_token, status_code,
-                                        peer_capability, buf, len);
-#else
-    ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code,
-                                        dialog_token, status_code, buf, len);
-#endif
-#endif
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
 
 int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                      const u8 *peer,
-#else
                                       u8 *peer,
-#endif
-                                      tdls_req_params_t *tdls_peer_params,
                                       cfg80211_exttdls_callback callback)
 {
 
-    hddTdlsPeer_t *pTdlsPeer = NULL;
+    hddTdlsPeer_t *pTdlsPeer;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
               " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR,
               __func__, MAC_ADDR_ARRAY(peer));
@@ -17801,73 +14010,24 @@
          (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) {
 
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-              " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ",
-              __func__, pHddCtx->cfg_ini->fTDLSExternalControl,
-              pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger);
+              " %s TDLS External control and Implicit Trigger not enabled ",
+              __func__);
         return -ENOTSUPP;
     }
 
     /* To cater the requirement of establishing the TDLS link
      * irrespective of the data traffic , get an entry of TDLS peer.
      */
-    mutex_lock(&pHddCtx->tdls_lock);
     pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer);
     if (pTdlsPeer == NULL) {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: peer " MAC_ADDRESS_STR " not existing",
                   __func__, MAC_ADDR_ARRAY(peer));
-        mutex_unlock(&pHddCtx->tdls_lock);
         return -EINVAL;
     }
 
-    /* check FW TDLS Off Channel capability */
-    if ((TRUE == sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)) &&
-        (TRUE == pHddCtx->cfg_ini->fEnableTDLSOffChannel) &&
-        (NULL != tdls_peer_params))
-    {
-        pTdlsPeer->peerParams.channel = tdls_peer_params->channel;
-        pTdlsPeer->peerParams.global_operating_class =
-                         tdls_peer_params->global_operating_class;
-        pTdlsPeer->peerParams.max_latency_ms = tdls_peer_params->max_latency_ms;
-        pTdlsPeer->peerParams.min_bandwidth_kbps =
-                                          tdls_peer_params->min_bandwidth_kbps;
-        /* check configured channel is valid, non dfs and
-         * not current operating channel */
-        if ((sme_IsTdlsOffChannelValid(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                      tdls_peer_params->channel)) &&
-            (pHddStaCtx) &&
-            (tdls_peer_params->channel !=
-                              pHddStaCtx->conn_info.operationChannel))
-        {
-            pTdlsPeer->isOffChannelConfigured = TRUE;
-        }
-        else
-        {
-            pTdlsPeer->isOffChannelConfigured = FALSE;
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                      "%s: Configured Tdls Off Channel is not valid", __func__);
-
-        }
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                  "%s: tdls_off_channel %d isOffChannelConfigured %d "
-                  "current operating channel %d",
-                  __func__, pTdlsPeer->peerParams.channel,
-                  pTdlsPeer->isOffChannelConfigured,
-                  (pHddStaCtx ? pHddStaCtx->conn_info.operationChannel : 0));
-    }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: TDLS off channel FW capability %d, "
-                  "host capab %d or Invalid TDLS Peer Params", __func__,
-                  sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL),
-                  pHddCtx->cfg_ini->fEnableTDLSOffChannel);
-    }
-
     if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) {
 
-        mutex_unlock(&pHddCtx->tdls_lock);
-
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
               " %s TDLS Add Force Peer Failed",
               __func__);
@@ -17876,114 +14036,71 @@
     /*EXT TDLS*/
 
     if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) {
-        mutex_unlock(&pHddCtx->tdls_lock);
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
               " %s TDLS set callback Failed",
               __func__);
         return -EINVAL;
     }
 
-    mutex_unlock(&pHddCtx->tdls_lock);
-
     return(0);
 
 }
 
-int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                        const u8 *peer
-#else
-                                        u8 *peer
-#endif
-)
+int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, u8 *peer)
 {
 
     hddTdlsPeer_t *pTdlsPeer;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
               " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR,
               __func__, MAC_ADDR_ARRAY(peer));
 
-    if (0 != wlan_hdd_validate_context(pHddCtx)) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is NULL"));
-        return -EINVAL;
-    }
-
     if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) ||
          (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) {
 
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-              " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ",
-              __func__, pHddCtx->cfg_ini->fTDLSExternalControl,
-              pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger);
+              " %s TDLS External control and Implicit Trigger not enabled ",
+              __func__);
         return -ENOTSUPP;
     }
 
-    mutex_lock(&pHddCtx->tdls_lock);
-    pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
+
+    pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE);
 
     if ( NULL == pTdlsPeer ) {
-        mutex_unlock(&pHddCtx->tdls_lock);
         hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR
-               " peer not existing",
+               " peer not exsting",
                __func__, MAC_ADDR_ARRAY(peer));
         return -EINVAL;
     }
     else {
         wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer,
                            eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
-        hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_EXT_CTRL,
-                                                 pTdlsPeer->peerMac);
-        /* if channel switch is configured, reset
-           the channel for this peer */
-        if (TRUE == pTdlsPeer->isOffChannelConfigured)
-        {
-            pTdlsPeer->peerParams.channel = 0;
-            pTdlsPeer->isOffChannelConfigured = FALSE;
-        }
     }
 
-    if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) {
-        mutex_unlock(&pHddCtx->tdls_lock);
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set force peer"));
+    if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) )
         return -EINVAL;
-    }
 
     /*EXT TDLS*/
 
     if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) {
-        mutex_unlock(&pHddCtx->tdls_lock);
+
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
               " %s TDLS set callback Failed",
               __func__);
         return -EINVAL;
     }
-
-    mutex_unlock(&pHddCtx->tdls_lock);
-
     return(0);
+
 }
 static int __wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                         const u8 *peer,
-#else
-                                         u8 *peer,
-#endif
-                                         enum nl80211_tdls_operation oper)
+                 u8 *peer, enum nl80211_tdls_operation oper)
 {
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     hdd_context_t *pHddCtx = wiphy_priv(wiphy);
     int status;
     hddTdlsPeer_t *pTdlsPeer;
 
-    ENTER();
-
-    if (!pAdapter) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL"));
-        return -EINVAL;
-    }
-
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                      TRACE_CODE_HDD_CFG80211_TDLS_OPER,
                      pAdapter->sessionId, oper));
@@ -17995,8 +14112,11 @@
     }
 
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -18005,10 +14125,8 @@
         FALSE == sme_IsFeatureSupportedByFW(TDLS))
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "TDLS Disabled in INI (%d) OR not enabled in FW (%d) "
-                "Cannot process TDLS commands",
-                pHddCtx->cfg_ini->fEnableTDLSSupport,
-                sme_IsFeatureSupportedByFW(TDLS));
+                "TDLS Disabled in INI OR not enabled in FW. "
+                "Cannot process TDLS commands");
         return -ENOTSUPP;
     }
 
@@ -18017,25 +14135,12 @@
             {
                 VOS_STATUS status;
                 long ret;
-                tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams = { {0}, 0,
-                                                0, 0, 0, 0, 0, 0, {0}, 0, {0} };
+                tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams;
                 WLAN_STADescType         staDesc;
-                tANI_U16 numCurrTdlsPeers = 0;
-                hddTdlsPeer_t *connPeer = NULL;
-                tANI_U8 suppChannelLen = 0;
-                tSirMacAddr peerMac;
-                int channel;
-                tTDLSLinkStatus peer_status = eTDLS_LINK_IDLE;
 
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                        " %s : NL80211_TDLS_ENABLE_LINK for " MAC_ADDRESS_STR,
-                                __func__, MAC_ADDR_ARRAY(peer));
-
-                mutex_lock(&pHddCtx->tdls_lock);
-                pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
+                pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE);
                 memset(&staDesc, 0, sizeof(staDesc));
                 if ( NULL == pTdlsPeer ) {
-                    mutex_unlock(&pHddCtx->tdls_lock);
                     hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR
                            " (oper %d) not exsting. ignored",
                            __func__, MAC_ADDR_ARRAY(peer), (int)oper);
@@ -18052,97 +14157,21 @@
                     hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u "
                            MAC_ADDRESS_STR " failed",
                            __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer));
-                    mutex_unlock(&pHddCtx->tdls_lock);
                     return -EINVAL;
                 }
 
-                /* before starting tdls connection, set tdls
-                 * off channel established status to default value */
-                pTdlsPeer->isOffChannelEstablished = FALSE;
-
-                mutex_unlock(&pHddCtx->tdls_lock);
-
-                wlan_hdd_tdls_set_cap(pAdapter, peer, eTDLS_CAP_SUPPORTED);
-                /* TDLS Off Channel, Disable tdls channel switch,
-                   when there are more than one tdls link */
-                numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter);
-                if (numCurrTdlsPeers == 2)
-                {
-                    mutex_lock(&pHddCtx->tdls_lock);
-                    /* get connected peer and send disable tdls off chan */
-                    connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter);
-                    if ((connPeer) &&
-                        (connPeer->isOffChannelSupported == TRUE) &&
-                        (connPeer->isOffChannelConfigured == TRUE))
-                    {
-                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                                  "%s: More then one peer connected, Disable "
-                                  "TDLS channel switch", __func__);
-
-                        connPeer->isOffChannelEstablished = FALSE;
-                        vos_mem_copy(peerMac, connPeer->peerMac, sizeof (tSirMacAddr));
-                        channel = connPeer->peerParams.channel;
-
-                        mutex_unlock(&pHddCtx->tdls_lock);
-
-                        ret = sme_SendTdlsChanSwitchReq(
-                                           WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                           pAdapter->sessionId,
-                                           peerMac,
-                                           channel,
-                                           TDLS_OFF_CHANNEL_BW_OFFSET,
-                                           TDLS_CHANNEL_SWITCH_DISABLE);
-                        if (ret != VOS_STATUS_SUCCESS) {
-                             hddLog(VOS_TRACE_LEVEL_ERROR,
-                                   FL("Failed to send TDLS switch channel request"));
-                        }
-                    }
-                    else
-                    {
-                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                                  "%s: No TDLS Connected Peer or "
-                                  "isOffChannelSupported %d "
-                                  "isOffChannelConfigured %d",
-                                  __func__,
-                                  (connPeer ? (connPeer->isOffChannelSupported)
-                                    : -1),
-                                  (connPeer ? (connPeer->isOffChannelConfigured)
-                                    : -1));
-                        mutex_unlock(&pHddCtx->tdls_lock);
-                    }
-                }
-
-                mutex_lock(&pHddCtx->tdls_lock);
-                pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
-                if ( NULL == pTdlsPeer ) {
-                    mutex_unlock(&pHddCtx->tdls_lock);
-                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                              "%s: " MAC_ADDRESS_STR
-                              " (oper %d) peer got freed in other context. ignored",
-                              __func__, MAC_ADDR_ARRAY(peer), (int)oper);
-                    return -EINVAL;
-                }
-                peer_status = pTdlsPeer->link_status;
-                mutex_unlock(&pHddCtx->tdls_lock);
-
-                if (eTDLS_LINK_CONNECTED != peer_status)
+                if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status)
                 {
                     if (IS_ADVANCE_TDLS_ENABLE) {
 
                         if (0 != wlan_hdd_tdls_get_link_establish_params(
                                    pAdapter, peer,&tdlsLinkEstablishParams)) {
-                            hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to get link establishment params"));
                             return -EINVAL;
                         }
                         INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp);
 
-                        ret = sme_SendTdlsLinkEstablishParams(
-                                         WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                         pAdapter->sessionId, peer,
-                                         &tdlsLinkEstablishParams);
-                        if (ret != VOS_STATUS_SUCCESS) {
-                            hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send link establishment params"));
-                        }
+                        sme_SendTdlsLinkEstablishParams(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                            pAdapter->sessionId, peer, &tdlsLinkEstablishParams);
                         /* Send TDLS peer UAPSD capabilities to the firmware and
                          * register with the TL on after the response for this operation
                          * is received .
@@ -18150,74 +14179,21 @@
                         ret = wait_for_completion_interruptible_timeout(
                                 &pAdapter->tdls_link_establish_req_comp,
                                 msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ));
-
-                        mutex_lock(&pHddCtx->tdls_lock);
-                        pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
-                        if ( NULL == pTdlsPeer ) {
-                            mutex_unlock(&pHddCtx->tdls_lock);
-                            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                                      "%s %d: " MAC_ADDRESS_STR
-                                      " (oper %d) peer got freed in other context. ignored",
-                                      __func__, __LINE__, MAC_ADDR_ARRAY(peer),
-                                      (int)oper);
-                            return -EINVAL;
-                        }
-                        peer_status = pTdlsPeer->link_status;
-                        mutex_unlock(&pHddCtx->tdls_lock);
-
-                        if (ret <= 0 || (peer_status == eTDLS_LINK_TEARING))
+                        if (ret <= 0)
                         {
                             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                                      FL("Link Establish Request Failed Status %ld"),
-                                           ret);
+                                      "%s: Link Establish Request Faled Status %ld",
+                                      __func__, ret);
                             return -EINVAL;
                         }
                     }
-
-                    mutex_lock(&pHddCtx->tdls_lock);
-                    pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
-                    if ( NULL == pTdlsPeer ) {
-                        mutex_unlock(&pHddCtx->tdls_lock);
-                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                                  "%s: " MAC_ADDRESS_STR
-                                  " (oper %d) peer got freed in other context. ignored",
-                                  __func__, MAC_ADDR_ARRAY(peer), (int)oper);
-                        return -EINVAL;
-                    }
-
                     wlan_hdd_tdls_set_peer_link_status(pTdlsPeer,
                                                        eTDLS_LINK_CONNECTED,
                                                        eTDLS_LINK_SUCCESS);
                     staDesc.ucSTAId = pTdlsPeer->staId;
                     staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos;
-
-                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                              "%s: tdlsLinkEstablishParams of peer "
-                              MAC_ADDRESS_STR "uapsdQueues: %d"
-                              "qos: %d maxSp: %d isBufSta: %d isOffChannelSupported: %d"
-                              "isResponder: %d  peerstaId: %d",
-                              __func__,
-                              MAC_ADDR_ARRAY(tdlsLinkEstablishParams.peerMac),
-                              tdlsLinkEstablishParams.uapsdQueues,
-                              tdlsLinkEstablishParams.qos,
-                              tdlsLinkEstablishParams.maxSp,
-                              tdlsLinkEstablishParams.isBufSta,
-                              tdlsLinkEstablishParams.isOffChannelSupported,
-                              tdlsLinkEstablishParams.isResponder,
-                              pTdlsPeer->staId);
-
-                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                              "%s: StaDesc ucSTAId: %d ucQosEnabled: %d",
-                              __func__,
-                              staDesc.ucSTAId,
-                              staDesc.ucQosEnabled);
-
-                    ret = WLANTL_UpdateTdlsSTAClient(
-                                                pHddCtx->pvosContext,
-                                                &staDesc);
-                    if (ret != VOS_STATUS_SUCCESS) {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to update TDLS STA params"));
-                    }
+                    WLANTL_UpdateTdlsSTAClient(pHddCtx->pvosContext,
+                                                    &staDesc);
 
                     /* Mark TDLS client Authenticated .*/
                     status = WLANTL_ChangeSTAState( pHddCtx->pvosContext,
@@ -18228,116 +14204,17 @@
                         if (pTdlsPeer->is_responder == 0)
                         {
                             v_U8_t staId = (v_U8_t)pTdlsPeer->staId;
-                            tdlsConnInfo_t *tdlsInfo;
 
-                            tdlsInfo = wlan_hdd_get_conn_info(pHddCtx, staId);
-
-                            if (!vos_timer_is_initialized(
-                                 &pTdlsPeer->initiatorWaitTimeoutTimer))
-                            {
-                                /* Initialize initiator wait callback */
-                                vos_timer_init(
-                                    &pTdlsPeer->initiatorWaitTimeoutTimer,
-                                    VOS_TIMER_TYPE_SW,
-                                    wlan_hdd_tdls_initiator_wait_cb,
-                                    tdlsInfo);
-                            }
                             wlan_hdd_tdls_timer_restart(pAdapter,
                                                         &pTdlsPeer->initiatorWaitTimeoutTimer,
                                                        WAIT_TIME_TDLS_INITIATOR);
                             /* suspend initiator TX until it receives direct packet from the
                             reponder or WAIT_TIME_TDLS_INITIATOR timer expires */
-                            ret = WLANTL_SuspendDataTx(
-                                      (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
-                                      &staId, NULL);
-                            if (ret != VOS_STATUS_SUCCESS) {
-                                 hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to suspend data tx"));
-                            }
+                            WLANTL_SuspendDataTx( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                                   &staId, NULL);
                         }
-
-                        if  ((TRUE == pTdlsPeer->isOffChannelSupported) &&
-                             (TRUE == pTdlsPeer->isOffChannelConfigured))
-                        {
-                             suppChannelLen =
-                                 tdlsLinkEstablishParams.supportedChannelsLen;
-
-                             if ((suppChannelLen > 0) &&
-                                 (suppChannelLen <= SIR_MAC_MAX_SUPP_CHANNELS))
-                             {
-                                 tANI_U8 suppPeerChannel = 0;
-                                 int i = 0;
-                                 for (i = 0U; i < suppChannelLen; i++)
-                                 {
-                                    suppPeerChannel =
-                                   tdlsLinkEstablishParams.supportedChannels[i];
-
-                                    pTdlsPeer->isOffChannelSupported = FALSE;
-                                    if (suppPeerChannel ==
-                                        pTdlsPeer->peerParams.channel)
-                                    {
-                                        pTdlsPeer->isOffChannelSupported = TRUE;
-                                        break;
-                                    }
-                                 }
-                             }
-                             else
-                             {
-                                pTdlsPeer->isOffChannelSupported = FALSE;
-                             }
-                        }
-                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                                  "%s: TDLS channel switch request for channel "
-                                  "%d isOffChannelConfigured %d suppChannelLen "
-                                  "%d isOffChannelSupported %d", __func__,
-                                  pTdlsPeer->peerParams.channel,
-                                  pTdlsPeer->isOffChannelConfigured,
-                                  suppChannelLen,
-                                  pTdlsPeer->isOffChannelSupported);
-
-                        /* TDLS Off Channel, Enable tdls channel switch,
-                           when their is only one tdls link and it supports */
-                        numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter);
-                        if ((numCurrTdlsPeers == 1) &&
-                            (TRUE == pTdlsPeer->isOffChannelSupported) &&
-                            (TRUE == pTdlsPeer->isOffChannelConfigured))
-                        {
-                            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                                  "%s: Send TDLS channel switch request for channel %d",
-                                  __func__, pTdlsPeer->peerParams.channel);
-
-                            pTdlsPeer->isOffChannelEstablished = TRUE;
-                            vos_mem_copy(peerMac, pTdlsPeer->peerMac, sizeof (tSirMacAddr));
-                            channel = pTdlsPeer->peerParams.channel;
-
-                            mutex_unlock(&pHddCtx->tdls_lock);
-
-                            ret = sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                                           pAdapter->sessionId,
-                                                           peerMac,
-                                                           channel,
-                                                           TDLS_OFF_CHANNEL_BW_OFFSET,
-                                                           TDLS_CHANNEL_SWITCH_ENABLE);
-                            if (ret != VOS_STATUS_SUCCESS) {
-                                 hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS offchannel: Failed to send TDLS switch channel req"));
-                            }
-                        }
-                        else
-                        {
-                            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                                      "%s: TDLS channel switch request not sent"
-                                      " numCurrTdlsPeers %d "
-                                      "isOffChannelSupported %d "
-                                      "isOffChannelConfigured %d",
-                                      __func__, numCurrTdlsPeers,
-                                      pTdlsPeer->isOffChannelSupported,
-                                      pTdlsPeer->isOffChannelConfigured);
-                            mutex_unlock(&pHddCtx->tdls_lock);
-                        }
-
+                        wlan_hdd_tdls_increment_peer_count(pAdapter);
                     }
-                    else
-                        mutex_unlock(&pHddCtx->tdls_lock);
-
                     wlan_hdd_tdls_check_bmps(pAdapter);
 
                     /* Update TL about the UAPSD masks , to route the packets to firmware */
@@ -18356,37 +14233,17 @@
                                                                pTdlsPeer->staId, ucAc[ac],
                                                                tlTid[ac], tlTid[ac], 0, 0,
                                                                WLANTL_BI_DIR );
-                            if (status != VOS_STATUS_SUCCESS) {
-                                hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to enable UAPSD for AC"));
-                            }
                         }
                     }
                 }
 
-                /* stop TCP delack timer if TDLS is enable  */
-                set_bit(WLAN_TDLS_MODE, &pHddCtx->mode);
-                hdd_manage_delack_timer(pHddCtx);
-                hdd_wlan_tdls_enable_link_event(peer,
-                           pTdlsPeer->isOffChannelSupported,
-                           pTdlsPeer->isOffChannelConfigured,
-                           pTdlsPeer->isOffChannelEstablished);
             }
             break;
         case NL80211_TDLS_DISABLE_LINK:
             {
-                tANI_U16 numCurrTdlsPeers = 0;
-                hddTdlsPeer_t *connPeer = NULL;
-
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                        " %s : NL80211_TDLS_DISABLE_LINK for " MAC_ADDRESS_STR,
-                                __func__, MAC_ADDR_ARRAY(peer));
-
-                mutex_lock(&pHddCtx->tdls_lock);
-                pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
-
+                pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE);
 
                 if ( NULL == pTdlsPeer ) {
-                    mutex_unlock(&pHddCtx->tdls_lock);
                     hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR
                            " (oper %d) not exsting. ignored",
                            __func__, MAC_ADDR_ARRAY(peer), (int)oper);
@@ -18402,42 +14259,22 @@
                 {
                     long status;
 
-                    /* set tdls off channel status to false for this peer */
-                    pTdlsPeer->isOffChannelEstablished = FALSE;
+
                     wlan_hdd_tdls_set_peer_link_status(pTdlsPeer,
                               eTDLS_LINK_TEARING,
                               (pTdlsPeer->link_status == eTDLS_LINK_TEARING)?
                               eTDLS_LINK_UNSPECIFIED:
                               eTDLS_LINK_DROPPED_BY_REMOTE);
-                    mutex_unlock(&pHddCtx->tdls_lock);
-
                     INIT_COMPLETION(pAdapter->tdls_del_station_comp);
 
-                    status = sme_DeleteTdlsPeerSta(
-                                WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                pAdapter->sessionId, peer );
-                    if (status != VOS_STATUS_SUCCESS) {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA"));
-                    }
+                    sme_DeleteTdlsPeerSta( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                            pAdapter->sessionId, peer );
 
                     status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp,
                               msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA));
-
-                    mutex_lock(&pHddCtx->tdls_lock);
-                    pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
-                    if ( NULL == pTdlsPeer ) {
-                        mutex_unlock(&pHddCtx->tdls_lock);
-                        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR
-                                " peer was freed in other context",
-                                __func__, MAC_ADDR_ARRAY(peer));
-                        return -EINVAL;
-                    }
-
                     wlan_hdd_tdls_set_peer_link_status(pTdlsPeer,
                                                        eTDLS_LINK_IDLE,
                                                        eTDLS_LINK_UNSPECIFIED);
-                    mutex_unlock(&pHddCtx->tdls_lock);
-
                     if (status <= 0)
                     {
                         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -18445,77 +14282,12 @@
                                   __func__, status);
                         return -EPERM;
                     }
-
-                    /* TDLS Off Channel, Enable tdls channel switch,
-                       when their is only one tdls link and it supports */
-                    numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter);
-                    if (numCurrTdlsPeers == 1)
-                    {
-                        tSirMacAddr peerMac;
-                        int channel;
-
-                        mutex_lock(&pHddCtx->tdls_lock);
-                        connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter);
-
-                        if (connPeer == NULL) {
-                            mutex_unlock(&pHddCtx->tdls_lock);
-                            hddLog(VOS_TRACE_LEVEL_ERROR,
-                                    "%s connPeer is NULL", __func__);
-                            return -EINVAL;
-                        }
-
-                        vos_mem_copy(peerMac, connPeer->peerMac, sizeof(tSirMacAddr));
-                        channel = connPeer->peerParams.channel;
-
-                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                                "%s: TDLS channel switch "
-                                "isOffChannelSupported %d "
-                                "isOffChannelConfigured %d "
-                                "isOffChannelEstablished %d",
-                                __func__,
-                                (connPeer ? connPeer->isOffChannelSupported : -1),
-                                (connPeer ? connPeer->isOffChannelConfigured : -1),
-                                (connPeer ? connPeer->isOffChannelEstablished : -1));
-
-                        if ((connPeer) &&
-                            (connPeer->isOffChannelSupported == TRUE) &&
-                            (connPeer->isOffChannelConfigured == TRUE))
-                        {
-                            connPeer->isOffChannelEstablished = TRUE;
-                            mutex_unlock(&pHddCtx->tdls_lock);
-                            status = sme_SendTdlsChanSwitchReq(
-                                         WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                         pAdapter->sessionId,
-                                         peerMac,
-                                         channel,
-                                         TDLS_OFF_CHANNEL_BW_OFFSET,
-                                         TDLS_CHANNEL_SWITCH_ENABLE);
-                            if (status != VOS_STATUS_SUCCESS) {
-                                hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel req"));
-                            }
-                        }
-                        else
-                            mutex_unlock(&pHddCtx->tdls_lock);
-                   }
-                    else
-                    {
-                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                                  "%s: TDLS channel switch request not sent "
-                                  "numCurrTdlsPeers %d ",
-                                  __func__, numCurrTdlsPeers);
-                    }
                 }
                 else
                 {
-                    mutex_unlock(&pHddCtx->tdls_lock);
                     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                               "%s: TDLS Peer Station doesn't exist.", __func__);
                 }
-                if (numCurrTdlsPeers == 0) {
-                   /* start TCP delack timer if TDLS is disable  */
-                    clear_bit(WLAN_TDLS_MODE, &pHddCtx->mode);
-                    hdd_manage_delack_timer(pHddCtx);
-                }
             }
             break;
         case NL80211_TDLS_TEARDOWN:
@@ -18525,7 +14297,7 @@
                 if (0 != status)
                 {
                     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                               FL("Error in TDLS Teardown"));
+                               "%s: Error in TDLS Teardown", __func__);
                     return status;
                 }
                 break;
@@ -18534,13 +14306,12 @@
             {
                 status = wlan_hdd_tdls_extctrl_config_peer(pAdapter,
                                                            peer,
-                                                           NULL,
                                                            NULL);
 
                 if (0 != status)
                 {
                     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                               FL("Error in TDLS Setup"));
+                               "%s: Error in TDLS Setup", __func__);
                     return status;
                 }
                 break;
@@ -18548,7 +14319,7 @@
         case NL80211_TDLS_DISCOVERY_REQ:
             /* We don't support in-driver setup/teardown/discovery */
              VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
-                 "%s: Driver doesn't support in-driver setup/teardown/discovery "
+                 "%s: We don't support in-driver setup/teardown/discovery "
                  ,__func__);
             return -ENOTSUPP;
         default:
@@ -18556,18 +14327,11 @@
                 "%s: unsupported event",__func__);
             return -ENOTSUPP;
     }
-
-    EXIT();
     return 0;
 }
 
 static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                       const u8 *peer,
-#else
-                                       u8 *peer,
-#endif
-                                       enum nl80211_tdls_operation oper)
+                 u8 *peer, enum nl80211_tdls_operation oper)
 {
     int ret;
 
@@ -18584,24 +14348,14 @@
     hddLog(VOS_TRACE_LEVEL_INFO,
            "tdls send discover req: "MAC_ADDRESS_STR,
            MAC_ADDR_ARRAY(peer));
+
 #if TDLS_MGMT_VERSION2
     return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer,
                             WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0);
 #else
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0))
-    return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer,
-                            WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, 0, NULL, 0);
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
-    return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer,
-                            WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0);
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
-    return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer,
-                            WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0);
-#else
     return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer,
                             WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0);
 #endif
-#endif /* KERNEL_VERSION */
 }
 #endif
 
@@ -18683,6 +14437,7 @@
 
     ENTER();
 
+
     if (NULL == pAdapter)
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
@@ -18695,8 +14450,11 @@
                      pAdapter->sessionId, pAdapter->device_mode));
 
     result = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != result)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return result;
     }
 
@@ -18767,7 +14525,6 @@
     vos_mem_zero(&hddGtkOffloadReqParams,
                   sizeof(hddGtkOffloadReqParams));
 
-    EXIT();
     return eHAL_STATUS_SUCCESS;
 }
 
@@ -18784,12 +14541,11 @@
 }
 #endif /*WLAN_FEATURE_GTK_OFFLOAD*/
 /*
- * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl
+ * FUNCTION: wlan_hdd_cfg80211_set_mac_acl
  * This function is used to set access control policy
  */
-static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy,
-                                         struct net_device *dev,
-                                         const struct cfg80211_acl_data *params)
+static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy,
+                struct net_device *dev, const struct cfg80211_acl_data *params)
 {
     int i;
     hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
@@ -18817,8 +14573,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -18834,9 +14593,6 @@
 
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d"
              "no acl entries = %d", params->acl_policy, params->n_acl_entries);
-    MTRACE(vos_trace(VOS_MODULE_ID_HDD,
-                     TRACE_CODE_HDD_CFG80211_SET_MAC_ACL,
-                     pAdapter->sessionId, pAdapter->device_mode));
 
     if (WLAN_HDD_SOFTAP == pAdapter->device_mode)
     {
@@ -18914,22 +14670,9 @@
         return -EINVAL;
     }
 
-    EXIT();
     return 0;
 }
 
-static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy,
-                                         struct net_device *dev,
-                                         const struct cfg80211_acl_data *params)
-{
-    int ret;
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 #ifdef WLAN_NL80211_TESTMODE
 #ifdef FEATURE_WLAN_LPHB
 void wlan_hdd_cfg80211_lphb_ind_handler
@@ -19010,12 +14753,11 @@
 #ifdef FEATURE_WLAN_LPHB
     hdd_context_t *pHddCtx = wiphy_priv(wiphy);
     eHalStatus smeStatus;
-
-    ENTER();
-
     err = wlan_hdd_validate_context(pHddCtx);
     if (0 != err)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return err;
     }
 #endif /* FEATURE_WLAN_LPHB */
@@ -19035,9 +14777,6 @@
         return -EINVAL;
     }
 
-    MTRACE(vos_trace(VOS_MODULE_ID_HDD,
-                     TRACE_CODE_HDD_CFG80211_TESTMODE,
-                     NO_SESSION, nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])));
     switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD]))
     {
 #ifdef FEATURE_WLAN_LPHB
@@ -19091,15 +14830,10 @@
             return -EOPNOTSUPP;
     }
 
-    EXIT();
-    return err;
+   return err;
 }
 
-static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
-                                      struct wireless_dev *wdev,
-#endif
-                                      void *data, int len)
+static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len)
 {
    int ret;
 
@@ -19141,8 +14875,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -19164,21 +14901,11 @@
         return -ENONET;
     }
 
-    if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                 "%s: Roaming in progress, hence return ", __func__);
-        return -ENONET;
-    }
-
     halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter);
 
     wlan_hdd_get_snr(pAdapter, &snr);
     wlan_hdd_get_rssi(pAdapter, &rssi);
 
-    MTRACE(vos_trace(VOS_MODULE_ID_HDD,
-                     TRACE_CODE_HDD_CFG80211_DUMP_SURVEY,
-                     pAdapter->sessionId, pAdapter->device_mode));
     sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId);
     hdd_wlan_get_freq(channel, &freq);
 
@@ -19219,7 +14946,6 @@
         return -ENONET;
      }
 
-     EXIT();
      return 0;
 }
 
@@ -19250,13 +14976,27 @@
 
     ENTER();
 
-    if (0 != wlan_hdd_validate_context(pHddCtx))
+    if ( NULL == pHddCtx )
     {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+              "%s: HddCtx validation failed", __func__);
         return 0;
     }
 
-    MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_CFG80211_RESUME_WLAN,
-                     NO_SESSION, pHddCtx->isWiphySuspended));
+    if (pHddCtx->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "%s: LOGP in Progress. Ignore!!!", __func__);
+        return 0;
+    }
+
+    if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "%s: Unloading/Loading in Progress. Ignore!!!", __func__);
+        return 0;
+    }
+
     spin_lock(&pHddCtx->schedScan_lock);
     pHddCtx->isWiphySuspended = FALSE;
     if (TRUE != pHddCtx->isSchedScanUpdatePending)
@@ -19270,6 +15010,7 @@
     pHddCtx->isSchedScanUpdatePending = FALSE;
     spin_unlock(&pHddCtx->schedScan_lock);
 
+
     status =  hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
 
     while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
@@ -19290,15 +15031,13 @@
                  * results in app's is in suspended state and not able to
                  * process the connect request to AP
                  */
-                hdd_prevent_suspend_timeout(2000,
-                                    WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN);
+                hdd_prevent_suspend_timeout(2000);
                 cfg80211_sched_scan_results(pHddCtx->wiphy);
             }
 
             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                     "%s : cfg80211 scan result database updated", __func__);
 
-            EXIT();
             return 0;
 
         }
@@ -19308,7 +15047,6 @@
 
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
           "%s: Failed to find Adapter", __func__);
-    EXIT();
     return 0;
 }
 
@@ -19334,17 +15072,15 @@
     int ret = 0;
 
     ENTER();
-
     ret = wlan_hdd_validate_context(pHddCtx);
     if (0 != ret)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return ret;
     }
 
 
-    MTRACE(vos_trace(VOS_MODULE_ID_HDD,
-                     TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN,
-                     NO_SESSION, pHddCtx->isWiphySuspended));
     pHddCtx->isWiphySuspended = TRUE;
 
     EXIT();
@@ -19363,109 +15099,6 @@
 
     return ret;
 }
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-static void wlan_hdd_cfg80211_oem_data_rsp_ind_new(void *ctx,
-                                   void *pMsg, tANI_U32 evLen)
-{
-    hdd_context_t *pHddCtx         = (hdd_context_t *)ctx;
-
-    ENTER();
-
-    if (wlan_hdd_validate_context(pHddCtx)) {
-        return;
-    }
-    if (!pMsg)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null"));
-        return;
-    }
-
-    send_oem_data_rsp_msg(evLen, pMsg);
-
-    EXIT();
-    return;
-
-}
-
-void wlan_hdd_cfg80211_oemdata_callback(void *ctx, const tANI_U16 evType,
-                                      void *pMsg,  tANI_U32 evLen)
-{
-    hdd_context_t *pHddCtx = (hdd_context_t *)ctx;
-
-    ENTER();
-
-    if (wlan_hdd_validate_context(pHddCtx)) {
-        return;
-    }
-
-    hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d) evLen %d"), evType, evLen);
-
-    switch(evType) {
-    case SIR_HAL_START_OEM_DATA_RSP_IND_NEW:
-        wlan_hdd_cfg80211_oem_data_rsp_ind_new(ctx, pMsg, evLen);
-        break;
-    default:
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType);
-        break;
-    }
-    EXIT();
-}
-#endif
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)) || \
-    defined(CFG80211_ABORT_SCAN)
-/**
- * __wlan_hdd_cfg80211_abort_scan() - cfg80211 abort scan api
- * @wiphy: Pointer to wiphy
- * @wdev: Pointer to wireless device structure
- *
- * This function is used to abort an ongoing scan
- *
- * Return: None
- */
-static void __wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy,
-                                           struct wireless_dev *wdev)
-{
-    struct net_device *dev = wdev->netdev;
-    hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
-    int ret;
-
-    ENTER();
-
-    if (NULL == adapter) {
-        hddLog(VOS_TRACE_LEVEL_FATAL, FL("HDD adapter is NULL"));
-        return;
-    }
-
-    ret = wlan_hdd_validate_context(hdd_ctx);
-    if (0 != ret)
-        return;
-
-    wlan_hdd_scan_abort(adapter);
-
-    return;
-}
-
-/**
- * wlan_hdd_cfg80211_abort_scan - cfg80211 abort scan api
- * @wiphy: Pointer to wiphy
- * @wdev: Pointer to wireless device structure
- *
- * Return: None
- */
-void wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy,
-                                  struct wireless_dev *wdev)
-{
-    vos_ssr_protect(__func__);
-    __wlan_hdd_cfg80211_abort_scan(wiphy, wdev);
-    vos_ssr_unprotect(__func__);
-
-    return;
-}
-#endif
-
 /* cfg80211_ops */
 static struct cfg80211_ops wlan_hdd_cfg80211_ops =
 {
@@ -19536,9 +15169,5 @@
      .testmode_cmd = wlan_hdd_cfg80211_testmode,
 #endif
      .dump_survey = wlan_hdd_cfg80211_dump_survey,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)) || \
-    defined(CFG80211_ABORT_SCAN)
-     .abort_scan = wlan_hdd_cfg80211_abort_scan,
-#endif
 };
 
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_debugfs.c b/wlan/prima/CORE/HDD/src/wlan_hdd_debugfs.c
index b53edcc..52b6a61 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_debugfs.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_debugfs.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -28,36 +28,28 @@
 #ifdef WLAN_OPEN_SOURCE
 #include <wlan_hdd_includes.h>
 #include <wlan_hdd_wowl.h>
-#include <vos_sched.h>
 
 #define MAX_USER_COMMAND_SIZE_WOWL_ENABLE 8
 #define MAX_USER_COMMAND_SIZE_WOWL_PATTERN 512
 #define MAX_USER_COMMAND_SIZE_FRAME 4096
 
-static ssize_t __wcnss_wowenable_write(struct file *file,
+static ssize_t wcnss_wowenable_write(struct file *file,
                const char __user *buf, size_t count, loff_t *ppos)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = (hdd_adapter_t *)file->private_data;
+
     char cmd[MAX_USER_COMMAND_SIZE_WOWL_ENABLE + 1];
     char *sptr, *token;
     v_U8_t wow_enable = 0;
     v_U8_t wow_mp = 0;
     v_U8_t wow_pbm = 0;
 
-    ENTER();
-
-    pAdapter = (hdd_adapter_t *)file->private_data;
     if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
                   "%s: Invalid adapter or adapter has invalid magic.",
                   __func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    if (0 != wlan_hdd_validate_context(pHddCtx))
-    {
+
         return -EINVAL;
     }
 
@@ -130,27 +122,15 @@
 
       return -EFAULT;
     }
-    EXIT();
+
     return count;
 }
 
-static ssize_t wcnss_wowenable_write(struct file *file,
+static ssize_t wcnss_wowpattern_write(struct file *file,
                const char __user *buf, size_t count, loff_t *ppos)
 {
-    ssize_t ret;
+    hdd_adapter_t *pAdapter = (hdd_adapter_t *)file->private_data;
 
-    vos_ssr_protect(__func__);
-    ret = __wcnss_wowenable_write(file, buf, count, ppos);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-static ssize_t __wcnss_wowpattern_write(struct file *file,
-               const char __user *buf, size_t count, loff_t *ppos)
-{
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
     char cmd[MAX_USER_COMMAND_SIZE_WOWL_PATTERN + 1];
     char *sptr, *token;
     v_U8_t pattern_idx = 0;
@@ -158,9 +138,6 @@
     char *pattern_buf;
     char *pattern_mask;
 
-    ENTER();
-
-    pAdapter = (hdd_adapter_t *)file->private_data;
     if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
@@ -169,11 +146,7 @@
 
         return -EINVAL;
     }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    if (0 != wlan_hdd_validate_context(pHddCtx))
-    {
-        return -EINVAL;
-    }
+
     if (!sme_IsFeatureSupportedByFW(WOW))
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -236,29 +209,18 @@
 
     hdd_add_wowl_ptrn_debugfs(pAdapter, pattern_idx, pattern_offset,
                               pattern_buf, pattern_mask);
-    EXIT();
+
     return count;
 }
 
-static ssize_t wcnss_wowpattern_write(struct file *file,
+static ssize_t wcnss_patterngen_write(struct file *file,
                const char __user *buf, size_t count, loff_t *ppos)
 {
-    ssize_t ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wcnss_wowpattern_write(file, buf, count, ppos);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-static ssize_t __wcnss_patterngen_write(struct file *file,
-               const char __user *buf, size_t count, loff_t *ppos)
-{
-    hdd_adapter_t *pAdapter;
+    hdd_adapter_t *pAdapter = (hdd_adapter_t *)file->private_data;
     hdd_context_t *pHddCtx;
     tSirAddPeriodicTxPtrn *addPeriodicTxPtrnParams;
     tSirDelPeriodicTxPtrn *delPeriodicTxPtrnParams;
+
     char *cmd, *sptr, *token;
     v_U8_t pattern_idx = 0;
     v_U8_t pattern_duration = 0;
@@ -266,9 +228,6 @@
     v_U16_t pattern_len = 0;
     v_U16_t i = 0;
 
-    ENTER();
-
-    pAdapter = (hdd_adapter_t *)file->private_data;
     if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
@@ -277,11 +236,8 @@
 
         return -EINVAL;
     }
+
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    if (0 != wlan_hdd_validate_context(pHddCtx))
-    {
-        return -EINVAL;
-    }
 
     if (!sme_IsFeatureSupportedByFW(WLAN_PERIODIC_TX_PTRN))
     {
@@ -455,7 +411,6 @@
 
     vos_mem_free(addPeriodicTxPtrnParams);
     vos_mem_free(cmd);
-    EXIT();
     return count;
 
 failure:
@@ -463,59 +418,16 @@
     return -EINVAL;
 }
 
-static ssize_t wcnss_patterngen_write(struct file *file,
-               const char __user *buf, size_t count, loff_t *ppos)
+static int wcnss_debugfs_open(struct inode *inode, struct file *file)
 {
-    ssize_t ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wcnss_patterngen_write(file, buf, count, ppos);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-
-}
-
-static int __wcnss_debugfs_open(struct inode *inode, struct file *file)
-{
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-
-    ENTER();
-
-    pAdapter = (hdd_adapter_t *)file->private_data;
-    if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
-                   "%s: Invalid adapter or adapter has invalid magic.",
-                   __func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    if (0 != wlan_hdd_validate_context(pHddCtx))
-    {
-        return -EINVAL;
-    }
-
     if (inode->i_private)
     {
         file->private_data = inode->i_private;
     }
-    EXIT();
+
     return 0;
 }
 
-static int wcnss_debugfs_open(struct inode *inode, struct file *file)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __wcnss_debugfs_open(inode, file);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 static const struct file_operations fops_wowenable = {
     .write = wcnss_wowenable_write,
     .open = wcnss_debugfs_open,
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_dev_pwr.c b/wlan/prima/CORE/HDD/src/wlan_hdd_dev_pwr.c
index 17d0647..afacf5f 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_dev_pwr.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_dev_pwr.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -47,7 +47,6 @@
  * Include Files
  * -------------------------------------------------------------------------*/
 #include <wlan_hdd_dev_pwr.h>
-#include <vos_sched.h>
 #ifdef ANI_BUS_TYPE_PLATFORM
 #include <linux/wcnss_wlan.h>
 #else
@@ -94,31 +93,6 @@
 #endif
 
 
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-/**
- * hdd_wlan_suspend_resume_event()- send suspend/resume state
- *
- * @state: suspend/resume state
- *
- * This Function send send suspend resume state diag event
- *
- * Return: void.
- */
-void hdd_wlan_suspend_resume_event(uint8_t state)
-{
-   WLAN_VOS_DIAG_EVENT_DEF(suspend_state,
-                     struct vos_event_suspend);
-   vos_mem_zero( &suspend_state,
-                        sizeof(suspend_state));
-
-   suspend_state.state= state;
-   WLAN_VOS_DIAG_EVENT_REPORT(&suspend_state,
-                      EVENT_WLAN_SUSPEND_RESUME);
-
-}
-#endif
-
-
 /*----------------------------------------------------------------------------
 
    @brief Function to suspend the wlan driver.
@@ -143,33 +117,13 @@
       VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_FATAL,"%s: Global VOS_SCHED context is Null",__func__);
       return 0;
    }
-
-   if (!pHddCtx->last_suspend_success)
-     pHddCtx->last_suspend_success = vos_timer_get_system_time();
-
-   if (!vos_is_apps_power_collapse_allowed(pHddCtx))
+   if(!vos_is_apps_power_collapse_allowed(pHddCtx))
    {
        /* Fail this suspend */
-       pHddCtx->continuous_suspend_fail_cnt++;
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-        FL("Fail wlan suspend: not in IMPS/BMPS, continuous Failcnt %d"),
-        pHddCtx->continuous_suspend_fail_cnt);
-
-       /* call fatal event if power collapse fails for
-        * WLAN_POWER_COLLAPSE_FAIL_THRESHOLD time.
-        */
-       if ((vos_timer_get_system_time() - pHddCtx->last_suspend_success) >=
-                                         WLAN_POWER_COLLAPSE_FAIL_THRESHOLD)
-       {
-          pHddCtx->last_suspend_success = 0;
-          vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                      WLAN_LOG_INDICATOR_HOST_DRIVER,
-                      WLAN_LOG_REASON_POWER_COLLAPSE_FAIL,
-                      FALSE, TRUE);
-       }
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Fail wlan suspend: not in IMPS/BMPS", __func__);
        return -EPERM;
    }
-   pHddCtx->continuous_suspend_fail_cnt = 0;
+
    /*
      Suspending MC Thread, Rx Thread and Tx Thread as the platform driver is going to Suspend.     
    */
@@ -178,7 +132,7 @@
    INIT_COMPLETION(pHddCtx->tx_sus_event_var);
 
    /* Indicate Tx Thread to Suspend */
-   set_bit(TX_SUSPEND_EVENT, &vosSchedContext->txEventFlag);
+   set_bit(TX_SUSPEND_EVENT_MASK, &vosSchedContext->txEventFlag);
 
    wake_up_interruptible(&vosSchedContext->txWaitQueue);
 
@@ -196,25 +150,14 @@
        * Thread then it means it is going to suspend, so do not return failure
        * from here.
        */
-      if (!test_and_clear_bit(TX_SUSPEND_EVENT,
+      if (!test_and_clear_bit(TX_SUSPEND_EVENT_MASK,
                               &vosSchedContext->txEventFlag))
       {
          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                    "%s: TX Thread: will still suspend", __func__);
          goto tx_suspend;
       }
-      /* call fatal event if suspend for
-       * WLAN_POWER_COLLAPSE_FAIL_THRESHOLD time.
-       */
-      if ((vos_timer_get_system_time() - pHddCtx->last_suspend_success) >=
-                                         WLAN_POWER_COLLAPSE_FAIL_THRESHOLD)
-      {
-          pHddCtx->last_suspend_success = 0;
-          vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                      WLAN_LOG_INDICATOR_HOST_DRIVER,
-                      WLAN_LOG_REASON_POWER_COLLAPSE_FAIL,
-                      FALSE, TRUE);
-      }
+
       return -ETIME;
    }
 
@@ -225,7 +168,7 @@
    INIT_COMPLETION(pHddCtx->rx_sus_event_var);
 
    /* Indicate Rx Thread to Suspend */
-   set_bit(RX_SUSPEND_EVENT, &vosSchedContext->rxEventFlag);
+   set_bit(RX_SUSPEND_EVENT_MASK, &vosSchedContext->rxEventFlag);
 
    wake_up_interruptible(&vosSchedContext->rxWaitQueue);
 
@@ -242,7 +185,7 @@
         * Thread then it means it is going to suspend, so do not return failure
         * from here.
         */
-       if (!test_and_clear_bit(RX_SUSPEND_EVENT,
+       if (!test_and_clear_bit(RX_SUSPEND_EVENT_MASK,
                                &vosSchedContext->rxEventFlag))
        {
            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -255,18 +198,6 @@
 
        /* Set the Tx Thread as Resumed */
        pHddCtx->isTxThreadSuspended = FALSE;
-      /* call fatal event if suspend for
-       * WLAN_POWER_COLLAPSE_FAIL_THRESHOLD time.
-       */
-      if ((vos_timer_get_system_time() - pHddCtx->last_suspend_success) >=
-                                         WLAN_POWER_COLLAPSE_FAIL_THRESHOLD)
-      {
-          pHddCtx->last_suspend_success = 0;
-          vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                      WLAN_LOG_INDICATOR_HOST_DRIVER,
-                      WLAN_LOG_REASON_POWER_COLLAPSE_FAIL,
-                      FALSE, TRUE);
-      }
 
        return -ETIME;
    }
@@ -278,15 +209,14 @@
    INIT_COMPLETION(pHddCtx->mc_sus_event_var);
 
    /* Indicate MC Thread to Suspend */
-   set_bit(MC_SUSPEND_EVENT, &vosSchedContext->mcEventFlag);
+   set_bit(MC_SUSPEND_EVENT_MASK, &vosSchedContext->mcEventFlag);
 
    wake_up_interruptible(&vosSchedContext->mcWaitQueue);
 
    /* Wait for Suspend Confirmation from MC Thread */
-   rc = wait_for_completion_interruptible_timeout(&pHddCtx->mc_sus_event_var,
-                                                        msecs_to_jiffies(200));
+   rc = wait_for_completion_interruptible_timeout(&pHddCtx->mc_sus_event_var, msecs_to_jiffies(200));
 
-   if (rc <= 0)
+   if(!rc)
    {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
             "%s: MC Thread: timeout while suspending %ld",
@@ -297,7 +227,7 @@
         * Thread then it means it is going to suspend, so do not return failure
         * from here.
         */
-       if (!test_and_clear_bit(MC_SUSPEND_EVENT,
+       if (!test_and_clear_bit(MC_SUSPEND_EVENT_MASK,
                                &vosSchedContext->mcEventFlag))
        {
            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -317,19 +247,6 @@
        /* Set the Tx Thread as Resumed */
        pHddCtx->isTxThreadSuspended = FALSE;
 
-      /* call fatal event if suspend for
-       * WLAN_POWER_COLLAPSE_FAIL_THRESHOLD time.
-       */
-      if ((vos_timer_get_system_time() - pHddCtx->last_suspend_success) >=
-                                         WLAN_POWER_COLLAPSE_FAIL_THRESHOLD)
-      {
-          pHddCtx->last_suspend_success = 0;
-          vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                      WLAN_LOG_INDICATOR_HOST_DRIVER,
-                      WLAN_LOG_REASON_POWER_COLLAPSE_FAIL,
-                      FALSE, TRUE);
-      }
-
        return -ETIME;
    }
 
@@ -339,8 +256,7 @@
    
    /* Set the Station state as Suspended */
    pHddCtx->isWlanSuspended = TRUE;
-   pHddCtx->last_suspend_success = 0;
-   hdd_wlan_suspend_resume_event(HDD_WLAN_SUSPEND);
+
    return 0;
 }
 
@@ -392,7 +308,6 @@
 
    /* Set the Station state as Suspended */
    pHddCtx->isWlanSuspended = FALSE;
-   hdd_wlan_suspend_resume_event(HDD_WLAN_RESUME);
 }
 
 /*----------------------------------------------------------------------------
@@ -406,21 +321,21 @@
    @return None
 
 ----------------------------------------------------------------------------*/
-int __hddDevSuspendHdlr(struct device *dev)
+int hddDevSuspendHdlr(struct device *dev)
 {
    int ret = 0;
    hdd_context_t* pHddCtx = NULL;
 
-   ENTER();
-
    pHddCtx =  (hdd_context_t*)wcnss_wlan_get_drvdata(dev);
 
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: WLAN suspended by platform driver",__func__);
+
    /* Get the HDD context */
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
+   if(!pHddCtx) {
+      VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
+      return 0;
    }
+
    if(pHddCtx->isWlanSuspended == TRUE)
    {
       VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_FATAL,"%s: WLAN is already in suspended state",__func__);
@@ -442,21 +357,9 @@
       suspend_notify_sent = true;
    }
 #endif
-
-   EXIT();
    return 0;
 }
 
-int hddDevSuspendHdlr(struct device *dev)
-{
-    int ret;
-    vos_ssr_protect(__func__);
-    ret = __hddDevSuspendHdlr(dev);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 /*----------------------------------------------------------------------------
 
    @brief Function to resume the wlan driver.
@@ -468,19 +371,14 @@
    @return None
 
 ----------------------------------------------------------------------------*/
-int __hddDevResumeHdlr(struct device *dev)
+int hddDevResumeHdlr(struct device *dev)
 {
    hdd_context_t* pHddCtx = NULL;
-   int ret = 0;
-
-   ENTER();
 
    pHddCtx =  (hdd_context_t*)wcnss_wlan_get_drvdata(dev);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
+
+   VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, "%s: WLAN being resumed by Android OS",__func__);
+
    if(pHddCtx->isWlanSuspended != TRUE)
    {
       VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_FATAL,"%s: WLAN is already in resumed state",__func__);
@@ -496,21 +394,10 @@
       suspend_notify_sent = false;
    }
 #endif
-   EXIT();
+
    return 0;
 }
 
-int hddDevResumeHdlr(struct device *dev)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __hddDevResumeHdlr(dev);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 static const struct dev_pm_ops pm_ops = {
    .suspend = hddDevSuspendHdlr,
    .resume = hddDevResumeHdlr,
@@ -532,7 +419,9 @@
 ----------------------------------------------------------------------------*/
 VOS_STATUS hddRegisterPmOps(hdd_context_t *pHddCtx)
 {
+#ifndef FEATURE_R33D
     wcnss_wlan_register_pm_ops(pHddCtx->parent_dev, &pm_ops);
+#endif /* FEATURE_R33D */
     return VOS_STATUS_SUCCESS;
 }
 
@@ -551,7 +440,9 @@
 ----------------------------------------------------------------------------*/
 VOS_STATUS hddDeregisterPmOps(hdd_context_t *pHddCtx)
 {
+#ifndef FEATURE_R33D
     wcnss_wlan_unregister_pm_ops(pHddCtx->parent_dev, &pm_ops);
+#endif /* FEATURE_R33D */
     return VOS_STATUS_SUCCESS;
 }
 
@@ -570,19 +461,21 @@
 {
    hdd_context_t        *pHddCtx = (hdd_context_t *)usrData;
    hdd_adapter_t        *staAdapater;
-
-   ENTER();
-   if (0 != (wlan_hdd_validate_context(pHddCtx)))
+   /* Sanity, This should not happen */
+   if(NULL == pHddCtx)
    {
-       return;
+      VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR,
+                "%s: NULL Context", __func__);
+      VOS_ASSERT(0);
+      return;
    }
 
    staAdapater = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION);
 
-   if ((NULL == staAdapater) || (WLAN_HDD_ADAPTER_MAGIC != staAdapater->magic))
+   if(NULL == staAdapater)
    {
       VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR,
-                FL("invalid Adapter %p"), staAdapater);
+                "%s: NULL Adapter", __func__);
       VOS_ASSERT(0);
       return;
    }
@@ -596,12 +489,11 @@
    pHddCtx->tmInfo.txFrameCount = 0;
 
    /* Resume TX flow */
-   hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
+    
    netif_tx_wake_all_queues(staAdapater->dev);
    pHddCtx->tmInfo.qBlocked = VOS_FALSE;
    mutex_unlock(&pHddCtx->tmInfo.tmOperationLock);
 
-   EXIT();
    return;
 }
 
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_dp_utils.c b/wlan/prima/CORE/HDD/src/wlan_hdd_dp_utils.c
index 7a18c4e..b1a9ecf 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_dp_utils.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_dp_utils.c
@@ -31,6 +31,9 @@
   \brief      Utility functions for data path module
   
   Description...
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
   
   ==============================================================================**/
 /* $HEADER$ */
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_early_suspend.c b/wlan/prima/CORE/HDD/src/wlan_hdd_early_suspend.c
index 85cdeae..d6c41b3 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_early_suspend.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_early_suspend.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -31,6 +31,9 @@
 *     \brief      power management functions
 *
 *     Description
+*                 Copyright 2009 (c) Qualcomm, Incorporated.
+*                 All Rights Reserved.
+*                 Qualcomm Confidential and Proprietary.
 *
 ==============================================================================**/
 /* $HEADER$ */
@@ -63,7 +66,6 @@
 #include <linux/semaphore.h>
 #include <wlan_hdd_hostapd.h>
 #include "cfgApi.h"
-#include <wlan_logging_sock_svc.h>
 
 #ifdef WLAN_BTAMP_FEATURE
 #include "bapApi.h"
@@ -106,32 +108,6 @@
 static struct timer_list ssr_timer;
 static bool ssr_timer_started;
 
-
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-/**
- * hdd_wlan_offload_event()- send offloads event
- *
- * @type: offload type
- * @state: enabled or disabled
- *
- * This Function send offloads enable/disable diag event
- *
- * Return: void.
- */
-
-void hdd_wlan_offload_event(uint8_t type, uint8_t state)
-{
-   WLAN_VOS_DIAG_EVENT_DEF(host_offload,
-                    struct vos_event_offload_req);
-   vos_mem_zero(&host_offload, sizeof(host_offload));
-
-   host_offload.offload_type = type;
-   host_offload.state = state;
-
-   WLAN_VOS_DIAG_EVENT_REPORT(&host_offload, EVENT_OFFLOAD_REQ);
-}
-#endif /* FEATURE_WLAN_DIAG_SUPPORT */
-
 //Callback invoked by PMC to report status of standby request
 void hdd_suspend_standby_cbk (void *callbackContext, eHalStatus status)
 {
@@ -335,7 +311,6 @@
    long ret;
 
    //Stop the Interface TX queue.
-   hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
    netif_tx_disable(pAdapter->dev);
    netif_carrier_off(pAdapter->dev);
 
@@ -399,8 +374,6 @@
        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: vos_stop return failed %d",
                 __func__, vosStatus);
        VOS_ASSERT(0);
-       if (isSsrPanicOnFailure())
-           VOS_BUG(0);
    }
 
    pHddCtx->hdd_ps_state = eHDD_SUSPEND_DEEP_SLEEP;
@@ -440,8 +413,6 @@
    {
       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
          "%s: Failed in vos_start",__func__);
-      if (isSsrPanicOnFailure())
-          VOS_BUG(0);
       goto err_deep_sleep;
    }
 
@@ -483,24 +454,20 @@
 
 }
 
-void __hdd_ipv6_notifier_work_queue(struct work_struct *work)
+void hdd_ipv6_notifier_work_queue(struct work_struct *work)
 {
     hdd_adapter_t* pAdapter =
              container_of(work, hdd_adapter_t, ipv6NotifierWorkQueue);
     hdd_context_t *pHddCtx;
     int status;
 
-    ENTER();
-    if (NULL == pAdapter)
-    {
-        hddLog(LOGE, FL("Adapter is invalid"));
-        return;
-    }
+    hddLog(LOG1, FL("Reconfiguring NS Offload"));
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(LOGE, FL("HDD context is invalid"));
         return;
     }
 
@@ -533,16 +500,12 @@
      */
     wlan_hdd_set_mc_addr_list(pAdapter, TRUE);
 #endif
-    EXIT();
+
+
 }
 
-void hdd_ipv6_notifier_work_queue(struct work_struct *work)
-{
-     vos_ssr_protect(__func__);
-     __hdd_ipv6_notifier_work_queue(work);
-     vos_ssr_unprotect(__func__);
-}
-int __wlan_hdd_ipv6_changed(struct notifier_block *nb,
+
+int wlan_hdd_ipv6_changed(struct notifier_block *nb,
                             unsigned long data, void *arg)
 {
     struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)arg;
@@ -552,11 +515,11 @@
     VOS_STATUS vos_status;
     int status;
 
-    ENTER();
     pHddCtx = container_of(nb, hdd_context_t, ipv6_notifier);
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(LOGE, FL("HDD context is invalid"));
         return NOTIFY_DONE;
     }
 
@@ -567,12 +530,6 @@
              (pAdapterNode->pAdapter->device_mode == WLAN_HDD_INFRA_STATION ||
               pAdapterNode->pAdapter->device_mode == WLAN_HDD_P2P_CLIENT))
         {
-
-            if (eConnectionState_Associated ==
-               WLAN_HDD_GET_STATION_CTX_PTR
-               (pAdapterNode->pAdapter)->conn_info.connState)
-                 sme_dhcp_done_ind(pHddCtx->hHal,
-                       pAdapterNode->pAdapter->sessionId);
             if (pHddCtx->cfg_ini->nEnableSuspend ==
                   WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER)
             {
@@ -588,18 +545,8 @@
         vos_status = hdd_get_next_adapter(pHddCtx, pAdapterNode, &pNext);
         pAdapterNode = pNext;
     }
-    EXIT();
-    return NOTIFY_DONE;
-}
 
-int wlan_hdd_ipv6_changed(struct notifier_block *nb,
-                            unsigned long data, void *arg)
-{
-    int ret;
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_ipv6_changed( nb, data, arg);
-    vos_ssr_unprotect(__func__);
-    return ret;
+    return NOTIFY_DONE;
 }
 
 /*
@@ -761,8 +708,11 @@
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
     ret = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != ret)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   FL("HDD context is not valid"));
         return;
     }
 
@@ -894,8 +844,6 @@
                                                           SIR_IPV6_ADDR_VALID;
                     offLoadRequest.offloadType =  SIR_IPV6_NS_OFFLOAD;
                     offLoadRequest.enableOrDisable = SIR_OFFLOAD_ENABLE;
-                    hdd_wlan_offload_event(SIR_IPV6_NS_OFFLOAD,
-                                                     SIR_OFFLOAD_ENABLE);
 
                     hddLog (VOS_TRACE_LEVEL_INFO,
                        FL("configuredMcastBcastFilter: %d"
@@ -917,9 +865,7 @@
                                 FL("Set offLoadRequest with %d"),
                                    offLoadRequest.enableOrDisable);
                     }
-                    hdd_wlan_offload_event(
-                                  SIR_OFFLOAD_NS_AND_MCAST_FILTER_ENABLE,
-                                  SIR_OFFLOAD_ENABLE);
+
                     vos_mem_copy(&offLoadRequest.params.hostIpv6Addr,
                                 &offLoadRequest.nsOffloadInfo.targetIPv6Addr[0],
                                 sizeof(tANI_U8)*SIR_MAC_IPV6_ADDR_LEN);
@@ -956,8 +902,6 @@
         vos_mem_zero((void *)&offLoadRequest, sizeof(tSirHostOffloadReq));
         offLoadRequest.enableOrDisable = SIR_OFFLOAD_DISABLE;
         offLoadRequest.offloadType =  SIR_IPV6_NS_OFFLOAD;
-        hdd_wlan_offload_event(SIR_IPV6_NS_OFFLOAD,
-                                           SIR_OFFLOAD_DISABLE);
 
         for (i = 0; i < slot_index; i++)
         {
@@ -985,28 +929,23 @@
     {
        vos_mem_free(selfIPv6AddrValid);
     }
-    EXIT();
     return;
 }
 #endif
 
-void __hdd_ipv4_notifier_work_queue(struct work_struct *work)
+void hdd_ipv4_notifier_work_queue(struct work_struct *work)
 {
     hdd_adapter_t* pAdapter =
              container_of(work, hdd_adapter_t, ipv4NotifierWorkQueue);
     hdd_context_t *pHddCtx;
     int status;
 
-    ENTER();
-    if (NULL == pAdapter)
-    {
-        hddLog(LOGE, FL("Adapter is invalid"));
-        return;
-    }
+    hddLog(LOG1, FL("Reconfiguring ARP Offload"));
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(LOGE, FL("HDD context is invalid"));
         return;
     }
 
@@ -1028,17 +967,9 @@
         // of IPv4 notifier again.
         hdd_conf_arp_offload(pAdapter, 2);
     }
-    EXIT();
 }
 
-void hdd_ipv4_notifier_work_queue(struct work_struct *work)
-{
-    vos_ssr_protect(__func__);
-    __hdd_ipv4_notifier_work_queue(work);
-    vos_ssr_unprotect(__func__);
-}
-
-int __wlan_hdd_ipv4_changed(struct notifier_block *nb,
+int wlan_hdd_ipv4_changed(struct notifier_block *nb,
                             unsigned long data, void *arg)
 {
     struct in_ifaddr *ifa = (struct in_ifaddr *)arg;
@@ -1051,11 +982,11 @@
     VOS_STATUS vos_status;
     int status;
 
-    ENTER();
     pHddCtx = container_of(nb, hdd_context_t, ipv4_notifier);
     status = wlan_hdd_validate_context(pHddCtx);
     if (0 != status)
     {
+        hddLog(LOGE, FL("HDD context is invalid"));
         return NOTIFY_DONE;
     }
 
@@ -1066,12 +997,6 @@
              (pAdapterNode->pAdapter->device_mode == WLAN_HDD_INFRA_STATION ||
               pAdapterNode->pAdapter->device_mode == WLAN_HDD_P2P_CLIENT))
         {
-
-            if (eConnectionState_Associated ==
-               WLAN_HDD_GET_STATION_CTX_PTR
-               (pAdapterNode->pAdapter)->conn_info.connState)
-                 sme_dhcp_done_ind(pHddCtx->hHal,
-                       pAdapterNode->pAdapter->sessionId);
             if ((pHddCtx->cfg_ini->nEnableSuspend !=
                   WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER)
                || (!pHddCtx->cfg_ini->fhostArpOffload))
@@ -1104,18 +1029,8 @@
         vos_status = hdd_get_next_adapter(pHddCtx, pAdapterNode, &pNext);
         pAdapterNode = pNext;
     }
-    EXIT();
-    return NOTIFY_DONE;
-}
 
-int wlan_hdd_ipv4_changed(struct notifier_block *nb,
-                            unsigned long data, void *arg)
-{
-    int ret;
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_ipv4_changed( nb, data, arg);
-    vos_ssr_unprotect(__func__);
-    return ret;
+    return NOTIFY_DONE;
 }
 
 /**----------------------------------------------------------------------------
@@ -1143,7 +1058,7 @@
    tSirHostOffloadReq  offLoadRequest;
    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-   hddLog(VOS_TRACE_LEVEL_INFO, FL(" fenable = %d "), fenable);
+   hddLog(VOS_TRACE_LEVEL_INFO, FL(" fenable = %d \n"), fenable);
 
    if(fenable)
    {
@@ -1162,8 +1077,6 @@
        {
            offLoadRequest.offloadType =  SIR_IPV4_ARP_REPLY_OFFLOAD;
            offLoadRequest.enableOrDisable = SIR_OFFLOAD_ENABLE;
-           hdd_wlan_offload_event(SIR_IPV4_ARP_REPLY_OFFLOAD,
-                                           SIR_OFFLOAD_ENABLE);
 
            hddLog(VOS_TRACE_LEVEL_INFO, "%s: Enabled", __func__);
 
@@ -1178,8 +1091,6 @@
                hddLog(VOS_TRACE_LEVEL_INFO,
                       "offload: inside arp offload conditional check");
            }
-           hdd_wlan_offload_event(SIR_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE,
-                                           SIR_OFFLOAD_ENABLE);
 
            hddLog(VOS_TRACE_LEVEL_INFO, "offload: arp filter programmed = %d",
                   offLoadRequest.enableOrDisable);
@@ -1218,8 +1129,7 @@
        vos_mem_zero((void *)&offLoadRequest, sizeof(tSirHostOffloadReq));
        offLoadRequest.enableOrDisable = SIR_OFFLOAD_DISABLE;
        offLoadRequest.offloadType =  SIR_IPV4_ARP_REPLY_OFFLOAD;
-       hdd_wlan_offload_event(SIR_IPV4_ARP_REPLY_OFFLOAD,
-                                           SIR_OFFLOAD_DISABLE);
+
        if (eHAL_STATUS_SUCCESS !=
                  sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter),
                  pAdapter->sessionId, &offLoadRequest))
@@ -1253,7 +1163,6 @@
          * disable Broadcast filtering, Anding with the negation
          * of Broadcast BIT
          */
-         hddLog(VOS_TRACE_LEVEL_INFO, FL(" ARP offload is enabled"));
         *pMcBcFilter &= ~(HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST);
     }
 
@@ -1265,7 +1174,6 @@
          * disable Multicast filtering, Anding with the negation
          * of Multicast BIT
          */
-         hddLog(VOS_TRACE_LEVEL_INFO, FL(" NS offload is enabled"));
         *pMcBcFilter &= ~(HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST);
     }
 #endif
@@ -1283,7 +1191,7 @@
     eHalStatus halStatus = eHAL_STATUS_FAILURE;
     tpSirWlanSetRxpFilters wlanRxpFilterParam =
                      vos_mem_malloc(sizeof(tSirWlanSetRxpFilters));
-    if (NULL == wlanRxpFilterParam)
+    if(NULL == wlanRxpFilterParam)
     {
         hddLog(VOS_TRACE_LEVEL_FATAL,
            "%s: vos_mem_alloc failed ", __func__);
@@ -1305,22 +1213,10 @@
 
     wlanRxpFilterParam->setMcstBcstFilter = setfilter;
     halStatus = sme_ConfigureRxpFilter(pHddCtx->hHal, wlanRxpFilterParam);
-
-    if (setfilter && (eHAL_STATUS_SUCCESS == halStatus))
-    {
-       pHddCtx->hdd_mcastbcast_filter_set = TRUE;
-    }
-
-    hddLog(VOS_TRACE_LEVEL_INFO, "%s to post set/reset filter to"
-           "lower mac with status %d"
-           "configuredMcstBcstFilterSetting = %d"
-           "setMcstBcstFilter = %d",(eHAL_STATUS_SUCCESS != halStatus) ?
-           "Failed" : "Success", halStatus,
-           wlanRxpFilterParam->configuredMcstBcstFilterSetting,
-           wlanRxpFilterParam->setMcstBcstFilter);
-
     if (eHAL_STATUS_SUCCESS != halStatus)
         vos_mem_free(wlanRxpFilterParam);
+    if(setfilter && (eHAL_STATUS_SUCCESS == halStatus))
+       pHddCtx->hdd_mcastbcast_filter_set = TRUE;
 }
 
 static void hdd_conf_suspend_ind(hdd_context_t* pHddCtx,
@@ -1485,7 +1381,6 @@
    }
 
    pHddCtx->hdd_wlan_suspended = TRUE;
-   hdd_wlan_suspend_resume_event(HDD_WLAN_EARLY_SUSPEND);
    hdd_set_pwrparams(pHddCtx);
    status =  hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
    while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
@@ -1520,7 +1415,6 @@
        if (pHddCtx->cfg_ini->nEnableSuspend == WLAN_MAP_SUSPEND_TO_STANDBY)
        {
           //stop the interface before putting the chip to standby
-          hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
           netif_tx_disable(pAdapter->dev);
           netif_carrier_off(pAdapter->dev);
        }
@@ -1560,8 +1454,7 @@
    /* if the driver was not in BMPS during early suspend,
     * the dynamic DTIM is now updated at Riva */
    if ((newState == BMPS) && pHddCtx->hdd_wlan_suspended
-           && (pHddCtx->cfg_ini->enableDynamicDTIM ||
-               pHddCtx->cfg_ini->enableModulatedDTIM)
+           && pHddCtx->cfg_ini->enableDynamicDTIM
            && (pHddCtx->hdd_ignore_dtim_enabled == FALSE))
    {
        pHddCtx->hdd_ignore_dtim_enabled = TRUE;
@@ -1782,13 +1675,12 @@
 
    if (!pHddCtx->hdd_wlan_suspended)
    {
-      hddLog(VOS_TRACE_LEVEL_INFO,
+      hddLog(VOS_TRACE_LEVEL_ERROR,
              "%s: Ignore resume wlan, Already resumed!", __func__);
       return;
    }
 
    pHddCtx->hdd_wlan_suspended = FALSE;
-   hdd_wlan_suspend_resume_event(HDD_WLAN_EARLY_RESUME);
    /*loop through all adapters. Concurrency */
    status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
 
@@ -1880,7 +1772,7 @@
    hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Preventing the phone from going to suspend",__func__);
 
    // Prevent the phone from going to sleep
-   hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT);
+   hdd_prevent_suspend();
 
    return VOS_STATUS_SUCCESS;
 }
@@ -1967,18 +1859,13 @@
    }
 
    //Stop the traffic monitor timer
-   if ((pHddCtx->cfg_ini->dynSplitscan)&& (VOS_TIMER_STATE_RUNNING ==
-                        vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)))
+   if ( VOS_TIMER_STATE_RUNNING ==
+                        vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr))
    {
         vos_timer_stop(&pHddCtx->tx_rx_trafficTmr);
    }
 
-   vos_flush_delayed_work(&pHddCtx->spoof_mac_addr_work);
    hdd_reset_all_adapters(pHddCtx);
-
-   /* set default value of Tcp delack and stop timer */
-   hdd_set_default_stop_delack_timer(pHddCtx);
-
    /* DeRegister with platform driver as client for Suspend/Resume */
    vosStatus = hddDeregisterPmOps(pHddCtx);
    if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
@@ -2023,22 +1910,22 @@
     */
    /* Wait for MC to exit */
    hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Shutting down MC thread",__func__);
-   set_bit(MC_SHUTDOWN_EVENT, &vosSchedContext->mcEventFlag);
-   set_bit(MC_POST_EVENT, &vosSchedContext->mcEventFlag);
+   set_bit(MC_SHUTDOWN_EVENT_MASK, &vosSchedContext->mcEventFlag);
+   set_bit(MC_POST_EVENT_MASK, &vosSchedContext->mcEventFlag);
    wake_up_interruptible(&vosSchedContext->mcWaitQueue);
    wait_for_completion(&vosSchedContext->McShutdown);
 
    /* Wait for TX to exit */
    hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Shutting down TX thread",__func__);
-   set_bit(TX_SHUTDOWN_EVENT, &vosSchedContext->txEventFlag);
-   set_bit(TX_POST_EVENT, &vosSchedContext->txEventFlag);
+   set_bit(TX_SHUTDOWN_EVENT_MASK, &vosSchedContext->txEventFlag);
+   set_bit(TX_POST_EVENT_MASK, &vosSchedContext->txEventFlag);
    wake_up_interruptible(&vosSchedContext->txWaitQueue);
    wait_for_completion(&vosSchedContext->TxShutdown);
 
    /* Wait for RX to exit */
    hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Shutting down RX thread",__func__);
-   set_bit(RX_SHUTDOWN_EVENT, &vosSchedContext->rxEventFlag);
-   set_bit(RX_POST_EVENT, &vosSchedContext->rxEventFlag);
+   set_bit(RX_SHUTDOWN_EVENT_MASK, &vosSchedContext->rxEventFlag);
+   set_bit(RX_POST_EVENT_MASK, &vosSchedContext->rxEventFlag);
    wake_up_interruptible(&vosSchedContext->rxWaitQueue);
 
    wait_for_completion(&vosSchedContext->RxShutdown);
@@ -2097,12 +1984,6 @@
    vos_sched_flush_mc_mqs(vosSchedContext);
    vos_sched_flush_tx_mqs(vosSchedContext);
    vos_sched_flush_rx_mqs(vosSchedContext);
-#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
-   wlan_logging_flush_pkt_queue();
-   /*Free fw dump mem in case of SSR/Shutdown */
-   wlan_set_fwr_mem_dump_state(FW_MEM_DUMP_IDLE);
-   wlan_free_fwr_mem_dump_buffer();
-#endif
 
    /* Deinit all the TX and MC queues */
    vos_sched_deinit_mqs(vosSchedContext);
@@ -2149,7 +2030,7 @@
 
    struct device *dev = NULL;
    hdd_ssr_timer_del();
-   hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT);
+   hdd_prevent_suspend();
 
 #ifdef HAVE_WCNSS_CAL_DOWNLOAD
    /* wait until WCNSS driver downloads NV */
@@ -2250,8 +2131,6 @@
    if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
    {
       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_start failed",__func__);
-      if (isSsrPanicOnFailure())
-          VOS_BUG(0);
       goto err_vosclose;
    }
 
@@ -2305,6 +2184,8 @@
 
     /* Restart all adapters */
    hdd_start_all_adapters(pHddCtx);
+   pHddCtx->isLogpInProgress = FALSE;
+   vos_set_logp_in_progress(VOS_MODULE_ID_VOSS, FALSE);
    pHddCtx->hdd_mcastbcast_filter_set = FALSE;
    pHddCtx->btCoexModeSet = FALSE;
    hdd_register_mcast_bcast_filter(pHddCtx);
@@ -2316,19 +2197,8 @@
       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddRegisterPmOps failed",__func__);
       goto err_bap_stop;
    }
-
-#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
-   if (pHddCtx->cfg_ini->wlanLoggingEnable &&
-               (pHddCtx->cfg_ini->enableFWLogging ||
-                pHddCtx->cfg_ini->enableMgmtLogging ||
-                pHddCtx->cfg_ini->enableContFWLogging))
-   {
-       hdd_init_frame_logging(pHddCtx);
-   }
-#endif
-
    /* Allow the phone to go to sleep */
-   hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT);
+   hdd_allow_suspend();
    /* register for riva power on lock */
    if (req_riva_power_on_lock("wlan"))
    {
@@ -2336,23 +2206,12 @@
                                         __func__);
       goto err_unregister_pmops;
    }
-   sme_set_rssi_threshold_breached_cb(pHddCtx->hHal, hdd_rssi_threshold_breached_cb);
    vos_set_reinit_in_progress(VOS_MODULE_ID_VOSS, FALSE);
-
-   sme_register_mgmt_frame_ind_callback(pHddCtx->hHal,hdd_indicate_mgmt_frame);
-
 #ifdef WLAN_FEATURE_EXTSCAN
     sme_EXTScanRegisterCallback(pHddCtx->hHal,
             wlan_hdd_cfg80211_extscan_callback,
                            pHddCtx);
 #endif /* WLAN_FEATURE_EXTSCAN */
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-    sme_OemDataRegisterCallback(pHddCtx->hHal,
-             wlan_hdd_cfg80211_oemdata_callback,
-                          pHddCtx);
-#endif /* FEATURE_OEM_DATA_SUPPORT */
-
    goto success;
 
 err_unregister_pmops:
@@ -2403,7 +2262,6 @@
        pHddCtx->cfg_ini= NULL;
 
        wiphy_unregister(pHddCtx->wiphy);
-       hdd_wlan_free_wiphy_channels(pHddCtx->wiphy);
        wiphy_free(pHddCtx->wiphy);
    }
    vos_preClose(&pVosContext);
@@ -2414,7 +2272,7 @@
 
 err_re_init:
    /* Allow the phone to go to sleep */
-   hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT);
+   hdd_allow_suspend();
    vos_set_reinit_in_progress(VOS_MODULE_ID_VOSS, FALSE);
    VOS_BUG(0);
    return -EPERM;
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_ftm.c b/wlan/prima/CORE/HDD/src/wlan_hdd_ftm.c
index 7bf993d..c0250ea 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_ftm.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_ftm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -31,6 +31,9 @@
 
   \brief This file contains the WLAN factory test mode implementation
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -76,7 +79,6 @@
 #include "pttMsgApi.h"
 #include "wlan_qct_pal_device.h"
 #include "linux/wcnss_wlan.h"
-#include "qc_sap_ioctl.h"
 
 #define RXMODE_DISABLE_ALL 0
 #define RXMODE_ENABLE_ALL  1
@@ -87,13 +89,19 @@
 #define FTM_CHAIN_SEL_R0_ON         1
 #define FTM_CHAIN_SEL_T0_ON         2
 #define FTM_CHAIN_SEL_R0_T0_ON      3
-#define FTM_CHAIN_SEL_ANTENNA_0     7
-#define FTM_CHAIN_SEL_ANTENNA_1     8
-#define FTM_CHAIN_SEL_MAX           8
+#define FTM_CHAIN_SEL_MAX           3
 
 #define WCNSS_TXFIR_OFFSET          0x00018000
 
+#ifndef QWLAN_PHYDBG_BASE
+#define QWLAN_PHYDBG_BASE                   0x03004000
+#endif /* QWLAN_PHYDBG_BASE */
+
+#ifndef QWLAN_PHYDBG_TXPKT_CNT_REG
+#define QWLAN_PHYDBG_TXPKT_CNT_REG          (QWLAN_PHYDBG_BASE + 0x6C)
 #define QWLAN_PHYDBG_TXPKT_CNT_CNT_MASK     0xFFFF
+#endif
+
 
 #ifndef QWLAN_AGC_CHANNEL_FREQ_REG_OFFSET
 #define QWLAN_AGC_CHANNEL_FREQ_REG_OFFSET   0x00013c34
@@ -101,6 +109,26 @@
 #endif /* QWLAN_AGC_CHANNEL_FREQ_REG_OFFSET */
 
 
+#ifndef QWLAN_RFAPB_BASE
+#define QWLAN_RFAPB_BASE                    0x0E02F800
+#endif /* QWLAN_RFAPB_BASE */
+
+#ifndef QWLAN_RFAPB_REV_ID_REG
+#define QWLAN_RFAPB_REV_ID_REG              (QWLAN_RFAPB_BASE + 0x00)
+#endif /* QWLAN_RFAPB_REV_ID_REG */
+
+#ifndef QWLAN_TXCTL_BASE
+#define QWLAN_TXCTL_BASE                    0x03012000
+#endif /* QWLAN_TXCTL_BASE */
+
+#ifndef QWLAN_TXCTL_FSHIFT_REG
+#define QWLAN_TXCTL_FSHIFT_REG              (QWLAN_TXCTL_BASE + 0x20)
+#define QWLAN_TXCTL_FSHIFT_BW14_OFFSET      0x02
+#define QWLAN_TXCTL_FSHIFT_BW14_MASK        0x1C
+#define QWLAN_TXCTL_FSHIFT_BW12_OFFSET      0x00
+#define QWLAN_TXCTL_FSHIFT_BW12_MASK        0x03
+#endif /* QWLAN_TXCTL_FSHIFT_REG */
+
 /* To set 4MAC addresses from given first MAC address,
  * Last byte value within given MAC address must less than 0xFF - 3 */
 #define QWLAN_MAX_MAC_LAST_BYTE_VALUE       0xFC
@@ -128,6 +156,15 @@
 static int wlan_ftm_stop(hdd_context_t *pHddCtx);
 VOS_STATUS wlan_write_to_efs (v_U8_t *pData, v_U16_t data_len);
 
+/* for PRIMA: all the available frequency, channal pair i the table are defined for channel frequency @ RF center frequency
+   Since it is associated to agc.channel_freq register for mapping.
+   For channel bonding, the channel number is +2 or -2 for CB with primary high, or with primary low respectively.
+*/
+static const freq_chan_t  freq_chan_tbl[] = {
+     {2412, 1}, {2417, 2},{2422, 3}, {2427, 4}, {2432, 5}, {2437, 6}, {2442, 7},
+     {2447, 8}, {2452, 9},{2457, 10},{2462, 11},{2467 ,12},{2472, 13},{2484, 14}
+};
+
 static rateStr2rateIndex_t rateName_rateIndex_tbl[] =
 {
    { HAL_PHY_RATE_11B_LONG_1_MBPS,       "11B_LONG_1_MBPS"},
@@ -475,7 +512,6 @@
     v_U16_t rxmode;
     v_U16_t chainSelect;
     ePhyChanBondState cbmode;
-    ePowerTempIndexSource powerIndex;
 
 } FTM_STATUS ;
 static FTM_STATUS ftm_status;
@@ -509,7 +545,6 @@
     ftm_status.rxmode = RXMODE_ENABLE_ALL; /* macStart() enables all receive pkt types */
     ftm_status.chainSelect = FTM_CHAIN_SEL_R0_T0_ON;
     ftm_status.cbmode = 0 ; //none channel bonding
-    ftm_status.powerIndex = FIXED_POWER_DBM;
 
     return;
 }
@@ -621,15 +656,6 @@
       goto err_probe_event;
    }
 
-   if(vos_event_init(&(gpVosContext->fwLogsComplete)) != VOS_STATUS_SUCCESS )
-   {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                "%s: Unable to init fwLogsComplete",__func__);
-      VOS_ASSERT(0);
-
-      goto err_wda_complete_event;
-   }
-
    /* Initialize the free message queue */
    vStatus = vos_mq_init(&gpVosContext->freeVosMq);
    if (! VOS_IS_STATUS_SUCCESS(vStatus))
@@ -639,7 +665,7 @@
                 "%s: Failed to initialize VOS free message queue %d",
                  __func__, vStatus);
       VOS_ASSERT(0);
-      goto err_fw_logs_complete_event;
+      goto err_wda_complete_event;
    }
 
    for (iter = 0; iter < VOS_CORE_MAX_MESSAGES; iter++)
@@ -761,9 +787,6 @@
 err_msg_queue:
    vos_mq_deinit(&gpVosContext->freeVosMq);
 
-err_fw_logs_complete_event:
-   vos_event_destroy(&gpVosContext->fwLogsComplete);
-
 err_wda_complete_event:
    vos_event_destroy(&gpVosContext->wdaCompleteEvent);
 
@@ -828,26 +851,12 @@
      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
   }
 
-  if ( TRUE == WDA_needShutdown(vosContext))
+  vosStatus = WDA_close( vosContext );
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
   {
-     vosStatus = WDA_shutdown(vosContext, VOS_TRUE);
-     if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-     {
-        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                            "%s: Failed to shutdown WDA %d", __func__, vosStatus);
-        VOS_ASSERT(VOS_IS_STATUS_SUCCESS(vosStatus));
-     }
-
-  }
-  else
-  {
-     vosStatus = WDA_close(vosContext);
-     if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-     {
-        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-            "%s: Failed to close WDA %d", __func__, vosStatus);
-        VOS_ASSERT(VOS_IS_STATUS_SUCCESS(vosStatus));
-     }
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close WDA %d", __func__, vosStatus);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
   }
 
   vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq);
@@ -868,14 +877,6 @@
      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
   }
 
-  vosStatus = vos_event_destroy(&gpVosContext->fwLogsComplete);
-  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-  {
-     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-         "%s: Failed to destroy fwLogsComplete %d", __func__, vosStatus);
-     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
-  }
-
   return VOS_STATUS_SUCCESS;
 }
 
@@ -1023,7 +1024,7 @@
         return VOS_STATUS_E_FAILURE;
     }
 
-    if (rfGain > 31) {
+    if (rfGain > 31 || rfGain <0) {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
                    "%s:rf gain value is invalid", __func__);
         return VOS_STATUS_E_FAILURE;
@@ -1214,14 +1215,6 @@
         case FTM_CHAIN_SEL_T0_ON:
             chainSelect = PHY_CHAIN_SEL_T0_ON;
             break;
-
-        case FTM_CHAIN_SEL_ANTENNA_0:
-            chainSelect = PHY_CHAIN_SEL_ANT_0;
-            break;
-
-        case FTM_CHAIN_SEL_ANTENNA_1:
-            chainSelect = PHY_CHAIN_SEL_ANT_1;
-            break;
     }
 
     vos_mem_set(pMsgBuf, sizeof(tPttMsgbuffer), 0);
@@ -1574,7 +1567,6 @@
     }
 
     pHddCtx->ftm.ftm_state = WLAN_FTM_INITIALIZED;
-    init_completion(&pHddCtx->ftm.startCmpVar);
 
     return VOS_STATUS_SUCCESS;
 
@@ -1584,7 +1576,6 @@
 #else
 nl_srv_exit();
 #endif /* WLAN_KD_READY_NOTIFIER */
-ptt_sock_deactivate_svc(pHddCtx);
 err_ftm_register_wext_close:
 hdd_UnregisterWext(pAdapter->dev);
 
@@ -1629,17 +1620,17 @@
                   "%s: Ftm has been started. stopping ftm", __func__);
         wlan_ftm_stop(pHddCtx);
     }
+
 #ifdef WLAN_KD_READY_NOTIFIER
     nl_srv_exit(pHddCtx->ptt_pid);
 #else
     nl_srv_exit();
 #endif /* WLAN_KD_READY_NOTIFIER */
-    ptt_sock_deactivate_svc(pHddCtx);
-
     //TODO----------
     //Deregister the device with the kernel
     hdd_UnregisterWext(pAdapter->dev);
 
+    hdd_close_all_adapters( pHddCtx );
 #if 0
     if(test_bit(NET_DEVICE_REGISTERED, &pAdapter->event_flags))
     {
@@ -1658,7 +1649,8 @@
 
     //Close VOSS
     wlan_ftm_vos_close(vosContext);
-    hdd_close_all_adapters( pHddCtx );
+
+
     vosStatus = vos_event_destroy(&pHddCtx->ftm.ftm_vos_event);
     if (!VOS_IS_STATUS_SUCCESS(vosStatus))
     {
@@ -1723,8 +1715,6 @@
        return VOS_STATUS_SUCCESS;
     }
 
-    pHddCtx->ftm.ftm_state = WLAN_FTM_STARTING;
-
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
             "%s: Starting Libra SW", __func__);
 
@@ -1780,7 +1770,6 @@
                     "%s: WDA_NVDownload_Start reporting  other error",__func__);
        }
        VOS_ASSERT(0);
-       WDA_setNeedShutdown(pHddCtx->pvosContext);
        goto err_status_failure;
     }
 
@@ -1841,7 +1830,6 @@
 
 err_status_failure:
 
-    pHddCtx->ftm.ftm_state = WLAN_FTM_INITIALIZED;
     return VOS_STATUS_E_FAILURE;
 
 }
@@ -3238,7 +3226,6 @@
     pVosContextType pVosContext = (pVosContextType)(pHddCtx->pvosContext);
     int hostState;
     tPttMsgbuffer *tempRspBuffer = NULL;
-    static int count;
 
     ENTER();
 
@@ -3274,19 +3261,6 @@
         return ;
     }
 
-    if (VOS_FTM_MODE != hdd_get_conparam())
-    {
-        count++;
-        if (count == 1 || !(count % 10))
-        {
-            hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Driver not loaded in FTM"
-                " mode, current mode: %d ",__func__, hdd_get_conparam());
-        }
-        pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_FAILURE;
-        wlan_ftm_send_response(pHddCtx);
-        return ;
-    }
-
     switch (pRequestBuf->ftmpkt.ftm_cmd_type)
     {
     case WLAN_FTM_START:
@@ -3305,7 +3279,6 @@
                    ,__func__);
             pHddCtx->ftm.pResponseBuf->ftm_err_code = WLAN_FTM_FAILURE;
             wlan_ftm_send_response(pHddCtx);
-            complete(&pHddCtx->ftm.startCmpVar);
             return;
         }
         /* Ptt application running on the host PC expects the length to be one byte less that what we have received*/
@@ -3314,7 +3287,7 @@
         pHddCtx->ftm.pResponseBuf->ftmpkt.ftm_cmd_type = 0;
 
         wlan_ftm_send_response(pHddCtx);
-        complete(&pHddCtx->ftm.startCmpVar);
+
         break;
 
     case WLAN_FTM_STOP:
@@ -3544,6 +3517,9 @@
 {
     unsigned int primary_channel = center_channel;
 
+        if (center_channel <= 14)
+                return primary_channel ;
+
     switch (cb)
     {
         case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
@@ -3656,75 +3632,6 @@
     return status;
 }
 
-static VOS_STATUS wlan_ftm_priv_set_dump(hdd_adapter_t *pAdapter, int *value)
-{
-    uPttMsgs *pMsgBody;
-    VOS_STATUS status;
-    long ret;
-    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
-
-    if (pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
-                   "%s:Ftm has not started. Please start the ftm. ", __func__);
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    if (NULL == pMsgBuf)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
-                   "%s:pMsgBuf is NULL", __func__);
-        return VOS_STATUS_E_NOMEM;
-    }
-
-    vos_mem_set(pMsgBuf, sizeof(*pMsgBuf), 0);
-    init_completion(&pHddCtx->ftm.ftm_comp_var);
-    pMsgBuf->msgId = PTT_MSG_PRIMA_GENERIC_CMD;
-    pMsgBuf->msgBodyLength = sizeof(tMsgPttPrimaGenericCmd) + PTT_HEADER_LENGTH;
-
-    pMsgBody = &pMsgBuf->msgBody;
-
-    pMsgBody->PrimaGenericCmd.cmdIdx = value[0];
-    pMsgBody->PrimaGenericCmd.param1 = value[1];
-    pMsgBody->PrimaGenericCmd.param2 = value[2];
-    pMsgBody->PrimaGenericCmd.param3 = value[3];
-    pMsgBody->PrimaGenericCmd.param4 = value[4];
-
-    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
-
-    if (status != VOS_STATUS_SUCCESS)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
-                   "%s:wlan_ftm_postmsg failed", __func__);
-        status = VOS_STATUS_E_FAILURE;
-        goto done;
-    }
-
-    ret = wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var,
-                                msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
-    if (0 >= ret )
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   FL("wait on ftm_comp_var failed %ld"), ret);
-    }
-
-    if (pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
-                   "%s:Ptt response status failed", __func__);
-    }
-
-    if (pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
-                   "%s:Ptt response status failed", __func__);
-        status = VOS_STATUS_E_FAILURE;
-        goto done;
-    }
-
-done:
-    return status;
-}
 
 /**---------------------------------------------------------------------------
 
@@ -3998,7 +3905,7 @@
     if (pwr_source > 3)
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
-                   "%s:invalid power index source. valid mode is 0, 1, 2, 3. ",
+                   "%s:invalid power index source. valid mode is 0 , 1, 2. ",
                    __func__);
         return VOS_STATUS_E_FAILURE;
     }
@@ -4031,7 +3938,6 @@
         goto done;
     }
 
-    ftm_status.powerIndex = pwr_source;
 done:
 
    return status;
@@ -4121,8 +4027,7 @@
 
         if (ftm_status.powerCtlMode == 2) //only for CLPC mode
         {
-           status = wlan_ftm_priv_set_power_index(pAdapter,
-                                                  ftm_status.powerIndex);
+           status = wlan_ftm_priv_set_power_index(pAdapter, FIXED_POWER_DBM) != VOS_STATUS_SUCCESS; //power index source set to Fixed
            if(status != VOS_STATUS_SUCCESS)
            {
               goto done;
@@ -4406,6 +4311,7 @@
     uPttMsgs *pMsgBody;
     VOS_STATUS status;
     v_U16_t  freq;
+    v_U8_t indx=0;
     long ret;
 
     hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
@@ -4472,8 +4378,16 @@
 
     freq = ((v_U16_t)pMsgBody->DbgReadRegister.regValue & QWLAN_AGC_CHANNEL_FREQ_FREQ_MASK);
 
-    *pChannel = vos_freq_to_chan(freq);
-    (*pChannel) ? (status = VOS_STATUS_SUCCESS) : (status = VOS_STATUS_E_FAILURE);
+    while ((indx <  SIZE_OF_TABLE(freq_chan_tbl)) && (freq != freq_chan_tbl[indx].freq))
+            indx++;
+    if (indx >= SIZE_OF_TABLE(freq_chan_tbl))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Invalid Frequency!!!",__func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    *pChannel = freq_chan_tbl[indx].chan;
 
      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Channel = %d  freq = %d",*pChannel, freq);
  done:
@@ -4546,7 +4460,7 @@
         status = VOS_STATUS_E_FAILURE;
         goto done;
     }
-    *pTxPwr = pMsgBody->GetTxPowerReport.pwrTemplateIndex;
+    *pTxPwr = ((((pMsgBody->GetTxPowerReport.pwrTemplateIndex & 0x1F) + 4)*50)/100);
 
  done:
 
@@ -4555,6 +4469,141 @@
 
 /**---------------------------------------------------------------------------
 
+  \brief wlan_ftm_priv_get_ftm_version() -
+
+   This function gets ftm driver and firmware version.
+
+  \param  - pAdapter - Pointer HDD Context.
+              - pTxRate   -  Poniter to get the Tx rate.
+
+  \return - 0 for success, non zero for failure
+
+  --------------------------------------------------------------------------*/
+
+VOS_STATUS wlan_ftm_priv_get_ftm_version(hdd_adapter_t *pAdapter,char *pftmVer)
+{
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    v_U32_t reg_val;
+    char *buf = pftmVer;
+    hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
+    int lenRes = 0;
+    int lenBuf = WE_FTM_MAX_STR_LEN;
+    long ret;
+
+    if (pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s:Ftm has not started. Please start the ftm. ", __func__);
+        return VOS_STATUS_E_FAILURE;
+    }
+
+    if (NULL == pMsgBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s:pMsgBuf is NULL", __func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    vos_mem_set(pMsgBuf, sizeof(tPttMsgbuffer), 0);
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_DBG_READ_REGISTER;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttDbgReadRegister) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+    pMsgBody->DbgReadRegister.regAddr = QWLAN_RFAPB_REV_ID_REG;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if (status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s:wlan_ftm_postmsg failed", __func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+
+    }
+    ret = wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var,
+                                 msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+    if (0 >= ret )
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   FL("wait on ftm_comp_var failed %ld"), ret);
+    }
+
+    if (pMsgBuf->msgResponse != PTT_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s:Ptt response status failed", __func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    reg_val = (v_U16_t)pMsgBody->DbgReadRegister.regValue;
+
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+
+    pMsgBuf->msgId = PTT_MSG_GET_BUILD_RELEASE_NUMBER;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttGetBuildReleaseNumber) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if (status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s:wlan_ftm_postmsg failed", __func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    ret = wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var,
+                                msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+    if (0 >= ret )
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   FL("wait on ftm_comp_var failed %ld"), ret);
+    }
+
+    lenRes = snprintf(buf, lenBuf, "%s_",WLAN_CHIP_VERSION);
+    if(lenRes < 0 || lenRes >= lenBuf)
+    {
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    buf += lenRes;
+    lenBuf -= lenRes;
+
+    /*Read the RevID*/
+    lenRes = snprintf(buf, lenBuf, "%x.%x-",(v_U8_t)(reg_val >> 8), (v_U8_t)(reg_val &0x000000FF));
+    if(lenRes < 0 || lenRes >= lenBuf)
+    {
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    buf += lenRes;
+    lenBuf -= lenRes;
+
+    lenRes = snprintf(buf, lenBuf, "%s-", QWLAN_VERSIONSTR);
+    if(lenRes < 0 || lenRes >= lenBuf)
+    {
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
+    buf += lenRes;
+    lenBuf -= lenRes;
+
+
+done:
+
+    return status;
+
+}
+
+/**---------------------------------------------------------------------------
+
   \brief wlan_ftm_priv_get_txrate() -
 
    This function gets the TX rate from the halphy ptt module and
@@ -4569,8 +4618,11 @@
 
 static VOS_STATUS wlan_ftm_priv_get_txrate(hdd_adapter_t *pAdapter,char *pTxRate)
 {
-    VOS_STATUS status = VOS_STATUS_SUCCESS;
-    v_U16_t ii;
+    uPttMsgs *pMsgBody;
+    VOS_STATUS status;
+    v_U16_t rate_index,ii;
+    long ret;
+
     hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
 
     if (pHddCtx->ftm.ftm_state != WLAN_FTM_STARTED)
@@ -4580,8 +4632,51 @@
         return VOS_STATUS_E_FAILURE;
     }
 
+    if (NULL == pMsgBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s:pMsgBuf is NULL", __func__);
+        return VOS_STATUS_E_NOMEM;
+    }
+    vos_mem_set(pMsgBuf, sizeof(tPttMsgbuffer), 0);
+    init_completion(&pHddCtx->ftm.ftm_comp_var);
+    pMsgBuf->msgId = PTT_MSG_GET_TX_POWER_REPORT;
+    pMsgBuf->msgBodyLength = sizeof(tMsgPttGetTxPowerReport) + PTT_HEADER_LENGTH;
+
+    pMsgBody = &pMsgBuf->msgBody;
+
+    status = wlan_ftm_postmsg((v_U8_t*)pMsgBuf,pMsgBuf->msgBodyLength);
+
+    if (status != VOS_STATUS_SUCCESS)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s:wlan_ftm_postmsg failed", __func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+    ret = wait_for_completion_interruptible_timeout(&pHddCtx->ftm.ftm_comp_var,
+                                msecs_to_jiffies(WLAN_FTM_COMMAND_TIME_OUT));
+    if (0 >= ret )
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   FL("wait on ftm_comp_var failed %ld"), ret);
+    }
+
+    if (pMsgBuf->msgResponse == PTT_STATUS_SUCCESS) {
+
+       rate_index = pMsgBody->GetTxPowerReport.rate;
+    }
+    else {
+       /*Return the default rate*/
+       //rate_index = HAL_PHY_RATE_11A_6_MBPS;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s: PTT_MSG_GET_TX_POWER_REPORT failed", __func__);
+        status = VOS_STATUS_E_FAILURE;
+        goto done;
+    }
+
     for(ii = 0; ii < SIZE_OF_TABLE(rateName_rateIndex_tbl); ii++) {
-        if(rateName_rateIndex_tbl[ii].rate_index == ftm_status.frameParams.rate)
+        if(rateName_rateIndex_tbl[ii].rate_index == rate_index)
           break;
     }
     if(ii >= SIZE_OF_TABLE(rateName_rateIndex_tbl))
@@ -4591,8 +4686,8 @@
         goto done;
     }
     strlcpy(pTxRate,rateName_rateIndex_tbl[ii].rate_str, WE_FTM_MAX_STR_LEN);
-
 done:
+
     return status;
 
 }
@@ -4926,7 +5021,7 @@
 }
 
 /* set param sub-ioctls */
-static int __iw_ftm_setchar_getnone(struct net_device *dev, struct iw_request_info *info,
+static int iw_ftm_setchar_getnone(struct net_device *dev, struct iw_request_info *info,
                        union iwreq_data *wrqu, char *extra)
 {
     int ret,sub_cmd;
@@ -4934,18 +5029,8 @@
     char *param;
     VOS_STATUS status;
     hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
     struct iw_point s_priv_data;
 
-    ENTER();
-
-    if (!capable(CAP_NET_ADMIN))
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("permission check failed"));
-        return -EPERM;
-    }
-
     ret =0;
     /* helper function to get iwreq_data with compat handling. */
     if (hdd_priv_get_data(&s_priv_data, wrqu))
@@ -4959,21 +5044,9 @@
        return -EINVAL;
     }
 
-    pAdapter = (hdd_adapter_t *)netdev_priv(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
     sub_cmd = s_priv_data.flags;
     length = s_priv_data.length;
+    pAdapter = (hdd_adapter_t *)netdev_priv(dev);
 
     /* we cannot use iotctl_private_iw_point in kernel to allocate memory
      * to store data from userspace as IW_SETCHAR_GETNONE is defined as
@@ -5040,47 +5113,19 @@
 
 OUT:
     kfree(param);
-    EXIT();
     return ret;
 }
 
-static int iw_ftm_setchar_getnone(struct net_device *dev, struct iw_request_info *info,
+static int iw_ftm_setint_getnone(struct net_device *dev, struct iw_request_info *info,
                        union iwreq_data *wrqu, char *extra)
 {
-   int ret;
-
-   vos_ssr_protect(__func__);
-   ret = __iw_ftm_setchar_getnone(dev, info, wrqu, extra);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
-static int __iw_ftm_setint_getnone(struct net_device *dev, struct iw_request_info *info,
-                       union iwreq_data *wrqu, char *extra)
-{
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
     int *value = (int *)extra;
     int sub_cmd = value[0];
     int set_value = value[1];
     int ret = 0; /* success */
     VOS_STATUS status;
 
-    ENTER();
-
-    pAdapter = (netdev_priv(dev));
-    if (NULL == pAdapter)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
     switch(sub_cmd)
     {
         case WE_FTM_ON_OFF:
@@ -5236,18 +5281,6 @@
            break;
         }
 
-        case WE_SET_POWER_INDEX:
-        {
-            status = wlan_ftm_priv_set_power_index(pAdapter, set_value);
-            if (status != VOS_STATUS_SUCCESS)
-            {
-                hddLog(VOS_TRACE_LEVEL_ERROR, "set power index failed = %d",
-                    status);
-                ret = -EINVAL;
-            }
-            break;
-        }
-
         default:
         {
             hddLog(LOGE, "Invalid IOCTL setvalue command %d value %d",
@@ -5256,46 +5289,18 @@
         }
     }
 
-    EXIT();
     return ret;
 }
 
-static int iw_ftm_setint_getnone(struct net_device *dev, struct iw_request_info *info,
-                       union iwreq_data *wrqu, char *extra)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __iw_ftm_setint_getnone(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
 /* get param sub-ioctls */
-static int __iw_ftm_setnone_getint(struct net_device *dev, struct iw_request_info *info,
+static int iw_ftm_setnone_getint(struct net_device *dev, struct iw_request_info *info,
                        union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
     int *value = (int *)extra;
     int ret = 0; /* success */
     VOS_STATUS status;
 
-    ENTER();
-
-    pAdapter = (netdev_priv(dev));
-    if (NULL == pAdapter)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
     switch (value[0])
     {
         case WE_GET_CHANNEL:
@@ -5338,45 +5343,16 @@
         }
     }
 
-    EXIT();
     return ret;
 }
 
-static int iw_ftm_setnone_getint(struct net_device *dev, struct iw_request_info *info,
-                       union iwreq_data *wrqu, char *extra)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __iw_ftm_setnone_getint(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-static int __iw_ftm_get_char_setnone(struct net_device *dev, struct iw_request_info *info,
+static int iw_ftm_get_char_setnone(struct net_device *dev, struct iw_request_info *info,
                        union iwreq_data *wrqu, char *extra)
 {
     int sub_cmd = wrqu->data.flags;
     VOS_STATUS status;
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
 
-    ENTER();
-
-    pAdapter = (netdev_priv(dev));
-    if (NULL == pAdapter)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
     switch(sub_cmd)
     {
         case WE_GET_MAC_ADDRESS:
@@ -5404,6 +5380,18 @@
             wrqu->data.length = strlen(extra)+1;
             break;
         }
+        case WE_GET_FTM_VERSION:
+        {
+            status = wlan_ftm_priv_get_ftm_version(pAdapter, extra);
+
+            if(status != VOS_STATUS_SUCCESS)
+            {
+                hddLog(VOS_TRACE_LEVEL_FATAL, "wlan_ftm_priv_get_mac_address failed =%d",status);
+                return -EINVAL;
+            }
+            wrqu->data.length = strlen(extra)+1;
+            break;
+        }
         case WE_GET_FTM_STATUS:
         {
             status = wlan_ftm_priv_get_status(pAdapter, extra);
@@ -5437,23 +5425,9 @@
         }
     }
 
-    EXIT();
     return 0;
 }
 
-static int iw_ftm_get_char_setnone(struct net_device *dev, struct iw_request_info *info,
-                       union iwreq_data *wrqu, char *extra)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __iw_ftm_get_char_setnone(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-
-    return ret;
-}
-
 VOS_STATUS wlan_write_to_efs (v_U8_t *pData, v_U16_t data_len)
 {
 #if defined(MSM_PLATFORM)
@@ -5514,7 +5488,7 @@
 }
 
 /*  action sub-ioctls */
-static int __iw_ftm_setnone_getnone(struct net_device *dev, struct iw_request_info *info,
+static int iw_ftm_setnone_getnone(struct net_device *dev, struct iw_request_info *info,
                        union iwreq_data *wrqu, char *extra)
 {
     int sub_cmd = wrqu->data.flags;
@@ -5554,57 +5528,25 @@
     return ret;
 }
 
-static int iw_ftm_setnone_getnone(struct net_device *dev, struct iw_request_info *info,
-                       union iwreq_data *wrqu, char *extra)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __iw_ftm_setnone_getnone(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-static int __iw_ftm_set_var_ints_getnone(struct net_device *dev, struct iw_request_info *info,
+static int iw_ftm_set_var_ints_getnone(struct net_device *dev, struct iw_request_info *info,
         union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
     int sub_cmd = wrqu->data.flags;
     int *value = (int*)wrqu->data.pointer;
-    int ret = 0;
-    VOS_STATUS status;
 
-    ENTER();
-
-    if(wrqu->data.length < 2)
+    if(wrqu->data.length != 2)
     {
-        hddLog(LOGE, "Invalid number of Arguments  %d ",  wrqu->data.length);
+        hddLog(LOGE, "Invalid number of Arguments  %d  \n",  wrqu->data.length);
         return -EINVAL;
     }
-
-    pAdapter = (netdev_priv(dev));
-    if (NULL == pAdapter)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
     switch (sub_cmd)
     {
         case WE_SET_TX_WF_GAIN:
         {
             v_S15_t dGain = 0;
             v_U16_t rfGain = 0;
+            VOS_STATUS status;
 
             dGain = *(v_S15_t*) value++;
             rfGain = *(v_U16_t*) value;
@@ -5619,85 +5561,17 @@
         }
         break;
 
-        case WE_SET_DUMP:
-            if (*value == 1)
-            {
-                 status = wlan_ftm_priv_set_dump(pAdapter, value);
-                 if(status != VOS_STATUS_SUCCESS)
-                 {
-                     hddLog(LOGE, "wlan_ftm_priv_set_dump Failed =%d\n",
-                            status);
-                     ret = -EINVAL;
-                 }
-            }else
-            {
-                 hddLog(LOGE, "%s arg[0]: %d expecting arg[0]: 1\n",
-                        __func__, *value);
-            }
-            break;
-
         default:
         {
-            hddLog(LOGE, "Invalid IOCTL command %d ", sub_cmd );
+            hddLog(LOGE, "Invalid IOCTL command %d  \n", sub_cmd );
             break;
         }
     }
 
-    EXIT();
     return 0;
 }
 
 
-static int iw_ftm_set_var_ints_getnone(struct net_device *dev, struct iw_request_info *info,
-        union iwreq_data *wrqu, char *extra)
-{
-   int ret;
-   union iwreq_data u_priv_wrqu;
-   int apps_args[MAX_VAR_ARGS] = {0};
-   int num_args;
-
-    if (!capable(CAP_NET_ADMIN))
-    {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-            FL("permission check failed"));
-         return -EPERM;
-    }
-
-    /* helper function to get iwreq_data with compat handling. */
-    if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
-    {
-       return -EINVAL;
-    }
-
-    if (NULL == u_priv_wrqu.data.pointer)
-    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: NULL data pointer", __func__);
-       return -EINVAL;
-    }
-
-    num_args = u_priv_wrqu.data.length;
-    if (num_args > MAX_VAR_ARGS)
-    {
-       num_args = MAX_VAR_ARGS;
-    }
-
-    if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
-                       (sizeof(int)) * num_args))
-    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: failed to copy data from user buffer", __func__);
-       return -EFAULT;
-    }
-
-    vos_ssr_protect(__func__);
-    ret = __iw_ftm_set_var_ints_getnone(dev, info, &u_priv_wrqu,
-                                       (char *)&apps_args);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 static const iw_handler we_ftm_private[] = {
 
    [WLAN_FTM_PRIV_SET_INT_GET_NONE      - SIOCIWFIRSTPRIV]   = iw_ftm_setint_getnone,  //set priv ioctl
@@ -5791,11 +5665,6 @@
         0,
         "set_cb" },
 
-    {   WE_SET_POWER_INDEX,
-        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-        0,
-        "set_power_index" },
-
     /* handlers for main ioctl */
     {   WLAN_FTM_PRIV_SET_NONE_GET_INT,
         0,
@@ -5844,6 +5713,11 @@
         IW_PRIV_TYPE_CHAR| WE_FTM_MAX_STR_LEN,
         "get_mac_address" },
 
+    {   WE_GET_FTM_VERSION,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_FTM_MAX_STR_LEN,
+        "ftm_version" },
+
     {   WE_GET_TX_RATE,
         0,
         IW_PRIV_TYPE_CHAR| WE_FTM_MAX_STR_LEN,
@@ -5875,11 +5749,6 @@
         0,
         "set_nv_defaults" },
 
-    {   WE_SET_DUMP,
-        IW_PRIV_TYPE_INT | MAX_FTM_VAR_ARGS,
-        0,
-        "dump" },
-
 };
 
 const struct iw_handler_def we_ftm_handler_def = {
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_hostapd.c b/wlan/prima/CORE/HDD/src/wlan_hdd_hostapd.c
index 752a34c..4951fb5 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -30,6 +30,9 @@
   \file  wlan_hdd_hostapd.c
   \brief WLAN Host Device Driver implementation
                
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 /**========================================================================= 
@@ -58,7 +61,6 @@
 #include <linux/wireless.h>
 #include <linux/semaphore.h>
 #include <linux/compat.h>
-#include <linux/rtnetlink.h>
 #include <vos_api.h>
 #include <vos_sched.h>
 #include <linux/etherdevice.h>
@@ -75,10 +77,9 @@
 #include "wlan_nlink_common.h"
 #include "wlan_btc_svc.h"
 #include <bap_hdd_main.h>
-#include "wlan_hdd_tdls.h"
 #include "wlan_hdd_p2p.h"
 #include "cfgApi.h"
-#include "wniCfg.h"
+#include "wniCfgAp.h"
 
 #ifdef FEATURE_WLAN_CH_AVOID
 #include "wcnss_wlan.h"
@@ -159,7 +160,7 @@
  *-------------------------------------------------------------------------*/
 /**---------------------------------------------------------------------------
 
-  \brief __hdd_hostapd_open() - HDD Open function for hostapd interface
+  \brief hdd_hostapd_open() - HDD Open function for hostapd interface
 
   This is called in response to ifconfig up
   
@@ -168,46 +169,23 @@
   \return - 0 for success non-zero for failure
               
   --------------------------------------------------------------------------*/
-int __hdd_hostapd_open (struct net_device *dev)
+int hdd_hostapd_open (struct net_device *dev)
 {
-   hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
-
    ENTER();
 
-   if(!test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags))
-   {
-       //WMM_INIT OR BSS_START not completed
-       hddLog( LOGW, "Ignore hostadp open request");
-       EXIT();
-       return 0;
-   }
-
    MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                     TRACE_CODE_HDD_HOSTAPD_OPEN_REQUEST, NO_SESSION, 0));
    //Turn ON carrier state
    netif_carrier_on(dev);
-   //Enable all Tx queues
-   hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
+   //Enable all Tx queues  
    netif_tx_start_all_queues(dev);
-
+   
    EXIT();
    return 0;
 }
-
-int hdd_hostapd_open (struct net_device *dev)
-{
-   int ret;
-
-   vos_ssr_protect(__func__);
-   ret = __hdd_hostapd_open(dev);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
 /**---------------------------------------------------------------------------
   
-  \brief __hdd_hostapd_stop() - HDD stop function for hostapd interface
+  \brief hdd_hostapd_stop() - HDD stop function for hostapd interface
   
   This is called in response to ifconfig down
   
@@ -216,12 +194,11 @@
   \return - 0 for success non-zero for failure
               
   --------------------------------------------------------------------------*/
-int __hdd_hostapd_stop (struct net_device *dev)
+int hdd_hostapd_stop (struct net_device *dev)
 {
    ENTER();
 
    if(NULL != dev) {
-       hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
        //Stop all tx queues
        netif_tx_disable(dev);
 
@@ -232,21 +209,9 @@
    EXIT();
    return 0;
 }
-
-int hdd_hostapd_stop (struct net_device *dev)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __hdd_hostapd_stop(dev);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 /**---------------------------------------------------------------------------
 
-  \brief __hdd_hostapd_uninit() - HDD uninit function
+  \brief hdd_hostapd_uninit() - HDD uninit function
 
   This is called during the netdev unregister to uninitialize all data
 associated with the device
@@ -256,44 +221,24 @@
   \return - void
 
   --------------------------------------------------------------------------*/
-static void __hdd_hostapd_uninit (struct net_device *dev)
+static void hdd_hostapd_uninit (struct net_device *dev)
 {
    hdd_adapter_t *pHostapdAdapter = netdev_priv(dev);
-   hdd_context_t *pHddCtx;
 
    ENTER();
 
-   if (WLAN_HDD_ADAPTER_MAGIC != pHostapdAdapter->magic)
+   if (pHostapdAdapter && pHostapdAdapter->pHddCtx)
    {
-      hddLog(VOS_TRACE_LEVEL_ERROR,
-             FL("Invalid magic"));
-      return;
-   }
-   pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-   if (NULL == pHddCtx)
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,
-             FL("NULL pHddCtx"));
-      return;
-   }
+      hdd_deinit_adapter(pHostapdAdapter->pHddCtx, pHostapdAdapter);
 
-   hdd_deinit_adapter(pHostapdAdapter->pHddCtx, pHostapdAdapter, TRUE);
-
-   /* after uninit our adapter structure will no longer be valid */
-   pHostapdAdapter->dev = NULL;
-   pHostapdAdapter->magic = 0;
+      /* after uninit our adapter structure will no longer be valid */
+      pHostapdAdapter->dev = NULL;
+   }
 
    EXIT();
 }
 
-static void hdd_hostapd_uninit (struct net_device *dev)
-{
-   vos_ssr_protect(__func__);
-   __hdd_hostapd_uninit(dev);
-   vos_ssr_unprotect(__func__);
 
-   return;
-}
 /**============================================================================
   @brief hdd_hostapd_hard_start_xmit() - Function registered with the Linux OS for 
   transmitting packets. There are 2 versions of this function. One that uses
@@ -309,20 +254,9 @@
 {
     return 0;    
 }
-
-int __hdd_hostapd_change_mtu(struct net_device *dev, int new_mtu)
-{
-    return 0;
-}
-
 int hdd_hostapd_change_mtu(struct net_device *dev, int new_mtu)
 {
-    int ret;
-    vos_ssr_protect(__func__);
-    ret = __hdd_hostapd_change_mtu(dev, new_mtu);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
+    return 0;
 }
 
 static int hdd_hostapd_driver_command(hdd_adapter_t *pAdapter,
@@ -337,8 +271,6 @@
     * Note that valid pointers are provided by caller
     */
 
-   ENTER();
-
    if (priv_data->total_len <= 0 ||
        priv_data->total_len > HOSTAPD_IOCTL_COMMAND_STRLEN_MAX)
    {
@@ -351,8 +283,11 @@
       goto exit;
    }
    status = wlan_hdd_validate_context(pHddCtx);
+
    if (0 != status)
    {
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "%s: HDD context is not valid", __func__);
        return status;
    }
 
@@ -446,17 +381,12 @@
        hdd_tx_rx_pkt_cnt_stat_timer_handler(pHddCtx);
        sme_SetMiracastMode(pHddCtx->hHal, pHddCtx->drvr_miracast);
    }
-   else if (strncasecmp(command, "DISABLE_CA_EVENT", 16) == 0)
-   {
-       ret = hdd_enable_disable_ca_event(pHddCtx, command, 16);
-   }
 
 exit:
    if (command)
    {
       kfree(command);
    }
-   EXIT();
    return ret;
 }
 
@@ -514,15 +444,13 @@
    return ret;
 }
 
-static int __hdd_hostapd_ioctl(struct net_device *dev,
+static int hdd_hostapd_ioctl(struct net_device *dev,
                              struct ifreq *ifr, int cmd)
 {
    hdd_adapter_t *pAdapter;
    hdd_context_t *pHddCtx;
    int ret;
 
-   ENTER();
-
    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
    if (NULL == pAdapter) {
       hddLog(VOS_TRACE_LEVEL_ERROR,
@@ -545,6 +473,7 @@
    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
    ret = wlan_hdd_validate_context(pHddCtx);
    if (ret) {
+      hddLog(VOS_TRACE_LEVEL_ERROR, "%s: invalid context", __func__);
       ret = -EBUSY;
       goto exit;
    }
@@ -563,25 +492,12 @@
       break;
    }
  exit:
-   EXIT();
    return ret;
 }
 
-static int hdd_hostapd_ioctl(struct net_device *dev,
-                             struct ifreq *ifr, int cmd)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __hdd_hostapd_ioctl(dev, ifr, cmd);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 /**---------------------------------------------------------------------------
   
-  \brief __hdd_hostapd_set_mac_address() -
+  \brief hdd_hostapd_set_mac_address() - 
    This function sets the user specified mac address using 
    the command ifconfig wlanX hw ether <mac adress>.
    
@@ -591,52 +507,22 @@
   
   --------------------------------------------------------------------------*/
 
-static int __hdd_hostapd_set_mac_address(struct net_device *dev, void *addr)
+static int hdd_hostapd_set_mac_address(struct net_device *dev, void *addr)
 {
    struct sockaddr *psta_mac_addr = addr;
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   int ret = 0;
-
    ENTER();
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
    memcpy(dev->dev_addr, psta_mac_addr->sa_data, ETH_ALEN);
    EXIT();
    return 0;
 }
-
-static int hdd_hostapd_set_mac_address(struct net_device *dev, void *addr)
-{
-   int ret;
-
-   vos_ssr_protect(__func__);
-   ret = __hdd_hostapd_set_mac_address(dev, addr);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
 void hdd_hostapd_inactivity_timer_cb(v_PVOID_t usrDataForCallback)
 {
     struct net_device *dev = (struct net_device *)usrDataForCallback;
     v_BYTE_t we_custom_event[64];
     union iwreq_data wrqu;
-    hdd_adapter_t *pHostapdAdapter;
-    hdd_context_t *pHddCtx;
-#ifdef DISABLE_CONCURRENCY_AUTOSAVE
+#ifdef DISABLE_CONCURRENCY_AUTOSAVE    
     VOS_STATUS vos_status;
+    hdd_adapter_t *pHostapdAdapter;
     hdd_ap_ctx_t *pHddApCtx;
 #endif /*DISABLE_CONCURRENCY_AUTOSAVE */
 
@@ -647,21 +533,9 @@
 
     ENTER();
 
-    pHostapdAdapter = netdev_priv(dev);
-    if ((NULL == pHostapdAdapter) ||
-        (WLAN_HDD_ADAPTER_MAGIC != pHostapdAdapter->magic))
-    {
-         hddLog(LOGE, FL("invalid adapter: %p"), pHostapdAdapter);
-         return;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-    {
-        return;
-    }
 #ifdef DISABLE_CONCURRENCY_AUTOSAVE
     if (vos_concurrent_open_sessions_running())
-    {
+    {  
        /*
               This timer routine is going to be called only when AP
               persona is up.
@@ -670,6 +544,7 @@
               that if Autosave is enabled next time and other session
               was down only then we bring down AP 
              */
+        pHostapdAdapter = netdev_priv(dev);
         pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
         vos_status = vos_timer_start(
          &pHddApCtx->hdd_ap_inactivity_timer, 
@@ -734,24 +609,16 @@
 {
     v_U8_t staId = 0;
     struct net_device *dev;
-    v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
-    ptSapContext pSapCtx = NULL;
-
     dev = (struct net_device *)usrDataForCallback;
-    pSapCtx = VOS_GET_SAP_CB(pVosContext);
-    if(pSapCtx == NULL){
-        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                FL("psapCtx is NULL"));
-        return;
-    }
+
     hddLog(LOGE, FL("Clearing all the STA entry...."));
     for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++)
     {
-        if ( pSapCtx->aStaInfo[staId].isUsed &&
+        if ( pHostapdAdapter->aStaInfo[staId].isUsed && 
            ( staId != (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uBCStaId))
         {
             //Disconnect all the stations
-            hdd_softap_sta_disassoc(pHostapdAdapter, &pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]);
+            hdd_softap_sta_disassoc(pHostapdAdapter, &pHostapdAdapter->aStaInfo[staId].macAddrSTA.bytes[0]);
         }
     }
 }
@@ -762,13 +629,13 @@
     hdd_context_t     *pHddCtx = NULL;
     VOS_STATUS status = VOS_STATUS_SUCCESS;
     dev = (struct net_device *)usrDataForCallback;
-
     ENTER();
 
     pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
 
     if (0 != status) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid"));
         return status;
     }
 
@@ -809,9 +676,6 @@
     hdd_context_t *pHddCtx;
     hdd_scaninfo_t *pScanInfo  = NULL;
     struct iw_michaelmicfailure msg;
-    v_CONTEXT_t pVosContext = NULL;
-    ptSapContext pSapCtx = NULL;
-    hdd_config_t *cfg_param;
 
     dev = (struct net_device *)usrDataForCallback;
     pHostapdAdapter = netdev_priv(dev);
@@ -823,20 +687,12 @@
                 "invalid adapter or adapter has invalid magic");
         return eHAL_STATUS_FAILURE;
     }
-    pVosContext = ( WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
-    pSapCtx = VOS_GET_SAP_CB(pVosContext);
-    if(pSapCtx == NULL){
-        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                 FL("psapCtx is NULL"));
-        return eHAL_STATUS_FAILURE;
-    }
+
     pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); 
     pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
     sapEvent = pSapEvent->sapHddEventCode;
     memset(&wrqu, '\0', sizeof(wrqu));
     pHddCtx = (hdd_context_t*)(pHostapdAdapter->pHddCtx);
-    cfg_param = pHddCtx->cfg_ini;
-
 
     switch(sapEvent)
     {
@@ -848,27 +704,14 @@
 
             pHostapdState->vosStatus = pSapEvent->sapevt.sapStartBssCompleteEvent.status;
             vos_status = vos_event_set(&pHostapdState->vosEvent);
-
+   
             if (!VOS_IS_STATUS_SUCCESS(vos_status) || pHostapdState->vosStatus)
-            {
+            {     
                 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: startbss event failed!!"));
                 goto stopbss;
             }
             else
-            {
-                if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)
-                {
-                    if ((cfg_param->dynSplitscan) &&
-                            (!pHddCtx->issplitscan_enabled))
-                    {
-                        pHddCtx->issplitscan_enabled = TRUE;
-                        sme_enable_disable_split_scan(
-                                WLAN_HDD_GET_HAL_CTX(pHostapdAdapter),
-                                cfg_param->nNumStaChanCombinedConc,
-                                cfg_param->nNumP2PChanCombinedConc);
-                    }
-                }
-
+            {                
                 pHddApCtx->uBCStaId = pSapEvent->sapevt.sapStartBssCompleteEvent.staId;
                 //@@@ need wep logic here to set privacy bit
                 vos_status = hdd_softap_Register_BC_STA(pHostapdAdapter, pHddApCtx->uPrivacy);
@@ -878,7 +721,7 @@
                     hdd_stop_bss_link(pHostapdAdapter, usrDataForCallback);
                 }
             }
-
+            
             if (0 != (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff)
             {
                 // AP Inactivity timer init and start
@@ -944,14 +787,6 @@
             sapCleanupChannelList();
 
             pHddApCtx->operatingChannel = 0; //Invalidate the channel info.
-
-            if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)
-            {
-                hddLog(LOG1,
-                       FL("P2P Go is getting removed and we are trying to re-enable TDLS"));
-                wlan_hdd_tdls_reenable(pHddCtx);
-            }
-
             goto stopbss;
         case eSAP_STA_SET_KEY_EVENT:
             //TODO: forward the message to hostapd once implementtation is done for now just print
@@ -1036,15 +871,6 @@
                                      vos_status, MAC_ADDR_ARRAY(wrqu.addr.sa_data));
             }
 
-            staId =
-                pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.staId;
-            if (VOS_IS_STATUS_SUCCESS(vos_status))
-            {
-
-                pSapCtx->aStaInfo[staId].rate_flags =
-                pSapEvent->sapevt.sapStationAssocReassocCompleteEvent.rate_flags;
-            }
-
             // Stop AP inactivity timer
             if (pHddApCtx->hdd_ap_inactivity_timer.state == VOS_TIMER_STATE_RUNNING)
             {
@@ -1055,13 +881,9 @@
 #ifdef WLAN_OPEN_SOURCE
             if (wake_lock_active(&pHddCtx->sap_wake_lock))
             {
-               vos_wake_lock_release(&pHddCtx->sap_wake_lock,
-                                      WIFI_POWER_EVENT_WAKELOCK_SAP);
+               wake_unlock(&pHddCtx->sap_wake_lock);
             }
-            vos_wake_lock_timeout_release(&pHddCtx->sap_wake_lock,
-                                          HDD_SAP_WAKE_LOCK_DURATION,
-                                          WIFI_POWER_EVENT_WAKELOCK_SAP);
-
+            wake_lock_timeout(&pHddCtx->sap_wake_lock, msecs_to_jiffies(HDD_SAP_WAKE_LOCK_DURATION));
 #endif
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
             {
@@ -1087,8 +909,6 @@
                 }
              }
 #endif
-            hdd_manage_delack_timer(pHddCtx);
-
             pScanInfo =  &pHddCtx->scan_info;
             // Lets do abort scan to ensure smooth authentication for client
             if ((pScanInfo != NULL) && pScanInfo->mScanPending)
@@ -1117,17 +937,17 @@
 
             if (0 != (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->nAPAutoShutOff)
             {
-                spin_lock_bh( &pSapCtx->staInfo_lock );
+                spin_lock_bh( &pHostapdAdapter->staInfo_lock );
                 // Start AP inactivity timer if no stations associated with it
                 for (i = 0; i < WLAN_MAX_STA_COUNT; i++)
                 {
-                    if (pSapCtx->aStaInfo[i].isUsed && i != (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uBCStaId)
+                    if (pHostapdAdapter->aStaInfo[i].isUsed && i != (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uBCStaId)
                     {
                         bApActive = TRUE;
                         break;
                     }
                 }
-                spin_unlock_bh( &pSapCtx->staInfo_lock );
+                spin_unlock_bh( &pHostapdAdapter->staInfo_lock );
 
                 if (bApActive == FALSE)
                 {
@@ -1153,7 +973,6 @@
                 hddLog(LOGE, "%s: failed to update Beacon interval %d",
                         __func__, vos_status);
             }
-            hdd_manage_delack_timer(pHddCtx);
             break;
         case eSAP_WPS_PBC_PROBE_REQ_EVENT:
         {
@@ -1191,6 +1010,13 @@
             vos_mem_free(pSapEvent->sapevt.sapAssocStaListEvent.pAssocStas);// Release caller allocated memory here
             pSapEvent->sapevt.sapAssocStaListEvent.pAssocStas = NULL;
             return VOS_STATUS_SUCCESS;
+        case eSAP_INDICATE_MGMT_FRAME:
+           hdd_indicateMgmtFrame( pHostapdAdapter, 
+                                 pSapEvent->sapevt.sapManagementFrameInfo.nFrameLength,
+                                 pSapEvent->sapevt.sapManagementFrameInfo.pbFrames,
+                                 pSapEvent->sapevt.sapManagementFrameInfo.frameType, 
+                                 pSapEvent->sapevt.sapManagementFrameInfo.rxChan, 0);
+           return VOS_STATUS_SUCCESS;
         case eSAP_REMAIN_CHAN_READY:
            hdd_remainChanReadyHandler( pHostapdAdapter );
            return VOS_STATUS_SUCCESS;
@@ -1416,6 +1242,35 @@
 }
 
 #ifdef FEATURE_WLAN_CH_AVOID
+/**---------------------------------------------------------------------------
+
+  \brief hdd_hostapd_freq_to_chn() -
+
+  Input frequency translated into channel number
+
+  \param  - freq input frequency with order of kHz
+
+  \return - corresponding channel number.
+            incannot find correct channel number, return 0
+
+  --------------------------------------------------------------------------*/
+v_U16_t hdd_hostapd_freq_to_chn
+(
+   v_U16_t   freq
+)
+{
+   int   loop;
+
+   for (loop = 0; loop < NUM_20MHZ_RF_CHANNELS; loop++)
+   {
+      if (rfChannels[loop].targetFreq == freq)
+      {
+         return rfChannels[loop].channelNum;
+      }
+   }
+
+   return (0);
+}
 
 /*==========================================================================
   FUNCTION    sapUpdateUnsafeChannelList
@@ -1487,6 +1342,35 @@
 }
 
 /**---------------------------------------------------------------------------
+  \brief hdd_restart_softap() -
+   Restart SAP  on STA channel to support
+   STA + SAP concurrency.
+
+  --------------------------------------------------------------------------*/
+void hdd_restart_softap
+(
+   hdd_context_t *pHddCtx,
+   hdd_adapter_t *pHostapdAdapter
+)
+{
+   tSirChAvoidIndType *chAvoidInd;
+
+   chAvoidInd =
+         (tSirChAvoidIndType *)vos_mem_malloc(sizeof(tSirChAvoidIndType));
+   if (NULL == chAvoidInd)
+   {
+       hddLog(VOS_TRACE_LEVEL_INFO, FL("CH_AVOID IND buffer alloc Fail"));
+       return ;
+   }
+   chAvoidInd->avoidRangeCount = 1;
+   chAvoidInd->avoidFreqRange[0].startFreq =
+    vos_chan_to_freq(pHostapdAdapter->sessionCtx.ap.operatingChannel);
+   chAvoidInd->avoidFreqRange[0].endFreq =
+     vos_chan_to_freq(pHostapdAdapter->sessionCtx.ap.operatingChannel);
+   hdd_hostapd_ch_avoid_cb((void *)pHddCtx, (void *)chAvoidInd);
+   vos_mem_free(chAvoidInd);
+}
+/**---------------------------------------------------------------------------
 
   \brief hdd_hostapd_ch_avoid_cb() -
 
@@ -1519,13 +1403,6 @@
    v_CONTEXT_t         pVosContext;
    tHddAvoidFreqList   hddAvoidFreqList;
    tANI_U32            i;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-   ptSapContext pSapCtx = NULL;
-   tHalHandle hHal;
-   v_U8_t cbMode;
-   VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
-   v_U32_t delay;
-#endif
 
    /* Basic sanity */
    if ((NULL == pAdapter) || (NULL == indParam))
@@ -1547,13 +1424,9 @@
                 NUM_20MHZ_RF_CHANNELS * sizeof(v_U16_t));
    for (rangeLoop = 0; rangeLoop < chAvoidInd->avoidRangeCount; rangeLoop++)
    {
-      if (unsafeChannelCount >= NUM_20MHZ_RF_CHANNELS) {
-         hddLog(LOGW, FL("LTE Coex unsafe channel list full"));
-         break;
-      }
-      startChannel = ieee80211_frequency_to_channel(
+      startChannel = hdd_hostapd_freq_to_chn(
                       chAvoidInd->avoidFreqRange[rangeLoop].startFreq);
-      endChannel   = ieee80211_frequency_to_channel(
+      endChannel   = hdd_hostapd_freq_to_chn(
                       chAvoidInd->avoidFreqRange[rangeLoop].endFreq);
       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                 "%s : start %d : %d, end %d : %d",
@@ -1591,10 +1464,6 @@
                            "%s : unsafe channel %d, count %d",
                            __func__,
                            channelLoop, unsafeChannelCount);
-                     if (unsafeChannelCount >= NUM_20MHZ_RF_CHANNELS) {
-                        hddLog(LOGW, FL("LTE Coex unsafe channel list full"));
-                        break;
-                     }
                  }
              }
          }
@@ -1635,12 +1504,6 @@
    /* Get SAP context first
     * SAP and P2PGO would not concurrent */
    pHostapdAdapter = hdd_get_adapter(hddCtxt, WLAN_HDD_SOFTAP);
-#ifdef WLAN_FEATURE_AP_HT40_24G
-   if (NULL == pHostapdAdapter)
-   {
-       pHostapdAdapter = hdd_get_adapter(hddCtxt, WLAN_HDD_P2P_GO);
-   }
-#endif
    if ((pHostapdAdapter) &&
        (test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) &&
        (unsafeChannelCount))
@@ -1651,145 +1514,25 @@
                 pHostapdAdapter->sessionCtx.ap.operatingChannel);
       for (channelLoop = 0; channelLoop < unsafeChannelCount; channelLoop++)
       {
-          if ((unsafeChannelList[channelLoop] ==
-                pHostapdAdapter->sessionCtx.ap.operatingChannel))
-          {
-              if ((AUTO_CHANNEL_SELECT ==
-                     pHostapdAdapter->sessionCtx.ap.sapConfig.channel)
-                && (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode))
-              {
-                  /* current operating channel is un-safe channel
-                   * restart driver */
-                   hdd_hostapd_stop(pHostapdAdapter->dev);
-                   /* On LE, this event is handled by wlan-services to
-                    * restart SAP. On android, this event would be
-                    * ignored.
-                    */
-                   wlan_hdd_send_svc_nlink_msg(WLAN_SVC_SAP_RESTART_IND,
-                                                                  NULL, 0);
-              }
-              return;
-          }
+         if (((unsafeChannelList[channelLoop] ==
+               pHostapdAdapter->sessionCtx.ap.operatingChannel)) &&
+             (AUTO_CHANNEL_SELECT ==
+               pHostapdAdapter->sessionCtx.ap.sapConfig.channel))
+         {
+            /* current operating channel is un-safe channel
+             * restart driver */
+            hdd_hostapd_stop(pHostapdAdapter->dev);
+            /* On LE, this event is handled by wlan-services to restart SAP.
+               On android, this event would be ignored. */
+            wlan_hdd_send_svc_nlink_msg(WLAN_SVC_SAP_RESTART_IND, NULL, 0);
+            break;
+         }
       }
    }
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-   if (hddCtxt->cfg_ini->apHT40_24GEnabled)
-   {
-       pSapCtx = VOS_GET_SAP_CB(pVosContext);
-
-       if(pSapCtx == NULL)
-       {
-           VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-                   FL("psapCtx is NULL"));
-           return;
-       }
-
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-               FL("SAP Secondary channel: %d "),
-               pSapCtx->sap_sec_chan);
-
-       /* tHalHandle */
-       hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
-
-       if (NULL == hHal)
-       {
-           VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                   FL("In invalid hHal"));
-           return;
-       }
-
-       cbMode = sme_GetChannelBondingMode24G(hHal);
-
-       VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("Selected Channel bonding : %d"), cbMode);
-
-       if (cbMode && (pSapCtx->sap_sec_chan > 0))
-       {
-           int i;
-           eHalStatus halStatus;
-
-           for (i = 0; i < unsafeChannelCount; i++)
-           {
-               if ((pSapCtx->sap_sec_chan == unsafeChannelList[i]))
-               {
-                   /* Current SAP Secondary channel is un-safe channel */
-                   VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                           FL("Move SAP from HT40 to HT20"));
-
-                   halStatus = sme_SetHT2040Mode(hHal, pSapCtx->sessionId,
-                           PHY_SINGLE_CHANNEL_CENTERED);
-
-                   if (halStatus == eHAL_STATUS_FAILURE)
-                   {
-                       VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                               FL("Failed to change HT20/40 mode"));
-                       return;
-                   }
-
-                   /* Disable Channel Bonding for 2.4GHz */
-                   sme_UpdateChannelBondingMode24G(hHal,
-                           PHY_SINGLE_CHANNEL_CENTERED);
-                   return;
-               }
-           }
-       }
-
-       if ((!pSapCtx->numHT40IntoSta)
-          && (pHostapdAdapter)
-          && (test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)))
-       {
-           /* if Unsafe channel is Zero or SAP Primary/Secondary channel
-            * are Safe then start HT20/40 timer to Move SAP from HT20
-            * to HT40.
-            */
-           if (((!unsafeChannelCount)
-              || (!sapCheckHT40SecondaryIsNotAllowed(pSapCtx))) && (!cbMode))
-           {
-               /* Stop Previous Running HT20/40 Timer & Start timer
-                  with (OBSS TransitionDelayFactor * obss interval)
-                  delay after time out move AP from HT20 -> HT40
-                  mode
-                */
-               if (VOS_TIMER_STATE_RUNNING == pSapCtx->sap_HT2040_timer.state)
-               {
-                   vosStatus = vos_timer_stop(&pSapCtx->sap_HT2040_timer);
-                   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-                       VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                               FL("Failed to Stop HT20/40 timer"));
-               }
-
-               delay =
-               (pSapCtx->ObssScanInterval * pSapCtx->ObssTransitionDelayFactor);
-
-               VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                       FL("Start HT20/40 transition timer (%d sec)"), delay);
-
-               vosStatus = vos_timer_start( &pSapCtx->sap_HT2040_timer,
-                       (delay * 1000));
-
-               if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-                   VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                           FL("Failed to Start HT20/40 timer"));
-           }
-           else
-           {
-               /* Stop HT20/40 Timer */
-               if (VOS_TIMER_STATE_RUNNING == pSapCtx->sap_HT2040_timer.state)
-               {
-                   VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                           FL("Stop HT20/40 transition timer"));
-                   vosStatus = vos_timer_stop(&pSapCtx->sap_HT2040_timer);
-                   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-                       VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                               FL("Failed to Stop HT20/40 timer"));
-               }
-           }
-       }
-   }
-#endif
    return;
 }
+
 #endif /* FEATURE_WLAN_CH_AVOID */
 
 int
@@ -1807,8 +1550,6 @@
     int ret = 0; /* success */
     v_CONTEXT_t pVosContext;
 
-    ENTER();
-
     if (NULL == pHostapdAdapter)
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -1821,6 +1562,8 @@
     ret = wlan_hdd_validate_context(pHddCtx);
     if (0 != ret)
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+               "%s: HDD context is not valid (%d)", __func__, ret);
         return -1;
     }
 
@@ -1846,12 +1589,12 @@
         case QCSAP_PARAM_CLR_ACL:
             if ( VOS_STATUS_SUCCESS != WLANSAP_ClearACL( pVosContext ))
             {
-               ret = -EIO;
+               ret = -EIO;            
             }
             break;
 
         case QCSAP_PARAM_ACL_MODE:
-            if ((eSAP_ALLOW_ALL < (eSapMacAddrACL)set_value) ||
+            if ((eSAP_ALLOW_ALL < (eSapMacAddrACL)set_value) || 
                 (eSAP_ACCEPT_UNLESS_DENIED > (eSapMacAddrACL)set_value))
             {
                 hddLog(LOGE, FL("Invalid ACL Mode value %d"), set_value);
@@ -1947,20 +1690,7 @@
                 }
                 break;
             }
-        case QCSAP_PARAM_GET_FRAME_LOGS:
-            {
-                if (wlan_hdd_get_frame_logs(pHostapdAdapter, set_value)
-                         != VOS_STATUS_SUCCESS)
-                {
-                    ret = -EINVAL;
-                }
-                break;
-            }
-        case QCSAP_PARAM_SET_PROXIMITY:
-            {
-                ret = wlan_hdd_set_proximity(set_value);
-                break;
-            }
+
         default:
             hddLog(LOGE, FL("Invalid setparam command %d value %d"),
                     sub_cmd, set_value);
@@ -1968,7 +1698,6 @@
             break;
     }
 
-    EXIT();
     return ret;
 }
 
@@ -1991,44 +1720,15 @@
                           struct iw_request_info *info,
                           union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter;
-    tHalHandle hHal;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
     int *value = (int *)extra;
     int sub_cmd = value[0];
     eHalStatus status;
     int ret = 0; /* success */
-    v_CONTEXT_t pVosContext;
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; 
 
-    ENTER();
-
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-         return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
-    }
-    pVosContext = pHddCtx->pvosContext;
-    if (NULL == pVosContext)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pVosContext Context is NULL",__func__);
-        return -EINVAL;
-    }
     switch (sub_cmd)
     {
     case QCSAP_PARAM_MAX_ASSOC:
@@ -2071,17 +1771,17 @@
             }
         }
         break;
-
+        
     case QCSAP_PARAM_CLR_ACL:
         if ( VOS_STATUS_SUCCESS != WLANSAP_ClearACL( pVosContext ))
         {
             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                 FL("WLANSAP_ClearACL failed"));
-               ret = -EIO;
-        }
+               ret = -EIO;            
+        }               
         *value = 0;
         break;
-
+        
     case QCSAP_PARAM_GET_WLAN_DBG:
         {
             vos_trace_display();
@@ -2102,7 +1802,6 @@
 
     }
 
-    EXIT();
     return ret;
 }
 
@@ -2143,35 +1842,14 @@
                          struct iw_request_info *info,
                          union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter;
-    v_CONTEXT_t pVosContext;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; 
     v_BYTE_t *value = (v_BYTE_t*)extra;
     v_U8_t pPeerStaMac[VOS_MAC_ADDR_SIZE];
     int listType, cmd, i;
     int ret = 0; /* success */
 
     ENTER();
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    pVosContext =  pHddCtx->pvosContext;
-    if (NULL == pVosContext)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Vos Context is NULL",__func__);
-        return -EINVAL;
-    }
     for (i=0; i<VOS_MAC_ADDR_SIZE; i++)
     {
         pPeerStaMac[i] = *(value+i);
@@ -2211,32 +1889,11 @@
                               struct iw_request_info *info,
                               union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
-    int *value;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
 
-    ENTER();
-
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
-    value = (int *)extra;
+    int *value = (int *)extra;
 
     *value = (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->operatingChannel;
-
-    EXIT();
     return 0;
 }
 
@@ -2260,36 +1917,13 @@
                                     struct iw_request_info *info,
                                     union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter;
-    tHalHandle hHal;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
     int *value = (int *)extra;
-    int set_value, ret = 0;
+    int set_value;
     tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
     tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
 
-    ENTER();
-
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
-    }
     if (NULL == value)
         return -ENOMEM;
 
@@ -2307,7 +1941,6 @@
         return -EIO;
     }
 
-    EXIT();
     return 0;
 }
 
@@ -2337,29 +1970,10 @@
      *  TL State (with Per Client infor)
      *  DXE Snapshot (Called at the end of TL Snapshot)
      */
-    hdd_adapter_t *pHostapdAdapter;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
-
-    ENTER();
-
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    hddLog(LOGE, "%s: called for SAP",__func__);
     hdd_wmm_tx_snapshot(pHostapdAdapter);
     WLANTL_TLDebugMessage(WLANTL_DEBUG_TX_SNAPSHOT);
-
-    EXIT();
     return 0;
 }
 
@@ -2382,43 +1996,13 @@
                                 struct iw_request_info *info,
                                 union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter;
-    hdd_context_t *pHddCtx;
-    v_CONTEXT_t pVosContext;
-    tHalHandle hHal;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
     int *value = (int *)extra;
-    int set_value, ret = 0;
+    int set_value;
     ptSapContext  pSapCtx = NULL;
 
-    ENTER();
-
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    pVosContext = pHddCtx->pvosContext;
-    if (NULL == pVosContext)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Vos Context is NULL",__func__);
-        return -EINVAL;
-    }
-    hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
-    }
     if (NULL == value)
         return -ENOMEM;
 
@@ -2438,7 +2022,6 @@
         return -EIO;
     }
 
-    EXIT();
     return 0;
 }
 
@@ -2472,14 +2055,11 @@
                                           struct iw_request_info *info,
                                           union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     int *isSetTrafficMon = (int *)extra;
     hdd_context_t *pHddCtx;
     int status;
 
-    ENTER();
-
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     if (NULL == pAdapter)
     {
         VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
@@ -2490,8 +2070,11 @@
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -2525,8 +2108,6 @@
         }
 
     }
-
-    EXIT();
     return 0;
 }
 
@@ -2550,33 +2131,14 @@
                                      struct iw_request_info *info,
                                      union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter;
-    hdd_context_t *pHddCtx;
-    hdd_station_info_t *pStaInfo = NULL;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    hdd_station_info_t *pStaInfo = pHostapdAdapter->aStaInfo;
     char *buf;
     int cnt = 0;
     int left;
     int ret = 0;
     /* maclist_index must be u32 to match userspace */
     u32 maclist_index;
-    v_CONTEXT_t pVosContext = NULL;
-    ptSapContext pSapCtx = NULL;
-
-    ENTER();
-
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
 
     /*
      * NOTE WELL: this is a "get" ioctl but it uses an even ioctl
@@ -2599,14 +2161,6 @@
         return -EINVAL;
     }
 
-    pVosContext = ( WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
-    pSapCtx = VOS_GET_SAP_CB(pVosContext);
-    if(pSapCtx == NULL){
-        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                  FL("psapCtx is NULL"));
-        return  -EFAULT;
-    }
-
     /* allocate local buffer to build the response */
     buf = kmalloc(wrqu->data.length, GFP_KERNEL);
     if (!buf) {
@@ -2614,12 +2168,11 @@
         return -ENOMEM;
     }
 
-    pStaInfo = pSapCtx->aStaInfo;
     /* start indexing beyond where the record count will be written */
     maclist_index = sizeof(maclist_index);
     left = wrqu->data.length - maclist_index;
 
-    spin_lock_bh(&pSapCtx->staInfo_lock);
+    spin_lock_bh(&pHostapdAdapter->staInfo_lock);
     while ((cnt < WLAN_MAX_STA_COUNT) && (left >= VOS_MAC_ADDR_SIZE)) {
         if ((pStaInfo[cnt].isUsed) &&
             (!IS_BROADCAST_MAC(pStaInfo[cnt].macAddrSTA.bytes))) {
@@ -2630,7 +2183,7 @@
         }
         cnt++;
     }
-    spin_unlock_bh(&pSapCtx->staInfo_lock);
+    spin_unlock_bh(&pHostapdAdapter->staInfo_lock);
 
     *((u32 *)buf) = maclist_index;
     wrqu->data.length = maclist_index;
@@ -2639,8 +2192,6 @@
         ret = -EFAULT;
     }
     kfree(buf);
-
-    EXIT();
     return ret;
 }
 
@@ -2676,32 +2227,10 @@
                                 struct iw_request_info *info,
                                 union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter;
-    hdd_context_t *pHddCtx;
-    v_U8_t *peerMacAddr;
-    int ret = 0;
-
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    v_U8_t *peerMacAddr;    
+    
     ENTER();
-
-    if (!capable(CAP_NET_ADMIN)) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("permission check failed"));
-        return -EPERM;
-    }
-
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
     /* iwpriv tool or framework calls this ioctl with
      * data passed in extra (less than 16 octets);
      */
@@ -2733,27 +2262,11 @@
                           struct iw_request_info *info,
                           union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
     WLANTL_TRANSFER_STA_TYPE  statBuffer;
     char *pstatbuf;
-    int len, ret = 0;
+    int len;
 
-    ENTER();
-
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
     memset(&statBuffer, 0, sizeof(statBuffer));
     WLANSAP_GetStatistics((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext,
                            &statBuffer, (v_BOOL_t)wrqu->data.flags);
@@ -2785,167 +2298,8 @@
     strlcpy(extra, pstatbuf, len);
     wrqu->data.length = len;
     kfree(pstatbuf);
-
-    EXIT();
     return 0;
 }
-int
-static __iw_softap_ap_get_stats(struct net_device *dev,
-                          struct iw_request_info *info,
-                          union iwreq_data *wrqu, char *extra)
-{
-    hdd_adapter_t *pAdapter;
-    hdd_tx_rx_stats_t *pStats;
-
-    ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-
-    pStats = &pAdapter->hdd_stats.hddTxRxStats;
-    snprintf(extra, QCSAP_MAX_STR_LEN,
-                     "\nTransmit"
-                     "\ncalled %u, dropped %u, backpressured %u, queued %u"
-                     "\n      dropped BK %u, BE %u, VI %u, VO %u"
-                     "\n   classified BK %u, BE %u, VI %u, VO %u"
-                     "\nbackpressured BK %u, BE %u, VI %u, VO %u"
-                     "\n       queued BK %u, BE %u, VI %u, VO %u"
-                     "\nfetched %u, empty %u, lowres %u, deqerr %u"
-                     "\ndequeued %u, depressured %u, deque-depressured %u,\
-                        completed %u, flushed %u"
-                     "\n      fetched BK %u, BE %u, VI %u, VO %u"
-                     "\n     dequeued BK %u, BE %u, VI %u, VO %u"
-                     "\n  depressured BK %u, BE %u, VI %u, VO %u"
-                     "\nDeque depressured BK %u, BE %u, VI %u, VO %u"
-                     "\n      flushed BK %u, BE %u, VI %u, VO %u"
-                     "\n\nReceive"
-                     "\nchains %u, packets %u, dropped %u, delivered %u, refused %u"
-                     "\n\nResetsStats"
-                     "\n",
-                     pStats->txXmitCalled,
-                     pStats->txXmitDropped,
-                     pStats->txXmitBackPressured,
-                     pStats->txXmitQueued,
-
-                     pStats->txXmitDroppedAC[WLANTL_AC_BK],
-                     pStats->txXmitDroppedAC[WLANTL_AC_BE],
-                     pStats->txXmitDroppedAC[WLANTL_AC_VI],
-                     pStats->txXmitDroppedAC[WLANTL_AC_VO],
-
-                     pStats->txXmitClassifiedAC[WLANTL_AC_BK],
-                     pStats->txXmitClassifiedAC[WLANTL_AC_BE],
-                     pStats->txXmitClassifiedAC[WLANTL_AC_VI],
-                     pStats->txXmitClassifiedAC[WLANTL_AC_VO],
-
-                     pStats->txXmitBackPressuredAC[WLANTL_AC_BK],
-                     pStats->txXmitBackPressuredAC[WLANTL_AC_BE],
-                     pStats->txXmitBackPressuredAC[WLANTL_AC_VI],
-                     pStats->txXmitBackPressuredAC[WLANTL_AC_VO],
-
-                     pStats->txXmitQueuedAC[WLANTL_AC_BK],
-                     pStats->txXmitQueuedAC[WLANTL_AC_BE],
-                     pStats->txXmitQueuedAC[WLANTL_AC_VI],
-                     pStats->txXmitQueuedAC[WLANTL_AC_VO],
-
-                     pStats->txFetched,
-                     pStats->txFetchEmpty,
-                     pStats->txFetchLowResources,
-                     pStats->txFetchDequeueError,
-
-                     pStats->txFetchDequeued,
-                     pStats->txFetchDePressured,
-                     pStats->txDequeDePressured,
-                     pStats->txCompleted,
-                     pStats->txFlushed,
-
-                     pStats->txFetchedAC[WLANTL_AC_BK],
-                     pStats->txFetchedAC[WLANTL_AC_BE],
-                     pStats->txFetchedAC[WLANTL_AC_VI],
-                     pStats->txFetchedAC[WLANTL_AC_VO],
-
-                     pStats->txFetchDequeuedAC[WLANTL_AC_BK],
-                     pStats->txFetchDequeuedAC[WLANTL_AC_BE],
-                     pStats->txFetchDequeuedAC[WLANTL_AC_VI],
-                     pStats->txFetchDequeuedAC[WLANTL_AC_VO],
-
-                     pStats->txFetchDePressuredAC[WLANTL_AC_BK],
-                     pStats->txFetchDePressuredAC[WLANTL_AC_BE],
-                     pStats->txFetchDePressuredAC[WLANTL_AC_VI],
-                     pStats->txFetchDePressuredAC[WLANTL_AC_VO],
-
-                     pStats->txDequeDePressuredAC[WLANTL_AC_BK],
-                     pStats->txDequeDePressuredAC[WLANTL_AC_BE],
-                     pStats->txDequeDePressuredAC[WLANTL_AC_VI],
-                     pStats->txDequeDePressuredAC[WLANTL_AC_VO],
-
-                     pStats->txFlushedAC[WLANTL_AC_BK],
-                     pStats->txFlushedAC[WLANTL_AC_BE],
-                     pStats->txFlushedAC[WLANTL_AC_VI],
-                     pStats->txFlushedAC[WLANTL_AC_VO],
-
-                     pStats->rxChains,
-                     pStats->rxPackets,
-                     pStats->rxDropped,
-                     pStats->rxDelivered,
-                     pStats->rxRefused
-                     );
-
-    wrqu->data.length = strlen(extra) + 1;
-
-   return 0;
-}
-
-int
-static __iw_softap_ap_clear_stats(struct net_device *dev,
-                          struct iw_request_info *info,
-                          union iwreq_data *wrqu, char *extra)
-{
-    hdd_adapter_t *pAdapter;
-
-    ENTER();
-
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-
-    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: clearing", __func__);
-    memset(&pAdapter->stats, 0, sizeof(pAdapter->stats));
-    memset(&pAdapter->hdd_stats, 0, sizeof(pAdapter->hdd_stats));
-    return 0;
-}
-
-
-int
-static iw_softap_get_stats(struct net_device *dev,
-                          struct iw_request_info *info,
-                          union iwreq_data *wrqu, char *extra)
-{
-   int ret;
-   vos_ssr_protect(__func__);
-   ret = __iw_softap_ap_get_stats(dev, info, wrqu, extra);
-   vos_ssr_unprotect(__func__);
-   return ret;
-}
-
-int
-static iw_softap_clear_stats(struct net_device *dev,
-                          struct iw_request_info *info,
-                          union iwreq_data *wrqu, char *extra)
-{
-   int ret;
-   vos_ssr_protect(__func__);
-   ret = __iw_softap_ap_clear_stats(dev, info, wrqu, extra);
-   vos_ssr_unprotect(__func__);
-   return ret;
-}
 
 int
 static iw_softap_ap_stats(struct net_device *dev,
@@ -2965,9 +2319,10 @@
                                        struct iw_request_info *info,
                                        union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter;
-    tHalHandle hHal;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
+
     int *value = (int *)extra;
     int startChannel = value[0];
     int endChannel = value[1];
@@ -2975,35 +2330,6 @@
     VOS_STATUS status;
     int ret = 0; /* success */
 
-    ENTER();
-
-    if (!capable(CAP_NET_ADMIN))
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("permission check failed"));
-        return -EPERM;
-    }
-
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
-    }
     status = WLANSAP_SetChannelRange(hHal,startChannel,endChannel,band);
     if(status != VOS_STATUS_SUCCESS)
     {
@@ -3014,7 +2340,6 @@
 
     pHddCtx->is_dynamic_channel_range_set = 1;
 
-    EXIT();
     return ret;
 }
 
@@ -3041,36 +2366,13 @@
     v_U8_t bandStartChannel = RF_CHAN_1;
     v_U8_t bandEndChannel = RF_CHAN_165;
     v_U32_t temp_num_channels = 0;
-    hdd_adapter_t *pHostapdAdapter;
-    tHalHandle hHal;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
     v_REGDOMAIN_t domainIdCurrentSoftap;
     tpChannelListInfo channel_list = (tpChannelListInfo) extra;
     eCsrBand curBand = eCSR_BAND_ALL;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
 
-    ENTER();
-
-    pHostapdAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pHostapdAdapter)
-    {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-         return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
-    }
     if (eHAL_STATUS_SUCCESS != sme_GetFreqBand(hHal, &curBand))
     {
         hddLog(LOGE,FL("not able get the current frequency band"));
@@ -3134,6 +2436,11 @@
 
     hddLog(LOG1,FL(" number of channels %d"), num_channels);
 
+    if (num_channels > IW_MAX_FREQUENCIES)
+    {
+        num_channels = IW_MAX_FREQUENCIES;
+    }
+
     channel_list->num_channels = num_channels;
     EXIT();
 
@@ -3158,36 +2465,12 @@
                  struct iw_request_info *info,
                  union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter;
-    hdd_context_t *pHddCtx;
-    v_CONTEXT_t pVosContext;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; 
     eHalStatus status;
     v_U32_t length = DOT11F_IE_RSN_MAX_LEN;
     v_U8_t genIeBytes[DOT11F_IE_RSN_MAX_LEN];
-    int ret = 0;
-
     ENTER();
-
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    pVosContext = pHddCtx->pvosContext;
-    if (NULL == pVosContext)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: vos context is not valid ",__func__);
-        return -EINVAL;
-    }
     hddLog(LOG1,FL("getGEN_IE ioctl"));
     // Actually retrieve the RSN IE from CSR.  (We previously sent it down in the CSR Roam Profile.)
     status = WLANSap_getstationIE_information(pVosContext, 
@@ -3229,35 +2512,11 @@
                                struct iw_request_info *info,
                                union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));    
     sQcSapreq_WPSPBCProbeReqIES_t WPSPBCProbeReqIEs;
-    hdd_ap_ctx_t *pHddApCtx;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
-
+    hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
     ENTER();
 
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
-    if (NULL == pHddApCtx)
-    {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: AP context is NULL",__func__);
-         return -EINVAL;
-    }
-
     hddLog(LOG1,FL("get_WPSPBCProbeReqIEs ioctl"));
     memset((void*)&WPSPBCProbeReqIEs, 0, sizeof(WPSPBCProbeReqIEs));
 
@@ -3313,34 +2572,10 @@
                          struct iw_request_info *info,
                          union iwreq_data *wrqu,char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   hdd_wext_state_t *pWextState;
-   int ret = 0;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); 
 
    ENTER();
-
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-   pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-   if (NULL == pWextState)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: pWextState is NULL",__func__);
-       return -EINVAL;
-   }
    switch(wrqu->param.flags & IW_AUTH_INDEX)
    {
       case IW_AUTH_TKIP_COUNTERMEASURES:
@@ -3349,8 +2584,8 @@
             hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
                    "Counter Measure started %d", wrqu->param.value);
             pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED;
-         }
-         else {
+         }  
+         else {   
             hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
                    "Counter Measure stopped=%d", wrqu->param.value);
             pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED;
@@ -3358,16 +2593,16 @@
 
          hdd_softap_tkip_mic_fail_counter_measure(pAdapter,
                                                   wrqu->param.value);
-      }
+      }   
       break;
-
+         
       default:
-
+         
          hddLog(LOGW, "%s called with unsupported auth type %d", __func__, 
                wrqu->param.flags & IW_AUTH_INDEX);
       break;
    }
-
+   
    EXIT();
    return 0;
 }
@@ -3389,64 +2624,35 @@
                                  struct iw_request_info *info,
                                  union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter;
-    v_CONTEXT_t pVosContext;
-    hdd_context_t *pHddCtx;
-    hdd_ap_ctx_t *pHddApCtx;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;    
+    hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
     int retval = 0;
     VOS_STATUS vstatus;
     struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
     v_U8_t groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
     int key_index;
     struct iw_point *encoding = &wrqu->encoding;
-    tCsrRoamSetKey  setKey;
+    tCsrRoamSetKey  setKey;   
 //    tCsrRoamRemoveKey RemoveKey;
     int i;
 
-    ENTER();
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    retval = wlan_hdd_validate_context(pHddCtx);
-    if (0 != retval)
-    {
-        return retval;
-    }
-    pVosContext = pHddCtx->pvosContext;
-    if (NULL == pVosContext)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pVosContext is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
-    if (NULL == pHddApCtx)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: AP Context is NULL",__func__);
-        return -EINVAL;
-    }
-
+    ENTER();    
+   
     key_index = encoding->flags & IW_ENCODE_INDEX;
-
+   
     if(key_index > 0) {
-
+      
          /*Convert from 1-based to 0-based keying*/
         key_index--;
     }
     if(!ext->key_len) {
-#if 0
+#if 0     
       /*Set the encrytion type to NONE*/
 #if 0
        pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
 #endif
-
+     
          RemoveKey.keyId = key_index;
          if(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
               /*Key direction for group is RX only*/
@@ -3588,9 +2794,8 @@
                    "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", __LINE__, vstatus );
        retval = -EINVAL;
     }
-
-    EXIT();
-    return retval;
+   
+   return retval;
 }
 
 static int iw_set_ap_encodeext(struct net_device *dev,
@@ -3606,10 +2811,10 @@
     return ret;
 }
 
-static int __iw_set_ap_mlme(struct net_device *dev,
-                            struct iw_request_info *info,
-                            union iwreq_data *wrqu,
-                            char *extra)
+static int iw_set_ap_mlme(struct net_device *dev,
+                       struct iw_request_info *info,
+                       union iwreq_data *wrqu,
+                       char *extra)
 {
 #if 0
     hdd_adapter_t *pAdapter = (netdev_priv(dev));
@@ -3654,20 +2859,6 @@
 //    return status;
 }
 
-static int iw_set_ap_mlme(struct net_device *dev,
-                            struct iw_request_info *info,
-                            union iwreq_data *wrqu,
-                            char *extra)
-{
-   int ret;
-
-   vos_ssr_protect(__func__);
-   ret = __iw_set_ap_mlme(dev, info, wrqu, extra);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
 static int __iw_get_ap_rts_threshold(struct net_device *dev,
                                      struct iw_request_info *info,
                                      union iwreq_data *wrqu, char *extra)
@@ -3723,49 +2914,22 @@
                             struct iw_freq *fwrq, char *extra)
 {
    v_U32_t status = FALSE, channel = 0, freq = 0;
-   hdd_adapter_t *pHostapdAdapter;
+   hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
    tHalHandle hHal;
    hdd_hostapd_state_t *pHostapdState;
-   hdd_ap_ctx_t *pHddApCtx;
-   hdd_context_t *pHddCtx;
-   int ret = 0;
+   hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
 
    ENTER();
 
-   pHostapdAdapter = (netdev_priv(dev));
-   if (NULL == pHostapdAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
+   if ((WLAN_HDD_GET_CTX(pHostapdAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+      return status;
    }
-   pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
+
    pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter);
-   if (NULL == pHostapdState)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: pHostapdState is NULL",__func__);
-       return -EINVAL;
-   }
    hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
-   if (NULL == hHal)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Hal Context is NULL",__func__);
-       return -EINVAL;
-   }
-   pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
-   if (NULL == pHddApCtx)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: AP context is NULL",__func__);
-       return -EINVAL;
-   }
+
    if(pHostapdState->bssState == BSS_STOP )
    {
        if (ccmCfgGetInt(hHal, WNI_CFG_CURRENT_CHANNEL, &channel)
@@ -3801,9 +2965,7 @@
            fwrq->e = MHZ;
        }
     }
-
-    EXIT();
-    return 0;
+   return 0;
 }
 
 static int iw_get_ap_freq(struct net_device *dev,
@@ -3824,28 +2986,9 @@
                          union iwreq_data *wrqu, char *extra)
 {
     int status = 0;
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-
-    ENTER();
-
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    status = wlan_hdd_validate_context(pHddCtx);
-    if (0 != status)
-    {
-        return status;
-    }
 
     wrqu->mode = IW_MODE_MASTER;
 
-    EXIT();
     return status;
 }
 
@@ -3862,41 +3005,384 @@
     return ret;
 }
 
+static int __iw_softap_setwpsie(struct net_device *dev,
+                              struct iw_request_info *info,
+                              union iwreq_data *wrqu,
+                              char *extra)
+{
+   hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+   v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
+   hdd_hostapd_state_t *pHostapdState;
+   eHalStatus halStatus= eHAL_STATUS_SUCCESS;
+   u_int8_t *wps_genie;
+   u_int8_t *fwps_genie;
+   u_int8_t *pos;
+   tpSap_WPSIE pSap_WPSIe;
+   u_int8_t WPSIeType;
+   u_int16_t length;   
+   struct iw_point s_priv_data;
+   ENTER();
+
+   /* helper function to get iwreq_data with compat handling. */
+   if (hdd_priv_get_data(&s_priv_data, wrqu))
+   {
+      return -EINVAL;
+   }
+
+   if ((NULL == s_priv_data.pointer) || (s_priv_data.length < QCSAP_MAX_WSC_IE))
+   {
+      return -EINVAL;
+   }
+
+   wps_genie = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
+                                               s_priv_data.length);
+
+   if(NULL == wps_genie)
+   {
+       hddLog(LOG1, "%s: failed to alloc memory "
+                    "and copy data from user buffer", __func__);
+       return -EFAULT;
+   }
+
+   fwps_genie = wps_genie;
+
+   pSap_WPSIe = vos_mem_malloc(sizeof(tSap_WPSIE));
+   if (NULL == pSap_WPSIe) 
+   {
+      hddLog(LOGE, "VOS unable to allocate memory");
+      kfree(fwps_genie);
+      return -ENOMEM;
+   }
+   vos_mem_zero(pSap_WPSIe, sizeof(tSap_WPSIE));
+ 
+   hddLog(LOG1,"%s WPS IE type[0x%X] IE[0x%X], LEN[%d]", __func__, wps_genie[0], wps_genie[1], wps_genie[2]);
+   WPSIeType = wps_genie[0];
+   if ( wps_genie[0] == eQC_WPS_BEACON_IE)
+   {
+      pSap_WPSIe->sapWPSIECode = eSAP_WPS_BEACON_IE; 
+      wps_genie = wps_genie + 1;
+      switch ( wps_genie[0] ) 
+      {
+         case DOT11F_EID_WPA: 
+            if (wps_genie[1] < 2 + 4)
+            {
+               vos_mem_free(pSap_WPSIe); 
+               kfree(fwps_genie);
+               return -EINVAL;
+            }
+            else if (memcmp(&wps_genie[2], "\x00\x50\xf2\x04", 4) == 0) 
+            {
+             hddLog (LOG1, "%s Set WPS BEACON IE(len %d)",__func__, wps_genie[1]+2);
+             pos = &wps_genie[6];
+             while (((size_t)pos - (size_t)&wps_genie[6])  < (wps_genie[1] - 4) )
+             {
+                switch((u_int16_t)(*pos<<8) | *(pos+1))
+                {
+                   case HDD_WPS_ELEM_VERSION:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.Version = *pos;   
+                      hddLog(LOG1, "WPS version %d", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.Version);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_VER_PRESENT;   
+                      pos += 1;
+                      break;
+                   
+                   case HDD_WPS_ELEM_WPS_STATE:
+                      pos +=4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.wpsState = *pos;
+                      hddLog(LOG1, "WPS State %d", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.wpsState);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_STATE_PRESENT;
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_APSETUPLOCK:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.APSetupLocked = *pos;
+                      hddLog(LOG1, "AP setup lock %d", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.APSetupLocked);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_APSETUPLOCK_PRESENT;
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_SELECTEDREGISTRA:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistra = *pos;
+                      hddLog(LOG1, "Selected Registra %d", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistra);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_SELECTEDREGISTRA_PRESENT;
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_DEVICE_PASSWORD_ID:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.DevicePasswordID = (*pos<<8) | *(pos+1);
+                      hddLog(LOG1, "Password ID: %x", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.DevicePasswordID);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_DEVICEPASSWORDID_PRESENT;
+                      pos += 2; 
+                      break;
+                   case HDD_WPS_ELEM_REGISTRA_CONF_METHODS:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistraCfgMethod = (*pos<<8) | *(pos+1);
+                      hddLog(LOG1, "Select Registra Config Methods: %x", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistraCfgMethod);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT;
+                      pos += 2; 
+                      break;
+                
+                   case HDD_WPS_ELEM_UUID_E:
+                      pos += 2; 
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSBeaconIE.UUID_E, pos, length);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_UUIDE_PRESENT; 
+                      pos += length;
+                      break;
+                   case HDD_WPS_ELEM_RF_BANDS:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.RFBand = *pos;
+                      hddLog(LOG1, "RF band: %d", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.RFBand);
+                      pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_RF_BANDS_PRESENT;
+                      pos += 1;
+                      break;
+                   
+                   default:
+                      hddLog (LOGW, "UNKNOWN TLV in WPS IE(%x)", (*pos<<8 | *(pos+1)));
+                      vos_mem_free(pSap_WPSIe);
+                      kfree(fwps_genie);
+                      return -EINVAL; 
+                }
+              }  
+            }
+            else { 
+                 hddLog (LOGE, "%s WPS IE Mismatch %X",
+                         __func__, wps_genie[0]);
+            }     
+            break;
+                 
+         default:
+            hddLog (LOGE, "%s Set UNKNOWN IE %X",__func__, wps_genie[0]);
+            vos_mem_free(pSap_WPSIe);
+            kfree(fwps_genie);
+            return 0;
+      }
+    } 
+    else if( wps_genie[0] == eQC_WPS_PROBE_RSP_IE)
+    {
+      pSap_WPSIe->sapWPSIECode = eSAP_WPS_PROBE_RSP_IE; 
+      wps_genie = wps_genie + 1;
+      switch ( wps_genie[0] ) 
+      {
+         case DOT11F_EID_WPA: 
+            if (wps_genie[1] < 2 + 4)
+            {
+               vos_mem_free(pSap_WPSIe); 
+               kfree(fwps_genie);
+               return -EINVAL;
+            }
+            else if (memcmp(&wps_genie[2], "\x00\x50\xf2\x04", 4) == 0) 
+            {
+             hddLog (LOG1, "%s Set WPS PROBE RSP IE(len %d)",__func__, wps_genie[1]+2);
+             pos = &wps_genie[6];
+             while (((size_t)pos - (size_t)&wps_genie[6])  < (wps_genie[1] - 4) )
+             {
+              switch((u_int16_t)(*pos<<8) | *(pos+1))
+              {
+                   case HDD_WPS_ELEM_VERSION:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Version = *pos;   
+                      hddLog(LOG1, "WPS version %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Version);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_VER_PRESENT;   
+                      pos += 1;
+                      break;
+                   
+                   case HDD_WPS_ELEM_WPS_STATE:
+                      pos +=4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.wpsState = *pos;
+                      hddLog(LOG1, "WPS State %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.wpsState);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_STATE_PRESENT;
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_APSETUPLOCK:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.APSetupLocked = *pos;
+                      hddLog(LOG1, "AP setup lock %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.APSetupLocked);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_APSETUPLOCK_PRESENT;
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_SELECTEDREGISTRA:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistra = *pos;
+                      hddLog(LOG1, "Selected Registra %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistra);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_SELECTEDREGISTRA_PRESENT;                      
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_DEVICE_PASSWORD_ID:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DevicePasswordID = (*pos<<8) | *(pos+1);
+                      hddLog(LOG1, "Password ID: %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DevicePasswordID);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_DEVICEPASSWORDID_PRESENT;
+                      pos += 2; 
+                      break;
+                   case HDD_WPS_ELEM_REGISTRA_CONF_METHODS:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistraCfgMethod = (*pos<<8) | *(pos+1);
+                      hddLog(LOG1, "Select Registra Config Methods: %x", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistraCfgMethod);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT;
+                      pos += 2; 
+                      break;
+                  case HDD_WPS_ELEM_RSP_TYPE:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ResponseType = *pos;
+                      hddLog(LOG1, "Config Methods: %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ResponseType);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_RESPONSETYPE_PRESENT;
+                      pos += 1;
+                      break;
+                   case HDD_WPS_ELEM_UUID_E:
+                      pos += 2; 
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.UUID_E, pos, length);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_UUIDE_PRESENT;
+                      pos += length;
+                      break;
+                   
+                   case HDD_WPS_ELEM_MANUFACTURER:
+                      pos += 2;
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Manufacture.num_name = length;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Manufacture.name, pos, length);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_MANUFACTURE_PRESENT;
+                      pos += length;
+                      break;
+ 
+                   case HDD_WPS_ELEM_MODEL_NAME:
+                      pos += 2;
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelName.num_text = length;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelName.text, pos, length);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_MODELNAME_PRESENT;
+                      pos += length;
+                      break;
+                   case HDD_WPS_ELEM_MODEL_NUM:
+                      pos += 2;
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelNumber.num_text = length;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelNumber.text, pos, length);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_MODELNUMBER_PRESENT;
+                      pos += length;
+                      break;
+                   case HDD_WPS_ELEM_SERIAL_NUM:
+                      pos += 2;
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SerialNumber.num_text = length;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SerialNumber.text, pos, length);
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_SERIALNUMBER_PRESENT;
+                      pos += length;
+                      break;
+                   case HDD_WPS_ELEM_PRIMARY_DEVICE_TYPE:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.PrimaryDeviceCategory = (*pos<<8 | *(pos+1));
+                      hddLog(LOG1, "primary dev category: %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.PrimaryDeviceCategory);
+                      pos += 2;
+                      
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.PrimaryDeviceOUI, pos, HDD_WPS_DEVICE_OUI_LEN);
+                      hddLog(LOG1, "primary dev oui: %02x, %02x, %02x, %02x", pos[0], pos[1], pos[2], pos[3]);
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceSubCategory = (*pos<<8 | *(pos+1));
+                      hddLog(LOG1, "primary dev sub category: %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceSubCategory);
+                      pos += 2;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT;                      
+                      break;
+                   case HDD_WPS_ELEM_DEVICE_NAME:
+                      pos += 2;
+                      length = *pos<<8 | *(pos+1);
+                      pos += 2;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceName.num_text = length;
+                      vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceName.text, pos, length);
+                      pos += length;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_DEVICENAME_PRESENT;
+                      break;
+                   case HDD_WPS_ELEM_CONFIG_METHODS:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ConfigMethod = (*pos<<8) | *(pos+1);
+                      hddLog(LOG1, "Config Methods: %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistraCfgMethod);
+                      pos += 2; 
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_CONFIGMETHODS_PRESENT;
+                      break;
+ 
+                   case HDD_WPS_ELEM_RF_BANDS:
+                      pos += 4;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.RFBand = *pos;
+                      hddLog(LOG1, "RF band: %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.RFBand);
+                      pos += 1;
+                      pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_RF_BANDS_PRESENT;
+                      break;
+              }  // switch
+            }
+         } 
+         else
+         {
+            hddLog (LOGE, "%s WPS IE Mismatch %X",__func__, wps_genie[0]);
+         }
+         
+      } // switch
+    }
+    halStatus = WLANSAP_Set_WpsIe(pVosContext, pSap_WPSIe);
+    pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter);
+    if( pHostapdState->bCommit && WPSIeType == eQC_WPS_PROBE_RSP_IE)
+    {
+        //hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+        //v_CONTEXT_t pVosContext = pHostapdAdapter->pvosContext;
+        WLANSAP_Update_WpsIe ( pVosContext );
+    }
+ 
+    vos_mem_free(pSap_WPSIe);   
+    kfree(fwps_genie);
+    EXIT();
+    return halStatus;
+}
+
+static int iw_softap_setwpsie(struct net_device *dev,
+                              struct iw_request_info *info,
+                              union iwreq_data *wrqu,
+                              char *extra)
+{
+    int ret;
+
+    vos_ssr_protect(__func__);
+    ret = __iw_softap_setwpsie(dev, info, wrqu, extra);
+    vos_ssr_unprotect(__func__);
+
+    return ret;
+}
 
 static int __iw_softap_stopbss(struct net_device *dev,
                              struct iw_request_info *info,
                              union iwreq_data *wrqu,
                              char *extra)
 {
-    hdd_adapter_t *pHostapdAdapter;
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
     VOS_STATUS status = VOS_STATUS_SUCCESS;
     hdd_context_t *pHddCtx         = NULL;
 
     ENTER();
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
+
     pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status) {
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid"));
         return status;
     }
 
-    if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags))
+    if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) 
     {
         if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss((WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext) ) )
         {
             hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter);
 
             status = vos_wait_single_event(&pHostapdState->vosEvent, 10000);
-
+   
             if (!VOS_IS_STATUS_SUCCESS(status))
-            {
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+            {  
+                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
                          ("ERROR: HDD vos wait for single_event failed!!"));
                 VOS_ASSERT(0);
             }
@@ -3928,23 +3414,8 @@
                              char *extra)
 {
     hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
-    hdd_context_t *pHddCtx;
-    int ret = 0;
 
     ENTER();
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
     hdd_wlan_get_version(pHostapdAdapter, wrqu, extra);
     EXIT();
     return 0;
@@ -3964,67 +3435,28 @@
     return ret;
 }
 
-int hdd_softap_get_sta_info(hdd_adapter_t *pAdapter, v_U8_t *pBuf, int buf_len)
+VOS_STATUS hdd_softap_get_sta_info(hdd_adapter_t *pAdapter, v_U8_t *pBuf, int buf_len)
 {
     v_U8_t i;
     int len = 0;
     const char sta_info_header[] = "staId staAddress\n";
-    v_CONTEXT_t pVosContext;
-    hdd_context_t *pHddCtx;
-    ptSapContext pSapCtx = NULL;
 
-    ENTER();
-
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    if (0 != wlan_hdd_validate_context(pHddCtx))
-    {
-        return VOS_STATUS_E_FAULT;
-    }
-    pVosContext = pHddCtx->pvosContext;
-    if (NULL == pVosContext)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: VOS context is not valid",__func__);
-        return VOS_STATUS_E_FAULT;
-    }
-    pSapCtx = VOS_GET_SAP_CB(pVosContext);
-    if(pSapCtx == NULL)
-    {
-        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                 FL("psapCtx is NULL"));
-        return VOS_STATUS_E_FAULT;
-    }
-
-    len = snprintf(pBuf, buf_len, sta_info_header);
-    if (len >= buf_len) {
-        hddLog(LOGE, FL("Insufficient buffer:%d, %d"), buf_len, len);
-        return -E2BIG;
-    }
+    len = scnprintf(pBuf, buf_len, sta_info_header);
     pBuf += len;
     buf_len -= len;
 
     for (i = 0; i < WLAN_MAX_STA_COUNT; i++)
     {
-        if(pSapCtx->aStaInfo[i].isUsed)
+        if(pAdapter->aStaInfo[i].isUsed)
         {
             len = scnprintf(pBuf, buf_len, "%5d .%02x:%02x:%02x:%02x:%02x:%02x\n",
-                                       pSapCtx->aStaInfo[i].ucSTAId,
-                                       pSapCtx->aStaInfo[i].macAddrSTA.bytes[0],
-                                       pSapCtx->aStaInfo[i].macAddrSTA.bytes[1],
-                                       pSapCtx->aStaInfo[i].macAddrSTA.bytes[2],
-                                       pSapCtx->aStaInfo[i].macAddrSTA.bytes[3],
-                                       pSapCtx->aStaInfo[i].macAddrSTA.bytes[4],
-                                       pSapCtx->aStaInfo[i].macAddrSTA.bytes[5]);
-            if (len >= buf_len) {
-                hddLog(LOGE, FL("Insufficient buffer:%d, %d"), buf_len, len);
-                return -E2BIG;
-            }
+                                       pAdapter->aStaInfo[i].ucSTAId,
+                                       pAdapter->aStaInfo[i].macAddrSTA.bytes[0],
+                                       pAdapter->aStaInfo[i].macAddrSTA.bytes[1],
+                                       pAdapter->aStaInfo[i].macAddrSTA.bytes[2],
+                                       pAdapter->aStaInfo[i].macAddrSTA.bytes[3],
+                                       pAdapter->aStaInfo[i].macAddrSTA.bytes[4],
+                                       pAdapter->aStaInfo[i].macAddrSTA.bytes[5]);
             pBuf += len;
             buf_len -= len;
         }
@@ -4033,101 +3465,65 @@
             break;
         }
     }
-    EXIT();
-    return 0;
+    return VOS_STATUS_SUCCESS;
 }
 
-static int __iw_softap_get_sta_info(struct net_device *dev,
-                                    struct iw_request_info *info,
-                                    union iwreq_data *wrqu,
-                                    char *extra)
+static int iw_softap_get_sta_info(struct net_device *dev,
+        struct iw_request_info *info,
+        union iwreq_data *wrqu, 
+        char *extra)
 {
     hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
-    int ret;
+    VOS_STATUS status;
     ENTER();
-    ret = hdd_softap_get_sta_info(pHostapdAdapter, extra, WE_SAP_MAX_STA_INFO);
-    if (ret) {
+    status = hdd_softap_get_sta_info(pHostapdAdapter, extra, WE_SAP_MAX_STA_INFO);
+    if ( !VOS_IS_STATUS_SUCCESS( status ) ) {
        hddLog(VOS_TRACE_LEVEL_ERROR, "%s Failed!!!",__func__);
-       return ret;
+       return -EINVAL;
     }
     wrqu->data.length = strlen(extra);
     EXIT();
     return 0;
 }
 
-static int iw_softap_get_sta_info(struct net_device *dev,
-                                  struct iw_request_info *info,
-                                  union iwreq_data *wrqu,
-                                  char *extra)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __iw_softap_get_sta_info(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 static int __iw_set_ap_genie(struct net_device *dev,
                              struct iw_request_info *info,
                              union iwreq_data *wrqu, char *extra)
 {
-
-    hdd_adapter_t *pHostapdAdapter;
-    hdd_context_t *pHddCtx;
-    v_CONTEXT_t pVosContext;
+ 
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
     eHalStatus halStatus= eHAL_STATUS_SUCCESS;
     u_int8_t *genie = (u_int8_t *)extra;
-    int ret = 0;
-
+    
     ENTER();
-    pHostapdAdapter = (netdev_priv(dev));
-    if (NULL == pHostapdAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    pVosContext = pHddCtx->pvosContext;
-    if (NULL == pVosContext)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: VOS Context is NULL",__func__);
-        return -EINVAL;
-    }
+    
     if(!wrqu->data.length)
     {
         EXIT();
         return 0;
     }
 
-    switch (genie[0])
+    switch (genie[0]) 
     {
-        case DOT11F_EID_WPA:
+        case DOT11F_EID_WPA: 
         case DOT11F_EID_RSN:
             if((WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy == 0)
             {
                 hdd_softap_Deregister_BC_STA(pHostapdAdapter);
                 hdd_softap_Register_BC_STA(pHostapdAdapter, 1);
-            }
+            }   
             (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = 1;
             halStatus = WLANSAP_Set_WPARSNIes(pVosContext, genie, wrqu->data.length);
             break;
-
+            
         default:
             hddLog (LOGE, "%s Set UNKNOWN IE %X",__func__, genie[0]);
             halStatus = 0;
     }
-
+    
     EXIT();
-    return halStatus;
+    return halStatus; 
 }
 
 static int iw_set_ap_genie(struct net_device *dev,
@@ -4208,7 +3604,7 @@
                             char *extra)
 
 {
-   hdd_adapter_t *pHostapdAdapter;
+   hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
    hdd_context_t *pHddCtx;
    char *pLinkSpeed = (char*)extra;
    char *pmacAddress;
@@ -4219,19 +3615,13 @@
    VOS_STATUS status = VOS_STATUS_E_FAILURE;
    int rc, valid;
 
-   ENTER();
-
-   pHostapdAdapter = (netdev_priv(dev));
-   if (NULL == pHostapdAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
    pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
+
    valid = wlan_hdd_validate_context(pHddCtx);
+
    if (0 != valid)
    {
+       hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context not valid"));
        return valid;
    }
 
@@ -4251,7 +3641,7 @@
            kfree(pmacAddress);
            return -EFAULT;
        }
-       pmacAddress[MAC_ADDRESS_STR_LEN-1] = '\0';
+       pmacAddress[MAC_ADDRESS_STR_LEN] = '\0';
 
        status = hdd_string_to_hex (pmacAddress, MAC_ADDRESS_STR_LEN, macAddress );
        kfree(pmacAddress);
@@ -4315,7 +3705,6 @@
       return -EIO;
    }
 
-   EXIT();
    return 0;
 }
 
@@ -4405,16 +3794,12 @@
       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "setparam" },
   { QCSAP_IOCTL_SETPARAM,
       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "" },
-  { QCSAP_PARAM_GET_FRAME_LOGS,
-      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "getFrameLogs" },
   { QCSAP_PARAM_MAX_ASSOC,
       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setMaxAssoc" },
    { QCSAP_PARAM_HIDE_SSID,
       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,  "hideSSID" },
    { QCSAP_PARAM_SET_MC_RATE,
       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,  "setMcRate" },
-  { QCSAP_PARAM_SET_PROXIMITY,
-      IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,  "setProximity" },
   { QCSAP_IOCTL_GETPARAM,
       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,    "getparam" },
@@ -4434,6 +3819,8 @@
       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setAclMode" },
   { QCSAP_IOCTL_GET_STAWPAIE,
       IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, "get_staWPAIE" },
+  { QCSAP_IOCTL_SETWPAIE,
+      IW_PRIV_TYPE_BYTE | QCSAP_MAX_WSC_IE | IW_PRIV_SIZE_FIXED, 0, "setwpaie" },
   { QCSAP_IOCTL_STOPBSS,
       IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED, 0, "stopbss" },
   { QCSAP_IOCTL_VERSION, 0,
@@ -4448,9 +3835,6 @@
         IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 6 , 0, "disassoc_sta" },
   { QCSAP_IOCTL_AP_STATS, 0,
         IW_PRIV_TYPE_CHAR | QCSAP_MAX_WSC_IE, "ap_stats" },
-  { QCSAP_IOCTL_GET_STATS, 0,
-        IW_PRIV_TYPE_CHAR | QCSAP_MAX_STR_LEN, "getStats"},
-  { QCSAP_IOCTL_CLR_STATS, 0, 0, "clearStats" },
   { QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED,
         IW_PRIV_TYPE_CHAR | 18,
         IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed" },
@@ -4532,6 +3916,7 @@
    [QCSAP_IOCTL_SETPARAM - SIOCIWFIRSTPRIV] = iw_softap_setparam,  //set priv ioctl
    [QCSAP_IOCTL_GETPARAM - SIOCIWFIRSTPRIV] = iw_softap_getparam,  //get priv ioctl   
    [QCSAP_IOCTL_GET_STAWPAIE - SIOCIWFIRSTPRIV] = iw_get_genie, //get station genIE
+   [QCSAP_IOCTL_SETWPAIE - SIOCIWFIRSTPRIV] = iw_softap_setwpsie,
    [QCSAP_IOCTL_STOPBSS - SIOCIWFIRSTPRIV] = iw_softap_stopbss,       // stop bss
    [QCSAP_IOCTL_VERSION - SIOCIWFIRSTPRIV] = iw_softap_version,       // get driver version
    [QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES - SIOCIWFIRSTPRIV] = iw_get_WPSPBCProbeReqIEs,
@@ -4539,7 +3924,7 @@
    [QCSAP_IOCTL_ASSOC_STA_MACADDR - SIOCIWFIRSTPRIV] = iw_softap_getassoc_stamacaddr,
    [QCSAP_IOCTL_DISASSOC_STA - SIOCIWFIRSTPRIV] = iw_softap_disassoc_sta,
    [QCSAP_IOCTL_AP_STATS - SIOCIWFIRSTPRIV] = iw_softap_ap_stats,
-   [QCSAP_IOCTL_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV]  = iw_set_three_ints_getnone,
+   [QCSAP_IOCTL_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV]  = iw_set_three_ints_getnone,   
    [QCSAP_IOCTL_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV]     = iw_set_var_ints_getnone,
    [QCSAP_IOCTL_SET_CHANNEL_RANGE - SIOCIWFIRSTPRIV] = iw_softap_set_channel_range,
    [QCSAP_IOCTL_MODIFY_ACL - SIOCIWFIRSTPRIV]   = iw_softap_modify_acl,
@@ -4550,8 +3935,6 @@
    [QCSAP_IOCTL_SET_MAX_TX_POWER - SIOCIWFIRSTPRIV]   = iw_softap_set_max_tx_power,
    [QCSAP_IOCTL_DATAPATH_SNAP_SHOT - SIOCIWFIRSTPRIV]  =   iw_display_data_path_snapshot,
    [QCSAP_IOCTL_SET_TRAFFIC_MONITOR - SIOCIWFIRSTPRIV]  =  iw_softap_set_trafficmonitor,
-   [QCSAP_IOCTL_GET_STATS - SIOCIWFIRSTPRIV]  =  iw_softap_get_stats,
-   [QCSAP_IOCTL_CLR_STATS - SIOCIWFIRSTPRIV]  =  iw_softap_clear_stats,
 };
 const struct iw_handler_def hostapd_handler_def = {
    .num_standard     = sizeof(hostapd_handler) / sizeof(hostapd_handler[0]),
@@ -4599,7 +3982,7 @@
 }
 
 VOS_STATUS hdd_init_ap_mode( hdd_adapter_t *pAdapter )
-{
+{   
     hdd_hostapd_state_t * phostapdBuf;
     struct net_device *dev = pAdapter->dev;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
@@ -4616,12 +3999,9 @@
     }
 
     ENTER();
-       // Allocate the Wireless Extensions state structure
+       // Allocate the Wireless Extensions state structure   
     phostapdBuf = WLAN_HDD_GET_HOSTAP_STATE_PTR( pAdapter );
-
-    spin_lock_init(&pAdapter->sta_hash_lock);
-    pAdapter->is_sta_id_hash_initialized = VOS_FALSE;
-
+ 
     sme_SetCurrDeviceMode(pHddCtx->hHal, pAdapter->device_mode);
 
 #ifdef FEATURE_WLAN_CH_AVOID
@@ -4655,6 +4035,8 @@
          return status;
     }
     
+    init_completion(&pAdapter->session_close_comp_var);
+    init_completion(&pAdapter->session_open_comp_var);
 
     sema_init(&(WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->semWpsPBCOverlapInd, 1);
  
@@ -4679,6 +4061,8 @@
 
     set_bit(WMM_INIT_DONE, &pAdapter->event_flags);
 
+    wlan_hdd_set_monitor_tx_adapter( WLAN_HDD_GET_CTX(pAdapter), pAdapter );
+
     return status;
 
 error_wmm_init:
@@ -4693,11 +4077,8 @@
     hdd_adapter_t *pHostapdAdapter = NULL;
     v_CONTEXT_t pVosContext= NULL;
 
-    pWlanHostapdDev = alloc_netdev_mq(sizeof(hdd_adapter_t), iface_name,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0))
-                                      NET_NAME_UNKNOWN,
-#endif
-                                      ether_setup, NUM_TX_QUEUES);
+   pWlanHostapdDev = alloc_netdev_mq(sizeof(hdd_adapter_t), iface_name, ether_setup, NUM_TX_QUEUES);
+
     if (pWlanHostapdDev != NULL)
     {
         pHostapdAdapter = netdev_priv(pWlanHostapdDev);
@@ -4731,6 +4112,13 @@
         pWlanHostapdDev->ieee80211_ptr = &pHostapdAdapter->wdev ;
         pHostapdAdapter->wdev.wiphy = pHddCtx->wiphy;  
         pHostapdAdapter->wdev.netdev =  pWlanHostapdDev;
+        init_completion(&pHostapdAdapter->tx_action_cnf_event);
+        init_completion(&pHostapdAdapter->cancel_rem_on_chan_var);
+        init_completion(&pHostapdAdapter->rem_on_chan_ready_event);
+        init_completion(&pHostapdAdapter->ula_complete);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+        init_completion(&pHostapdAdapter->offchannel_tx_event);
+#endif
 
         SET_NETDEV_DEV(pWlanHostapdDev, pHddCtx->parent_dev);
     }
@@ -4774,7 +4162,7 @@
    return status;
 }
     
-VOS_STATUS hdd_unregister_hostapd(hdd_adapter_t *pAdapter, tANI_U8 rtnl_held)
+VOS_STATUS hdd_unregister_hostapd(hdd_adapter_t *pAdapter)
 {
    ENTER();
    
@@ -4785,16 +4173,7 @@
       detatch the wireless device handlers */
    if (pAdapter->dev)
    {
-       if (TRUE == rtnl_held)
-       {
-           pAdapter->dev->wireless_handlers = NULL;
-       }
-       else
-       {
-           rtnl_lock();
-           pAdapter->dev->wireless_handlers = NULL;
-           rtnl_unlock();
-       }
+      pAdapter->dev->wireless_handlers = NULL;
    }
    EXIT();
    return 0;
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_main.c b/wlan/prima/CORE/HDD/src/wlan_hdd_main.c
index 802452b..e743680 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_main.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_main.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -34,6 +34,9 @@
 
   \brief WLAN Host Device Driver implementation
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -119,7 +122,6 @@
 #include "wlan_hdd_tdls.h"
 #endif
 #include "wlan_hdd_debugfs.h"
-#include "sapInternal.h"
 
 #ifdef MODULE
 #define WLAN_MODULE_NAME  module_name(THIS_MODULE)
@@ -176,15 +178,6 @@
 #define SIZE_OF_SETROAMMODE             11    /* size of SETROAMMODE */
 #define SIZE_OF_GETROAMMODE             11    /* size of GETROAMMODE */
 
-#ifdef WLAN_FEATURE_RMC
-/*
- * Ibss prop IE from command will be of size:
- * size  = sizeof(oui) + sizeof(oui_data) + 1(Element ID) + 1(EID Length)
- * OUI_DATA should be at least 3 bytes long
- */
-#define WLAN_HDD_IBSS_MIN_OUI_DATA_LENGTH (3)
-#endif
-
 #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
 #define TID_MIN_VALUE 0
 #define TID_MAX_VALUE 15
@@ -200,29 +193,12 @@
 #define WLAN_MAX_BUF_SIZE 1024
 #define WLAN_PRIV_DATA_MAX_LEN    8192
 
-/*
- * When ever we need to print IBSSPEERINFOALL for morethan 16 STA
- * we will split the printing.
- */
-#define NUM_OF_STA_DATA_TO_PRINT 16
-
-#ifdef WLAN_FEATURE_RMC
-#define WLAN_NLINK_CESIUM 30
-#endif
-
 //wait time for beacon miss rate.
 #define BCN_MISS_RATE_TIME 500
 
-/*
- * Android DRIVER command structures
- */
-struct android_wifi_reassoc_params {
-	unsigned char bssid[18];
-	int channel;
-};
-
-static vos_wake_lock_t wlan_wake_lock;
-
+#ifdef WLAN_OPEN_SOURCE
+static struct wake_lock wlan_wake_lock;
+#endif
 /* set when SSR is needed after unload */
 static e_hdd_ssr_required isSsrRequired = HDD_SSR_NOT_REQUIRED;
 
@@ -230,34 +206,11 @@
 static VOS_STATUS wlan_hdd_framework_restart(hdd_context_t *pHddCtx);
 static void wlan_hdd_restart_init(hdd_context_t *pHddCtx);
 static void wlan_hdd_restart_deinit(hdd_context_t *pHddCtx);
-
-#ifdef WLAN_FEATURE_RMC
-static void hdd_tx_fail_ind_callback(v_U8_t *MacAddr, v_U8_t seqNo);
-
-static int hdd_open_cesium_nl_sock(void);
-static void hdd_close_cesium_nl_sock(void);
-static struct sock *cesium_nl_srv_sock;
-static v_U16_t cesium_pid;
-
-static int hdd_ParseIBSSTXFailEventParams(tANI_U8 *pValue,
-                                          tANI_U8 *tx_fail_count,
-                                          tANI_U16 *pid);
-
-static int hdd_ParseUserParams(tANI_U8 *pValue, tANI_U8 **ppArg);
-
-#endif /* WLAN_FEATURE_RMC */
 void wlan_hdd_restart_timer_cb(v_PVOID_t usrDataForCallback);
 void hdd_set_wlan_suspend_mode(bool suspend);
 
 v_U16_t hdd_select_queue(struct net_device *dev,
-    struct sk_buff *skb
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0))
-    , void *accel_priv
-#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-    , select_queue_fallback_t fallback
-#endif
-);
+    struct sk_buff *skb);
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
 static void hdd_set_multicast_list(struct net_device *dev);
@@ -271,14 +224,10 @@
 static VOS_STATUS hdd_parse_send_action_frame_data(tANI_U8 *pValue, tANI_U8 *pTargetApBssid,
                               tANI_U8 *pChannel, tANI_U8 *pDwellTime,
                               tANI_U8 **pBuf, tANI_U8 *pBufLen);
-static int hdd_parse_reassoc_command_v1_data(const tANI_U8 *pValue,
-				tANI_U8 *pTargetApBssid, tANI_U8 *pChannel);
+static VOS_STATUS hdd_parse_reassoc_command_data(tANI_U8 *pValue,
+                                                 tANI_U8 *pTargetApBssid,
+                                                 tANI_U8 *pChannel);
 #endif
-
-/* Store WLAN driver info in a global variable such that crash debugger
-   can extract it from driver debug symbol and crashdump for post processing */
-tANI_U8 g_wlan_driver[ ] = "pronto_driver";
-
 #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
 VOS_STATUS hdd_parse_get_cckm_ie(tANI_U8 *pValue, tANI_U8 **pCckmIe, tANI_U8 *pCckmIeLen);
 #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
@@ -301,7 +250,7 @@
    }
 }
 
-static int __hdd_netdev_notifier_call(struct notifier_block * nb,
+static int hdd_netdev_notifier_call(struct notifier_block * nb,
                                          unsigned long state,
                                          void *ndev)
 {
@@ -402,17 +351,6 @@
    return NOTIFY_DONE;
 }
 
-static int hdd_netdev_notifier_call(struct notifier_block * nb,
-                                         unsigned long state,
-                                         void *ndev)
-{
-    int ret;
-    vos_ssr_protect(__func__);
-    ret = __hdd_netdev_notifier_call( nb, state, ndev);
-    vos_ssr_unprotect(__func__);
-    return ret;
-}
-
 struct notifier_block hdd_netdev_notifier = {
    .notifier_call = hdd_netdev_notifier_call,
 };
@@ -435,30 +373,6 @@
 static int curr_con_mode;
 #endif
 
-#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
-/**
- * hdd_init_offloaded_packets_ctx() - Initialize offload packets context
- * @hdd_ctx: hdd global context
- *
- * Return: none
- */
-static void hdd_init_offloaded_packets_ctx(hdd_context_t *hdd_ctx)
-{
-    uint8_t i;
-
-    mutex_init(&hdd_ctx->op_ctx.op_lock);
-    for (i = 0; i < MAXNUM_PERIODIC_TX_PTRNS; i++)
-    {
-        hdd_ctx->op_ctx.op_table[i].request_id = 0;
-        hdd_ctx->op_ctx.op_table[i].pattern_id = i;
-    }
-}
-#else
-static void hdd_init_offloaded_packets_ctx(hdd_context_t *hdd_ctx)
-{
-}
-#endif
-
 /**---------------------------------------------------------------------------
 
   \brief hdd_vos_trace_enable() - Configure initial VOS Trace enable
@@ -548,17 +462,18 @@
  */
 int wlan_hdd_validate_context(hdd_context_t *pHddCtx)
 {
+    ENTER();
 
     if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini)
     {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                 "%s: HDD context is Null", __func__);
         return -ENODEV;
     }
 
     if (pHddCtx->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: LOGP %s. Ignore!!", __func__,
                     vos_is_wlan_in_badState(VOS_MODULE_ID_HDD, NULL)
                     ?"failed":"in Progress");
@@ -567,7 +482,7 @@
 
     if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx))
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: Unloading/Loading in Progress. Ignore!!!", __func__);
         return -EAGAIN;
     }
@@ -766,486 +681,6 @@
 
 }
 
-#ifdef WLAN_FEATURE_RMC
-static int hdd_parse_setrmcenable_command(tANI_U8 *pValue, tANI_U8 *pRmcEnable)
-{
-    tANI_U8 *inPtr = pValue;
-    int tempInt;
-    int v = 0;
-    char buf[32];
-    *pRmcEnable = 0;
-
-    inPtr = strnchr(pValue, strlen(pValue), SPACE_ASCII_VALUE);
-    /*no argument after the command*/
-    if (NULL == inPtr)
-    {
-        return 0;
-    }
-
-    /*no space after the command*/
-    else if (SPACE_ASCII_VALUE != *inPtr)
-    {
-        return 0;
-    }
-
-    /*removing empty spaces*/
-    while ((SPACE_ASCII_VALUE  == *inPtr) && ('\0' !=  *inPtr)) inPtr++;
-
-    /*no argument followed by spaces*/
-    if ('\0' == *inPtr)
-    {
-        return 0;
-    }
-
-    /* getting the first argument which enables or disables RMC
-         * for input IP v4 address*/
-    sscanf(inPtr, "%32s ", buf);
-    v = kstrtos32(buf, 10, &tempInt);
-    if ( v < 0)
-    {
-       return -EINVAL;
-    }
-
-    *pRmcEnable = tempInt;
-
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-       "ucRmcEnable: %d", *pRmcEnable);
-
-    return 0;
-}
-
-/* Function header left blank Intentionally */
-static int hdd_parse_setrmcactionperiod_command(tANI_U8 *pValue,
-           tANI_U32 *pActionPeriod)
-{
-    tANI_U8 *inPtr = pValue;
-    int tempInt;
-    int v = 0;
-    char buf[32];
-    *pActionPeriod = 0;
-
-    inPtr = strnchr(pValue, strlen(pValue), SPACE_ASCII_VALUE);
-    /*no argument after the command*/
-    if (NULL == inPtr)
-    {
-        return -EINVAL;
-    }
-
-    /*no space after the command*/
-    else if (SPACE_ASCII_VALUE != *inPtr)
-    {
-        return -EINVAL;
-    }
-
-    /*removing empty spaces*/
-    while ((SPACE_ASCII_VALUE  == *inPtr) && ('\0' !=  *inPtr)) inPtr++;
-
-    /*no argument followed by spaces*/
-    if ('\0' == *inPtr)
-    {
-        return 0;
-    }
-
-    /* getting the first argument which enables or disables RMC
-         * for input IP v4 address*/
-    sscanf(inPtr, "%32s ", buf);
-    v = kstrtos32(buf, 10, &tempInt);
-    if ( v < 0)
-    {
-       return -EINVAL;
-    }
-
-    /* Range checking for passed paramter */
-    if (tempInt < WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STAMIN ||
-        tempInt > WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STAMAX)
-    {
-       return -EINVAL;
-    }
-
-    *pActionPeriod = tempInt;
-
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-       "uActionPeriod: %d", *pActionPeriod);
-
-    return 0;
-}
-
-/* Function header left blank Intentionally */
-static int hdd_parse_setrmcrate_command(tANI_U8 *pValue,
-           tANI_U32 *pRate, tTxrateinfoflags *pTxFlags)
-{
-    tANI_U8 *inPtr = pValue;
-    int tempInt;
-    int v = 0;
-    char buf[32];
-    *pRate = 0;
-    *pTxFlags = 0;
-
-    inPtr = strnchr(pValue, strlen(pValue), SPACE_ASCII_VALUE);
-    /*no argument after the command*/
-    if (NULL == inPtr)
-    {
-        return -EINVAL;
-    }
-
-    /*no space after the command*/
-    else if (SPACE_ASCII_VALUE != *inPtr)
-    {
-        return -EINVAL;
-    }
-
-    /*removing empty spaces*/
-    while ((SPACE_ASCII_VALUE  == *inPtr) && ('\0' !=  *inPtr)) inPtr++;
-
-    /*no argument followed by spaces*/
-    if ('\0' == *inPtr)
-    {
-        return 0;
-    }
-
-    /*
-     * getting the first argument which sets multicast rate.
-     */
-    sscanf(inPtr, "%32s ", buf);
-    v = kstrtos32(buf, 10, &tempInt);
-    if ( v < 0)
-        {
-       return -EINVAL;
-        }
-
-    /*
-     * Validate the multicast rate.
-     */
-    switch (tempInt)
-        {
-        default:
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
-            "Unsupported rate: %d", tempInt);
-            return -EINVAL;
-        case 0:
-        case 6:
-        case 9:
-        case 12:
-        case 18:
-        case 24:
-        case 36:
-        case 48:
-        case 54:
-            *pTxFlags = eHAL_TX_RATE_LEGACY;
-            *pRate = tempInt * 10;
-            break;
-        case 65:
-            *pTxFlags = eHAL_TX_RATE_HT20;
-            *pRate = tempInt * 10;
-            break;
-        case 72:
-            *pTxFlags = eHAL_TX_RATE_HT20 | eHAL_TX_RATE_SGI;
-            *pRate = 722; /* fractional rate 72.2 Mbps */
-            break;
-    }
-
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-       "Rate: %d", *pRate);
-
-    return 0;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief hdd_cfg80211_get_ibss_peer_info_cb() - Callback function for IBSS
-  Peer Info request
-
-  This is an asynchronous callback function from SME when the peer info
-  is received
-
-  \pUserData -> Adapter private data
-  \pPeerInfoRsp -> Peer info response
-
-  \return - 0 for success non-zero for failure
-  --------------------------------------------------------------------------*/
-static void
-hdd_cfg80211_get_ibss_peer_info_cb(v_VOID_t *pUserData, v_VOID_t *pPeerInfoRsp)
-{
-   hdd_adapter_t *pAdapter = (hdd_adapter_t *)pUserData;
-   tSirPeerInfoRspParams *pPeerInfo = (tSirPeerInfoRspParams *)pPeerInfoRsp;
-   hdd_station_ctx_t *pStaCtx;
-   v_U8_t   i;
-
-   /*Sanity check*/
-   if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
-        {
-      hddLog(LOGE,
-         FL("invalid adapter or adapter has invalid magic"));
-      return;
-   }
-
-   pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   if (NULL != pStaCtx && NULL != pPeerInfo &&
-       eHAL_STATUS_SUCCESS == pPeerInfo->status)
-   {
-      pStaCtx->ibss_peer_info.status = pPeerInfo->status;
-      pStaCtx->ibss_peer_info.numIBSSPeers = pPeerInfo->numPeers;
-
-      /* Paranoia check */
-      if (pPeerInfo->numPeers < HDD_MAX_NUM_IBSS_STA)
-      {
-         for (i = 0; i < pPeerInfo->numPeers; i++)
-         {
-            memcpy(&pStaCtx->ibss_peer_info.ibssPeerList[i],
-                   &pPeerInfo->peerInfoParams[i],
-                   sizeof(hdd_ibss_peer_info_params_t));
-         }
-         hddLog(LOG1,
-            FL("Peer Info copied in HDD"));
-      }
-      else
-      {
-         hddLog(LOGE,
-               FL(" Number of peers %d returned is more than limit %d"),
-               pPeerInfo->numPeers, HDD_MAX_NUM_IBSS_STA);
-      }
-   }
-   else
-   {
-      hddLog(LOG1,
-           FL("peerInfo returned is NULL"));
-   }
-
-   complete(&pAdapter->ibss_peer_info_comp);
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief hdd_cfg80211_get_ibss_peer_info_all() -
-
-  Request function to get IBSS peer info from lower layers
-
-  \pAdapter -> Adapter context
-
-  \return - 0 for success non-zero for failure
-  --------------------------------------------------------------------------*/
-static
-VOS_STATUS hdd_cfg80211_get_ibss_peer_info_all(hdd_adapter_t *pAdapter)
-{
-   tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-   long status;
-   VOS_STATUS retStatus = VOS_STATUS_E_FAILURE;
-
-   INIT_COMPLETION(pAdapter->ibss_peer_info_comp);
-
-   retStatus = sme_RequestIBSSPeerInfo(hHal, pAdapter,
-                                    hdd_cfg80211_get_ibss_peer_info_cb,
-                                    VOS_TRUE, 0xFF);
-
-   if (VOS_STATUS_SUCCESS == retStatus)
-   {
-      status = wait_for_completion_interruptible_timeout
-               (&pAdapter->ibss_peer_info_comp,
-                msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
-
-      /* status will be 0 if timed out */
-      if (status <= 0)
-      {
-         hddLog(VOS_TRACE_LEVEL_WARN, "%s: Warning: IBSS_PEER_INFO_TIMEOUT %ld",
-                __func__, status);
-         retStatus = VOS_STATUS_E_FAILURE;
-         return retStatus;
-      }
-   }
-   else
-   {
-      hddLog(VOS_TRACE_LEVEL_WARN,
-             "%s: Warning: sme_RequestIBSSPeerInfo Request failed", __func__);
-   }
-
-   return retStatus;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief hdd_cfg80211_get_ibss_peer_info() -
-
-  Request function to get IBSS peer info from lower layers
-
-  \pAdapter -> Adapter context
-  \staIdx -> Sta index for which the peer info is requested
-
-  \return - 0 for success non-zero for failure
-  --------------------------------------------------------------------------*/
-static VOS_STATUS
-hdd_cfg80211_get_ibss_peer_info(hdd_adapter_t *pAdapter, v_U8_t staIdx)
-{
-    long status;
-    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    VOS_STATUS retStatus = VOS_STATUS_E_FAILURE;
-
-    INIT_COMPLETION(pAdapter->ibss_peer_info_comp);
-
-    retStatus = sme_RequestIBSSPeerInfo(hHal, pAdapter,
-                                     hdd_cfg80211_get_ibss_peer_info_cb,
-                                     VOS_FALSE, staIdx);
-
-    if (VOS_STATUS_SUCCESS == retStatus)
-    {
-       status = wait_for_completion_interruptible_timeout
-                (&pAdapter->ibss_peer_info_comp,
-                msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
-
-       /* status = 0 on timeout */
-       if (status <= 0)
-       {
-          hddLog(VOS_TRACE_LEVEL_WARN, "%s: Warning: IBSS_PEER_INFO_TIMEOUT %ld",
-                  __func__, status);
-          retStatus = VOS_STATUS_E_FAILURE;
-          return retStatus;
-       }
-    }
-    else
-    {
-       hddLog(VOS_TRACE_LEVEL_WARN,
-              "%s: Warning: sme_RequestIBSSPeerInfo Request failed", __func__);
-    }
-
-    return retStatus;
-}
-
-/* Function header left blank Intentionally */
-VOS_STATUS
-hdd_parse_get_ibss_peer_info(tANI_U8 *pValue, v_MACADDR_t *pPeerMacAddr)
-{
-    tANI_U8 *inPtr = pValue;
-    inPtr = strnchr(pValue, strlen(pValue), SPACE_ASCII_VALUE);
-
-    /*no argument after the command*/
-    if (NULL == inPtr)
-    {
-        return VOS_STATUS_E_FAILURE;;
-    }
-
-    /*no space after the command*/
-    else if (SPACE_ASCII_VALUE != *inPtr)
-    {
-        return VOS_STATUS_E_FAILURE;;
-    }
-
-    /*removing empty spaces*/
-    while ((SPACE_ASCII_VALUE  == *inPtr) && ('\0' !=  *inPtr) ) inPtr++;
-
-    /*no argument followed by spaces*/
-    if ('\0' == *inPtr)
-    {
-        return VOS_STATUS_E_FAILURE;;
-    }
-
-    /*getting the first argument ie the peer mac address */
-    if (inPtr[2] != ':' || inPtr[5] != ':' || inPtr[8] != ':' ||
-        inPtr[11] != ':' || inPtr[14] != ':')
-    {
-       return VOS_STATUS_E_FAILURE;;
-    }
-    sscanf(inPtr, "%2x:%2x:%2x:%2x:%2x:%2x",
-                  (unsigned int *)&pPeerMacAddr->bytes[0],
-                  (unsigned int *)&pPeerMacAddr->bytes[1],
-                  (unsigned int *)&pPeerMacAddr->bytes[2],
-                  (unsigned int *)&pPeerMacAddr->bytes[3],
-                  (unsigned int *)&pPeerMacAddr->bytes[4],
-                  (unsigned int *)&pPeerMacAddr->bytes[5]);
-
-    /* The command buffer seems to be fine */
-    return VOS_STATUS_SUCCESS;
-}
-
-/* Function header left blank Intentionally */
-static int hdd_parse_set_ibss_oui_data_command(tANI_U8 *command, tANI_U8 *ie,
-                                               tANI_U32 limit)
-{
-   tANI_U8 len;
-   tANI_U8 data;
-
-   /* skip white space */
-   while ((SPACE_ASCII_VALUE == *command) && ('\0' != *command))
-   {
-      command++;
-      limit--;
-   }
-
-   /* skip element id  and element length */
-   len = 2;
-
-   /* extract oui */
-   while ((SPACE_ASCII_VALUE != *command) && ('\0' != *command) &&
-          (limit > 1))
-   {
-      /* Convert ASCII to decimal */
-      data = ((*command -'0') << 4) | (*(command + 1) - '0');
-      ie[len++] = data;
-      command += 2;
-      limit -= 2;
-   }
-
-   /* skip white space */
-   while ((SPACE_ASCII_VALUE == *command) && ('\0' != *command))
-   {
-      command++;
-      limit--;
-   }
-
-   /* extract data */
-   while ((SPACE_ASCII_VALUE != *command) && ('\0' != *command) &&
-         (limit > 1))
-   {
-      /* Convert ASCII to decimal */
-      data = ((*command -'0') << 4) | (*(command + 1) - '0');
-      ie[len++] = data;
-      command += 2;
-      limit -= 2;
-   }
-
-   /* fill element id and element length */
-   ie[0] = IE_EID_VENDOR;
-   ie[1] = len - 2;
-
-   return len;
-}
-
-static tANI_U32 hdd_find_ibss_wpa_ie_pos(tANI_U8 *addIePtr, tANI_U32 addIeLen)
-{
-   tANI_U32 ieLenPresent = 0;
-   int left = addIeLen;
-   v_U8_t *ptr = addIePtr;
-   v_U8_t elem_id,elem_len;
-
-   while(left >= 2)
-   {
-      elem_id  =  ptr[0];
-      elem_len =  ptr[1];
-      left -= 2;
-      if(elem_len > left)
-      {
-         hddLog(LOGE,
-             FL("****Invalid elem_len=%d left=%d*****"),
-                                           elem_len,left);
-         return 0;
-      }
-      if ((elem_id == IE_EID_VENDOR) &&
-               (left >= WPA_OUI_TYPE_SIZE))
-      {
-         if (!memcmp(&ptr[2], WPA_OUI_TYPE,
-                          WPA_OUI_TYPE_SIZE))
-         {
-             ieLenPresent += elem_len + 2;
-             return ieLenPresent;
-         }
-      }
-      ieLenPresent += (elem_len + 2);
-      left -= elem_len;
-      ptr += (elem_len + 2);
-    }
-    return 0;
-}
-
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
 
 /**---------------------------------------------------------------------------
@@ -1410,13 +845,19 @@
     tANI_U8 *inPtr = pValue;
     tANI_U8 val = 0;
     tANI_U8 lastArg = 0;
-    tANI_U32 nScanFreq = HDD_SET_BATCH_SCAN_DEFAULT_FREQ;
+    tANI_U32 nScanFreq;
     tANI_U32 nMscan;
-    tANI_U32 nBestN = HDD_SET_BATCH_SCAN_BEST_NETWORK;
-    tANI_U8  ucRfBand = HDD_SET_BATCH_SCAN_DEFAULT_BAND;
-    tANI_U32 nRtt = 0;
+    tANI_U32 nBestN;
+    tANI_U8  ucRfBand;
+    tANI_U32 nRtt;
     tANI_U32 temp;
 
+    /*initialize default values*/
+    nScanFreq = HDD_SET_BATCH_SCAN_DEFAULT_FREQ;
+    ucRfBand = HDD_SET_BATCH_SCAN_DEFAULT_BAND;
+    nRtt = 0;
+    nBestN = HDD_SET_BATCH_SCAN_BEST_NETWORK;
+
     /*go to space after WLS_BATCHING_SET command*/
     inPtr = strnchr(pValue, strlen(pValue), SPACE_ASCII_VALUE);
     /*no argument after the command*/
@@ -2146,11 +1587,11 @@
                 rc = wait_for_completion_timeout(
                      &pAdapter->hdd_get_batch_scan_req_var,
                      msecs_to_jiffies(HDD_GET_BATCH_SCAN_RSP_TIME_OUT));
-                if (0 >= rc)
+                if (0 == rc)
                 {
                     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                           "%s: wait on hdd_get_batch_scan_req_var failed %ld",
-                             __func__, rc);
+                    "%s: Timeout waiting to fetch batch scan rsp from fw",
+                    __func__);
                     return -EFAULT;
                 }
             }
@@ -2217,6 +1658,7 @@
    return 0;
 } /*End of hdd_return_batch_scan_rsp_to_user*/
 
+
 /**---------------------------------------------------------------------------
 
   \brief hdd_handle_batch_scan_ioctl () - This function handles WLS_BATCHING
@@ -2244,12 +1686,12 @@
     int ret = 0;
     hdd_context_t *pHddCtx;
 
-    ENTER();
-
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     ret = wlan_hdd_validate_context(pHddCtx);
     if (ret)
     {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "%s: HDD context is not valid!", __func__);
         goto exit;
     }
 
@@ -2472,191 +1914,13 @@
     }
 
 exit:
-    EXIT();
+
     return ret;
 }
 
 
 #endif/*End of FEATURE_WLAN_BATCH_SCAN*/
 
-#if  defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
-/**
- * hdd_assign_handoff_src_reassoc - Set handoff source as REASSOC
- *                                  to Handoff request
- * @handoffInfo: Pointer to Handoff request
- * @src: enum of handoff_src
- * Return: None
- */
-#ifndef QCA_WIFI_ISOC
-static inline void hdd_assign_handoff_src_reassoc(tCsrHandoffRequest
-					*handoffInfo, handoff_src src)
-{
-	handoffInfo->src = src;
-}
-#else
-static inline void hdd_assign_handoff_src_reassoc(tCsrHandoffRequest
-					*handoffInfo, handoff_src src)
-{
-}
-#endif
-
-/**
- * hdd_reassoc() - perform a user space-directed reassoc
- *
- * @pAdapter: Adapter upon which the command was received
- * @bssid: BSSID with which to reassociate
- * @channel: channel upon which to reassociate
- * @src:      The source for the trigger of this action
- *
- * Return: 0 for success non-zero for failure
- */
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-int hdd_reassoc(hdd_adapter_t *pAdapter, const tANI_U8 *bssid,
-			const tANI_U8 channel, const handoff_src src)
-{
-	hdd_station_ctx_t *pHddStaCtx;
-	tCsrHandoffRequest handoffInfo;
-	hdd_context_t *pHddCtx = NULL;
-	pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-
-	pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-
-	/* if not associated, no need to proceed with reassoc */
-	if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) {
-		hddLog(LOG1, FL("Not associated"));
-		return -EINVAL;
-	}
-
-	/* if the target bssid is same as currently associated AP,
-	   then no need to proceed with reassoc */
-	if (!memcmp(bssid, pHddStaCtx->conn_info.bssId, sizeof(tSirMacAddr))) {
-		hddLog(LOG1, FL("Reassoc BSSID is same as currently associated AP bssid"));
-		return -EINVAL;
-	}
-
-	/* Check channel number is a valid channel number */
-	if (VOS_STATUS_SUCCESS !=
-		wlan_hdd_validate_operation_channel(pAdapter, channel)) {
-		hddLog(LOGE, FL("Invalid Channel %d"), channel);
-		return -EINVAL;
-	}
-
-	/* Proceed with reassoc */
-	handoffInfo.channel = channel;
-	hdd_assign_handoff_src_reassoc(&handoffInfo, src);
-	memcpy(handoffInfo.bssid, bssid, sizeof(tSirMacAddr));
-	sme_HandoffRequest(pHddCtx->hHal, &handoffInfo);
-	return 0;
-}
-#else
-int hdd_reassoc(hdd_adapter_t *pAdapter, const tANI_U8 *bssid,
-			const tANI_U8 channel, const handoff_src src)
-{
-	return -EPERM;
-}
-#endif
-
-/**
- * hdd_parse_reassoc_v1() - parse version 1 of the REASSOC command
- *     This function parses the v1 REASSOC command with the format
- *     REASSOC xx:xx:xx:xx:xx:xx CH where "xx:xx:xx:xx:xx:xx" is the
- *     Hex-ASCII representation of the BSSID and CH is the ASCII
- *     representation of the channel. For example
- *     REASSOC 00:0a:0b:11:22:33 48
- *
- * @pAdapter: Adapter upon which the command was received
- * @command: ASCII text command that was received
- *
- * Return: 0 for success non-zero for failure
- */
-static int
-hdd_parse_reassoc_v1(hdd_adapter_t *pAdapter, const char *command)
-{
-	tANI_U8 channel = 0;
-	tSirMacAddr bssid;
-	int ret;
-
-	ret = hdd_parse_reassoc_command_v1_data(command, bssid, &channel);
-	if (ret)
-		hddLog(LOGE, FL("Failed to parse reassoc command data"));
-	else
-		ret = hdd_reassoc(pAdapter, bssid, channel, REASSOC);
-
-	return ret;
-}
-
-/**
- * hdd_parse_reassoc_v2() - parse version 2 of the REASSOC command
- *     This function parses the v2 REASSOC command with the format
- *     REASSOC <android_wifi_reassoc_params>
- *
- * @pAdapter: Adapter upon which the command was received
- * @command: command that was received, ASCII command followed
- *                    by binary data
- *
- * Return: 0 for success non-zero for failure
- */
-static int
-hdd_parse_reassoc_v2(hdd_adapter_t *pAdapter, const char *command)
-{
-	struct android_wifi_reassoc_params params;
-	tSirMacAddr bssid;
-	int ret;
-
-	/* The params are located after "REASSOC " */
-	memcpy(&params, command + 8, sizeof(params));
-
-	if (!mac_pton(params.bssid, (u8 *)&bssid)) {
-		hddLog(LOGE, FL("MAC address parsing failed"));
-		ret = -EINVAL;
-	} else {
-		ret = hdd_reassoc(pAdapter, bssid, params.channel, REASSOC);
-	}
-	return ret;
-}
-
-/**
- * hdd_parse_reassoc() - parse the REASSOC command
- *    There are two different versions of the REASSOC command.Version 1
- *    of the command contains a parameter list that is ASCII characters
- *    whereas version 2 contains a combination of ASCII and binary
- *    payload.  Determine if a version 1 or a version 2 command is being
- *    parsed by examining the parameters, and then dispatch the parser
- *    that is appropriate for the command.
- *
- *  @pAdapter: Adapter upon which the command was received
- *  @command: command that was received
- *
- *  Return: 0 for success non-zero for failure
- */
-static int
-hdd_parse_reassoc(hdd_adapter_t *pAdapter, const char *command)
-{
-	int ret;
-
-	/*
-	 * both versions start with "REASSOC"
-	 * v1 has a bssid and channel # as an ASCII string
-	 *    REASSOC xx:xx:xx:xx:xx:xx CH
-	 * v2 has a C struct
-	 *    REASSOC <binary c struct>
-	 *
-	 * The first field in the v2 struct is also the bssid in ASCII.
-	 * But in the case of a v2 message the BSSID is NUL-terminated.
-	 * Hence we can peek at that offset to see if this is V1 or V2
-	 * REASSOC xx:xx:xx:xx:xx:xx*
-	 *           1111111111222222
-	 * 01234567890123456789012345
-	 */
-	if (command[25])
-		ret = hdd_parse_reassoc_v1(pAdapter, command);
-	else
-		ret = hdd_parse_reassoc_v2(pAdapter, command);
-
-	return ret;
-}
-#endif  /* WLAN_FEATURE_VOWIFI_11R || FEATURE_WLAN_ESE FEATURE_WLAN_LFR */
-
 static void getBcnMissRateCB(VOS_STATUS status, int bcnMissRate, void *data)
 {
     bcnMissRateContext_t *pCBCtx;
@@ -2699,66 +1963,6 @@
     return;
 }
 
-void hdd_FWStatisCB( VOS_STATUS status,
-     tSirFwStatsResult *fwStatsResult, void *pContext )
-{
-    fwStatsContext_t *fwStatsCtx;
-    hdd_adapter_t *pAdapter;
-
-    hddLog(VOS_TRACE_LEVEL_INFO, FL(" with status = %d"),status);
-
-    if (NULL == pContext)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("argument data is NULL"));
-        return;
-    }
-    /* there is a race condition that exists between this callback
-       function and the caller since the caller could time out either
-       before or while this code is executing.  we use a spinlock to
-       serialize these actions */
-    spin_lock(&hdd_context_lock);
-    fwStatsCtx = (fwStatsContext_t *) pContext;
-    if (fwStatsCtx->magic != FW_STATS_CONTEXT_MAGIC)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-               FL("invalid context magic: %08x"), fwStatsCtx->magic);
-        spin_unlock(&hdd_context_lock);
-        return;
-    }
-    pAdapter = fwStatsCtx->pAdapter;
-    if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-              FL("pAdapter returned is NULL or invalid"));
-        spin_unlock(&hdd_context_lock);
-        return;
-    }
-    pAdapter->fwStatsRsp.type = 0;
-    if ((VOS_STATUS_SUCCESS == status) && (NULL != fwStatsResult))
-    {
-        switch( fwStatsResult->type )
-        {
-            case FW_UBSP_STATS:
-            {
-                 memcpy(&pAdapter->fwStatsRsp,fwStatsResult,sizeof(tSirFwStatsResult));
-                 hddLog(VOS_TRACE_LEVEL_INFO,
-                  FL("ubsp_enter_cnt = %d ubsp_jump_ddr_cnt = %d"),
-                  pAdapter->fwStatsRsp.fwStatsData.ubspStats.ubsp_enter_cnt,
-                  pAdapter->fwStatsRsp.fwStatsData.ubspStats.ubsp_jump_ddr_cnt);
-            }
-            break;
-            default:
-            {
-                   hddLog(VOS_TRACE_LEVEL_ERROR,
-                    FL(" No handling for stats type %d"),fwStatsResult->type);
-            }
-         }
-    }
-    complete(&(fwStatsCtx->completion));
-    spin_unlock(&hdd_context_lock);
-    return;
-}
-
 static int hdd_get_dwell_time(hdd_config_t *pCfg, tANI_U8 *command, char *extra, tANI_U8 n, tANI_U8 *len)
 {
     int ret = 0;
@@ -2916,202 +2120,6 @@
 
     return ret;
 }
-static int hdd_cmd_setFccChannel(hdd_context_t *pHddCtx, tANI_U8 *cmd,
-                                                                 tANI_U8 cmd_len)
-{
-    tANI_U8 *value;
-    tANI_U8 fcc_constraint;
-
-    eHalStatus status;
-    int ret = 0;
-    value =  cmd + cmd_len + 1;
-
-    ret = kstrtou8(value, 10, &fcc_constraint);
-    if ((ret < 0) || (fcc_constraint > 1)) {
-       /*
-        *  If the input value is greater than max value of datatype,
-        *  then also it is a failure
-        */
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-        "%s: value out of range", __func__);
-        return -EINVAL;
-    }
-
-    status = sme_handleSetFccChannel(pHddCtx->hHal, fcc_constraint,
-                                     pHddCtx->scan_info.mScanPending);
-    if (status != eHAL_STATUS_SUCCESS)
-        ret = -EPERM;
-
-    return ret;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief hdd_enable_disable_ca_event() - When Host sends IOCTL (enabled),
-         FW will send *ONE* CA ind to Host(even though it is duplicate).
-         When Host send IOCTL (disable), FW doesn't perform any action.
-         Whenever any change in CA *and* WLAN is in SAP/P2P-GO mode, FW
-         sends CA ind to host. (regard less of IOCTL status)
-  \param  - pHddCtx - HDD context
-  \param  - command - command received from framework
-  \param  - cmd_len - len of the command
-
-  \return - 0 on success, appropriate error values on failure.
-
-  --------------------------------------------------------------------------*/
-int hdd_enable_disable_ca_event(hdd_context_t *pHddCtx, tANI_U8* command, tANI_U8 cmd_len)
-{
-   tANI_U8 set_value;
-   int ret = 0;
-   eHalStatus status;
-
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       ret = -EINVAL;
-       goto exit;
-   }
-
-   if (pHddCtx->cfg_ini->gOptimizeCAevent == 0)
-   {
-       hddLog(VOS_TRACE_LEVEL_ERROR, "Enable gOptimizeCAevent"
-             " ini param to control channel avooidance indication");
-       ret = 0;
-       goto exit;
-   }
-
-   set_value = command[cmd_len + 1] - '0';
-   status = sme_enableDisableChanAvoidIndEvent(pHddCtx->hHal, set_value);
-   if (status != eHAL_STATUS_SUCCESS)
-   {
-       hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed to send"
-             " enableDisableChanAoidance command to SME\n", __func__);
-       ret = -EINVAL;
-   }
-
-exit:
-   return ret;
-}
-
-/**
- * wlan_hdd_fastreassoc_handoff_request() - Post Handoff request to SME
- * @pHddCtx: Pointer to the HDD context
- * @channel: channel to reassociate
- * @targetApBssid: Target AP/BSSID to reassociate
- *
- * Return: None
- */
-#if defined(WLAN_FEATURE_ROAM_SCAN_OFFLOAD) && !defined(QCA_WIFI_ISOC)
-static void wlan_hdd_fastreassoc_handoff_request(hdd_context_t *pHddCtx,
-				uint8_t channel, tSirMacAddr targetApBssid)
-{
-	tCsrHandoffRequest handoffInfo;
-	handoffInfo.channel = channel;
-	handoffInfo.src = FASTREASSOC;
-	vos_mem_copy(handoffInfo.bssid, targetApBssid, sizeof(tSirMacAddr));
-	sme_HandoffRequest(pHddCtx->hHal, &handoffInfo);
-}
-#else
-static void wlan_hdd_fastreassoc_handoff_request(hdd_context_t *pHddCtx,
-				uint8_t channel, tSirMacAddr targetApBssid)
-{
-}
-#endif
-
-/**
- * csr_fastroam_neighbor_ap_event() - Function to trigger scan/roam
- * @pAdapter: Pointer to HDD adapter
- * @channel: Channel to scan/roam
- * @targetApBssid: BSSID to roam
- *
- * Return: None
- */
-#ifdef QCA_WIFI_ISOC
-static void csr_fastroam_neighbor_ap_event(hdd_adapter_t *pAdapter,
-				uint8_t channel, tSirMacAddr targetApBssid)
-{
-	smeIssueFastRoamNeighborAPEvent(WLAN_HDD_GET_HAL_CTX(pAdapter),
-			&targetApBssid[0], eSME_ROAM_TRIGGER_SCAN, channel);
-}
-#else
-static void csr_fastroam_neighbor_ap_event(hdd_adapter_t *pAdapter,
-				uint8_t channel, tSirMacAddr targetApBssid)
-{
-}
-#endif
-
-/**
- * wlan_hdd_handle_fastreassoc() - Handle fastreassoc command
- * @pAdapter: pointer to hdd adapter
- * @command: pointer to the command received
- *
- * Return: VOS_STATUS enum
- */
-static VOS_STATUS wlan_hdd_handle_fastreassoc(hdd_adapter_t *pAdapter,
-						uint8_t *command)
-{
-	tANI_U8 *value = command;
-	tANI_U8 channel = 0;
-	tSirMacAddr targetApBssid;
-	hdd_station_ctx_t *pHddStaCtx = NULL;
-	hdd_context_t *pHddCtx = NULL;
-	int ret;
-	pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-	pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-
-	/* if not associated, no need to proceed with reassoc */
-	if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) {
-		hddLog(LOG1, FL("Not associated!"));
-		return eHAL_STATUS_FAILURE;
-	}
-
-	ret = hdd_parse_reassoc_command_v1_data(value, targetApBssid, &channel);
-	if (ret) {
-		hddLog(LOGE, FL("Failed to parse reassoc command data"));
-		return eHAL_STATUS_FAILURE;
-	}
-
-	/* if the target bssid is same as currently associated AP,
-	   then no need to proceed with reassoc */
-	if (vos_mem_compare(targetApBssid,
-				pHddStaCtx->conn_info.bssId,
-				sizeof(tSirMacAddr))) {
-		hddLog(LOG1, FL("Reassoc BSSID is same as currently associated AP bssid"));
-		return eHAL_STATUS_FAILURE;
-	}
-
-	/* Check channel number is a valid channel number */
-	if (VOS_STATUS_SUCCESS !=
-		wlan_hdd_validate_operation_channel(pAdapter, channel)) {
-		hddLog(LOGE, FL("Invalid Channel [%d]"), channel);
-		return eHAL_STATUS_FAILURE;
-	}
-
-	/* Proceed with reassoc */
-	wlan_hdd_fastreassoc_handoff_request(pHddCtx, channel, targetApBssid);
-
-	/* Proceed with scan/roam */
-	csr_fastroam_neighbor_ap_event(pAdapter, channel, targetApBssid);
-
-	return eHAL_STATUS_SUCCESS;
-}
-
-/**
- * hdd_assign_reassoc_handoff - Set handoff source as REASSOC
- * @handoffInfo: Pointer to the csr Handoff Request.
- *
- * Return: None
- */
-#ifndef QCA_WIFI_ISOC
-static inline void hdd_assign_reassoc_handoff(tCsrHandoffRequest *handoffInfo)
-{
-	handoffInfo->src = REASSOC;
-}
-#else
-static inline void hdd_assign_reassoc_handoff(tCsrHandoffRequest *handoffInfo)
-{
-}
-#endif
 
 static int hdd_driver_command(hdd_adapter_t *pAdapter,
                               hdd_priv_data_t *ppriv_data)
@@ -3122,11 +2130,6 @@
    hdd_scaninfo_t *pScanInfo = NULL;
    int ret = 0;
    int status;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-   struct cfg80211_mgmt_tx_params params;
-#endif
-
-   ENTER();
    /*
     * Note that valid pointers are provided by caller
     */
@@ -3146,8 +2149,9 @@
    status = wlan_hdd_validate_context(pHddCtx);
    if (0 != status)
    {
-       ret = -EINVAL;
-       goto exit;
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "%s: HDD context is not valid", __func__);
+       return status;
    }
    /* Allocate +1 for '\0' */
    command = kmalloc(priv_data.total_len + 1, GFP_KERNEL);
@@ -3204,14 +2208,11 @@
             * 9 byte will have band setting value */
            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                     "%s: SetBandCommand Info  comm %s UL %d, TL %d", __func__, command, priv_data.used_len, priv_data.total_len);
-           if(VOS_FTM_MODE != hdd_get_conparam())
-           {
-               /* Change band request received */
-               ret = hdd_setBand_helper(pAdapter->dev, ptr);
-               if(ret < 0)
-                   VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                       "%s: failed to set band ret=%d", __func__, ret);
-           }
+           /* Change band request received */
+           ret = hdd_setBand_helper(pAdapter->dev, ptr);
+           if(ret < 0)
+               VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                   "%s: failed to set band ret=%d", __func__, ret);
        }
        else if(strncmp(command, "SETWMMPS", 8) == 0)
        {
@@ -3354,8 +2355,7 @@
                             TRACE_CODE_HDD_GETROAMTRIGGER_IOCTL,
                             pAdapter->sessionId, lookUpThreshold));
            len = scnprintf(extra, sizeof(extra), "%s %d", command, rssi);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len))
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
            {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
@@ -3422,8 +2422,8 @@
            len = scnprintf(extra, sizeof(extra), "%s %d",
                    "GETROAMSCANPERIOD", (nEmptyScanRefreshPeriod/1000));
            /* Returned value is in units of seconds */
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len)) {
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
+           {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
                ret = -EFAULT;
@@ -3484,8 +2484,8 @@
            len = scnprintf(extra, sizeof(extra), "%s %d",
                    "GETROAMSCANREFRESHPERIOD", (value/1000));
            /* Returned value is in units of seconds */
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len)) {
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
+           {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
                ret = -EFAULT;
@@ -3545,7 +2545,7 @@
            sme_UpdateIsFastRoamIniFeatureEnabled((tHalHandle)(pHddCtx->hHal), roamMode);
        }
        /* GETROAMMODE */
-       else if (strncmp(command, "GETROAMMODE", SIZE_OF_GETROAMMODE) == 0)
+       else if (strncmp(priv_data.buf, "GETROAMMODE", SIZE_OF_GETROAMMODE) == 0)
        {
 	   tANI_BOOLEAN roamMode = sme_getIsLfrFeatureEnabled((tHalHandle)(pHddCtx->hHal));
 	   char extra[32];
@@ -3560,8 +2560,8 @@
 	       roamMode = CFG_LFR_FEATURE_ENABLED_MIN;
 
 	   len = scnprintf(extra, sizeof(extra), "%s %d", command, roamMode);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-	   if (copy_to_user(priv_data.buf, &extra, len)) {
+	   if (copy_to_user(priv_data.buf, &extra, len + 1))
+	   {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
                ret = -EFAULT;
@@ -3610,7 +2610,7 @@
            pHddCtx->cfg_ini->RoamRssiDiff = roamRssiDiff;
            sme_UpdateRoamRssiDiff((tHalHandle)(pHddCtx->hHal), roamRssiDiff);
        }
-       else if (strncmp(command, "GETROAMDELTA", 12) == 0)
+       else if (strncmp(priv_data.buf, "GETROAMDELTA", 12) == 0)
        {
            tANI_U8 roamRssiDiff = sme_getRoamRssiDiff((tHalHandle)(pHddCtx->hHal));
            char extra[32];
@@ -3621,8 +2621,8 @@
                             pAdapter->sessionId, roamRssiDiff));
            len = scnprintf(extra, sizeof(extra), "%s %d",
                    command, roamRssiDiff);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len)) {
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
+           {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
                ret = -EFAULT;
@@ -3642,8 +2642,8 @@
                             TRACE_CODE_HDD_GETBAND_IOCTL,
                             pAdapter->sessionId, band));
            len = scnprintf(extra, sizeof(extra), "%s %d", command, band);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len)) {
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
+           {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
                ret = -EFAULT;
@@ -3710,14 +2710,13 @@
            [Number of roam scan channels][Channel1][Channel2]... */
            /* copy the number of channels in the 0th index */
            len = scnprintf(extra, sizeof(extra), "%s %d", command, numChannels);
-           for (j = 0; (j < numChannels) && len <= sizeof(extra); j++)
+           for (j = 0; (j < numChannels); j++)
            {
                len += scnprintf(extra + len, sizeof(extra) - len, " %d",
                        ChannelList[j]);
            }
 
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len))
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
            {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
@@ -3746,8 +2745,7 @@
 
            len = scnprintf(extra, sizeof(extra), "%s %d",
                    "GETCCXMODE", eseMode);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len))
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
            {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
@@ -3776,8 +2774,7 @@
 
            len = scnprintf(extra, sizeof(extra), "%s %d",
                    "GETOKCMODE", okcMode);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len))
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
            {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
@@ -3793,8 +2790,7 @@
 
            len = scnprintf(extra, sizeof(extra), "%s %d",
                    "GETFASTROAM", lfrMode);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len))
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
            {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
@@ -3810,8 +2806,7 @@
 
            len = scnprintf(extra, sizeof(extra), "%s %d",
                    "GETFASTTRANSITION", ft);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len))
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
            {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
@@ -3957,16 +2952,6 @@
            vos_mem_free(buf);
            buf = NULL;
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-           params.chan = &chan;
-           params.offchan = 0;
-           params.wait = dwellTime;
-           params.buf = finalBuf;
-           params.len = finalLen;
-           params.no_cck = 1;
-           params.dont_wait_for_ack = 1;
-           ret = wlan_hdd_mgmt_tx(NULL, &pAdapter->wdev, &params, &cookie);
-#else
            wlan_hdd_mgmt_tx( NULL,
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
                        &(pAdapter->wdev),
@@ -3979,7 +2964,6 @@
 #endif
                        dwellTime, finalBuf, finalLen,  1,
                        1, &cookie );
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)*/
            vos_mem_free(finalBuf);
        }
        else if (strncmp(command, "GETROAMSCANCHANNELMINTIME", 25) == 0)
@@ -3994,8 +2978,7 @@
            MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                             TRACE_CODE_HDD_GETROAMSCANCHANNELMINTIME_IOCTL,
                             pAdapter->sessionId, val));
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len))
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
            {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
@@ -4051,8 +3034,7 @@
            /* value is interms of msec */
            len = scnprintf(extra, sizeof(extra), "%s %d",
                    "GETSCANCHANNELTIME", val);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len))
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
            {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
@@ -4108,8 +3090,7 @@
            /* value is interms of msec */
            len = scnprintf(extra, sizeof(extra), "%s %d",
                    "GETSCANHOMETIME", val);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len))
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
            {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
@@ -4164,8 +3145,7 @@
            /* value is interms of msec */
            len = scnprintf(extra, sizeof(extra), "%s %d",
                    "GETROAMINTRABAND", val);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len))
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
            {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
@@ -4212,15 +3192,15 @@
            pHddCtx->cfg_ini->nProbes = nProbes;
            sme_UpdateRoamScanNProbes((tHalHandle)(pHddCtx->hHal), nProbes);
        }
-       else if (strncmp(command, "GETSCANNPROBES", 14) == 0)
+       else if (strncmp(priv_data.buf, "GETSCANNPROBES", 14) == 0)
        {
            tANI_U8 val = sme_getRoamScanNProbes((tHalHandle)(pHddCtx->hHal));
            char extra[32];
            tANI_U8 len = 0;
 
            len = scnprintf(extra, sizeof(extra), "%s %d", command, val);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len)) {
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
+           {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
                ret = -EFAULT;
@@ -4269,15 +3249,15 @@
                sme_UpdateRoamScanHomeAwayTime((tHalHandle)(pHddCtx->hHal), homeAwayTime, eANI_BOOLEAN_TRUE);
            }
        }
-       else if (strncmp(command, "GETSCANHOMEAWAYTIME", 19) == 0)
+       else if (strncmp(priv_data.buf, "GETSCANHOMEAWAYTIME", 19) == 0)
        {
            tANI_U16 val = sme_getRoamScanHomeAwayTime((tHalHandle)(pHddCtx->hHal));
            char extra[32];
            tANI_U8 len = 0;
 
            len = scnprintf(extra, sizeof(extra), "%s %d", command, val);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len)) {
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
+           {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
                ret = -EFAULT;
@@ -4286,9 +3266,58 @@
        }
        else if (strncmp(command, "REASSOC", 7) == 0)
        {
-           ret = hdd_parse_reassoc(pAdapter, command);
-           if (!ret)
+           tANI_U8 *value = command;
+           tANI_U8 channel = 0;
+           tSirMacAddr targetApBssid;
+           eHalStatus status = eHAL_STATUS_SUCCESS;
+#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
+           tCsrHandoffRequest handoffInfo;
+#endif
+           hdd_station_ctx_t *pHddStaCtx = NULL;
+           pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+
+           /* if not associated, no need to proceed with reassoc */
+           if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
+           {
+               VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s:Not associated!",__func__);
+               ret = -EINVAL;
                goto exit;
+           }
+
+           status = hdd_parse_reassoc_command_data(value, targetApBssid, &channel);
+           if (eHAL_STATUS_SUCCESS != status)
+           {
+               VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "%s: Failed to parse reassoc command data", __func__);
+               ret = -EINVAL;
+               goto exit;
+           }
+
+           /* if the target bssid is same as currently associated AP,
+              then no need to proceed with reassoc */
+           if (VOS_TRUE == vos_mem_compare(targetApBssid,
+                                           pHddStaCtx->conn_info.bssId, sizeof(tSirMacAddr)))
+           {
+               VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s:Reassoc BSSID is same as currently associated AP bssid",__func__);
+               ret = -EINVAL;
+               goto exit;
+           }
+
+           /* Check channel number is a valid channel number */
+           if(VOS_STATUS_SUCCESS !=
+                         wlan_hdd_validate_operation_channel(pAdapter, channel))
+           {
+               hddLog(VOS_TRACE_LEVEL_ERROR,
+                      "%s: Invalid Channel [%d]", __func__, channel);
+               return -EINVAL;
+           }
+
+           /* Proceed with reassoc */
+#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
+           handoffInfo.channel = channel;
+           vos_mem_copy(handoffInfo.bssid, targetApBssid, sizeof(tSirMacAddr));
+           sme_HandoffRequest(pHddCtx->hHal, &handoffInfo);
+#endif
        }
        else if (strncmp(command, "SETWESMODE", 10) == 0)
        {
@@ -4328,15 +3357,15 @@
            pHddCtx->cfg_ini->isWESModeEnabled = wesMode;
            sme_UpdateWESMode((tHalHandle)(pHddCtx->hHal), wesMode);
        }
-       else if (strncmp(command, "GETWESMODE", 10) == 0)
+       else if (strncmp(priv_data.buf, "GETWESMODE", 10) == 0)
        {
            tANI_BOOLEAN wesMode = sme_GetWESMode((tHalHandle)(pHddCtx->hHal));
            char extra[32];
            tANI_U8 len = 0;
 
            len = scnprintf(extra, sizeof(extra), "%s %d", command, wesMode);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len)) {
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
+           {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
                ret = -EFAULT;
@@ -4425,66 +3454,68 @@
            pHddCtx->cfg_ini->isFastTransitionEnabled = ft;
            sme_UpdateFastTransitionEnabled((tHalHandle)(pHddCtx->hHal), ft);
        }
-       else if (strncmp(command, "SETDFSSCANMODE", 14) == 0)
-       {
-           tANI_U8 *value = command;
-           tANI_U8 dfsScanMode = DFS_CHNL_SCAN_ENABLED_NORMAL;
 
-           /* Move pointer to ahead of SETDFSSCANMODE<delimiter> */
-           value = value + 15;
-           /* Convert the value from ascii to integer */
-           ret = kstrtou8(value, 10, &dfsScanMode);
-           if (ret < 0)
-           {
-               /* If the input value is greater than max value of
-                               datatype, then also kstrtou8 fails
-                          */
-               VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                      "%s: kstrtou8 failed range [%d - %d]", __func__,
-                      CFG_ENABLE_DFS_CHNL_SCAN_MIN,
-                      CFG_ENABLE_DFS_CHNL_SCAN_MAX);
-               ret = -EINVAL;
-               goto exit;
-           }
-
-           if ((dfsScanMode < CFG_ENABLE_DFS_CHNL_SCAN_MIN) ||
-               (dfsScanMode > CFG_ENABLE_DFS_CHNL_SCAN_MAX))
-           {
-               VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                      "dfsScanMode value %d is out of range"
-                      " (Min: %d Max: %d)", dfsScanMode,
-                      CFG_ENABLE_DFS_CHNL_SCAN_MIN,
-                      CFG_ENABLE_DFS_CHNL_SCAN_MAX);
-               ret = -EINVAL;
-               goto exit;
-           }
-           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                      "%s: Received Command to Set DFS Scan Mode = %d",
-                      __func__, dfsScanMode);
-
-           ret = wlan_hdd_handle_dfs_chan_scan(pHddCtx, dfsScanMode);
-       }
-       else if (strncmp(command, "GETDFSSCANMODE", 14) == 0)
-       {
-           tANI_U8 dfsScanMode = sme_GetDFSScanMode(pHddCtx->hHal);
-           char extra[32];
-           tANI_U8 len = 0;
-
-           len = scnprintf(extra, sizeof(extra), "%s %d", command, dfsScanMode);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len))
-           {
-               VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: failed to copy data to user buffer", __func__);
-               ret = -EFAULT;
-               goto exit;
-           }
-       }
        else if (strncmp(command, "FASTREASSOC", 11) == 0)
        {
-           ret = wlan_hdd_handle_fastreassoc(pAdapter, command);
-           if (!ret)
+           tANI_U8 *value = command;
+           tANI_U8 channel = 0;
+           tSirMacAddr targetApBssid;
+           tANI_U8 trigger = 0;
+           eHalStatus status = eHAL_STATUS_SUCCESS;
+           tHalHandle hHal;
+           v_U32_t roamId = 0;
+           tCsrRoamModifyProfileFields modProfileFields;
+           hdd_station_ctx_t *pHddStaCtx = NULL;
+           pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+           hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+
+           /* if not associated, no need to proceed with reassoc */
+           if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
+           {
+               VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s:Not associated!",__func__);
+               ret = -EINVAL;
                goto exit;
+           }
+
+           status = hdd_parse_reassoc_command_data(value, targetApBssid, &channel);
+           if (eHAL_STATUS_SUCCESS != status)
+           {
+               VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "%s: Failed to parse reassoc command data", __func__);
+               ret = -EINVAL;
+               goto exit;
+           }
+
+           /* if the target bssid is same as currently associated AP,
+              issue reassoc to same AP */
+           if (VOS_TRUE == vos_mem_compare(targetApBssid,
+                                           pHddStaCtx->conn_info.bssId, sizeof(tSirMacAddr)))
+           {
+               VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                         "%s:11r Reassoc BSSID is same as currently associated AP bssid",
+                         __func__);
+               sme_GetModifyProfileFields(hHal, pAdapter->sessionId,
+                                       &modProfileFields);
+               sme_RoamReassoc(hHal, pAdapter->sessionId,
+                            NULL, modProfileFields, &roamId, 1);
+               return 0;
+           }
+
+           /* Check channel number is a valid channel number */
+           if(VOS_STATUS_SUCCESS !=
+                         wlan_hdd_validate_operation_channel(pAdapter, channel))
+           {
+               hddLog(VOS_TRACE_LEVEL_ERROR,
+                      "%s: Invalid Channel  [%d]", __func__, channel);
+               return -EINVAL;
+           }
+
+           trigger = eSME_ROAM_TRIGGER_SCAN;
+
+           /* Proceed with scan/roam */
+           smeIssueFastRoamNeighborAPEvent(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                           &targetApBssid[0],
+                                           (tSmeFastRoamTrigger)(trigger));
        }
 #endif
 #ifdef FEATURE_WLAN_ESE
@@ -4624,7 +3655,7 @@
            pHddCtx->cfg_ini->isOkcIniFeatureEnabled = okcMode;
        }
 #endif  /* FEATURE_WLAN_OKC */
-       else if (strncmp(command, "GETROAMSCANCONTROL", 18) == 0)
+       else if (strncmp(priv_data.buf, "GETROAMSCANCONTROL", 18) == 0)
        {
            tANI_BOOLEAN roamScanControl = sme_GetRoamScanControl((tHalHandle)(pHddCtx->hHal));
            char extra[32];
@@ -4632,8 +3663,8 @@
 
            len = scnprintf(extra, sizeof(extra), "%s %d",
                    command, roamScanControl);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len)) {
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
+           {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
                ret = -EFAULT;
@@ -4709,14 +3740,14 @@
        }
        else if (strncmp(command, "SCAN-ACTIVE", 11) == 0)
        {
-           hddLog(LOG1,
-                FL("making default scan to ACTIVE"));
+           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                              FL("making default scan to ACTIVE"));
            pHddCtx->scan_info.scan_mode = eSIR_ACTIVE_SCAN;
        }
        else if (strncmp(command, "SCAN-PASSIVE", 12) == 0)
        {
-           hddLog(LOG1,
-                FL("making default scan to PASSIVE"));
+           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                              FL("making default scan to PASSIVE"));
            pHddCtx->scan_info.scan_mode = eSIR_PASSIVE_SCAN;
        }
        else if (strncmp(command, "GETDWELLTIME", 12) == 0)
@@ -4727,8 +3758,8 @@
 
            memset(extra, 0, sizeof(extra));
            ret = hdd_get_dwell_time(pCfg, command, extra, sizeof(extra), &len);
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (ret != 0 || copy_to_user(priv_data.buf, &extra, len)) {
+           if (ret != 0 || copy_to_user(priv_data.buf, &extra, len + 1))
+           {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
                ret = -EFAULT;
@@ -4838,703 +3869,6 @@
            ret = hdd_handle_batch_scan_ioctl(pAdapter, &priv_data, command);
        }
 #endif
-#ifdef WLAN_FEATURE_RMC
-       else if ((strncasecmp(command, "SETIBSSBEACONOUIDATA", 20) == 0) &&
-                (WLAN_HDD_IBSS == pAdapter->device_mode))
-       {
-           int i = 0;
-           tANI_U8 *ibss_ie;
-           tANI_U32 command_len;
-           tANI_U8 *value = command;
-           tHalHandle hHal = pHddCtx->hHal;
-           tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-           tANI_U32 ibss_ie_length;
-           tANI_U32 len, present;
-           tANI_U8 *addIE;
-           tANI_U8 *addIEData;
-
-           hddLog(LOG1,
-                     FL(" received command %s"),((char *) value));
-           /* validate argument of command */
-           if (strlen(value) <= 21)
-           {
-               hddLog(LOGE,
-                   FL("No arguements in command length %zu"), strlen(value));
-              ret = -EFAULT;
-              goto exit;
-           }
-
-           /* moving to arguments of commands */
-           value = value + 21;
-           command_len = strlen(value);
-
-           /* oui_data can't be less than 3 bytes */
-           if (command_len <= (2 * WLAN_HDD_IBSS_MIN_OUI_DATA_LENGTH))
-           {
-               hddLog(LOGE,
-                     FL("Invalid SETIBSSBEACONOUIDATA command length %d"),
-                     command_len);
-              ret = -EFAULT;
-              goto exit;
-           }
-           ibss_ie = vos_mem_malloc(command_len);
-           if (!ibss_ie) {
-               hddLog(LOGE,
-                     FL("Could not allocate memory for command length %d"),
-                     command_len);
-              ret = -ENOMEM;
-              goto exit;
-           }
-           vos_mem_zero(ibss_ie, command_len);
-
-           ibss_ie_length = hdd_parse_set_ibss_oui_data_command(value, ibss_ie,
-                                                                  command_len);
-           if (ibss_ie_length < (2 * WLAN_HDD_IBSS_MIN_OUI_DATA_LENGTH)) {
-               hddLog(LOGE, FL("Could not parse command %s return length %d"),
-                     value, ibss_ie_length);
-                 ret = -EFAULT;
-              vos_mem_free(ibss_ie);
-                 goto exit;
-              }
-
-           hddLog(LOG1, FL("ibss_ie length %d ibss_ie:"), ibss_ie_length);
-           while (i < ibss_ie_length)
-              hddLog(LOG1, FL("0x%x"), ibss_ie[i++]);
-
-           /* Populate Vendor IE in Beacon */
-           if ((ccmCfgGetInt(hHal,
-                             WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG,
-                             &present)) != eHAL_STATUS_SUCCESS)
-           {
-              hddLog(LOGE,
-                FL("unable to ftch WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG"));
-              ret = -EFAULT;
-              vos_mem_free(ibss_ie);
-              goto exit;
-           }
-
-           addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN);
-           if (!addIE) {
-              hddLog(LOGE,
-                     FL("Could not allocate memory for command length %d"),
-                     command_len);
-              vos_mem_free(ibss_ie);
-              ret = -ENOMEM;
-              goto exit;
-           }
-           vos_mem_zero(addIE, WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN);
-
-           if (present)
-           {
-              if ((wlan_cfgGetStrLen(pMac,
-                      WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, &len)) != eSIR_SUCCESS)
-              {
-                 hddLog(LOGE,
-                   FL("unable to fetch WNI_CFG_PROBE_RSP_BCN_ADDNIE_LEN"));
-                 ret = -EFAULT;
-                 vos_mem_free(ibss_ie);
-                 vos_mem_free(addIE);
-                 goto exit;
-              }
-
-              if (len <= WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN && len &&
-                ((len + ibss_ie_length) <=
-                                    WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN))
-              {
-                 if ((ccmCfgGetStr(hHal,
-                        WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, addIE, &len))
-                        != eHAL_STATUS_SUCCESS)
-                 {
-                    hddLog(LOGE,
-                      FL("unable to fetch WNI_PROBE_RSP_BCN_ADDNIE_DATA"));
-                    ret = -EFAULT;
-                    vos_mem_free(ibss_ie);
-                    vos_mem_free(addIE);
-                    goto exit;
-                 }
-                 else
-                 {
-                    /* Curruntly only WPA IE is added before Vendor IE
-                     * so we can blindly place the Vendor IE after WPA
-                     * IE. If no WPA IE found replace all with Vendor IE.
-                     */
-                    len = hdd_find_ibss_wpa_ie_pos(addIE, len);
-                 }
-              }
-              else
-              {
-                 hddLog(LOGE,
-                    FL("IE len exceed limit len %d,ibss_ie_length %d "),
-                    len, ibss_ie_length);
-                 ret = -EFAULT;
-                 vos_mem_free(addIE);
-                 vos_mem_free(ibss_ie);
-                 goto exit;
-              }
-           }
-           else {
-              len = 0;
-           }
-
-           vos_mem_copy (addIE + len , ibss_ie, ibss_ie_length);
-           len += ibss_ie_length;
-
-           if (ccmCfgSetStr(hHal,
-               WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, addIE, len, NULL,
-               eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS)
-           {
-              hddLog(LOGE,
-                  FL("unable to set WNI_CFG_PRBE_RSP_BCN_ADDNIE_DATA"));
-              ret = -EFAULT;
-              vos_mem_free(ibss_ie);
-              vos_mem_free(addIE);
-              goto exit;
-           }
-           vos_mem_free(addIE);
-           if (ccmCfgSetInt(hHal,
-               WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL,
-               eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS)
-           {
-              hddLog(LOGE,
-                 FL("unble to set WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG"));
-              ret = -EFAULT;
-              vos_mem_free(ibss_ie);
-              goto exit;
-           }
-
-           /* Populate Vendor IE in probe resp */
-           if ((ccmCfgGetInt(hHal,
-                             WNI_CFG_PROBE_RSP_ADDNIE_FLAG,
-                             &present)) != eHAL_STATUS_SUCCESS)
-           {
-               hddLog(LOGE,
-                   FL("unable to fetch WNI_CFG_PROBE_RSP_ADDNIE_FLAG"));
-               ret = -EFAULT;
-               vos_mem_free(ibss_ie);
-               goto exit;
-           }
-
-           addIEData = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN);
-           if (!addIEData) {
-              hddLog(LOGE,
-                     FL("Could not allocate memory for command length %d"),
-                     command_len);
-              vos_mem_free(ibss_ie);
-              ret = -ENOMEM;
-              goto exit;
-           }
-           vos_mem_zero(addIEData, WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN);
-
-           if (present) {
-              if (eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
-                                      WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &len)) {
-                 hddLog(LOGE,
-                     FL("unable to fetch WNI_CFG_PROBE_RSP_ADDNIE_DATA1"));
-                 ret = -EFAULT;
-                 vos_mem_free(ibss_ie);
-                 vos_mem_free(addIEData);
-                 goto exit;
-              }
-              if (len < WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && len &&
-                 (ibss_ie_length + len) <=
-                                   WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN) {
-
-                 if ((ccmCfgGetStr(hHal,
-                         WNI_CFG_PROBE_RSP_ADDNIE_DATA1, addIEData, &len))
-                         != eHAL_STATUS_SUCCESS) {
-                    hddLog(LOGE,
-                     FL("unable fetch WNI_CFG_PROBE_RSP_ADDNIE_DATA1"));
-                    ret = -EFAULT;
-                    vos_mem_free(ibss_ie);
-                    vos_mem_free(addIEData);
-                    goto exit;
-                 }
-                 else {
-                    /* Curruntly only WPA IE is added before Vendor IE
-                     * so we can blindly place the Vendor IE after WPA
-                     * IE. If no WPA IE found replace all with Vendor IE.
-                     */
-                    len = hdd_find_ibss_wpa_ie_pos(addIEData, len);
-                 }
-              }
-              else
-              {
-                 hddLog(LOGE,
-                    FL("IE len exceed limit len %d,ibss_ie_length %d "),
-                    len, ibss_ie_length);
-                 ret = -EFAULT;
-                 vos_mem_free(addIEData);
-                 vos_mem_free(ibss_ie);
-                 goto exit;
-              }
-           } /* probe rsp ADD IE present */
-           else {
-              /* probe rsp add IE is not present */
-              len = 0;
-           }
-
-           vos_mem_copy(addIEData +len , ibss_ie, ibss_ie_length);
-           len += ibss_ie_length;
-
-           vos_mem_free(ibss_ie);
-
-           if (ccmCfgSetStr(hHal,
-                               WNI_CFG_PROBE_RSP_ADDNIE_DATA1,
-                               (tANI_U8*)(addIEData),
-                               len, NULL,
-                               eANI_BOOLEAN_FALSE)
-                               == eHAL_STATUS_FAILURE) {
-              hddLog(LOGE,
-                  FL("unable to copy to WNI_CFG_PROBE_RSP_ADDNIE_DATA1"));
-              ret = -EFAULT;
-              vos_mem_free(addIEData);
-              goto exit;
-           }
-           vos_mem_free(addIEData);
-           if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                            WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL,
-                           eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-           {
-              hddLog(LOGE,
-                  FL("unable to copy WNI_CFG_PROBE_RSP_ADDNIE_FLAG"));
-              ret = -EFAULT;
-              goto exit;
-           }
-        }
-       else if (strncasecmp(command, "SETRMCENABLE", 12) == 0)
-       {
-          tANI_U8 *value = command;
-          tANI_U8 ucRmcEnable = 0;
-          int  status;
-
-          if ((WLAN_HDD_IBSS != pAdapter->device_mode) &&
-              (WLAN_HDD_SOFTAP != pAdapter->device_mode))
-          {
-             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "Received SETRMCENABLE command in invalid mode %d "
-                "SETRMCENABLE command is only allowed in IBSS or SOFTAP mode",
-                pAdapter->device_mode);
-             ret = -EINVAL;
-             goto exit;
-          }
-
-          status = hdd_parse_setrmcenable_command(value, &ucRmcEnable);
-          if (status)
-          {
-             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "Invalid SETRMCENABLE command ");
-             ret = -EINVAL;
-             goto exit;
-          }
-
-          VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-               "%s: ucRmcEnable %d ", __func__, ucRmcEnable);
-
-          if (TRUE == ucRmcEnable)
-          {
-              status = sme_EnableRMC( (tHalHandle)(pHddCtx->hHal),
-                         pAdapter->sessionId );
-          }
-          else if(FALSE == ucRmcEnable)
-          {
-              status = sme_DisableRMC( (tHalHandle)(pHddCtx->hHal),
-                         pAdapter->sessionId );
-          }
-          else
-          {
-             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "Invalid SETRMCENABLE command %d", ucRmcEnable);
-             ret = -EINVAL;
-             goto exit;
-          }
-
-          if (VOS_STATUS_SUCCESS != status)
-          {
-              VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: SETRMC %d failed status %d", __func__, ucRmcEnable,
-                 status);
-              ret = -EINVAL;
-              goto exit;
-          }
-       }
-       else if (strncasecmp(command, "SETRMCACTIONPERIOD", 18) == 0)
-       {
-          tANI_U8 *value = command;
-          tANI_U32 uActionPeriod = 0;
-          int  status;
-
-          if ((WLAN_HDD_IBSS != pAdapter->device_mode) &&
-              (WLAN_HDD_SOFTAP != pAdapter->device_mode))
-          {
-             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "Received SETRMC command in invalid mode %d "
-                "SETRMC command is only allowed in IBSS or SOFTAP mode",
-                pAdapter->device_mode);
-             ret = -EINVAL;
-             goto exit;
-          }
-
-          status = hdd_parse_setrmcactionperiod_command(value, &uActionPeriod);
-          if (status)
-          {
-             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "Invalid SETRMCACTIONPERIOD command ");
-             ret = -EINVAL;
-             goto exit;
-          }
-
-          VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-               "%s: uActionPeriod %d ", __func__, uActionPeriod);
-
-          if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY,
-                 uActionPeriod, NULL, eANI_BOOLEAN_FALSE))
-          {
-              VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Could not set SETRMCACTIONPERIOD %d", __func__, uActionPeriod);
-              ret = -EINVAL;
-              goto exit;
-          }
-
-      }
-      else if (strncasecmp(command, "GETIBSSPEERINFOALL", 18) == 0)
-      {
-         /* Peer Info All Command */
-         int status = eHAL_STATUS_SUCCESS;
-         hdd_station_ctx_t *pHddStaCtx = NULL;
-         char *extra = NULL;
-         int idx = 0, length = 0;
-         v_MACADDR_t *macAddr;
-         v_U32_t txRateMbps = 0, numOfBytestoPrint = 0;
-
-         if (WLAN_HDD_IBSS == pAdapter->device_mode)
-         {
-            pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-         }
-         else
-         {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                      "%s: pAdapter is not valid for this device mode",
-                      __func__);
-            ret = -EINVAL;
-            goto exit;
-         }
-
-         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                 "%s: Received GETIBSSPEERINFOALL Command", __func__);
-
-
-         /* Handle the command */
-         status = hdd_cfg80211_get_ibss_peer_info_all(pAdapter);
-         if (VOS_STATUS_SUCCESS == status)
-         {
-            /* The variable extra needed to be allocated on the heap since
-             * amount of memory required to copy the data for 32 devices
-             * exceeds the size of 1024 bytes of default stack size. On
-             * 64 bit devices, the default max stack size of 2048 bytes
-             */
-            extra = kmalloc(WLAN_MAX_BUF_SIZE, GFP_KERNEL);
-
-            if (NULL == extra)
-            {
-               VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                         "%s:kmalloc failed", __func__);
-               ret = -EINVAL;
-               goto exit;
-            }
-
-            /* Copy number of stations */
-            length = scnprintf( extra, WLAN_MAX_BUF_SIZE, "%d ",
-                             pHddStaCtx->ibss_peer_info.numIBSSPeers);
-            numOfBytestoPrint = length;
-            for (idx = 0; idx < pHddStaCtx->ibss_peer_info.numIBSSPeers; idx++)
-            {
-               macAddr =
-                       hdd_wlan_get_ibss_mac_addr_from_staid(pAdapter,
-                                         pHddStaCtx->ibss_peer_info.ibssPeerList[idx].staIdx);
-               if (NULL != macAddr)
-               {
-                  txRateMbps =
-                     ((pHddStaCtx->ibss_peer_info.ibssPeerList[idx].txRate)*500*1000)/1000000;
-
-                  length += scnprintf( (extra + length), WLAN_MAX_BUF_SIZE - length,
-                                  "%02x:%02x:%02x:%02x:%02x:%02x %d %d ",
-                                  macAddr->bytes[0], macAddr->bytes[1], macAddr->bytes[2],
-                                  macAddr->bytes[3], macAddr->bytes[4], macAddr->bytes[5],
-                                  (int)txRateMbps,
-                                  (int)pHddStaCtx->ibss_peer_info.ibssPeerList[idx].rssi);
-               }
-               else
-               {
-                  VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                             "%s: MAC ADDR is NULL for staIdx: %d", __func__,
-                             pHddStaCtx->ibss_peer_info.ibssPeerList[idx].staIdx);
-               }
-
-               /*
-                * VOS_TRACE() macro has limitation of 512 bytes for the print
-                * buffer. Hence printing the data in two chunks. The first chunk
-                * will have the data for 16 devices and the second chunk will
-                * have the rest.
-                */
-               if (idx < NUM_OF_STA_DATA_TO_PRINT)
-               {
-                   numOfBytestoPrint = length;
-               }
-            }
-
-            /*
-             * Copy the data back into buffer, if the data to copy is
-             * morethan 512 bytes than we will split the data and do
-             * it in two shots
-             */
-            if (copy_to_user(priv_data.buf, extra, numOfBytestoPrint))
-            {
-               VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                          "%s: Copy into user data buffer failed ", __func__);
-               ret = -EFAULT;
-               kfree(extra);
-               goto exit;
-            }
-            priv_data.buf[numOfBytestoPrint] = '\0';
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
-                      "%s", priv_data.buf);
-
-            if (length > numOfBytestoPrint)
-            {
-                if (copy_to_user(priv_data.buf + numOfBytestoPrint,
-                                 extra + numOfBytestoPrint,
-                                 length - numOfBytestoPrint + 1))
-                {
-                    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                              "%s: Copy into user data buffer failed ", __func__);
-                    ret = -EFAULT;
-                    kfree(extra);
-                    goto exit;
-                }
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
-                          "%s", &priv_data.buf[numOfBytestoPrint]);
-            }
-
-            /* Free temporary buffer */
-            kfree(extra);
-         }
-
-         else
-         {
-            /* Command failed, log error */
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                      "%s: GETIBSSPEERINFOALL command failed with status code %d",
-                      __func__, status);
-            ret = -EINVAL;
-            goto exit;
-         }
-         ret = 0;
-      }
-      else if(strncasecmp(command, "GETIBSSPEERINFO", 15) == 0)
-      {
-         /* Peer Info <Peer Addr> command */
-         tANI_U8 *value = command;
-         VOS_STATUS status;
-         hdd_station_ctx_t *pHddStaCtx = NULL;
-         char extra[128] = { 0 };
-         v_U32_t length = 0;
-         v_U8_t staIdx = 0;
-         v_U32_t txRateMbps = 0;
-         v_MACADDR_t peerMacAddr;
-
-         if (WLAN_HDD_IBSS == pAdapter->device_mode)
-         {
-            pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-         }
-         else
-         {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                      "%s: pAdapter is not valid for this device mode",
-                      __func__);
-            ret = -EINVAL;
-            goto exit;
-         }
-
-         /* if there are no peers, no need to continue with the command */
-         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                 "%s: Received GETIBSSPEERINFO Command", __func__);
-
-         if (eConnectionState_IbssConnected != pHddStaCtx->conn_info.connState)
-         {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                      "%s:No IBSS Peers coalesced", __func__);
-            ret = -EINVAL;
-            goto exit;
-         }
-
-         /* Parse the incoming command buffer */
-         status = hdd_parse_get_ibss_peer_info(value, &peerMacAddr);
-         if (VOS_STATUS_SUCCESS != status)
-         {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                      "%s: Invalid GETIBSSPEERINFO command", __func__);
-            ret = -EINVAL;
-            goto exit;
-         }
-
-         /* Get station index for the peer mac address */
-         hdd_Ibss_GetStaId(pHddStaCtx, &peerMacAddr, &staIdx);
-
-         if (staIdx > HDD_MAX_NUM_IBSS_STA)
-         {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                      "%s: Invalid StaIdx %d returned", __func__, staIdx);
-            ret = -EINVAL;
-            goto exit;
-         }
-
-         /* Handle the command */
-         status = hdd_cfg80211_get_ibss_peer_info(pAdapter, staIdx);
-         if (VOS_STATUS_SUCCESS == status)
-         {
-            v_U32_t txRate = pHddStaCtx->ibss_peer_info.ibssPeerList[0].txRate;
-            txRateMbps = (txRate * 500 * 1000)/1000000;
-
-            length = scnprintf( extra, sizeof(extra), "%d %d", (int)txRateMbps,
-                            (int)pHddStaCtx->ibss_peer_info.ibssPeerList[0].rssi);
-
-            /* Copy the data back into buffer */
-            if (copy_to_user(priv_data.buf, &extra, length+ 1))
-            {
-               VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: copy data to user buffer failed GETIBSSPEERINFO command",
-                  __func__);
-               ret = -EFAULT;
-               goto exit;
-            }
-         }
-         else
-         {
-            /* Command failed, log error */
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                      "%s: GETIBSSPEERINFO command failed with status code %d",
-                      __func__, status);
-            ret = -EINVAL;
-            goto exit;
-         }
-
-         /* Success ! */
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
-                   "%s", priv_data.buf);
-         ret = 0;
-       }
-       else if (strncasecmp(command, "SETRMCTXRATE", 12) == 0)
-       {
-          tANI_U8 *value = command;
-          tANI_U32 uRate = 0;
-          tTxrateinfoflags txFlags = 0;
-          tSirRateUpdateInd *rateUpdateParams;
-          int  status;
-
-          if ((WLAN_HDD_IBSS != pAdapter->device_mode) &&
-              (WLAN_HDD_SOFTAP != pAdapter->device_mode))
-           {
-              VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "Received SETRMCTXRATE command in invalid mode %d "
-                "SETRMC command is only allowed in IBSS or SOFTAP mode",
-                pAdapter->device_mode);
-              ret = -EINVAL;
-              goto exit;
-           }
-
-          status = hdd_parse_setrmcrate_command(value, &uRate, &txFlags);
-          if (status)
-           {
-               VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "Invalid SETRMCTXRATE command ");
-               ret = -EINVAL;
-               goto exit;
-           }
-
-          rateUpdateParams = vos_mem_malloc(sizeof(tSirRateUpdateInd));
-          if (NULL == rateUpdateParams)
-           {
-             ret = -EINVAL;
-             goto exit;
-           }
-
-          VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-               "%s: uRate %d ", __func__, uRate);
-
-          vos_mem_zero(rateUpdateParams, sizeof(tSirRateUpdateInd ));
-
-          /* -1 implies ignore this param */
-          rateUpdateParams->ucastDataRate = -1;
-
-          /*
-           * Fill the user specifieed RMC rate param
-           * and the derived tx flags.
-           */
-          rateUpdateParams->rmcDataRate = uRate;
-          rateUpdateParams->rmcDataRateTxFlag = txFlags;
-
-          status = sme_SendRateUpdateInd((tHalHandle)(pHddCtx->hHal), rateUpdateParams);
-       }
-       else if (strncasecmp(command, "SETIBSSTXFAILEVENT", 18) == 0 )
-       {
-           char *value;
-           tANI_U8 tx_fail_count = 0;
-           tANI_U16 pid = 0;
-
-           value = command;
-
-           ret = hdd_ParseIBSSTXFailEventParams(value, &tx_fail_count, &pid);
-
-           if (0 != ret)
-           {
-              hddLog(VOS_TRACE_LEVEL_INFO,
-                     "%s: Failed to parse SETIBSSTXFAILEVENT arguments",
-                     __func__);
-              goto exit;
-           }
-
-           hddLog(VOS_TRACE_LEVEL_INFO, "%s: tx_fail_cnt=%hhu, pid=%hu",
-                   __func__, tx_fail_count, pid);
-
-           if (0 == tx_fail_count)
-           {
-               // Disable TX Fail Indication
-               if (eHAL_STATUS_SUCCESS  ==
-                   sme_TXFailMonitorStartStopInd(pHddCtx->hHal,
-                                                 tx_fail_count,
-                                                 NULL))
-               {
-                   cesium_pid = 0;
-           }
-               else
-               {
-                   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                             "%s: failed to disable TX Fail Event ", __func__);
-                   ret = -EINVAL;
-       }
-           }
-           else
-       {
-               if (eHAL_STATUS_SUCCESS  ==
-                   sme_TXFailMonitorStartStopInd(pHddCtx->hHal,
-                                                 tx_fail_count,
-                                           (void*)hdd_tx_fail_ind_callback))
-               {
-                   cesium_pid = pid;
-                   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                             "%s: Registered Cesium pid %u", __func__,
-                             cesium_pid);
-       }
-               else
-               {
-                   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                             "%s: Failed to enable TX Fail Monitoring", __func__);
-                   ret = -EINVAL;
-               }
-           }
-       }
-
-#endif /* WLAN_FEATURE_RMC */
 #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
        else if (strncmp(command, "SETCCXROAMSCANCHANNELS", 22) == 0)
        {
@@ -5655,8 +3989,8 @@
                   tsmMetrics.UplinkPktLoss, tsmMetrics.UplinkPktCount, tsmMetrics.RoamingCount,
                   tsmMetrics.RoamingDly);
 
-           len = VOS_MIN(priv_data.total_len, len + 1);
-           if (copy_to_user(priv_data.buf, &extra, len)) {
+           if (copy_to_user(priv_data.buf, &extra, len + 1))
+           {
                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: failed to copy data to user buffer", __func__);
                ret = -EFAULT;
@@ -5792,13 +4126,7 @@
            int set_value;
            /* Move pointer to ahead of TDLSOFFCH*/
            value += 26;
-           if (!(sscanf(value, "%d", &set_value))) {
-               VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                               FL("No input identified"));
-               ret = -EINVAL;
-               goto exit;
-           }
-
+           sscanf(value, "%d", &set_value);
            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                      "%s: Tdls offchannel offset:%d",
                      __func__, set_value);
@@ -5814,13 +4142,7 @@
            int set_value;
            /* Move pointer to ahead of tdlsoffchnmode*/
            value += 18;
-           ret = sscanf(value, "%d", &set_value);
-           if (ret != 1) {
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                           FL("No input identified"));
-               ret = -EINVAL;
-               goto exit;
-           }
+           sscanf(value, "%d", &set_value);
            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                      "%s: Tdls offchannel mode:%d",
                      __func__, set_value);
@@ -5835,14 +4157,7 @@
            int set_value;
            /* Move pointer to ahead of TDLSOFFCH*/
            value += 14;
-           ret = sscanf(value, "%d", &set_value);
-           if (ret != 1) {
-              VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                     "Wrong value is given for hdd_set_tdls_offchannel");
-               ret = -EINVAL;
-               goto exit;
-           }
-
+           sscanf(value, "%d", &set_value);
            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                      "%s: Tdls offchannel num: %d",
                      __func__, set_value);
@@ -5854,135 +4169,15 @@
            }
        }
 #endif
-       else if (strncmp(command, "GETFWSTATS", 10) == 0)
-       {
-           eHalStatus status;
-           char *buf = NULL;
-           char len;
-           long waitRet;
-           fwStatsContext_t fwStatsCtx;
-           tSirFwStatsResult *fwStatsRsp = &(pAdapter->fwStatsRsp);
-           tANI_U8 *ptr = command;
-           int stats = *(ptr + 11) - '0';
-
-           hddLog(VOS_TRACE_LEVEL_INFO, FL("stats = %d "),stats);
-           if (!IS_FEATURE_FW_STATS_ENABLE)
-           {
-               hddLog(VOS_TRACE_LEVEL_INFO,
-                     FL("Get Firmware stats feature not supported"));
-               ret = -EINVAL;
-               goto exit;
-           }
-
-           if (FW_STATS_MAX <= stats || 0 >= stats)
-           {
-               hddLog(VOS_TRACE_LEVEL_INFO,
-                        FL(" stats %d not supported"),stats);
-               ret = -EINVAL;
-               goto exit;
-           }
-
-           init_completion(&(fwStatsCtx.completion));
-           fwStatsCtx.magic = FW_STATS_CONTEXT_MAGIC;
-           fwStatsCtx.pAdapter = pAdapter;
-           fwStatsRsp->type = 0;
-           status = sme_GetFwStats( (tHalHandle)pHddCtx->hHal, stats,
-                                   &fwStatsCtx, hdd_FWStatisCB);
-           if (eHAL_STATUS_SUCCESS != status)
-           {
-               hddLog(VOS_TRACE_LEVEL_ERROR,
-                       FL(" fail to post WDA cmd status = %d"), status);
-               ret = -EINVAL;
-               goto exit;
-           }
-           waitRet = wait_for_completion_timeout
-                             (&(fwStatsCtx.completion), FW_STATE_WAIT_TIME);
-           if (waitRet <= 0)
-           {
-               hddLog(VOS_TRACE_LEVEL_ERROR,
-                        FL("failed to wait on GwtFwstats"));
-               //Make magic number to zero so that callback is not executed.
-               spin_lock(&hdd_context_lock);
-               fwStatsCtx.magic = 0x0;
-               spin_unlock(&hdd_context_lock);
-               ret = -EINVAL;
-               goto exit;
-           }
-           if (fwStatsRsp->type)
-           {
-               buf = kmalloc(FW_STATE_RSP_LEN, GFP_KERNEL);
-               if (!buf)
-               {
-                 hddLog(VOS_TRACE_LEVEL_ERROR,
-                       FL(" failed to allocate memory"));
-                 ret = -ENOMEM;
-                 goto exit;
-               }
-               switch( fwStatsRsp->type )
-               {
-                   case FW_UBSP_STATS:
-                   {
-                        len = snprintf(buf, FW_STATE_RSP_LEN,
-                              "GETFWSTATS: ubsp_enter_cnt %d ubsp_jump_ddr_cnt %d",
-                              fwStatsRsp->fwStatsData.ubspStats.ubsp_enter_cnt,
-                              fwStatsRsp->fwStatsData.ubspStats.ubsp_jump_ddr_cnt);
-                   }
-                   break;
-                   default:
-                   {
-                        hddLog(VOS_TRACE_LEVEL_ERROR, FL( "No handling for stats type %d"),fwStatsRsp->type);
-                        ret = -EFAULT;
-                        kfree(buf);
-                        goto exit;
-                   }
-               }
-               if (copy_to_user(priv_data.buf, buf, len + 1))
-               {
-                   hddLog(VOS_TRACE_LEVEL_ERROR,
-                      FL(" failed to copy data to user buffer"));
-                   ret = -EFAULT;
-                   kfree(buf);
-                   goto exit;
-               }
-               ret = len;
-               kfree(buf);
-           }
-           else
-           {
-               hddLog(VOS_TRACE_LEVEL_ERROR,
-                   FL("failed to fetch the stats"));
-               ret = -EFAULT;
-               goto exit;
-           }
-
-       }
-       else if (strncasecmp(command, "SET_FCC_CHANNEL", 15) == 0)
-       {
-          /*
-           * this command wld be called by user-space when it detects WLAN
-           * ON after airplane mode is set. When APM is set, WLAN turns off.
-           * But it can be turned back on. Otherwise; when APM is turned back
-           * off, WLAN wld turn back on. So at that point the command is
-           * expected to come down. 0 means disable, 1 means enable. The
-           * constraint is removed when parameter 1 is set or different
-           * country code is set
-           */
-           ret = hdd_cmd_setFccChannel(pHddCtx, command, 15);
-       }
-       else if (strncasecmp(command, "DISABLE_CA_EVENT", 16) == 0)
-       {
-           ret = hdd_enable_disable_ca_event(pHddCtx, command, 16);
-       }
        else {
            MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                             TRACE_CODE_HDD_UNSUPPORTED_IOCTL,
                             pAdapter->sessionId, 0));
-           hddLog( VOS_TRACE_LEVEL_WARN, FL("Unsupported GUI command %s"),
-                   command);
+           hddLog( VOS_TRACE_LEVEL_WARN, "%s: Unsupported GUI command %s",
+                   __func__, command);
        }
    }
 exit:
-   EXIT();
    if (command)
    {
        kfree(command);
@@ -6048,8 +4243,6 @@
    hdd_context_t *pHddCtx;
    int ret;
 
-   ENTER();
-
    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
    if (NULL == pAdapter) {
       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
@@ -6072,6 +4265,8 @@
    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
    ret = wlan_hdd_validate_context(pHddCtx);
    if (ret) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                "%s: invalid context", __func__);
       ret = -EBUSY;
       goto exit;
    }
@@ -6090,7 +4285,6 @@
       break;
    }
  exit:
-   EXIT();
    return ret;
 }
 
@@ -6105,11 +4299,6 @@
     return ret;
 }
 
-int hdd_mon_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
-  return 0;
-}
-
 #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
 /**---------------------------------------------------------------------------
 
@@ -6135,8 +4324,7 @@
                                      tCsrEseBeaconReq *pEseBcnReq)
 {
     tANI_U8 *inPtr = pValue;
-    uint8_t input = 0;
-    uint32_t tempInt = 0;
+    int tempInt = 0;
     int j = 0, i = 0, v = 0;
     char buf[32];
 
@@ -6162,14 +4350,13 @@
     v = sscanf(inPtr, "%31s ", buf);
     if (1 != v) return -EINVAL;
 
-    v = kstrtos8(buf, 10, &input);
+    v = kstrtos32(buf, 10, &tempInt);
     if ( v < 0) return -EINVAL;
 
-    input = VOS_MIN(input, SIR_ESE_MAX_MEAS_IE_REQS);
-    pEseBcnReq->numBcnReqIe = input;
+    pEseBcnReq->numBcnReqIe = tempInt;
 
-    hddLog(LOG1, "Number of Bcn Req Ie fields: %d", pEseBcnReq->numBcnReqIe);
-
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
+               "Number of Bcn Req Ie fields(%d)", pEseBcnReq->numBcnReqIe);
 
     for (j = 0; j < (pEseBcnReq->numBcnReqIe); j++)
     {
@@ -6189,27 +4376,27 @@
             v = sscanf(inPtr, "%31s ", buf);
             if (1 != v) return -EINVAL;
 
-            v = kstrtou32(buf, 10, &tempInt);
+            v = kstrtos32(buf, 10, &tempInt);
             if (v < 0) return -EINVAL;
 
             switch (i)
             {
                 case 0:  /* Measurement token */
-                if (!tempInt)
+                if (tempInt <= 0)
                 {
                    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                             "Invalid Measurement Token: %u", tempInt);
+                             "Invalid Measurement Token(%d)", tempInt);
                    return -EINVAL;
                 }
                 pEseBcnReq->bcnReq[j].measurementToken = tempInt;
                 break;
 
                 case 1:  /* Channel number */
-                if ((!tempInt) ||
+                if ((tempInt <= 0) ||
                     (tempInt > WNI_CFG_CURRENT_CHANNEL_STAMAX))
                 {
                    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                             "Invalid Channel Number: %u", tempInt);
+                             "Invalid Channel Number(%d)", tempInt);
                    return -EINVAL;
                 }
                 pEseBcnReq->bcnReq[j].channel = tempInt;
@@ -6219,18 +4406,18 @@
                 if ((tempInt < eSIR_PASSIVE_SCAN) || (tempInt > eSIR_BEACON_TABLE))
                 {
                    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                             "Invalid Scan Mode(%u) Expected{0|1|2}", tempInt);
+                             "Invalid Scan Mode(%d) Expected{0|1|2}", tempInt);
                    return -EINVAL;
                 }
                 pEseBcnReq->bcnReq[j].scanMode= tempInt;
                 break;
 
                 case 3:  /* Measurement duration */
-                if (((!tempInt) && (pEseBcnReq->bcnReq[j].scanMode != eSIR_BEACON_TABLE)) ||
-                    ((pEseBcnReq->bcnReq[j].scanMode == eSIR_BEACON_TABLE)))
+                if (((tempInt <= 0) && (pEseBcnReq->bcnReq[j].scanMode != eSIR_BEACON_TABLE)) ||
+                    ((tempInt < 0) && (pEseBcnReq->bcnReq[j].scanMode == eSIR_BEACON_TABLE)))
                 {
                    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                             "Invalid Measurement Duration: %u", tempInt);
+                             "Invalid Measurement Duration(%d)", tempInt);
                    return -EINVAL;
                 }
                 pEseBcnReq->bcnReq[j].measurementDuration = tempInt;
@@ -6711,21 +4898,24 @@
 }
 
 
-/**
- * hdd_parse_reassoc_command_v1_data() - HDD Parse reassoc command data
- *    This function parses the reasoc command data passed in the format
- *    REASSOC<space><bssid><space><channel>
- *
- * @pValue: Pointer to input data (its a NUL terminated string)
- * @pTargetApBssid: Pointer to target Ap bssid
- * @pChannel: Pointer to the Target AP channel
- *
- * Return: 0 for success non-zero for failure
- */
-static int hdd_parse_reassoc_command_v1_data(const tANI_U8 *pValue,
-				tANI_U8 *pTargetApBssid, tANI_U8 *pChannel)
+/**---------------------------------------------------------------------------
+
+  \brief hdd_parse_reassoc_command_data() - HDD Parse reassoc command data
+
+  This function parses the reasoc command data passed in the format
+  REASSOC<space><bssid><space><channel>
+
+  \param  - pValue Pointer to input data (its a NUL terminated string)
+  \param  - pTargetApBssid Pointer to target Ap bssid
+  \param  - pChannel Pointer to the Target AP channel
+
+  \return - 0 for success non-zero for failure
+
+  --------------------------------------------------------------------------*/
+VOS_STATUS hdd_parse_reassoc_command_data(tANI_U8 *pValue,
+                            tANI_U8 *pTargetApBssid, tANI_U8 *pChannel)
 {
-    const tANI_U8 *inPtr = pValue;
+    tANI_U8 *inPtr = pValue;
     int tempInt;
     int v = 0;
     tANI_U8 tempBuf[32];
@@ -6999,7 +5189,6 @@
        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                  "%s: Enabling Tx Queues", __func__);
        /* Enable TX queues only when we are connected */
-       hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
        netif_tx_start_all_queues(dev);
    }
 
@@ -7028,7 +5217,7 @@
    return ret;
 }
 
-int __hdd_mon_open (struct net_device *dev)
+int hdd_mon_open (struct net_device *dev)
 {
    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
 
@@ -7038,25 +5227,10 @@
       return -EINVAL;
    }
 
+   netif_start_queue(dev);
+
    return 0;
 }
-
-int hdd_mon_open (struct net_device *dev)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __hdd_mon_open(dev);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-int hdd_mon_stop(struct net_device *dev)
-{
-  return 0;
-}
-
 /**---------------------------------------------------------------------------
 
   \brief __hdd_stop() - HDD stop function
@@ -7083,13 +5257,15 @@
          "%s: pAdapter is Null", __func__);
       return -ENODEV;
    }
-   MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_STOP_REQUEST,
+   MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_OPEN_REQUEST,
                     pAdapter->sessionId, pAdapter->device_mode));
 
    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
    ret = wlan_hdd_validate_context(pHddCtx);
    if (ret)
    {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                "%s: HDD context is not valid!", __func__);
       return ret;
    }
 
@@ -7108,7 +5284,6 @@
    /* Disable TX on the interface, after this hard_start_xmit() will not
     * be called on that interface
     */
-   hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
    netif_tx_disable(pAdapter->dev);
 
    /* Mark the interface status as "down" for outside world */
@@ -7128,7 +5303,7 @@
    mutex_lock(&pHddCtx->tdls_lock);
 #endif
    /* DeInit the adapter. This ensures datapath cleanup as well */
-   hdd_deinit_adapter(pHddCtx, pAdapter, TRUE);
+   hdd_deinit_adapter(pHddCtx, pAdapter);
 #ifdef FEATURE_WLAN_TDLS
    mutex_unlock(&pHddCtx->tdls_lock);
 #endif
@@ -7249,7 +5424,7 @@
 #ifdef FEATURE_WLAN_TDLS
       mutex_lock(&pHddCtx->tdls_lock);
 #endif
-      hdd_deinit_adapter(pHddCtx, pAdapter, TRUE);
+      hdd_deinit_adapter(pHddCtx, pAdapter);
 #ifdef FEATURE_WLAN_TDLS
       mutex_unlock(&pHddCtx->tdls_lock);
 #endif
@@ -7257,7 +5432,6 @@
       /* after uninit our adapter structure will no longer be valid */
       pAdapter->dev = NULL;
       pAdapter->magic = 0;
-      pAdapter->pHddCtx = NULL;
    } while (0);
 
    EXIT();
@@ -7413,193 +5587,6 @@
    }
 }
 
-#ifdef WLAN_FEATURE_RMC
-static void hdd_tx_fail_ind_callback(v_U8_t *MacAddr, v_U8_t seqNo)
-{
-   int payload_len;
-   struct sk_buff *skb;
-   struct nlmsghdr *nlh;
-   v_U8_t *data;
-
-   payload_len = ETH_ALEN;
-
-   if (0 == cesium_pid)
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR, "%s: cesium process not registered",
-             __func__);
-      return;
-   }
-
-   if ((skb = nlmsg_new(payload_len,GFP_ATOMIC)) == NULL)
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,
-             "%s: nlmsg_new() failed for msg size[%d]",
-             __func__, NLMSG_SPACE(payload_len));
-      return;
-   }
-
-   nlh = nlmsg_put(skb, cesium_pid, seqNo, 0, payload_len, NLM_F_REQUEST);
-
-   if (NULL == nlh)
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,
-             "%s: nlmsg_put() failed for msg size[%d]",
-             __func__, NLMSG_SPACE(payload_len));
-
-      kfree_skb(skb);
-      return;
-   }
-
-   data = nlmsg_data(nlh);
-   memcpy(data, MacAddr, ETH_ALEN);
-
-   if (nlmsg_unicast(cesium_nl_srv_sock, skb, cesium_pid) < 0)
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR, "%s: nlmsg_unicast() failed for msg size[%d]",
-                                       __func__, NLMSG_SPACE(payload_len));
-   }
-
-   return;
-}
-
-/**---------------------------------------------------------------------------
-     \brief hdd_ParseuserParams - return a pointer to the next argument
-
-     \return - status
-
---------------------------------------------------------------------------*/
-static int hdd_ParseUserParams(tANI_U8 *pValue, tANI_U8 **ppArg)
-{
-   tANI_U8 *pVal;
-
-   pVal = strchr(pValue, ' ');
-
-   if (NULL == pVal)
-   {
-      /* no argument remains */
-      return -EINVAL;
-   }
-   else if (SPACE_ASCII_VALUE != *pVal)
-   {
-      /* no space after the current argument */
-      return -EINVAL;
-   }
-
-   pVal++;
-
-   /* remove empty spaces */
-   while ((SPACE_ASCII_VALUE  == *pVal) && ('\0' !=  *pVal))
-   {
-      pVal++;
-   }
-
-   /* no argument followed by spaces */
-   if ('\0' == *pVal)
-   {
-      return -EINVAL;
-   }
-
-   *ppArg = pVal;
-
-   return 0;
-}
-
-/**----------------------------------------------------------------------------
-     \brief hdd_ParseIBSSTXFailEventParams - Parse params for SETIBSSTXFAILEVENT
-
-     \return - status
-
-------------------------------------------------------------------------------*/
-static int hdd_ParseIBSSTXFailEventParams(tANI_U8 *pValue,
-                                          tANI_U8 *tx_fail_count,
-                                          tANI_U16 *pid)
-{
-   tANI_U8 *param = NULL;
-   int ret;
-
-   ret = hdd_ParseUserParams(pValue, &param);
-
-   if (0 == ret && NULL != param)
-   {
-      if (1 != sscanf(param, "%hhu", tx_fail_count))
-      {
-         ret = -EINVAL;
-         goto done;
-      }
-   }
-   else
-   {
-      goto done;
-   }
-
-   if (0 == *tx_fail_count)
-   {
-      *pid = 0;
-      goto done;
-   }
-
-   pValue = param;
-   pValue++;
-
-   ret = hdd_ParseUserParams(pValue, &param);
-
-   if (0 == ret)
-   {
-      if (1 != sscanf(param, "%hu", pid))
-      {
-         ret = -EINVAL;
-         goto done;
-      }
-   }
-   else
-   {
-      goto done;
-   }
-
-done:
-   return ret;
-}
-
-static int hdd_open_cesium_nl_sock()
-{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
-   struct netlink_kernel_cfg cfg = {
-          .groups = WLAN_NLINK_MCAST_GRP_ID,
-          .input = NULL
-          };
-#endif
-   int ret = 0;
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
-   cesium_nl_srv_sock = netlink_kernel_create(&init_net, WLAN_NLINK_CESIUM,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
-                                              THIS_MODULE,
-#endif
-                                              &cfg);
-#else
-   cesium_nl_srv_sock = netlink_kernel_create(&init_net, WLAN_NLINK_CESIUM,
-                                        WLAN_NLINK_MCAST_GRP_ID, NULL, NULL, THIS_MODULE);
-#endif
-
-   if (cesium_nl_srv_sock == NULL)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "NLINK:  cesium netlink_kernel_create failed");
-       ret = -ECONNREFUSED;
-   }
-
-   return ret;
-}
-
-static void hdd_close_cesium_nl_sock()
-{
-   if (NULL != cesium_nl_srv_sock)
-   {
-      netlink_kernel_release(cesium_nl_srv_sock);
-      cesium_nl_srv_sock = NULL;
-   }
-}
-#endif /* WLAN_FEATURE_RMC */
 /**---------------------------------------------------------------------------
 
     \brief hdd_req_bmps_cbk() - HDD Request BMPS callback function
@@ -7731,26 +5718,11 @@
 
 static int __hdd_set_mac_address(struct net_device *dev, void *addr)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
    struct sockaddr *psta_mac_addr = addr;
    eHalStatus halStatus = eHAL_STATUS_SUCCESS;
-   int ret = 0;
 
    ENTER();
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
 
    memcpy(&pAdapter->macAddressCurrent, psta_mac_addr->sa_data, ETH_ALEN);
    memcpy(dev->dev_addr, psta_mac_addr->sa_data, ETH_ALEN);
@@ -7832,15 +5804,26 @@
  };
  static struct net_device_ops wlan_mon_drv_ops = {
       .ndo_open = hdd_mon_open,
-      .ndo_stop = hdd_mon_stop,
+      .ndo_stop = hdd_stop,
       .ndo_uninit = hdd_uninit,
       .ndo_start_xmit = hdd_mon_hard_start_xmit,  
       .ndo_tx_timeout = hdd_tx_timeout,
       .ndo_get_stats = hdd_stats,
-      .ndo_do_ioctl = hdd_mon_ioctl,
+      .ndo_do_ioctl = hdd_ioctl,
       .ndo_set_mac_address = hdd_set_mac_address,
  };
-
+ static struct net_device_ops nullify_netdev_ops = {
+      .ndo_open = NULL,
+      .ndo_stop = NULL,
+      .ndo_uninit = NULL,
+      .ndo_start_xmit = NULL,
+      .ndo_tx_timeout = NULL,
+      .ndo_get_stats = NULL,
+      .ndo_set_mac_address = NULL,
+      .ndo_do_ioctl = NULL,
+      .ndo_change_mtu = NULL,
+      .ndo_select_queue = NULL,
+ };
 #endif
 
 void hdd_set_station_ops( struct net_device *pWlanDev )
@@ -7859,15 +5842,6 @@
 #endif
 }
 
-void  hdd_set_ibss_ops( hdd_adapter_t *pAdapter )
-{
- #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
-     wlan_drv_ops.ndo_start_xmit = hdd_ibss_hard_start_xmit;
- #else
-     pAdapter->dev->hard_start_xmit = hdd_ibss_hard_start_xmit;
- #endif
-}
-
 static hdd_adapter_t* hdd_alloc_station_adapter( hdd_context_t *pHddCtx, tSirMacAddr macAddr, const char* name )
 {
    struct net_device *pWlanDev = NULL;
@@ -7875,11 +5849,8 @@
    /*
     * cfg80211 initialization and registration....
     */ 
-   pWlanDev = alloc_netdev_mq(sizeof( hdd_adapter_t ), name,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0))
-                              NET_NAME_UNKNOWN,
-#endif
-                              ether_setup, NUM_TX_QUEUES);
+   pWlanDev = alloc_netdev_mq(sizeof( hdd_adapter_t ), name, ether_setup, NUM_TX_QUEUES);
+   
    if(pWlanDev != NULL)
    {
 
@@ -7893,7 +5864,32 @@
       pAdapter->magic = WLAN_HDD_ADAPTER_MAGIC;
       spin_lock_init(&pAdapter->lock_for_active_session);
 
+      init_completion(&pAdapter->session_open_comp_var);
+      init_completion(&pAdapter->session_close_comp_var);
+      init_completion(&pAdapter->disconnect_comp_var);
+      init_completion(&pAdapter->linkup_event_var);
+      init_completion(&pAdapter->cancel_rem_on_chan_var);
+      init_completion(&pAdapter->rem_on_chan_ready_event);
+      init_completion(&pAdapter->pno_comp_var);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+      init_completion(&pAdapter->offchannel_tx_event);
+#endif
+      init_completion(&pAdapter->tx_action_cnf_event);
+#ifdef FEATURE_WLAN_TDLS
+      init_completion(&pAdapter->tdls_add_station_comp);
+      init_completion(&pAdapter->tdls_del_station_comp);
+      init_completion(&pAdapter->tdls_mgmt_comp);
+      init_completion(&pAdapter->tdls_link_establish_req_comp);
+#endif
+      init_completion(&pHddCtx->mc_sus_event_var);
+      init_completion(&pHddCtx->tx_sus_event_var);
+      init_completion(&pHddCtx->rx_sus_event_var);
+      init_completion(&pAdapter->ula_complete);
+      init_completion(&pAdapter->change_country_code);
+
 #ifdef FEATURE_WLAN_BATCH_SCAN
+      init_completion(&pAdapter->hdd_set_batch_scan_req_var);
+      init_completion(&pAdapter->hdd_get_batch_scan_req_var);
       pAdapter->pBatchScanRsp = NULL;
       pAdapter->numScanList = 0;
       pAdapter->batchScanState = eHDD_BATCH_SCAN_STATE_STOPPED;
@@ -8006,32 +6002,6 @@
 
    return eHAL_STATUS_SUCCESS;
 }
-/**
- * hdd_close_tx_queues() - close tx queues
- * @hdd_ctx: hdd global context
- *
- * Return: None
- */
-static void hdd_close_tx_queues(hdd_context_t *hdd_ctx)
-{
-   VOS_STATUS status;
-   hdd_adapter_t *adapter;
-   hdd_adapter_list_node_t *adapter_node = NULL, *next_adapter = NULL;
-   /* Not validating hdd_ctx as it's already done by the caller */
-   ENTER();
-   status = hdd_get_front_adapter(hdd_ctx, &adapter_node);
-   while (NULL != adapter_node && VOS_STATUS_SUCCESS == status) {
-      adapter = adapter_node->pAdapter;
-      if (adapter && adapter->dev) {
-          netif_tx_disable (adapter->dev);
-          netif_carrier_off(adapter->dev);
-      }
-      status = hdd_get_next_adapter(hdd_ctx, adapter_node,
-                                    &next_adapter);
-      adapter_node = next_adapter;
-   }
-   EXIT();
-}
 
 VOS_STATUS hdd_init_station_mode( hdd_adapter_t *pAdapter )
 {
@@ -8042,9 +6012,6 @@
    VOS_STATUS status = VOS_STATUS_E_FAILURE;
    long rc = 0;
 
-   spin_lock_init( &pAdapter->sta_hash_lock);
-   pAdapter->is_sta_id_hash_initialized = VOS_FALSE;
-
    INIT_COMPLETION(pAdapter->session_open_comp_var);
    sme_SetCurrDeviceMode(pHddCtx->hHal, pAdapter->device_mode);
    //Open a SME session for future operation
@@ -8080,13 +6047,12 @@
       status = VOS_STATUS_E_FAILURE;
       goto error_register_wext;
    }
-
    //Safe to register the hard_start_xmit function again
-   #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
-      wlan_drv_ops.ndo_start_xmit = hdd_hard_start_xmit;
-   #else
-      pWlanDev->hard_start_xmit = hdd_hard_start_xmit;
-   #endif
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+   wlan_drv_ops.ndo_start_xmit = hdd_hard_start_xmit;
+#else
+   pWlanDev->hard_start_xmit = hdd_hard_start_xmit;
+#endif
 
    //Set the Connection State to Not Connected
    hddLog(VOS_TRACE_LEVEL_INFO,
@@ -8132,7 +6098,7 @@
    {
       INIT_COMPLETION(pAdapter->session_close_comp_var);
       if (eHAL_STATUS_SUCCESS == sme_CloseSession(pHddCtx->hHal,
-                                    pAdapter->sessionId, FALSE, VOS_TRUE,
+                                    pAdapter->sessionId,
                                     hdd_smeCloseSessionCallback, pAdapter))
       {
          unsigned long rc;
@@ -8165,30 +6131,19 @@
                      msecs_to_jiffies(ACTION_FRAME_TX_TIMEOUT));
       if (rc <= 0)
       {
-          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s ERROR: HDD Wait for Action Confirmation Failed!! %ld"
-                  , __func__, rc);
-
-          // Inform tx status as FAILURE to upper layer and free cfgState->buf
-          hdd_sendActionCnf( pAdapter, FALSE );
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+              "%s ERROR: HDD Wait for Action Confirmation Failed!! %ld"
+               , __func__, rc);
       }
    }
    return;
 }
 
-void hdd_deinit_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter, tANI_U8 rtnl_held )
+void hdd_deinit_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter )
 {
    ENTER();
    switch ( pAdapter->device_mode )
    {
-      case WLAN_HDD_IBSS:
-      {
-         if(test_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags))
-         {
-            hdd_ibss_deinit_tx_rx( pAdapter );
-            clear_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags);
-         }
-      }
       case WLAN_HDD_INFRA_STATION:
       case WLAN_HDD_P2P_CLIENT:
       case WLAN_HDD_P2P_DEVICE:
@@ -8221,18 +6176,24 @@
 
          hdd_cleanup_actionframe(pHddCtx, pAdapter);
 
-         hdd_unregister_hostapd(pAdapter, rtnl_held);
+         hdd_unregister_hostapd(pAdapter);
          hdd_set_conparam( 0 );
+         wlan_hdd_set_monitor_tx_adapter( WLAN_HDD_GET_CTX(pAdapter), NULL );
          break;
       }
 
       case WLAN_HDD_MONITOR:
       {
+          hdd_adapter_t* pAdapterforTx = pAdapter->sessionCtx.monitor.pAdapterForTx;
          if(test_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags))
          {
             hdd_deinit_tx_rx( pAdapter );
             clear_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags);
          }
+         if(NULL != pAdapterforTx)
+         {
+            hdd_cleanup_actionframe(pHddCtx, pAdapterforTx);
+         }
          break;
       }
 
@@ -8348,9 +6309,7 @@
 
            /* switch to the DTIM specified in cfg.ini */
             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "Switch to DTIM %d Listen interval %d",
-                powerRequest.uDTIMPeriod,
-                powerRequest.uListenInterval);
+                      "Switch to DTIM %d", powerRequest.uListenInterval);
             sme_SetPowerParams( pHddCtx->hHal, &powerRequest, TRUE);
             break;
 
@@ -8523,38 +6482,6 @@
    return status;
 }
 
-void hdd_monPostMsgCb(tANI_U32 *magic, struct completion *cmpVar)
-{
-    if (magic == NULL || cmpVar == NULL) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("invalid arguments %p %p"), magic, cmpVar);
-        return;
-    }
-    if (*magic != MON_MODE_MSG_MAGIC) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("maic: %x"), *magic);
-        return;
-    }
-
-    complete(cmpVar);
-    return;
-}
-
-void hdd_init_mon_mode (hdd_adapter_t *pAdapter)
- {
-    hdd_mon_ctx_t *pMonCtx = NULL;
-    pMonCtx = WLAN_HDD_GET_MONITOR_CTX_PTR(pAdapter);
-
-    pMonCtx->state = 0;
-    pMonCtx->ChannelNo = 1;
-    pMonCtx->ChannelBW = 20;
-    pMonCtx->crcCheckEnabled = 1;
-    pMonCtx->typeSubtypeBitmap = 0xFFFF00000000;
-    pMonCtx->is80211to803ConReq = 1;
-    pMonCtx->numOfMacFilters = 0;
- }
-
-
 hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type,
                                  const char *iface_name, tSirMacAddr macAddr,
                                  tANI_U8 rtnl_held )
@@ -8617,7 +6544,6 @@
          mutex_unlock(&pHddCtx->tdls_lock);
 #endif
 
-         hdd_initialize_adapter_common(pAdapter);
          status = hdd_init_station_mode( pAdapter );
          if( VOS_STATUS_SUCCESS != status )
             goto err_free_netdev;
@@ -8628,7 +6554,7 @@
 #ifdef FEATURE_WLAN_TDLS
             mutex_lock(&pHddCtx->tdls_lock);
 #endif
-            hdd_deinit_adapter(pHddCtx, pAdapter, rtnl_held);
+            hdd_deinit_adapter(pHddCtx, pAdapter);
 #ifdef FEATURE_WLAN_TDLS
             mutex_unlock(&pHddCtx->tdls_lock);
 #endif
@@ -8636,27 +6562,17 @@
          }
 
          // Workqueue which gets scheduled in IPv4 notification callback.
-         vos_init_work(&pAdapter->ipv4NotifierWorkQueue, hdd_ipv4_notifier_work_queue);
+         INIT_WORK(&pAdapter->ipv4NotifierWorkQueue, hdd_ipv4_notifier_work_queue);
 
 #ifdef WLAN_NS_OFFLOAD
          // Workqueue which gets scheduled in IPv6 notification callback.
-         vos_init_work(&pAdapter->ipv6NotifierWorkQueue, hdd_ipv6_notifier_work_queue);
+         INIT_WORK(&pAdapter->ipv6NotifierWorkQueue, hdd_ipv6_notifier_work_queue);
 #endif
          //Stop the Interface TX queue.
-         hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
          netif_tx_disable(pAdapter->dev);
          //netif_tx_disable(pWlanDev);
          netif_carrier_off(pAdapter->dev);
 
-         if (WLAN_HDD_P2P_CLIENT == session_type ||
-                 WLAN_HDD_P2P_DEVICE == session_type)
-         {
-             /* Initialize the work queue to defer the
-              * back to back RoC request */
-             vos_init_delayed_work(&pAdapter->roc_work,
-                     hdd_p2p_roc_work_queue);
-         }
-
          break;
       }
 
@@ -8676,40 +6592,21 @@
                                   NL80211_IFTYPE_P2P_GO;
          pAdapter->device_mode = session_type;
 
-         hdd_initialize_adapter_common(pAdapter);
          status = hdd_init_ap_mode(pAdapter);
          if( VOS_STATUS_SUCCESS != status )
             goto err_free_netdev;
 
-         status = hdd_sta_id_hash_attach(pAdapter);
-         if (VOS_STATUS_SUCCESS != status)
-         {
-             hddLog(VOS_TRACE_LEVEL_FATAL,
-                    FL("failed to attach hash for session %d"), session_type);
-             hdd_deinit_adapter(pHddCtx, pAdapter, rtnl_held);
-             goto err_free_netdev;
-         }
-
          status = hdd_register_hostapd( pAdapter, rtnl_held );
          if( VOS_STATUS_SUCCESS != status )
          {
-            hdd_deinit_adapter(pHddCtx, pAdapter, rtnl_held);
+            hdd_deinit_adapter(pHddCtx, pAdapter);
             goto err_free_netdev;
          }
-         hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
+
          netif_tx_disable(pAdapter->dev);
          netif_carrier_off(pAdapter->dev);
 
          hdd_set_conparam( 1 );
-
-         if (WLAN_HDD_P2P_GO == session_type)
-         {
-             /* Initialize the work queue to
-              * defer the back to back RoC request */
-             INIT_DELAYED_WORK(&pAdapter->roc_work,
-                     hdd_p2p_roc_work_queue);
-         }
-
          break;
       }
       case WLAN_HDD_MONITOR:
@@ -8722,33 +6619,34 @@
             return NULL;
          }
 
-         // Register wireless extensions
-         if( VOS_STATUS_SUCCESS !=  (status = hdd_register_wext(pAdapter->dev)))
-         {
-              hddLog(VOS_TRACE_LEVEL_FATAL,
-                   "hdd_register_wext() failed with status code %08d [x%08x]",
-                                                      status, status );
-              status = VOS_STATUS_E_FAILURE;
-         }
-
          pAdapter->wdev.iftype = NL80211_IFTYPE_MONITOR; 
          pAdapter->device_mode = session_type;
+         status = hdd_register_interface( pAdapter, rtnl_held );
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)
          pAdapter->dev->netdev_ops = &wlan_mon_drv_ops;
 #else
          pAdapter->dev->open = hdd_mon_open;
          pAdapter->dev->hard_start_xmit = hdd_mon_hard_start_xmit;
-         pAdapter->dev->stop = hdd_mon_stop;
-         pAdapter->dev->do_ioctl = hdd_mon_ioctl;
 #endif
-         status = hdd_register_interface( pAdapter, rtnl_held );
-         hdd_init_mon_mode( pAdapter );
-         hdd_initialize_adapter_common(pAdapter);
          hdd_init_tx_rx( pAdapter );
          set_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags);
-         //Stop the Interface TX queue.
-         netif_tx_disable(pAdapter->dev);
-         netif_carrier_off(pAdapter->dev);
+         //Set adapter to be used for data tx. It will use either GO or softap.
+         pAdapter->sessionCtx.monitor.pAdapterForTx = 
+                           hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_SOFTAP);
+         if (NULL == pAdapter->sessionCtx.monitor.pAdapterForTx)
+         {
+            pAdapter->sessionCtx.monitor.pAdapterForTx = 
+                           hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_GO);
+         }
+         /* This workqueue will be used to transmit management packet over
+          * monitor interface. */
+         if (NULL == pAdapter->sessionCtx.monitor.pAdapterForTx) {
+             hddLog(VOS_TRACE_LEVEL_ERROR,"%s:Failed:hdd_get_adapter",__func__);
+             return NULL;
+         }
+
+         INIT_WORK(&pAdapter->sessionCtx.monitor.pAdapterForTx->monTxWorkQueue,
+                   hdd_mon_tx_work_queue);
       }
          break;
       case WLAN_HDD_FTM:
@@ -8768,11 +6666,9 @@
          pAdapter->device_mode = session_type;
          status = hdd_register_interface( pAdapter, rtnl_held );
 
-         hdd_initialize_adapter_common(pAdapter);
          hdd_init_tx_rx( pAdapter );
 
          //Stop the Interface TX queue.
-         hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
          netif_tx_disable(pAdapter->dev);
          netif_carrier_off(pAdapter->dev);
       }
@@ -8788,7 +6684,7 @@
 
    if( VOS_STATUS_SUCCESS == status )
    {
-      //Add it to the hdd's session list.
+      //Add it to the hdd's session list. 
       pHddAdapterNode = vos_mem_malloc( sizeof( hdd_adapter_list_node_t ) );
       if( NULL == pHddAdapterNode )
       {
@@ -8971,7 +6867,6 @@
    union iwreq_data wrqu;
    v_U8_t retry = 0;
    long ret;
-   VOS_STATUS status;
 
    if (pHddCtx->isLogpInProgress) {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
@@ -8984,25 +6879,11 @@
    pScanInfo =  &pHddCtx->scan_info;
    switch(pAdapter->device_mode)
    {
-      case WLAN_HDD_IBSS:
-          if ( VOS_TRUE == bCloseSession )
-          {
-              status = hdd_sta_id_hash_detach(pAdapter);
-              if (status != VOS_STATUS_SUCCESS)
-              hddLog(VOS_TRACE_LEVEL_ERROR,
-                  FL("sta id hash detach failed"));
-          }
-
       case WLAN_HDD_INFRA_STATION:
       case WLAN_HDD_P2P_CLIENT:
       case WLAN_HDD_P2P_DEVICE:
       {
          hdd_station_ctx_t *pstation = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-#ifdef FEATURE_WLAN_TDLS
-         mutex_lock(&pHddCtx->tdls_lock);
-         wlan_hdd_tdls_exit(pAdapter, TRUE);
-         mutex_unlock(&pHddCtx->tdls_lock);
-#endif
          if( hdd_connIsConnected(pstation) ||
              (pstation->conn_info.connState == eConnectionState_Connecting) )
          {
@@ -9014,17 +6895,13 @@
                 halStatus = sme_RoamDisconnect(pHddCtx->hHal,
                                             pAdapter->sessionId, 
                                             eCSR_DISCONNECT_REASON_UNSPECIFIED);
-            /* Success implies disconnect command got queued up successfully
-             * Or cmd not queued as scan for SSID is in progress
-             */
-            if((eHAL_STATUS_SUCCESS == halStatus) ||
-               (eHAL_STATUS_CMD_NOT_QUEUED == halStatus))
+            //success implies disconnect command got queued up successfully
+            if(halStatus == eHAL_STATUS_SUCCESS)
             {
                ret = wait_for_completion_interruptible_timeout(
                           &pAdapter->disconnect_comp_var,
                            msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
-               if (ret <= 0 &&
-                   (eHAL_STATUS_CMD_NOT_QUEUED != halStatus))
+               if (ret <= 0)
                {
                    hddLog(VOS_TRACE_LEVEL_ERROR,
                           "%s: wait on disconnect_comp_var failed %ld",
@@ -9053,12 +6930,12 @@
                  FL("wait on disconnect_comp_var failed %ld"), ret);
              }
          }
-         if(pScanInfo != NULL && pHddCtx->scan_info.mScanPending)
+         else if(pScanInfo != NULL && pHddCtx->scan_info.mScanPending)
          {
-            wlan_hdd_scan_abort(pAdapter);
+            hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId,
+                               eCSR_SCAN_ABORT_DEFAULT);
          }
-       if ((pAdapter->device_mode != WLAN_HDD_INFRA_STATION) &&
-                   (pAdapter->device_mode != WLAN_HDD_IBSS))
+       if (pAdapter->device_mode != WLAN_HDD_INFRA_STATION)
        {
           while (pAdapter->is_roc_inprogress)
           {
@@ -9073,26 +6950,24 @@
                {
                   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                             "%s: ROC completion is not received.!!!", __func__);
-                  if (eHAL_STATUS_SUCCESS !=
-                      sme_CancelRemainOnChannel( WLAN_HDD_GET_HAL_CTX( pAdapter),
-                                                     pAdapter->sessionId ))
-                  {
-                      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                              FL("Failed to Cancel Remain on Channel"));
-                  }
+                  sme_CancelRemainOnChannel(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                            pAdapter->sessionId);
                   wait_for_completion_interruptible_timeout(
                                        &pAdapter->cancel_rem_on_chan_var,
                                        msecs_to_jiffies(WAIT_CANCEL_REM_CHAN));
                   break;
                }
             }
-          vos_flush_delayed_work(&pAdapter->roc_work);
        }
 #ifdef WLAN_NS_OFFLOAD
-         vos_flush_work(&pAdapter->ipv6NotifierWorkQueue);
+#ifdef WLAN_OPEN_SOURCE
+         cancel_work_sync(&pAdapter->ipv6NotifierWorkQueue);
+#endif
 #endif
 
-         vos_flush_work(&pAdapter->ipv4NotifierWorkQueue);
+#ifdef WLAN_OPEN_SOURCE
+         cancel_work_sync(&pAdapter->ipv4NotifierWorkQueue);
+#endif
 
          /* It is possible that the caller of this function does not
           * wish to close the session
@@ -9102,8 +6977,8 @@
          {
             INIT_COMPLETION(pAdapter->session_close_comp_var);
             if (eHAL_STATUS_SUCCESS ==
-                    sme_CloseSession(pHddCtx->hHal, pAdapter->sessionId, FALSE,
-                      VOS_FALSE, hdd_smeCloseSessionCallback, pAdapter))
+                  sme_CloseSession(pHddCtx->hHal, pAdapter->sessionId,
+                     hdd_smeCloseSessionCallback, pAdapter))
             {
                unsigned long ret;
 
@@ -9123,14 +6998,6 @@
 
       case WLAN_HDD_SOFTAP:
       case WLAN_HDD_P2P_GO:
-          if ( VOS_TRUE == bCloseSession )
-          {
-              status = hdd_sta_id_hash_detach(pAdapter);
-              if (status != VOS_STATUS_SUCCESS)
-              hddLog(VOS_TRACE_LEVEL_ERROR,
-                  FL("sta id hash detach failed"));
-          }
-
          //Any softap specific cleanup here...
          if (pAdapter->device_mode == WLAN_HDD_P2P_GO) {
             while (pAdapter->is_roc_inprogress) {
@@ -9149,8 +7016,6 @@
                   break;
                }
             }
-
-            vos_flush_delayed_work(&pAdapter->roc_work);
          }
          mutex_lock(&pHddCtx->sap_lock);
          if (test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) 
@@ -9206,6 +7071,9 @@
          break;
 
       case WLAN_HDD_MONITOR:
+#ifdef WLAN_OPEN_SOURCE
+         cancel_work_sync(&pAdapter->sessionCtx.monitor.pAdapterForTx->monTxWorkQueue);
+#endif
          break;
 
       default:
@@ -9296,7 +7164,6 @@
    while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
    {
       pAdapter = pAdapterNode->pAdapter;
-      hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
       netif_tx_disable(pAdapter->dev);
       netif_carrier_off(pAdapter->dev);
 
@@ -9304,15 +7171,6 @@
 
       hdd_deinit_tx_rx(pAdapter);
 
-      if(pAdapter->device_mode == WLAN_HDD_IBSS )
-         hdd_ibss_deinit_tx_rx(pAdapter);
-
-      status = hdd_sta_id_hash_detach(pAdapter);
-      if (status != VOS_STATUS_SUCCESS)
-          hddLog(VOS_TRACE_LEVEL_ERROR,
-                 FL("sta id hash detach failed for session id %d"),
-                 pAdapter->sessionId);
-
       wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode);
 
       if (test_bit(WMM_INIT_DONE, &pAdapter->event_flags))
@@ -9321,11 +7179,6 @@
           clear_bit(WMM_INIT_DONE, &pAdapter->event_flags);
       }
 
-      if (test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags))
-      {
-          clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags);
-      }
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
       if (eHDD_BATCH_SCAN_STATE_STARTED == pAdapter->batchScanState)
       {
@@ -9333,11 +7186,6 @@
       }
 #endif
 
-#ifdef FEATURE_WLAN_TDLS
-      mutex_lock(&pHddCtx->tdls_lock);
-      wlan_hdd_tdls_exit(pAdapter, TRUE);
-      mutex_unlock(&pHddCtx->tdls_lock);
-#endif
       status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
       pAdapterNode = pNext;
    }
@@ -9379,8 +7227,7 @@
             pHddCtx->scan_info.waitScanResult = FALSE;
 
             //Trigger the initial scan
-            if (!pHddCtx->isLogpInProgress)
-                hdd_wlan_initial_scan(pAdapter);
+            hdd_wlan_initial_scan(pAdapter);
 
             //Indicate disconnect event to supplicant if associated previously
             if (eConnectionState_Associated == connState ||
@@ -9394,8 +7241,8 @@
                pAdapter->sessionCtx.station.hdd_ReassocScenario = VOS_FALSE;
 
                /* indicate disconnected event to nl80211 */
-               wlan_hdd_cfg80211_indicate_disconnect(pAdapter->dev, false,
-                                                     WLAN_REASON_UNSPECIFIED);
+               cfg80211_disconnected(pAdapter->dev, WLAN_REASON_UNSPECIFIED,
+                                     NULL, 0, GFP_KERNEL); 
             }
             else if (eConnectionState_Connecting == connState)
             {
@@ -9461,13 +7308,7 @@
          hddLog(VOS_TRACE_LEVEL_INFO,
             "%s: Set HDD connState to eConnectionState_NotConnected",
                    __func__);
-         spin_lock_bh(&pAdapter->lock_for_active_session);
-         if (eConnectionState_Associated ==  pHddStaCtx->conn_info.connState)
-         {
-             wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode);
-         }
          pHddStaCtx->conn_info.connState = eConnectionState_NotConnected;
-         spin_unlock_bh(&pAdapter->lock_for_active_session);
          init_completion(&pAdapter->disconnect_comp_var);
          sme_RoamDisconnect(pHddCtx->hHal, pAdapter->sessionId,
                              eCSR_DISCONNECT_REASON_UNSPECIFIED);
@@ -9507,6 +7348,7 @@
    v_U8_t staChannel = 0, p2pChannel = 0, apChannel = 0;
    const char *p2pMode = "DEV";
    const char *ccMode = "Standalone";
+   int n;
 
    status =  hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
    while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
@@ -9554,14 +7396,14 @@
    if (staChannel > 0 && (apChannel > 0 || p2pChannel > 0)) {
        ccMode = (p2pChannel==staChannel||apChannel==staChannel) ? "SCC" : "MCC";
    }
-   hddLog(VOS_TRACE_LEVEL_ERROR, "wlan(%d) " MAC_ADDRESS_STR " %s",
+   n = pr_info("wlan(%d) " MAC_ADDRESS_STR " %s",
                 staChannel, MAC_ADDR_ARRAY(staBssid), ccMode);
    if (p2pChannel > 0) {
-       hddLog(VOS_TRACE_LEVEL_ERROR, "p2p-%s(%d) " MAC_ADDRESS_STR,
+       n +=  pr_info("p2p-%s(%d) " MAC_ADDRESS_STR,
                      p2pMode, p2pChannel, MAC_ADDR_ARRAY(p2pBssid));
    }
    if (apChannel > 0) {
-       hddLog(VOS_TRACE_LEVEL_ERROR, "AP(%d) " MAC_ADDRESS_STR,
+       n += pr_info("AP(%d) " MAC_ADDRESS_STR,
                      apChannel, MAC_ADDR_ARRAY(apBssid));
    }
 
@@ -9584,19 +7426,14 @@
     isSsrRequired = value;
 }
 
-void hdd_set_pre_close( hdd_context_t *pHddCtx)
-{
-   sme_PreClose(pHddCtx->hHal);
-}
-
 VOS_STATUS hdd_get_front_adapter( hdd_context_t *pHddCtx,
                                   hdd_adapter_list_node_t** ppAdapterNode)
 {
     VOS_STATUS status;
-    spin_lock_bh(&pHddCtx->hddAdapters.lock);
+    spin_lock(&pHddCtx->hddAdapters.lock);
     status =  hdd_list_peek_front ( &pHddCtx->hddAdapters,
                    (hdd_list_node_t**) ppAdapterNode );
-    spin_unlock_bh(&pHddCtx->hddAdapters.lock);
+    spin_unlock(&pHddCtx->hddAdapters.lock);
     return status;
 }
 
@@ -9605,12 +7442,12 @@
                                  hdd_adapter_list_node_t** pNextAdapterNode)
 {
     VOS_STATUS status;
-    spin_lock_bh(&pHddCtx->hddAdapters.lock);
+    spin_lock(&pHddCtx->hddAdapters.lock);
     status = hdd_list_peek_next ( &pHddCtx->hddAdapters,
                                   (hdd_list_node_t*) pAdapterNode,
                                   (hdd_list_node_t**)pNextAdapterNode );
 
-    spin_unlock_bh(&pHddCtx->hddAdapters.lock);
+    spin_unlock(&pHddCtx->hddAdapters.lock);
     return status;
 }
 
@@ -9618,10 +7455,10 @@
                                hdd_adapter_list_node_t* pAdapterNode)
 {
     VOS_STATUS status;
-    spin_lock_bh(&pHddCtx->hddAdapters.lock);
+    spin_lock(&pHddCtx->hddAdapters.lock);
     status =  hdd_list_remove_node ( &pHddCtx->hddAdapters,
                                      &pAdapterNode->node );
-    spin_unlock_bh(&pHddCtx->hddAdapters.lock);
+    spin_unlock(&pHddCtx->hddAdapters.lock);
     return status;
 }
 
@@ -9629,10 +7466,10 @@
                                      hdd_adapter_list_node_t** ppAdapterNode)
 {
     VOS_STATUS status;
-    spin_lock_bh(&pHddCtx->hddAdapters.lock);
+    spin_lock(&pHddCtx->hddAdapters.lock);
     status =  hdd_list_remove_front( &pHddCtx->hddAdapters,
                    (hdd_list_node_t**) ppAdapterNode );
-    spin_unlock_bh(&pHddCtx->hddAdapters.lock);
+    spin_unlock(&pHddCtx->hddAdapters.lock);
     return status;
 }
 
@@ -9640,10 +7477,10 @@
                                  hdd_adapter_list_node_t* pAdapterNode)
 {
     VOS_STATUS status;
-    spin_lock_bh(&pHddCtx->hddAdapters.lock);
+    spin_lock(&pHddCtx->hddAdapters.lock);
     status =  hdd_list_insert_back ( &pHddCtx->hddAdapters,
                    (hdd_list_node_t*) pAdapterNode );
-    spin_unlock_bh(&pHddCtx->hddAdapters.lock);
+    spin_unlock(&pHddCtx->hddAdapters.lock);
     return status;
 }
 
@@ -9651,10 +7488,10 @@
                                   hdd_adapter_list_node_t* pAdapterNode)
 {
     VOS_STATUS status;
-    spin_lock_bh(&pHddCtx->hddAdapters.lock);
+    spin_lock(&pHddCtx->hddAdapters.lock);
     status =  hdd_list_insert_front ( &pHddCtx->hddAdapters,
                    (hdd_list_node_t*) pAdapterNode );
-    spin_unlock_bh(&pHddCtx->hddAdapters.lock);
+    spin_unlock(&pHddCtx->hddAdapters.lock);
     return status;
 }
 
@@ -9709,34 +7546,6 @@
 
 } 
 
-hdd_adapter_t *hdd_get_adapter_by_sme_session_id( hdd_context_t *pHddCtx,
-                                        tANI_U32 sme_session_id )
-{
-    hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
-    hdd_adapter_t *pAdapter;
-    VOS_STATUS vos_status;
-
-
-    vos_status = hdd_get_front_adapter( pHddCtx, &pAdapterNode);
-
-    while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == vos_status))
-    {
-        pAdapter = pAdapterNode->pAdapter;
-
-        if (pAdapter->sessionId == sme_session_id)
-            return pAdapter;
-
-        vos_status = hdd_get_next_adapter(pHddCtx, pAdapterNode, &pNext);
-        pAdapterNode = pNext;
-    }
-
-    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-            "%s: sme_session_id %d does not exist with host",
-            __func__, sme_session_id);
-
-    return NULL;
-}
-
 hdd_adapter_t * hdd_get_adapter( hdd_context_t *pHddCtx, device_mode_t mode )
 {
    hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
@@ -9789,6 +7598,28 @@
 
 /**---------------------------------------------------------------------------
   
+  \brief hdd_set_monitor_tx_adapter() - 
+
+   This API initializes the adapter to be used while transmitting on monitor
+   adapter. 
+   
+  \param  - pHddCtx - Pointer to the HDD context.
+            pAdapter - Adapter that will used for TX. This can be NULL.
+  \return - None. 
+  --------------------------------------------------------------------------*/
+void wlan_hdd_set_monitor_tx_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter )
+{
+   hdd_adapter_t *pMonAdapter;
+
+   pMonAdapter = hdd_get_adapter( pHddCtx, WLAN_HDD_MONITOR );
+
+   if( NULL != pMonAdapter )
+   {
+      pMonAdapter->sessionCtx.monitor.pAdapterForTx = pAdapter;
+   }
+}
+/**---------------------------------------------------------------------------
+  
   \brief hdd_get_operating_channel() -
 
    This API returns the operating channel of the requested device mode 
@@ -9843,45 +7674,36 @@
 #ifdef WLAN_FEATURE_PACKET_FILTERING
 /**---------------------------------------------------------------------------
 
-  \brief __hdd_set_multicast_list() -
+  \brief hdd_set_multicast_list() - 
 
   This used to set the multicast address list.
 
   \param  - dev - Pointer to the WLAN device.
   - skb - Pointer to OS packet (sk_buff).
-  \return - success/fail
+  \return - success/fail 
 
   --------------------------------------------------------------------------*/
-static void __hdd_set_multicast_list(struct net_device *dev)
+static void hdd_set_multicast_list(struct net_device *dev)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
    int mc_count;
-   int i = 0, ret = 0;
+   int i = 0;
    struct netdev_hw_addr *ha;
 
-   ENTER();
-
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
    if (NULL == pAdapter)
    {
       hddLog(VOS_TRACE_LEVEL_ERROR,
             "%s: Adapter context is Null", __func__);
       return;
    }
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return;
-   }
+
    if (dev->flags & IFF_ALLMULTI)
    {
       hddLog(VOS_TRACE_LEVEL_INFO,
             "%s: allow all multicast frames", __func__);
       pAdapter->mc_addr_list.mc_cnt = 0;
    }
-   else
+   else 
    {
       mc_count = netdev_mc_count(dev);
       hddLog(VOS_TRACE_LEVEL_INFO,
@@ -9902,30 +7724,13 @@
          memset(&(pAdapter->mc_addr_list.addr[i][0]), 0, ETH_ALEN);
          memcpy(&(pAdapter->mc_addr_list.addr[i][0]), ha->addr, ETH_ALEN);
          hddLog(VOS_TRACE_LEVEL_INFO, "%s: mlist[%d] = "MAC_ADDRESS_STR,
-               __func__, i,
+               __func__, i, 
                MAC_ADDR_ARRAY(pAdapter->mc_addr_list.addr[i]));
          i++;
       }
    }
-
-   if (pHddCtx->hdd_wlan_suspended)
-   {
-       /*
-        * Configure the Mcast address list to FW
-        * If wlan is already in suspend mode
-        */
-       wlan_hdd_set_mc_addr_list(pAdapter, TRUE);
-   }
-   EXIT();
    return;
 }
-
-static void hdd_set_multicast_list(struct net_device *dev)
-{
-   vos_ssr_protect(__func__);
-   __hdd_set_multicast_list(dev);
-   vos_ssr_unprotect(__func__);
-}
 #endif
 
 /**---------------------------------------------------------------------------
@@ -9941,14 +7746,7 @@
   
   --------------------------------------------------------------------------*/
 v_U16_t hdd_select_queue(struct net_device *dev,
-    struct sk_buff *skb
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0))
-    , void *accel_priv
-#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-    , select_queue_fallback_t fallback
-#endif
-)
+    struct sk_buff *skb)
 {
    return hdd_wmm_select_queue(dev, skb);
 }
@@ -10075,145 +7873,6 @@
    spin_unlock(&hdd_context_lock);
 }
 
-void wlan_hdd_mon_set_typesubtype( hdd_mon_ctx_t *pMonCtx,int type)
-{
-   pMonCtx->typeSubtypeBitmap = 0;
-   if( type%10 ) /* Management Packets */
-     pMonCtx->typeSubtypeBitmap |= 0xFFFF;
-   type/=10;
-   if( type%10 ) /* Control Packets */
-     pMonCtx->typeSubtypeBitmap |= 0xFFFF0000;
-   type/=10;
-   if( type%10 ) /* Data Packets */
-     pMonCtx->typeSubtypeBitmap |= 0xFFFF00000000;
-}
-
-VOS_STATUS wlan_hdd_mon_postMsg(tANI_U32 *magic, struct completion *cmpVar,
-                                hdd_mon_ctx_t *pMonCtx , void* callback)
-{
-    vos_msg_t    monMsg;
-    tSirMonModeReq *pMonModeReq;
-
-    if (MON_MODE_START == pMonCtx->state)
-        monMsg.type = WDA_MON_START_REQ;
-    else if (MON_MODE_STOP == pMonCtx->state)
-        monMsg.type = WDA_MON_STOP_REQ;
-    else {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-                FL("invalid monitor state %d"), pMonCtx->state);
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    pMonModeReq = vos_mem_malloc(sizeof(tSirMonModeReq));
-    if (pMonModeReq == NULL) {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-                FL("fail to allocate memory for monitor mode req"));
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    pMonModeReq->magic = magic;
-    pMonModeReq->cmpVar = cmpVar;
-    pMonModeReq->data = pMonCtx;
-    pMonModeReq->callback = callback;
-
-    monMsg.reserved = 0;
-    monMsg.bodyptr = pMonModeReq;
-    monMsg.bodyval = 0;
-
-    if (VOS_STATUS_SUCCESS != vos_mq_post_message(
-        VOS_MODULE_ID_WDA,(vos_msg_t *)&monMsg)) {
-        hddLog(VOS_TRACE_LEVEL_ERROR,"%s: : Failed to post Msg to HAL",__func__);
-        vos_mem_free(pMonModeReq);
-    }
-    return VOS_STATUS_SUCCESS;
-}
-
-void wlan_hdd_mon_close(hdd_context_t *pHddCtx)
-{
-    VOS_STATUS vosStatus;
-    v_CONTEXT_t pVosContext = pHddCtx->pvosContext;
-    long ret;
-    hdd_mon_ctx_t *pMonCtx = NULL;
-    v_U32_t magic;
-    struct completion cmpVar;
-
-    hdd_adapter_t *pAdapter = hdd_get_adapter(pHddCtx,WLAN_HDD_MONITOR);
-    if(pAdapter == NULL || pVosContext == NULL)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:pAdapter is NULL",__func__);
-        return ;
-    }
-
-    pMonCtx =  WLAN_HDD_GET_MONITOR_CTX_PTR(pAdapter);
-    if (pMonCtx!= NULL && pMonCtx->state == MON_MODE_START) {
-        pMonCtx->state = MON_MODE_STOP;
-        magic = MON_MODE_MSG_MAGIC;
-        init_completion(&cmpVar);
-        if (VOS_STATUS_SUCCESS !=
-                      wlan_hdd_mon_postMsg(&magic, &cmpVar,
-                                            pMonCtx, hdd_monPostMsgCb)) {
-             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                       FL("failed to post MON MODE REQ"));
-             pMonCtx->state = MON_MODE_START;
-             magic = 0;
-             return;
-        }
-        ret = wait_for_completion_timeout(&cmpVar, MON_MODE_MSG_TIMEOUT);
-        magic = 0;
-        if (ret <= 0 ) {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    FL("timeout on monitor mode completion %ld"), ret);
-        }
-    }
-
-   hdd_UnregisterWext(pAdapter->dev);
-
-   vos_mon_stop( pVosContext );
-
-   vosStatus = vos_sched_close( pVosContext );
-   if (!VOS_IS_STATUS_SUCCESS(vosStatus))    {
-      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-         "%s: Failed to close VOSS Scheduler",__func__);
-      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
-   }
-
-   vosStatus = vos_nv_close();
-   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-   {
-      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-          "%s: Failed to close NV", __func__);
-      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
-   }
-
-   vos_close(pVosContext);
-
-   #ifdef WLAN_KD_READY_NOTIFIER
-       nl_srv_exit(pHddCtx->ptt_pid);
-   #else
-       nl_srv_exit();
-   #endif
-
-   hdd_close_all_adapters( pHddCtx );
-}
-/**
- * hdd_wlan_free_wiphy_channels - free Channel pointer for wiphy
- * @ wiphy: the wiphy to validate against
- *
- * Return: void
- */
-void hdd_wlan_free_wiphy_channels(struct wiphy *wiphy)
-{
-    int i =0;
-    for (i = 0; i < IEEE80211_NUM_BANDS; i++)
-    {
-        if (NULL != wiphy->bands[i] &&
-                (NULL != wiphy->bands[i]->channels))
-        {
-            vos_mem_free(wiphy->bands[i]->channels);
-            wiphy->bands[i]->channels = NULL;
-        }
-    }
-}
 /**---------------------------------------------------------------------------
 
   \brief hdd_wlan_exit() - HDD WLAN exit function
@@ -10238,61 +7897,34 @@
 
    ENTER();
 
+#ifdef WLAN_NS_OFFLOAD
+   hddLog(LOGE, FL("Unregister IPv6 notifier"));
+   unregister_inet6addr_notifier(&pHddCtx->ipv6_notifier);
+#endif
+   hddLog(LOGE, FL("Unregister IPv4 notifier"));
+   unregister_inetaddr_notifier(&pHddCtx->ipv4_notifier);
 
-   if (VOS_MONITOR_MODE == hdd_get_conparam())
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,"%s: MONITOR MODE",__func__);
-      wlan_hdd_mon_close(pHddCtx);
-      goto free_hdd_ctx;
-   }
-   else if (VOS_FTM_MODE != hdd_get_conparam())
+   if (VOS_FTM_MODE != hdd_get_conparam())
    {
       // Unloading, restart logic is no more required.
       wlan_hdd_restart_deinit(pHddCtx);
 
-#ifdef FEATURE_WLAN_TDLS
-      /* At the time of driver unloading; if tdls connection is present;
-       * hdd_rx_packet_cbk calls wlan_hdd_tdls_find_peer.
-       * wlan_hdd_tdls_find_peer always checks for valid context;
-       * as load/unload in progress there can be a race condition.
-       * hdd_rx_packet_cbk calls wlan_hdd_tdls_find_peer only
-       * when tdls state is enabled.
-       * As soon as driver set load/unload flag; tdls flag also needs
-       * to be disabled so that hdd_rx_packet_cbk won't call
-       * wlan_hdd_tdls_find_peer.
-       */
-      wlan_hdd_tdls_set_mode(pHddCtx, eTDLS_SUPPORT_DISABLED, FALSE,
-                             HDD_SET_TDLS_MODE_SOURCE_USER);
-#endif
-
       vosStatus = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
       while (NULL != pAdapterNode && VOS_STATUS_E_EMPTY != vosStatus)
       {
          pAdapter = pAdapterNode->pAdapter;
          if (NULL != pAdapter)
          {
-            /* Disable TX on the interface, after this hard_start_xmit() will
-             * not be called on that interface
-             */
-            hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
-            netif_tx_disable(pAdapter->dev);
-
-            /* Mark the interface status as "down" for outside world */
-            netif_carrier_off(pAdapter->dev);
-
             /* DeInit the adapter. This ensures that all data packets
              * are freed.
              */
 #ifdef FEATURE_WLAN_TDLS
             mutex_lock(&pHddCtx->tdls_lock);
 #endif
-            hdd_deinit_adapter(pHddCtx, pAdapter, FALSE);
+            hdd_deinit_adapter(pHddCtx, pAdapter);
 #ifdef FEATURE_WLAN_TDLS
             mutex_unlock(&pHddCtx->tdls_lock);
 #endif
-            vos_flush_delayed_work(&pHddCtx->scan_ctxt.scan_work);
-
-            wlan_hdd_init_deinit_defer_scan_context(&pHddCtx->scan_ctxt);
 
             if (WLAN_HDD_INFRA_STATION ==  pAdapter->device_mode ||
                 WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)
@@ -10305,7 +7937,6 @@
          vosStatus = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
          pAdapterNode = pNext;
       }
-
       // Cancel any outstanding scan requests.  We are about to close all
       // of our adapters, but an adapter structure is what SME passes back
       // to our callback function. Hence if there are any outstanding scan
@@ -10321,34 +7952,18 @@
       // Power has completed all scans will be cancelled.
       if (pHddCtx->scan_info.mScanPending)
       {
-          if(NULL != pAdapter)
-          {
-             hddLog(VOS_TRACE_LEVEL_INFO,
-                    FL("abort scan mode: %d sessionId: %d"),
-                       pAdapter->device_mode,
-                       pAdapter->sessionId);
-          }
-          hdd_abort_mac_scan(pHddCtx,
-                             pHddCtx->scan_info.sessionId,
-                             eCSR_SCAN_ABORT_DEFAULT);
+          hddLog(VOS_TRACE_LEVEL_INFO,
+                 FL("abort scan mode: %d sessionId: %d"),
+                     pAdapter->device_mode,
+                     pAdapter->sessionId);
+           hdd_abort_mac_scan(pHddCtx,
+                              pHddCtx->scan_info.sessionId,
+                              eCSR_SCAN_ABORT_DEFAULT);
       }
    }
    else
    {
       hddLog(VOS_TRACE_LEVEL_INFO,"%s: FTM MODE",__func__);
-      if (pHddCtx->ftm.ftm_state == WLAN_FTM_STARTING)
-      {
-         INIT_COMPLETION(pHddCtx->ftm.startCmpVar);
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-              "%s: in middle of FTM START", __func__);
-         lrc = wait_for_completion_timeout(&pHddCtx->ftm.startCmpVar,
-                                          msecs_to_jiffies(20000));
-         if(!lrc)
-         {
-              VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
-              "%s: timedout on ftmStartCmpVar fatal error", __func__);
-         }
-      }
       wlan_hdd_ftm_close(pHddCtx);
       goto free_hdd_ctx;
    }
@@ -10368,39 +7983,20 @@
    }
 
    //Stop the traffic monitor timer
-   if ((pHddCtx->cfg_ini->dynSplitscan) && (VOS_TIMER_STATE_RUNNING ==
-        vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)))
+   if ( VOS_TIMER_STATE_RUNNING ==
+                        vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr))
    {
         vos_timer_stop(&pHddCtx->tx_rx_trafficTmr);
    }
 
    // Destroy the traffic monitor timer
-   if ((pHddCtx->cfg_ini->dynSplitscan) &&
-       (!VOS_IS_STATUS_SUCCESS(vos_timer_destroy(
-                         &pHddCtx->tx_rx_trafficTmr))))
+   if (!VOS_IS_STATUS_SUCCESS(vos_timer_destroy(
+                         &pHddCtx->tx_rx_trafficTmr)))
    {
        hddLog(VOS_TRACE_LEVEL_ERROR,
            "%s: Cannot deallocate Traffic monitor timer", __func__);
    }
 
-   if (VOS_TIMER_STATE_RUNNING ==
-                      vos_timer_getCurrentState(&pHddCtx->delack_timer)) {
-       vos_timer_stop(&pHddCtx->delack_timer);
-   }
-
-   if (!VOS_IS_STATUS_SUCCESS(vos_timer_destroy(
-                                   &pHddCtx->delack_timer))) {
-       hddLog(VOS_TRACE_LEVEL_ERROR,
-            "%s: Cannot deallocate Bus bandwidth timer", __func__);
-   }
-
-   if (VOS_TIMER_STATE_RUNNING ==
-                 vos_timer_getCurrentState(&pHddCtx->tdls_source_timer)) {
-       vos_timer_stop(&pHddCtx->tdls_source_timer);
-   }
-
-   vos_timer_destroy(&pHddCtx->tdls_source_timer);
-
    //Disable IMPS/BMPS as we do not want the device to enter any power
    //save mode during shutdown
    sme_DisablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE);
@@ -10436,13 +8032,6 @@
          /* continue -- need to clean up as much as possible */
       }
    }
-   if ((eHAL_STATUS_SUCCESS == halStatus) ||
-       (eHAL_STATUS_PMC_PENDING == halStatus && lrc > 0))
-   {
-       /* This will issue a dump command which will clean up
-          BTQM queues and unblock MC thread */
-       vos_fwDumpReq(274, 0, 0, 0, 0, 1);
-   }
 
    /* either we never sent a request, we sent a request and received a
       response or we sent a request and timed out.  if we never sent a
@@ -10459,21 +8048,8 @@
    powerContext.magic = 0;
    spin_unlock(&hdd_context_lock);
 
-   /* If Device is shutdown, no point for SME to wait for responses
-      from device. Pre Close SME */
-   if(wcnss_device_is_shutdown())
-   {
-      sme_PreClose(pHddCtx->hHal);
-   }
    hdd_debugfs_exit(pHddCtx);
 
-#ifdef WLAN_NS_OFFLOAD
-   hddLog(LOG1, FL("Unregister IPv6 notifier"));
-   unregister_inet6addr_notifier(&pHddCtx->ipv6_notifier);
-#endif
-   hddLog(LOG1, FL("Unregister IPv4 notifier"));
-   unregister_inetaddr_notifier(&pHddCtx->ipv4_notifier);
-
    // Unregister the Net Device Notifier
    unregister_netdevice_notifier(&hdd_netdev_notifier);
    
@@ -10495,8 +8071,6 @@
       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
          "%s: Failed to stop VOSS",__func__);
       VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
-      if (isSsrPanicOnFailure())
-          VOS_BUG(0);
    }
 
    //This requires pMac access, Call this before vos_close().
@@ -10511,12 +8085,14 @@
          "%s: Failed to close VOSS Scheduler",__func__);
       VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
    }
+#ifdef WLAN_OPEN_SOURCE
 #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
    /* Destroy the wake lock */
-   vos_wake_lock_destroy(&pHddCtx->rx_wake_lock);
+   wake_lock_destroy(&pHddCtx->rx_wake_lock);
 #endif
    /* Destroy the wake lock */
-   vos_wake_lock_destroy(&pHddCtx->sap_wake_lock);
+   wake_lock_destroy(&pHddCtx->sap_wake_lock);
+#endif
 
 #ifdef CONFIG_ENABLE_LINUX_REG
    vosStatus = vos_nv_close();
@@ -10539,10 +8115,6 @@
    //Clean up HDD Nlink Service
    send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0);
 
-   hdd_close_tx_queues(pHddCtx);
-   wlan_free_fwr_mem_dump_buffer();
-   memdump_deinit();
-
 #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
    if (pHddCtx->cfg_ini->wlanLoggingEnable)
    {
@@ -10556,15 +8128,9 @@
    nl_srv_exit();
 #endif /* WLAN_KD_READY_NOTIFIER */
 
-#ifdef WLAN_FEATURE_RMC
-   hdd_close_cesium_nl_sock();
-#endif /* WLAN_FEATURE_RMC */
 
    hdd_close_all_adapters( pHddCtx );
 
-   vos_flush_delayed_work(&pHddCtx->spoof_mac_addr_work);
-
-free_hdd_ctx:
    /* free the power on lock from platform driver */
    if (free_riva_power_on_lock("wlan"))
    {
@@ -10572,6 +8138,8 @@
                                            __func__);
    }
 
+free_hdd_ctx:
+
    //Free up dynamically allocated members inside HDD Adapter
    if (pHddCtx->cfg_ini)
    {
@@ -10579,13 +8147,11 @@
        pHddCtx->cfg_ini= NULL;
    }
 
-   /* FTM/MONITOR mode, WIPHY did not registered
+   /* FTM mode, WIPHY did not registered
       If un-register here, system crash will happen */
-   if (!(VOS_FTM_MODE == hdd_get_conparam() ||
-            VOS_MONITOR_MODE == hdd_get_conparam()))
+   if (VOS_FTM_MODE != hdd_get_conparam())
    {
       wiphy_unregister(wiphy) ;
-      hdd_wlan_free_wiphy_channels(wiphy);
    }
    wiphy_free(wiphy) ;
    if (hdd_is_ssr_required())
@@ -10711,26 +8277,31 @@
 }
 
 /* wake lock APIs for HDD */
-void hdd_prevent_suspend(uint32_t reason)
+void hdd_prevent_suspend(void)
 {
-
-    vos_wake_lock_acquire(&wlan_wake_lock, reason);
-
+#ifdef WLAN_OPEN_SOURCE
+    wake_lock(&wlan_wake_lock);
+#else
+    wcnss_prevent_suspend();
+#endif
 }
 
-void hdd_allow_suspend(uint32_t reason)
+void hdd_allow_suspend(void)
 {
-
-    vos_wake_lock_release(&wlan_wake_lock, reason);
-
+#ifdef WLAN_OPEN_SOURCE
+    wake_unlock(&wlan_wake_lock);
+#else
+    wcnss_allow_suspend();
+#endif
 }
 
-void hdd_prevent_suspend_timeout(v_U32_t timeout, uint32_t reason)
+void hdd_prevent_suspend_timeout(v_U32_t timeout)
 {
-
-    vos_wake_lock_timeout_release(&wlan_wake_lock, timeout,
-                                      reason);
-
+#ifdef WLAN_OPEN_SOURCE
+    wake_lock_timeout(&wlan_wake_lock, msecs_to_jiffies(timeout));
+#else
+    /* Do nothing as there is no API in wcnss for timeout*/
+#endif
 }
 
 /**---------------------------------------------------------------------------
@@ -10826,7 +8397,6 @@
 
       pr_info("%s: WCNSS software version %s\n",
               WLAN_MODULE_NAME, versionString);
-      vos_mem_copy(pHddCtx->fw_Version, versionString, sizeof(versionString));
 
       vstatus = sme_GetWcnssHardwareVersion(pHddCtx->hHal,
                                             versionString,
@@ -10878,13 +8448,8 @@
        struct sk_buff *skb;
        struct nlmsghdr *nlh;
        tAniMsgHdr *ani_hdr;
-       int flags = GFP_KERNEL;
-       void *nl_data = NULL;
 
-       if (in_interrupt() || irqs_disabled() || in_atomic())
-           flags = GFP_ATOMIC;
-
-       skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), flags);
+       skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), GFP_KERNEL);
 
        if(skb == NULL) {
                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -10907,21 +8472,6 @@
                        nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr)));
                        skb_put(skb, NLMSG_SPACE(sizeof(tAniMsgHdr)));
                        break;
-               case WLAN_SVC_WLAN_TP_IND:
-                        ani_hdr->length = len;
-                        nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr)
-                                                                       + len));
-                        nl_data = (char *)ani_hdr + sizeof(tAniMsgHdr);
-                        memcpy(nl_data, data, len);
-                        skb_put(skb, NLMSG_SPACE(sizeof(tAniMsgHdr) + len));
-                        break;
-               case WLAN_MSG_RPS_ENABLE_IND:
-                        ani_hdr->length = len;
-                        nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + len));
-                        nl_data = (char *)ani_hdr + sizeof(tAniMsgHdr);
-                        memcpy(nl_data, data, len);
-                        skb_put(skb, NLMSG_SPACE(sizeof(tAniMsgHdr) + len));
-                        break;
                default:
                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                        "Attempt to send unknown nlink message %d", type);
@@ -10934,68 +8484,7 @@
     return;
 }
 
-/**
- * hdd_request_tcp_delack() - Find the Delack value based on RX packet
- * @pHddCtx: Valid Global HDD context pointer
- * @rx_packets: Number of RX packet in perticular time
- *
- * Based on the RX packet this function calculate  next value of tcp delack.
- * This function compare rx packet value to high and low threshold limit.
- *
- * Return: void
- */
-void hdd_request_tcp_delack(hdd_context_t *pHddCtx, uint64_t rx_packets)
-{
-    /* average of rx_packets and prev_rx is taken so that
-       bus width doesnot fluctuate much */
-    uint64_t temp_rx = (rx_packets + pHddCtx->prev_rx)/2;
-    TP_IND_TYPE next_rx_level = pHddCtx->cur_rx_level;
 
-    pHddCtx->prev_rx = rx_packets;
-    if (temp_rx > pHddCtx->cfg_ini->tcpDelAckThresholdHigh)
-        next_rx_level = TP_IND_HIGH;
-    else if (temp_rx <= pHddCtx->cfg_ini->tcpDelAckThresholdLow)
-        next_rx_level = TP_IND_LOW;
-
-    hdd_set_delack_value(pHddCtx, next_rx_level);
-}
-
-#define HDD_BW_GET_DIFF(x, y) ((x) >= (y) ? (x) - (y) : (ULONG_MAX - (y) + (x)))
-
-/**
- * hdd_tcp_delack_compute_function() - get link status
- * @priv: Valid Global HDD context pointer
- *
- * This function find number of RX packet during timer life span.
- * It request tcp delack with number of RX packet and re-configure delack timer
- * for tcpDelAckComputeInterval timer interval.
- *
- * Return: void
- */
-void hdd_tcp_delack_compute_function(void *priv)
-{
-    hdd_context_t *pHddCtx = (hdd_context_t *)priv;
-    hdd_adapter_t *pAdapter = NULL;
-    v_U32_t rx_packets = 0;
-    hdd_adapter_list_node_t *pAdapterNode = NULL;
-    VOS_STATUS status = 0;
-
-    for (status = hdd_get_front_adapter(pHddCtx, &pAdapterNode);
-          NULL != pAdapterNode && VOS_STATUS_SUCCESS == status;
-          status = hdd_get_next_adapter(pHddCtx, pAdapterNode, &pAdapterNode)) {
-        if ((pAdapter = pAdapterNode->pAdapter) == NULL)
-             continue;
-
-        rx_packets += HDD_BW_GET_DIFF(pAdapter->stats.rx_packets,
-                    pAdapter->prev_rx_packets);
-        pAdapter->prev_rx_packets = pAdapter->stats.rx_packets;
-    }
-
-    hdd_request_tcp_delack(pHddCtx, rx_packets);
-
-    vos_timer_start(&pHddCtx->delack_timer,
-            pHddCtx->cfg_ini->tcpDelAckComputeInterval);
-}
 
 /**---------------------------------------------------------------------------
 
@@ -11013,12 +8502,12 @@
    */
    if (WCNSS_XO_48MHZ == wcnss_wlan_iris_xo_mode())
    {
-      hddLog(VOS_TRACE_LEVEL_INFO, "%s: Hardware supports 5Ghz", __func__);
+      hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Hardware supports 5Ghz", __func__);
       return true;
    }
    else
    {
-      hddLog(VOS_TRACE_LEVEL_INFO, "%s: Hardware doesn't supports 5Ghz",
+      hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Hardware doesn't supports 5Ghz",
                     __func__);
       return false;
    }
@@ -11085,91 +8574,6 @@
    return 0;
 }
 
-int wlan_hdd_mon_open(hdd_context_t *pHddCtx)
-{
-    VOS_STATUS status;
-    v_CONTEXT_t pVosContext= NULL;
-    hdd_adapter_t *pAdapter= NULL;
-
-    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-
-    if (NULL == pVosContext)
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Trying to open VOSS without a PreOpen", __func__);
-        VOS_ASSERT(0);
-        return VOS_STATUS_E_FAILURE;
-    }
-
-   status = vos_nv_open();
-   if (!VOS_IS_STATUS_SUCCESS(status))
-   {
-       /* NV module cannot be initialized */
-       hddLog( VOS_TRACE_LEVEL_FATAL,
-                "%s: vos_nv_open failed", __func__);
-       return VOS_STATUS_E_FAILURE;
-   }
-
-   status = vos_init_wiphy_from_nv_bin();
-   if (!VOS_IS_STATUS_SUCCESS(status))
-   {
-       /* NV module cannot be initialized */
-       hddLog( VOS_TRACE_LEVEL_FATAL,
-               "%s: vos_init_wiphy failed", __func__);
-       goto err_vos_nv_close;
-   }
-
-   status = vos_open( &pVosContext, pHddCtx->parent_dev);
-   if ( !VOS_IS_STATUS_SUCCESS( status ))
-   {
-      hddLog(VOS_TRACE_LEVEL_FATAL, "%s: vos_open failed", __func__);
-      goto err_vos_nv_close;
-   }
-
-   status = vos_mon_start( pVosContext );
-   if ( !VOS_IS_STATUS_SUCCESS( status ) )
-   {
-      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_start failed",__func__);
-      goto err_vosclose;
-   }
-
-   WLANTL_SetMonRxCbk( pVosContext, hdd_rx_packet_monitor_cbk );
-   WDA_featureCapsExchange(pVosContext);
-   wcnss_wlan_set_drvdata(pHddCtx->parent_dev, pHddCtx);
-
-   pAdapter = hdd_open_adapter( pHddCtx, WLAN_HDD_MONITOR, "wlan%d",
-         wlan_hdd_get_intf_addr(pHddCtx), FALSE );
-   if( pAdapter == NULL )
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR, "%s: hdd_open_adapter failed", __func__);
-      goto err_close_adapter;
-   }
-
-   //Initialize the nlink service
-   if(nl_srv_init() != 0)
-   {
-      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: nl_srv_init failed", __func__);
-      goto err_close_adapter;
-   }
-   return VOS_STATUS_SUCCESS;
-
-err_close_adapter:
-   hdd_close_all_adapters( pHddCtx );
-   vos_mon_stop( pVosContext );
-err_vosclose:
-   status = vos_sched_close( pVosContext );
-   if (!VOS_IS_STATUS_SUCCESS(status))    {
-      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-         "%s: Failed to close VOSS Scheduler", __func__);
-      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( status ) );
-   }
-   vos_close(pVosContext );
-
-err_vos_nv_close:
-   vos_nv_close();
-
-return status;
-}
 /**---------------------------------------------------------------------------
 
   \brief hdd_11d_scan_done - callback to be executed when 11d scan is
@@ -11196,251 +8600,6 @@
 
     return eHAL_STATUS_SUCCESS;
 }
-/**---------------------------------------------------------------------------
-
-  \brief hdd_init_frame_logging_done - callback to be executed when mgmt frame
-                                       logging is completed successfully.
-
-  \return -  None
-
-  --------------------------------------------------------------------------*/
-void hdd_init_frame_logging_done(void *fwlogInitCbContext, tAniLoggingInitRsp *pRsp)
-{
-   hdd_context_t* pHddCtx = (hdd_context_t*)fwlogInitCbContext;
-
-   if (NULL == pHddCtx)
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,
-                 "%s: HDD context is NULL",__func__);
-      return;
-   }
-
-   if ((pRsp->status == VOS_STATUS_SUCCESS) &&
-       (TRUE == pHddCtx->cfg_ini->enableMgmtLogging))
-   {
-      hddLog(VOS_TRACE_LEVEL_INFO, FL("Mgmt Frame Logging init successful"));
-      pHddCtx->mgmt_frame_logging = TRUE;
-   }
-   else
-   {
-      hddLog(VOS_TRACE_LEVEL_INFO, FL("Mgmt Frame Logging init not success"));
-      pHddCtx->mgmt_frame_logging = FALSE;
-      return;
-   }
-
-   /*Check feature supported by FW*/
-   if(TRUE == sme_IsFeatureSupportedByFW(MEMORY_DUMP_SUPPORTED))
-   {
-      //Store fwr mem dump size given by firmware.
-      wlan_store_fwr_mem_dump_size(pRsp->fw_mem_dump_max_size);
-   }
-   else
-   {
-      wlan_store_fwr_mem_dump_size(0);
-   }
-
-
-}
-/**---------------------------------------------------------------------------
-
-  \brief hdd_init_frame_logging - function to initialize frame logging.
-                            Currently only Mgmt Frames are logged in both TX
-                            and Rx direction and are sent to userspace
-                            application using logger thread when queried.
-
-  \return -  None
-
-  --------------------------------------------------------------------------*/
-void hdd_init_frame_logging(hdd_context_t* pHddCtx)
-{
-   eHalStatus halStatus = eHAL_STATUS_FAILURE;
-   tSirFWLoggingInitParam wlanFWLoggingInitParam = {0};
-
-   if (TRUE != sme_IsFeatureSupportedByFW(MGMT_FRAME_LOGGING) &&
-       TRUE != sme_IsFeatureSupportedByFW(LOGGING_ENHANCEMENT))
-   {
-       hddLog(VOS_TRACE_LEVEL_INFO, FL("MGMT_FRAME_LOGGING not supp by FW"));
-       return;
-   }
-
-   hddLog(VOS_TRACE_LEVEL_INFO, "%s: Configuring %s %s %s %s Logging",__func__,
-               pHddCtx->cfg_ini->enableFWLogging?"FW Log,":"",
-               pHddCtx->cfg_ini->enableContFWLogging ? "Cont FW log,":"",
-               pHddCtx->cfg_ini->enableMgmtLogging ? "Mgmt Pkt Log":"",
-               pHddCtx->cfg_ini->enableFwrMemDump ? "Fw Mem dump":"");
-
-   if (pHddCtx->cfg_ini->enableFWLogging ||
-                 pHddCtx->cfg_ini->enableContFWLogging)
-   {
-      wlanFWLoggingInitParam.enableFlag |= WLAN_QXDM_LOG_EN;
-   }
-
-   if (pHddCtx->cfg_ini->enableMgmtLogging)
-   {
-      wlanFWLoggingInitParam.enableFlag |= WLAN_FRAME_LOG_EN;
-   }
-   if (pHddCtx->cfg_ini->enableBMUHWtracing)
-   {
-      wlanFWLoggingInitParam.enableFlag |= WLAN_BMUHW_TRACE_LOG_EN;
-   }
-   if(pHddCtx->cfg_ini->enableFwrMemDump &&
-      (TRUE == sme_IsFeatureSupportedByFW(MEMORY_DUMP_SUPPORTED)))
-   {
-      wlanFWLoggingInitParam.enableFlag |= WLAN_FW_MEM_DUMP_EN;
-   }
-   if( wlanFWLoggingInitParam.enableFlag == 0 )
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Logging not enabled", __func__);
-      return;
-   }
-   wlanFWLoggingInitParam.frameType = WLAN_FRAME_LOGGING_FRAMETYPE_MGMT;
-   wlanFWLoggingInitParam.frameSize = WLAN_MGMT_LOGGING_FRAMESIZE_128BYTES;
-   wlanFWLoggingInitParam.bufferMode = WLAN_FRAME_LOGGING_BUFFERMODE_CIRCULAR;
-   wlanFWLoggingInitParam.continuousFrameLogging =
-                              pHddCtx->cfg_ini->enableContFWLogging;
-
-   wlanFWLoggingInitParam.enableFlag &= ~WLAN_DPU_TXP_LOG_EN;
-
-   wlanFWLoggingInitParam.minLogBufferSize =
-                              pHddCtx->cfg_ini->minLoggingBufferSize;
-   wlanFWLoggingInitParam.maxLogBufferSize =
-                              pHddCtx->cfg_ini->maxLoggingBufferSize;
-   wlanFWLoggingInitParam.fwlogInitCallback = hdd_init_frame_logging_done;
-   wlanFWLoggingInitParam.fwlogInitCbContext= pHddCtx;
-
-   halStatus = sme_InitMgmtFrameLogging(pHddCtx->hHal, &wlanFWLoggingInitParam);
-
-   if (eHAL_STATUS_SUCCESS != halStatus)
-   {
-       hddLog(LOGE, FL("sme_InitMgmtFrameLogging failed, returned %d"),
-            halStatus);
-   }
-
-   return;
-}
-
-static void hdd_dp_util_send_rps_ind(hdd_context_t  *hdd_ctxt)
-{
-    hdd_adapter_t *adapter;
-    hdd_adapter_list_node_t *adapter_node, *next;
-    VOS_STATUS status = VOS_STATUS_SUCCESS;
-    struct wlan_rps_data rps_data;
-    int count;
-
-    if(!hdd_ctxt->cfg_ini->rps_mask)
-    {
-      return;
-    }
-
-    for (count=0; count < WLAN_SVC_IFACE_NUM_QUEUES; count++)
-    {
-       rps_data.cpu_map[count] = hdd_ctxt->cfg_ini->rps_mask;
-    }
-
-    rps_data.num_queues = WLAN_SVC_IFACE_NUM_QUEUES;
-
-    hddLog(LOG1, FL("0x%x 0x%x 0x%x 0x%x 0x%x 0x%x"),
-             rps_data.cpu_map[0], rps_data.cpu_map[1],rps_data.cpu_map[2],
-                 rps_data.cpu_map[3], rps_data.cpu_map[4], rps_data.cpu_map[5]);
-
-    status = hdd_get_front_adapter (hdd_ctxt, &adapter_node);
-
-    while (NULL != adapter_node && VOS_STATUS_SUCCESS == status)
-    {
-        adapter = adapter_node->pAdapter;
-        if (NULL != adapter) {
-               strlcpy(rps_data.ifname, adapter->dev->name,
-                                        sizeof(rps_data.ifname));
-          wlan_hdd_send_svc_nlink_msg(WLAN_MSG_RPS_ENABLE_IND,
-                   (void *)&rps_data,sizeof(rps_data));
-        }
-        status = hdd_get_next_adapter (hdd_ctxt, adapter_node, &next);
-        adapter_node = next;
-   }
-}
-
-void wlan_hdd_schedule_defer_scan(struct work_struct *work)
-{
-    scan_context_t *scan_ctx =
-          container_of(work, scan_context_t, scan_work.work);
-
-    if (NULL == scan_ctx)
-    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 FL("scan_ctx is NULL"));
-        return;
-    }
-
-    if (unlikely(TDLS_CTX_MAGIC != scan_ctx->magic))
-        return;
-
-    scan_ctx->attempt++;
-
-    wlan_hdd_cfg80211_scan(scan_ctx->wiphy,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
-                           scan_ctx->dev,
-#endif
-                           scan_ctx->scan_request);
-}
-
-int wlan_hdd_copy_defer_scan_context(hdd_context_t *pHddCtx,
-                            struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
-                            struct net_device *dev,
-#endif
-                            struct cfg80211_scan_request *request)
-{
-    scan_context_t *scan_ctx;
-
-    ENTER();
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-    {
-        return -1;
-    }
-
-    scan_ctx = &pHddCtx->scan_ctxt;
-
-    scan_ctx->wiphy = wiphy;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
-    scan_ctx->dev = dev;
-#endif
-
-    scan_ctx->scan_request = request;
-
-    EXIT();
-    return 0;
-}
-
-void wlan_hdd_defer_scan_init_work(hdd_context_t *pHddCtx,
-                                struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
-                                struct net_device *dev,
-#endif
-                                struct cfg80211_scan_request *request,
-                                unsigned long delay)
-{
-    if (TDLS_CTX_MAGIC != pHddCtx->scan_ctxt.magic)
-    {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
-        wlan_hdd_copy_defer_scan_context(pHddCtx, wiphy, dev, request);
-#else
-        wlan_hdd_copy_defer_scan_context(pHddCtx, wiphy, request);
-#endif
-        pHddCtx->scan_ctxt.attempt = 0;
-        pHddCtx->scan_ctxt.magic = TDLS_CTX_MAGIC;
-    }
-    schedule_delayed_work(&pHddCtx->scan_ctxt.scan_work, delay);
-}
-
-void wlan_hdd_init_deinit_defer_scan_context(scan_context_t *scan_ctx)
-{
-    scan_ctx->magic = 0;
-    scan_ctx->attempt = 0;
-    scan_ctx->reject = 0;
-    scan_ctx->scan_request = NULL;
-
-    return;
-}
 
 /**---------------------------------------------------------------------------
 
@@ -11481,27 +8640,18 @@
       hddLog(VOS_TRACE_LEVEL_ERROR,"%s: cfg80211 init failed", __func__);
       return -EIO;
    }
+
    pHddCtx = wiphy_priv(wiphy);
 
    //Initialize the adapter context to zeros.
    vos_mem_zero(pHddCtx, sizeof( hdd_context_t ));
 
    pHddCtx->wiphy = wiphy;
-   hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);
+   hdd_prevent_suspend();
    pHddCtx->isLoadUnloadInProgress = WLAN_HDD_LOAD_IN_PROGRESS;
 
    vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, TRUE);
 
-   /* register for riva power on lock to platform driver
-    * Locking power early to ensure FW doesn't reset by kernel while
-    * host driver is busy initializing itself */
-   if (req_riva_power_on_lock("wlan"))
-   {
-      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: req riva power on lock failed",
-                                     __func__);
-      goto err_free_hdd_context;
-   }
-
    /*Get vos context here bcoz vos_open requires it*/
    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
 
@@ -11526,12 +8676,6 @@
    init_completion(&pHddCtx->scan_info.abortscan_event_var);
    init_completion(&pHddCtx->wiphy_channel_update_event);
    init_completion(&pHddCtx->ssr_comp_var);
-   init_completion(&pHddCtx->mc_sus_event_var);
-   init_completion(&pHddCtx->tx_sus_event_var);
-   init_completion(&pHddCtx->rx_sus_event_var);
-
-
-   hdd_init_ll_stats_ctx(pHddCtx);
 
 #ifdef CONFIG_ENABLE_LINUX_REG
    init_completion(&pHddCtx->linux_reg_req);
@@ -11539,17 +8683,10 @@
    init_completion(&pHddCtx->driver_crda_req);
 #endif
 
-#ifdef WLAN_FEATURE_EXTSCAN
-   init_completion(&pHddCtx->ext_scan_context.response_event);
-#endif /* WLAN_FEATURE_EXTSCAN */
-
    spin_lock_init(&pHddCtx->schedScan_lock);
 
    hdd_list_init( &pHddCtx->hddAdapters, MAX_NUMBER_OF_ADAPTERS );
 
-   vos_init_delayed_work(&pHddCtx->spoof_mac_addr_work,
-                                hdd_processSpoofMacAddrRequest);
-
 #ifdef FEATURE_WLAN_TDLS
    /* tdls_lock is initialized before an hdd_open_adapter ( which is
     * invoked by other instances also) to protect the concurrent
@@ -11557,10 +8694,6 @@
     */
    mutex_init(&pHddCtx->tdls_lock);
 #endif
-   mutex_init(&pHddCtx->spoofMacAddr.macSpoofingLock);
-   mutex_init(&pHddCtx->wmmLock);
-
-   hdd_init_offloaded_packets_ctx(pHddCtx);
    /* By default Strict Regulatory For FCC should be false */
 
    pHddCtx->nEnableStrictRegulatoryForFCC = FALSE;
@@ -11679,24 +8812,11 @@
           goto err_free_hdd_context;
       }
       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: FTM driver loaded success fully",__func__);
-      pHddCtx->isLoadUnloadInProgress = WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS;
+
       vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, FALSE);
       return VOS_STATUS_SUCCESS;
    }
 
-   if( VOS_MONITOR_MODE == hdd_get_conparam())
-   {
-       if ( VOS_STATUS_SUCCESS != wlan_hdd_mon_open(pHddCtx))
-       {
-          hddLog(VOS_TRACE_LEVEL_FATAL,"%s: wlan_hdd_mon_open Failed",__func__);
-          goto err_free_hdd_context;
-       }
-       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Driver loaded in Monitor Mode",__func__);
-       pHddCtx->isLoadUnloadInProgress = WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS;
-       vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, FALSE);
-       return VOS_STATUS_SUCCESS;
-   }
-
    //Open watchdog module
    if(pHddCtx->cfg_ini->fIsLogpEnabled)
    {
@@ -11738,23 +8858,12 @@
    }
 
 #endif
-   //Initialize the nlink service
-   if(nl_srv_init() != 0)
-   {
-      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: nl_srv_init failed", __func__);
-      goto err_vos_nv_close;
-   }
 
-#ifdef WLAN_KD_READY_NOTIFIER
-   pHddCtx->kd_nl_init = 1;
-#endif /* WLAN_KD_READY_NOTIFIER */
-
-   vos_set_roam_delay_stats_enabled(pHddCtx->cfg_ini->gEnableRoamDelayStats);
    status = vos_open( &pVosContext, pHddCtx->parent_dev);
    if ( !VOS_IS_STATUS_SUCCESS( status ))
    {
       hddLog(VOS_TRACE_LEVEL_FATAL, "%s: vos_open failed", __func__);
-      goto err_nl_srv;
+      goto err_vos_nv_close;
    }
 
    pHddCtx->hHal = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME, pVosContext );
@@ -11896,8 +9005,6 @@
    if ( !VOS_IS_STATUS_SUCCESS( status ) )
    {
       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_start failed",__func__);
-      if (isSsrPanicOnFailure())
-          VOS_BUG(0);
       goto err_vosclose;
    }
 
@@ -12122,11 +9229,6 @@
 
    wlan_hdd_tdls_init(pHddCtx);
 
-   wlan_hdd_init_deinit_defer_scan_context(&pHddCtx->scan_ctxt);
-
-   vos_init_delayed_work(&pHddCtx->scan_ctxt.scan_work,
-                         wlan_hdd_schedule_defer_scan);
-
    sme_Register11dScanDoneCallback(pHddCtx->hHal, hdd_11d_scan_done);
 
    /* Register with platform driver as client for Suspend/Resume */
@@ -12156,46 +9258,47 @@
       goto err_unregister_pmops;
    }
 
+   /* register for riva power on lock to platform driver */
+   if (req_riva_power_on_lock("wlan"))
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: req riva power on lock failed",
+                                     __func__);
+      goto err_unregister_pmops;
+   }
+
    // register net device notifier for device change notification
    ret = register_netdevice_notifier(&hdd_netdev_notifier);
 
    if(ret < 0)
    {
       hddLog(VOS_TRACE_LEVEL_ERROR,"%s: register_netdevice_notifier failed",__func__);
-      goto err_unregister_pmops;
+      goto err_free_power_on_lock;
    }
 
+   //Initialize the nlink service
+   if(nl_srv_init() != 0)
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: nl_srv_init failed", __func__);
+      goto err_reg_netdev;
+   }
+
+#ifdef WLAN_KD_READY_NOTIFIER
+   pHddCtx->kd_nl_init = 1;
+#endif /* WLAN_KD_READY_NOTIFIER */
+
    //Initialize the BTC service
    if(btc_activate_service(pHddCtx) != 0)
    {
       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: btc_activate_service failed",__func__);
-      goto err_reg_netdev;
+      goto err_nl_srv;
    }
 
-#ifdef FEATURE_OEM_DATA_SUPPORT
-   //Initialize the OEM service
-   if (oem_activate_service(pHddCtx) != 0)
-   {
-       hddLog(VOS_TRACE_LEVEL_FATAL,
-              "%s: oem_activate_service failed", __func__);
-       goto err_reg_netdev;
-   }
-#endif
-
 #ifdef PTT_SOCK_SVC_ENABLE
    //Initialize the PTT service
    if(ptt_sock_activate_svc(pHddCtx) != 0)
    {
       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: ptt_sock_activate_svc failed",__func__);
-      goto err_reg_netdev;
-   }
-#endif
-
-#ifdef WLAN_FEATURE_RMC
-   if (hdd_open_cesium_nl_sock() < 0)
-   {
-      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hdd_open_cesium_nl_sock failed", __func__);
-      goto err_reg_netdev;
+      goto err_nl_srv;
    }
 #endif
 
@@ -12204,42 +9307,19 @@
    {
        if(wlan_logging_sock_activate_svc(
                    pHddCtx->cfg_ini->wlanLoggingFEToConsole,
-                   pHddCtx->cfg_ini->wlanLoggingNumBuf,
-                   pHddCtx->cfg_ini->wlanPerPktStatsLogEnable,
-                   pHddCtx->cfg_ini->wlanPerPktStatsNumBuf))
+                   pHddCtx->cfg_ini->wlanLoggingNumBuf))
        {
            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wlan_logging_sock_activate_svc"
                    " failed", __func__);
-           goto err_reg_netdev;
+           goto err_nl_srv;
        }
        //TODO: To Remove enableDhcpDebug and use gEnableDebugLog for
        //EAPOL and DHCP
-       if (!pHddCtx->cfg_ini->gEnableDebugLog)
-           pHddCtx->cfg_ini->gEnableDebugLog =
-           VOS_PKT_PROTO_TYPE_EAPOL | VOS_PKT_PROTO_TYPE_DHCP |
-           VOS_PKT_PROTO_TYPE_ARP;
+       pHddCtx->cfg_ini->enableDhcpDebug = CFG_DEBUG_DHCP_ENABLE;
+       pHddCtx->cfg_ini->gEnableDebugLog = VOS_PKT_PROTO_TYPE_EAPOL;
    }
-
-   if (pHddCtx->cfg_ini->wlanLoggingEnable &&
-               (pHddCtx->cfg_ini->enableFWLogging ||
-                pHddCtx->cfg_ini->enableMgmtLogging ||
-                pHddCtx->cfg_ini->enableContFWLogging ||
-                pHddCtx->cfg_ini->enableFwrMemDump )
-                )
-   {
-       hdd_init_frame_logging(pHddCtx);
-   }
-   else
-   {
-       hddLog(VOS_TRACE_LEVEL_INFO, FL("Logging disabled in ini"));
-   }
-
 #endif
 
-
-   if (vos_is_multicast_logging())
-       wlan_logging_set_log_level();
-
    hdd_register_mcast_bcast_filter(pHddCtx);
    if (VOS_STA_SAP_MODE != hdd_get_conparam())
    {
@@ -12252,23 +9332,26 @@
    mutex_init(&pHddCtx->sap_lock);
    mutex_init(&pHddCtx->roc_lock);
 
+
+#ifdef WLAN_OPEN_SOURCE
 #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
    /* Initialize the wake lcok */
-   vos_wake_lock_init(&pHddCtx->rx_wake_lock,
+   wake_lock_init(&pHddCtx->rx_wake_lock,
+           WAKE_LOCK_SUSPEND,
            "qcom_rx_wakelock");
-
 #endif
    /* Initialize the wake lcok */
-   vos_wake_lock_init(&pHddCtx->sap_wake_lock,
+   wake_lock_init(&pHddCtx->sap_wake_lock,
+           WAKE_LOCK_SUSPEND,
            "qcom_sap_wakelock");
-
+#endif
 
    vos_event_init(&pHddCtx->scan_info.scan_finished_event);
    pHddCtx->scan_info.scan_pending_option = WEXT_SCAN_PENDING_GIVEUP;
 
    pHddCtx->isLoadUnloadInProgress = WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS;
    vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, FALSE);
-   hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);
+   hdd_allow_suspend();
 
 #ifdef FEATURE_WLAN_SCAN_PNO
    /*SME must send channel update configuration to RIVA*/
@@ -12276,12 +9359,6 @@
 #endif
    /* Send the update default channel list to the FW*/
    sme_UpdateChannelList(pHddCtx->hHal);
-
-   /* Fwr capabilities received, Set the Dot11 mode */
-   sme_SetPhyMode(WLAN_HDD_GET_HAL_CTX(pAdapter),
-       hdd_cfg_xlate_to_csr_phy_mode(pHddCtx->cfg_ini->dot11Mode));
-   sme_SetDefDot11Mode(pHddCtx->hHal);
-
 #ifndef CONFIG_ENABLE_LINUX_REG
    /*updating wiphy so that regulatory user hints can be processed*/
    if (wiphy)
@@ -12300,27 +9377,12 @@
                      hdd_tx_rx_pkt_cnt_stat_timer_handler,
                      (void *)pHddCtx);
    }
-   wlan_hdd_cfg80211_nan_init(pHddCtx);
-
-   mutex_init(&pHddCtx->cur_rx_level_lock);
-   vos_timer_init(&pHddCtx->delack_timer, VOS_TIMER_TYPE_SW,
-                             hdd_tcp_delack_compute_function,(void *)pHddCtx);
-   vos_timer_init(&pHddCtx->tdls_source_timer, VOS_TIMER_TYPE_SW,
-                  wlan_hdd_change_tdls_mode, (void *)pHddCtx);
-
 #ifdef WLAN_FEATURE_EXTSCAN
     sme_EXTScanRegisterCallback(pHddCtx->hHal,
             wlan_hdd_cfg80211_extscan_callback,
                            pHddCtx);
 #endif /* WLAN_FEATURE_EXTSCAN */
 
-#ifdef FEATURE_OEM_DATA_SUPPORT
-    sme_OemDataRegisterCallback(pHddCtx->hHal,
-            wlan_hdd_cfg80211_oemdata_callback,
-                           pHddCtx);
-#endif /* FEATURE_OEM_DATA_SUPPORT */
-
-   sme_set_rssi_threshold_breached_cb(pHddCtx->hHal, hdd_rssi_threshold_breached_cb);
 #ifdef WLAN_NS_OFFLOAD
    // Register IPv6 notifier to notify if any change in IP
    // So that we can reconfigure the offload parameters
@@ -12328,11 +9390,11 @@
    ret = register_inet6addr_notifier(&pHddCtx->ipv6_notifier);
    if (ret)
    {
-      hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to register IPv6 notifier"));
+      hddLog(LOGE, FL("Failed to register IPv6 notifier"));
    }
    else
    {
-      hddLog(VOS_TRACE_LEVEL_INFO, FL("Registered IPv6 notifier"));
+      hddLog(LOGE, FL("Registered IPv6 notifier"));
    }
 #endif
 
@@ -12342,21 +9404,27 @@
    ret = register_inetaddr_notifier(&pHddCtx->ipv4_notifier);
    if (ret)
    {
-      hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to register IPv4 notifier"));
+      hddLog(LOGE, FL("Failed to register IPv4 notifier"));
    }
    else
    {
-      hddLog(VOS_TRACE_LEVEL_INFO, FL("Registered IPv4 notifier"));
+      hddLog(LOGE, FL("Registered IPv4 notifier"));
    }
-   /*Fw mem dump procfs initialization*/
-   memdump_init();
-   hdd_dp_util_send_rps_ind(pHddCtx);
 
    goto success;
 
+err_nl_srv:
+#ifdef WLAN_KD_READY_NOTIFIER
+   nl_srv_exit(pHddCtx->ptt_pid);
+#else
+   nl_srv_exit();
+#endif /* WLAN_KD_READY_NOTIFIER */
 err_reg_netdev:
    unregister_netdevice_notifier(&hdd_netdev_notifier);
 
+err_free_power_on_lock:
+   free_riva_power_on_lock("wlan");
+
 err_unregister_pmops:
    hddDevTmUnregisterNotifyCallback(pHddCtx);
    hddDeregisterPmOps(pHddCtx);
@@ -12379,8 +9447,6 @@
 err_unregister_wiphy:
 #endif
    wiphy_unregister(wiphy) ;
-   hdd_wlan_free_wiphy_channels(wiphy);
-
 err_vosstop:
    vos_stop(pVosContext);
 
@@ -12393,12 +9459,6 @@
    }
    vos_close(pVosContext );
 
-err_nl_srv:
-#ifdef WLAN_KD_READY_NOTIFIER
-   nl_srv_exit(pHddCtx->ptt_pid);
-#else
-   nl_srv_exit();
-#endif /* WLAN_KD_READY_NOTIFIER */
 err_vos_nv_close:
 
 #ifdef CONFIG_ENABLE_LINUX_REG
@@ -12415,8 +9475,7 @@
    pHddCtx->cfg_ini= NULL;
 
 err_free_hdd_context:
-   hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);
-   free_riva_power_on_lock("wlan");
+   hdd_allow_suspend();
    wiphy_free(wiphy) ;
    //kfree(wdev) ;
    VOS_BUG(1);
@@ -12467,8 +9526,11 @@
 
    ENTER();
 
-   vos_wake_lock_init(&wlan_wake_lock, "wlan");
+#ifdef WLAN_OPEN_SOURCE
+   wake_lock_init(&wlan_wake_lock, WAKE_LOCK_SUSPEND, "wlan");
+#endif
 
+   hddTraceInit();
    pr_info("%s: loading driver v%s\n", WLAN_MODULE_NAME,
            QWLAN_VERSIONSTR TIMER_MANAGER_STR MEMORY_DEBUG_STR);
 
@@ -12488,7 +9550,10 @@
 
    if (max_retries >= 5) {
       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: WCNSS driver not ready", __func__);
-      vos_wake_lock_destroy(&wlan_wake_lock);
+#ifdef WLAN_OPEN_SOURCE
+      wake_lock_destroy(&wlan_wake_lock);
+#endif
+
 #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
       wlan_logging_sock_deinit_svc();
 #endif
@@ -12531,9 +9596,6 @@
          break;
    }
 
-   hddTraceInit();
-   hdd_register_debug_callback();
-
 #ifndef MODULE
       /* For statically linked driver, call hdd_set_conparam to update curr_con_mode
        */
@@ -12560,7 +9622,11 @@
 #ifdef MEMORY_DEBUG
       vos_mem_exit();
 #endif
-      vos_wake_lock_destroy(&wlan_wake_lock);
+
+#ifdef WLAN_OPEN_SOURCE
+      wake_lock_destroy(&wlan_wake_lock);
+#endif
+
 #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
       wlan_logging_sock_deinit_svc();
 #endif
@@ -12621,8 +9687,10 @@
 {
    hdd_context_t *pHddCtx = NULL;
    v_CONTEXT_t pVosContext = NULL;
+   pVosWatchdogContext pVosWDCtx = NULL;
    v_REGDOMAIN_t regId;
    unsigned long rc = 0;
+   unsigned long flags;
 
    pr_info("%s: unloading driver v%s\n", WLAN_MODULE_NAME, QWLAN_VERSIONSTR);
 
@@ -12642,29 +9710,36 @@
    {
       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: module exit called before probe",__func__);
    }
-   else if (VOS_MONITOR_MODE == hdd_get_conparam())
-   {
-       hddLog(VOS_TRACE_LEVEL_INFO,"%s: MONITOR MODE",__func__);
-       pHddCtx->isLoadUnloadInProgress = WLAN_HDD_UNLOAD_IN_PROGRESS;
-       vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, TRUE);
-       hdd_wlan_exit(pHddCtx);
-       vos_preClose( &pVosContext );
-      goto done;
-   }
    else
    {
-      /* We wait for active entry threads to exit from driver
-       * by waiting until rtnl_lock is available.
-       */
-      rtnl_lock();
-      rtnl_unlock();
-
-      INIT_COMPLETION(pHddCtx->ssr_comp_var);
-      if ((pHddCtx->isLogpInProgress) && (FALSE ==
-                  vos_is_wlan_in_badState(VOS_MODULE_ID_HDD, NULL)))
+      pVosWDCtx = get_vos_watchdog_ctxt();
+      if(pVosWDCtx == NULL)
       {
+         hddLog(VOS_TRACE_LEVEL_ERROR, FL("WD context is invalid"));
+         goto done;
+      }
+      rtnl_lock();
+      hdd_nullify_netdev_ops(pHddCtx);
+      rtnl_unlock();
+      spin_lock_irqsave(&pVosWDCtx->wdLock, flags);
+      if (!pHddCtx->isLogpInProgress || (TRUE ==
+               vos_is_wlan_in_badState(VOS_MODULE_ID_HDD, NULL)))
+      {
+         //SSR isn't in progress OR last wlan reinit wasn't successful
+         pHddCtx->isLoadUnloadInProgress = WLAN_HDD_UNLOAD_IN_PROGRESS;
+         vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, TRUE);
+         spin_unlock_irqrestore(&pVosWDCtx->wdLock, flags);
+      }
+      else
+      {
+         INIT_COMPLETION(pHddCtx->ssr_comp_var);
+
+         pHddCtx->isLoadUnloadInProgress = WLAN_HDD_UNLOAD_IN_PROGRESS;
+         vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, TRUE);
+         spin_unlock_irqrestore(&pVosWDCtx->wdLock, flags);
+
          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-              "%s:SSR  in Progress; block rmmod !!!", __func__);
+              "%s:SSR is in Progress; block rmmod !!!", __func__);
          rc = wait_for_completion_timeout(&pHddCtx->ssr_comp_var,
                                           msecs_to_jiffies(30000));
          if(!rc)
@@ -12675,8 +9750,11 @@
          }
       }
 
-      pHddCtx->isLoadUnloadInProgress = WLAN_HDD_UNLOAD_IN_PROGRESS;
-      vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, TRUE);
+      /* We wait for active entry threads to exit from driver
+       * by waiting until rtnl_lock is available.
+       */
+      rtnl_lock();
+      rtnl_unlock();
 
        /* Driver Need to send country code 00 in below condition
         * 1) If gCountryCodePriority is set to 1; and last country
@@ -12693,7 +9771,7 @@
         *
         */
 
-        if ((eANI_BOOLEAN_TRUE == sme_Is11dCountrycode(pHddCtx->hHal) &&
+      if ((eANI_BOOLEAN_TRUE == sme_Is11dCountrycode(pHddCtx->hHal) &&
               pHddCtx->cfg_ini->fSupplicantCountryCodeHasPriority  &&
               sme_Is11dSupported(pHddCtx->hHal)))
         {
@@ -12720,7 +9798,9 @@
 #endif
 
 done:
-   vos_wake_lock_destroy(&wlan_wake_lock);
+#ifdef WLAN_OPEN_SOURCE
+   wake_lock_destroy(&wlan_wake_lock);
+#endif
 
    pr_info("%s: driver unloaded\n", WLAN_MODULE_NAME);
 }
@@ -12907,14 +9987,7 @@
 {
     v_U16_t i;
     VOS_STATUS vos_status;
-    v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-    ptSapContext pSapCtx = NULL;
-    pSapCtx = VOS_GET_SAP_CB(pVosContext);
-    if(pSapCtx == NULL){
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("psapCtx is NULL"));
-        return 1;
-    }
+
     ENTER();
 
     hddLog(VOS_TRACE_LEVEL_INFO,
@@ -12925,19 +9998,19 @@
     {
         for(i = 0; i < WLAN_MAX_STA_COUNT; i++)
         {
-            if ((pSapCtx->aStaInfo[i].isUsed) &&
-                (!pSapCtx->aStaInfo[i].isDeauthInProgress))
+            if ((pAdapter->aStaInfo[i].isUsed) &&
+                (!pAdapter->aStaInfo[i].isDeauthInProgress))
             {
                 struct tagCsrDelStaParams delStaParams;
 
                 WLANSAP_PopulateDelStaParams(
-                            pSapCtx->aStaInfo[i].macAddrSTA.bytes,
+                            pAdapter->aStaInfo[i].macAddrSTA.bytes,
                             eSIR_MAC_DEAUTH_LEAVING_BSS_REASON,
                             SIR_MAC_MGMT_DEAUTH >> 4,
                             &delStaParams);
                 vos_status = hdd_softap_sta_deauth(pAdapter, &delStaParams);
                 if (VOS_IS_STATUS_SUCCESS(vos_status))
-                    pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE;
+                    pAdapter->aStaInfo[i].isDeauthInProgress = TRUE;
             }
         }
     }
@@ -13079,24 +10152,10 @@
         {
             if (((pConfig->fIsImpsEnabled || pConfig->fIsBmpsEnabled)
                  && (pmcState != IMPS && pmcState != BMPS && pmcState != UAPSD
-                  &&  pmcState != STOPPED && pmcState != STANDBY &&
-                      pmcState != WOWL)) ||
+                  &&  pmcState != STOPPED && pmcState != STANDBY)) ||
                  (eANI_BOOLEAN_TRUE == scanRspPending) ||
                  (eANI_BOOLEAN_TRUE == inMiddleOfRoaming))
             {
-                if(pmcState == FULL_POWER &&
-                   sme_IsCoexScoIndicationSet(pHddCtx->hHal))
-                {
-                    /*
-                     * When SCO indication comes from Coex module , host will
-                     * enter in to full power mode, but this should not prevent
-                     * apps processor power collapse.
-                     */
-                    hddLog(LOG1,
-                       FL("Allow apps power collapse"
-                          "even when sco indication is set"));
-                    return TRUE;
-                }
                 hddLog( LOGE, "%s: do not allow APPS power collapse-"
                     "pmcState = %d scanRspPending = %d inMiddleOfRoaming = %d",
                     __func__, pmcState, scanRspPending, inMiddleOfRoaming );
@@ -13214,7 +10273,6 @@
  * --------------------------------------------------------------------------*/
 void wlan_hdd_decr_active_session(hdd_context_t *pHddCtx, tVOS_CON_MODE mode)
 {
-
    switch (mode) {
    case VOS_STA_MODE:
    case VOS_P2P_CLIENT_MODE:
@@ -13322,17 +10380,11 @@
 
    /* Iterate over all adapters/devices */
    status =  hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
-   if ((NULL == pAdapterNode) || (VOS_STATUS_SUCCESS != status))
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 FL("fail to get adapter: %p %d"), pAdapterNode, status);
-       goto end;
-   }
-
    do 
    {
-      if(pAdapterNode->pAdapter &&
-           WLAN_HDD_ADAPTER_MAGIC == pAdapterNode->pAdapter->magic)
+      if( (status == VOS_STATUS_SUCCESS) && 
+                           pAdapterNode  && 
+                           pAdapterNode->pAdapter)
       {
          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, 
                "restarting the driver(intf:\'%s\' mode:%d :try %d)",
@@ -13350,18 +10402,14 @@
           * the driver.
           *
           */
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
-         cfg80211_rx_unprot_mlme_mgmt(pAdapterNode->pAdapter->dev, (u_int8_t*)mgmt, len);
-#else
+         
          cfg80211_send_unprot_deauth(pAdapterNode->pAdapter->dev, (u_int8_t*)mgmt, len );  
-#endif
       }
       status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
       pAdapterNode = pNext;
    } while((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status));
 
-   end:
+
    /* Free the allocated management frame */
    kfree(mgmt);
 
@@ -13422,184 +10470,12 @@
    }
    /* Send reset FIQ to WCNSS to invoke SSR. */
 #ifdef HAVE_WCNSS_RESET_INTR
-   wcnss_reset_fiq(TRUE);
+   wcnss_reset_intr();
 #endif
  
    return status;
 }
 
-/**
- * hdd_get_total_sessions() -  provide total number of active sessions
- * @pHddCtx: Valid Global HDD context pointer
- *
- * This function iterates through pAdaptors and find the number of all active
- * sessions. This active sessions includes connected sta, p2p client and number
- * of client connected to sap/p2p go.
- *
- * Return:  Total number of active sessions.
- */
-v_U8_t  hdd_get_total_sessions(hdd_context_t *pHddCtx)
-{
-    v_U8_t active_session = 0;
-    hdd_station_ctx_t *pHddStaCtx;
-    hdd_adapter_list_node_t *pAdapterNode, *pNext;
-    hdd_adapter_t *pAdapter;
-    VOS_STATUS status;
-
-    status = hdd_get_front_adapter(pHddCtx, &pAdapterNode);
-    while (NULL != pAdapterNode && VOS_STATUS_SUCCESS == status) {
-        pAdapter = pAdapterNode->pAdapter;
-        switch (pAdapter->device_mode) {
-        case VOS_STA_MODE:
-        case VOS_P2P_CLIENT_MODE:
-            pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-            if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)
-               active_session += 1;
-            break;
-        case VOS_STA_SAP_MODE:
-        case VOS_P2P_GO_MODE:
-           active_session += hdd_softap_get_connected_sta(pAdapter);
-           break;
-        default:
-           break;
-        }
-
-        status = hdd_get_next_adapter(pHddCtx, pAdapterNode, &pNext);
-        pAdapterNode = pNext;
-    }
-
-    return active_session;
-}
-
-/**
- * hdd_set_delack_value() - Set delack value
- * @pHddCtx: Valid Global HDD context pointer
- * @next_rx_level: Value to set for delack
- *
- * This function compare  present value and  next value of delack. If the both
- * are diffrent then it sets next value .
- *
- * Return: void.
- */
-void hdd_set_delack_value(hdd_context_t *pHddCtx, v_U32_t next_rx_level)
-{
-    if (pHddCtx->cur_rx_level != next_rx_level) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_DEBUG,
-               "%s: TCP DELACK trigger level %d",
-               __func__, next_rx_level);
-        mutex_lock(&pHddCtx->cur_rx_level_lock);
-        pHddCtx->cur_rx_level = next_rx_level;
-        mutex_unlock(&pHddCtx->cur_rx_level_lock);
-        wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_TP_IND, &next_rx_level,
-                                                       sizeof(next_rx_level));
-    }
-}
-
-/**
- * hdd_set_default_stop_delack_timer() - Start delack timer
- * @pHddCtx: Valid Global HDD context pointer
- *
- * This function stop delack timer and set delack value to default..
- *
- * Return: void.
- */
-
-void hdd_set_default_stop_delack_timer(hdd_context_t *pHddCtx)
-{
-    if (VOS_TIMER_STATE_RUNNING !=
-                            vos_timer_getCurrentState(&pHddCtx->delack_timer)) {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_DEBUG,
-               "%s: Can not stop timer", __func__);
-        return;
-    }
-
-    vos_timer_stop(&pHddCtx->delack_timer);
-    hdd_set_delack_value(pHddCtx, TP_IND_LOW);
-}
-
-/**
- * hdd_start_delack_timer() - Start delack timer
- * @pHddCtx: Valid Global HDD context pointer
- *
- * This function starts the delack timer for tcpDelAckComputeInterval time
- * interval.The default timer value is 2 second.
- *
- * Return: void.
- */
-void hdd_start_delack_timer(hdd_context_t *pHddCtx)
-{
-    if (VOS_TIMER_STATE_RUNNING ==
-                            vos_timer_getCurrentState(&pHddCtx->delack_timer)) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_DEBUG,
-              "%s: Timer is already running", __func__);
-        return;
-    }
-
-    vos_timer_start(&pHddCtx->delack_timer,
-                                pHddCtx->cfg_ini->tcpDelAckComputeInterval);
-}
-
-/**
- * hdd_update_prev_rx_packet_count() - Update previous rx packet count
- * @pHddCtx: Valid Global HDD context pointer
- *
- * This function updates the prev_rx_packets count from the corresponding
- * pAdapter states. This prev_rx_packets will diffed with the packet count
- * at the end of delack timer. That can give number of RX packet is spacific
- * time.
- *
- * Return: void.
- */
-void hdd_update_prev_rx_packet_count(hdd_context_t *pHddCtx)
-{
-    hdd_adapter_list_node_t *pAdapterNode, *pNext;
-    hdd_adapter_t *pAdapter;
-    VOS_STATUS status;
-
-    status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
-    while (NULL != pAdapterNode && VOS_STATUS_SUCCESS == status) {
-        pAdapter = pAdapterNode->pAdapter;
-        pAdapter->prev_rx_packets = pAdapter->stats.rx_packets;
-        status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
-        pAdapterNode = pNext;
-    }
-}
-
-/**
- * hdd_manage_delack_timer() - start\stop delack timer
- * @pHddCtx: Valid Global HDD context pointer
- *
- * This function check the number of concerent session present, it starts the
- * delack timer if only one session is present.
- * In the case of BT_COEX and TDLS mode it blindly stop delack functionality.
- *
- * Return: void.
- */
-void hdd_manage_delack_timer(hdd_context_t *pHddCtx)
-{
-    uint8_t sessions;
-
-    if (!pHddCtx->cfg_ini->enable_delack) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_DEBUG,
-               "%s: TCP DELACK is not enabled", __func__);
-        return;
-    }
-
-    /* Blindly stop timer of BTCOEX and TDLS Session is up */
-    if (pHddCtx->mode != 0) {
-        hdd_set_default_stop_delack_timer(pHddCtx);
-        return;
-    }
-
-    sessions = hdd_get_total_sessions(pHddCtx);
-    if (sessions == 1) {
-        hdd_update_prev_rx_packet_count(pHddCtx);
-        hdd_start_delack_timer(pHddCtx);
-    } else {
-        hdd_set_default_stop_delack_timer(pHddCtx);
-    }
-}
-
 /**---------------------------------------------------------------------------
  *
  *   \brief wlan_hdd_init_channels
@@ -13657,130 +10533,33 @@
     return sme_isSta_p2p_clientConnected(pHddCtx->hHal);
 }
 
-
-/*
- * API to find if the firmware will send logs using DXE channel
- */
-v_U8_t hdd_is_fw_logging_enabled(void)
-{
-    hdd_context_t *pHddCtx;
-
-    pHddCtx = vos_get_context(VOS_MODULE_ID_HDD,
-                              vos_get_global_context(VOS_MODULE_ID_HDD, NULL));
-
-    return (pHddCtx && pHddCtx->cfg_ini->enableMgmtLogging);
-}
-
-/*
- * API to find if the firmware will send trace logs using DXE channel
- */
-v_U8_t hdd_is_fw_ev_logging_enabled(void)
-{
-    hdd_context_t *pHddCtx;
-
-    pHddCtx = vos_get_context(VOS_MODULE_ID_HDD,
-                              vos_get_global_context(VOS_MODULE_ID_HDD, NULL));
-
-    return (pHddCtx && pHddCtx->cfg_ini->enableFWLogging);
-}
-/*
- * API to find if there is any session connected
- */
-VOS_STATUS hdd_is_any_session_connected(hdd_context_t *pHddCtx)
-{
-    return sme_is_any_session_connected(pHddCtx->hHal);
-}
-
-
 int wlan_hdd_scan_abort(hdd_adapter_t *pAdapter)
 {
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     hdd_scaninfo_t *pScanInfo = NULL;
     long status = 0;
-    tSirAbortScanStatus abortScanStatus;
 
     pScanInfo = &pHddCtx->scan_info;
-    INIT_COMPLETION(pScanInfo->abortscan_event_var);
     if (pScanInfo->mScanPending)
     {
-        abortScanStatus = hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId,
-                                             eCSR_SCAN_ABORT_DEFAULT);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                  FL("abortScanStatus: %d"), abortScanStatus);
+        INIT_COMPLETION(pScanInfo->abortscan_event_var);
+        hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId,
+                                    eCSR_SCAN_ABORT_DEFAULT);
 
-        /* If there is active scan command lets wait for the completion else
-         * there is no need to wait as scan command might be in the SME pending
-         * command list.
-         */
-        if (abortScanStatus == eSIR_ABORT_ACTIVE_SCAN_LIST_NOT_EMPTY)
-        {
-            status = wait_for_completion_interruptible_timeout(
+        status = wait_for_completion_interruptible_timeout(
                            &pScanInfo->abortscan_event_var,
                            msecs_to_jiffies(5000));
-            if (0 >= status)
-            {
-               VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+        if (0 >= status)
+        {
+           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: Timeout or Interrupt occurred while waiting for abort"
                   "scan, status- %ld", __func__, status);
-                return -ETIMEDOUT;
-            }
-        }
-        else if (abortScanStatus == eSIR_ABORT_SCAN_FAILURE)
-        {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                      FL("hdd_abort_mac_scan failed"));
-            return -VOS_STATUS_E_FAILURE;
+            return -ETIMEDOUT;
         }
     }
     return 0;
 }
 
-/**
- * hdd_indicate_mgmt_frame() - Wrapper to indicate management frame to
- * user space
- * @frame_ind: Management frame data to be informed.
- *
- * This function is used to indicate management frame to
- * user space
- *
- * Return: None
- *
- */
-void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind)
-{
-   hdd_context_t *hdd_ctx = NULL;
-   hdd_adapter_t *adapter = NULL;
-   v_CONTEXT_t vos_context = NULL;
-
-   /* Get the global VOSS context.*/
-   vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-   if (!vos_context) {
-      hddLog(LOGE, FL("Global VOS context is Null"));
-      return;
-   }
-   /* Get the HDD context.*/
-   hdd_ctx =
-      (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, vos_context );
-
-   if (0 != wlan_hdd_validate_context(hdd_ctx))
-   {
-       return;
-   }
-   adapter = hdd_get_adapter_by_sme_session_id(hdd_ctx,
-                                          frame_ind->sessionId);
-
-   if ((NULL != adapter) &&
-        (WLAN_HDD_ADAPTER_MAGIC == adapter->magic))
-      __hdd_indicate_mgmt_frame(adapter,
-                             frame_ind->frameLen,
-                             frame_ind->frameBuf,
-                             frame_ind->frameType,
-                             frame_ind->rxChan,
-                             frame_ind->rxRssi);
-    return;
-
-}
-
 VOS_STATUS wlan_hdd_cancel_remain_on_channel(hdd_context_t *pHddCtx)
 {
     hdd_adapter_t *pAdapter;
@@ -13812,760 +10591,32 @@
     }
     return VOS_STATUS_SUCCESS;
 }
-
-hdd_remain_on_chan_ctx_t *hdd_get_remain_on_channel_ctx(hdd_context_t *pHddCtx)
+void hdd_nullify_netdev_ops(hdd_context_t *pHddCtx)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
-    hdd_cfg80211_state_t *cfgState;
-    hdd_remain_on_chan_ctx_t *pRemainChanCtx = NULL;
-    VOS_STATUS vosStatus;
+   VOS_STATUS status;
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   hdd_adapter_t      *pAdapter;
 
-    vosStatus = hdd_get_front_adapter (pHddCtx, &pAdapterNode);
-    while (NULL != pAdapterNode && VOS_STATUS_E_EMPTY != vosStatus)
-    {
-        pAdapter = pAdapterNode->pAdapter;
-        if (NULL != pAdapter)
-        {
-            cfgState = WLAN_HDD_GET_CFG_STATE_PTR(pAdapter);
-            pRemainChanCtx = cfgState->remain_on_chan_ctx;
-            if (pRemainChanCtx)
-                break;
-        }
-        vosStatus = hdd_get_next_adapter (pHddCtx, pAdapterNode, &pNext);
-        pAdapterNode = pNext;
-    }
-    return pRemainChanCtx;
-}
-
-/**
- * wlan_hdd_handle_dfs_chan_scan () - handles disable/enable DFS channels
- *
- * @pHddCtx: HDD context within host driver
- * @dfsScanMode: dfsScanMode passed from ioctl
- *
- */
-
-VOS_STATUS wlan_hdd_handle_dfs_chan_scan(hdd_context_t *pHddCtx,
-                                   tANI_U8 dfsScanMode)
-{
-    hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
-    hdd_adapter_t *pAdapter;
-    VOS_STATUS vosStatus;
-    hdd_station_ctx_t *pHddStaCtx;
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-
-    if(!pHddCtx)
-    {
-       hddLog(LOGE, FL("HDD context is Null"));
-       return eHAL_STATUS_FAILURE;
-    }
-
-    if (pHddCtx->scan_info.mScanPending)
-    {
-        hddLog(LOG1, FL("Aborting scan for sessionId: %d"),
-               pHddCtx->scan_info.sessionId);
-        hdd_abort_mac_scan(pHddCtx,
-                           pHddCtx->scan_info.sessionId,
-                           eCSR_SCAN_ABORT_DEFAULT);
-    }
-
-    if (!dfsScanMode)
-    {
-        vosStatus = hdd_get_front_adapter( pHddCtx, &pAdapterNode);
-        while ((NULL != pAdapterNode) &&
-               (VOS_STATUS_SUCCESS == vosStatus))
-        {
-            pAdapter = pAdapterNode->pAdapter;
-
-            if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode)
-            {
-                pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-
-                if(!pHddStaCtx)
-                {
-                   hddLog(LOGE, FL("HDD STA context is Null"));
-                   return eHAL_STATUS_FAILURE;
-                }
-
-                /* if STA is already connected on DFS channel,
-                                disconnect immediately*/
-                if (hdd_connIsConnected(pHddStaCtx) &&
-                    (NV_CHANNEL_DFS ==
-                     vos_nv_getChannelEnabledState(
-                         pHddStaCtx->conn_info.operationChannel)))
-                {
-                    status = sme_RoamDisconnect(pHddCtx->hHal,
-                             pAdapter->sessionId,
-                             eCSR_DISCONNECT_REASON_UNSPECIFIED);
-                    hddLog(LOG1, FL("Client connected on DFS channel %d,"
-                           "sme_RoamDisconnect returned with status: %d"
-                           "for sessionid: %d"), pHddStaCtx->conn_info.
-                            operationChannel, status, pAdapter->sessionId);
-                }
-            }
-
-            vosStatus = hdd_get_next_adapter(pHddCtx, pAdapterNode,
-                                              &pNext);
-            pAdapterNode = pNext;
-        }
-    }
-
-    sme_UpdateDFSScanMode(pHddCtx->hHal, dfsScanMode);
-    sme_UpdateDFSRoamMode(pHddCtx->hHal,
-                         (dfsScanMode != DFS_CHNL_SCAN_DISABLED));
-
-    status = sme_HandleDFSChanScan(pHddCtx->hHal);
-    if (!HAL_STATUS_SUCCESS(status))
-    {
-         hddLog(LOGE,
-                FL("Failed in sme_HandleDFSChanScan (err=%d)"), status);
-         return status;
-    }
-
-    return status;
-}
-
-static int hdd_log2_ceil(unsigned value)
-{
-    /* need to switch to unsigned math so that negative values
-     * will right-shift towards 0 instead of -1
-     */
-    unsigned tmp = value;
-    int log2 = -1;
-
-    if (value == 0)
-        return 0;
-
-    while (tmp) {
-        log2++;
-        tmp >>= 1;
-    }
-    if (1U << log2 != value)
-        log2++;
-
-    return log2;
-}
-
-/**
- * hdd_sta_id_hash_attach() - initialize sta id to macaddr hash
- * @pAdapter: adapter handle
- *
- * Return: vos status
- */
-VOS_STATUS hdd_sta_id_hash_attach(hdd_adapter_t *pAdapter)
-{
-    int hash_elem, log2, i;
-
-    spin_lock_bh( &pAdapter->sta_hash_lock);
-    if (pAdapter->is_sta_id_hash_initialized == VOS_TRUE) {
-        spin_unlock_bh( &pAdapter->sta_hash_lock);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: hash already attached for session id %d",
-                  __func__, pAdapter->sessionId);
-        return VOS_STATUS_SUCCESS;
-    }
-    spin_unlock_bh( &pAdapter->sta_hash_lock);
-
-    hash_elem = WLAN_MAX_STA_COUNT;
-    hash_elem *= HDD_STA_ID_HASH_MULTIPLIER;
-    log2 = hdd_log2_ceil(hash_elem);
-    hash_elem = 1 << log2;
-
-    pAdapter->sta_id_hash.mask = hash_elem - 1;
-    pAdapter->sta_id_hash.idx_bits = log2;
-    pAdapter->sta_id_hash.bins =
-        vos_mem_malloc(hash_elem *sizeof(hdd_list_t));
-    if (!pAdapter->sta_id_hash.bins) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: malloc failed for session %d",
-                  __func__, pAdapter->sessionId);
-        return VOS_STATUS_E_NOMEM;
-    }
-
-    for (i = 0; i < hash_elem; i++)
-        hdd_list_init(&pAdapter->sta_id_hash.bins[i], WLAN_MAX_STA_COUNT);
-
-    spin_lock_bh( &pAdapter->sta_hash_lock);
-    pAdapter->is_sta_id_hash_initialized = VOS_TRUE;
-    spin_unlock_bh( &pAdapter->sta_hash_lock);
-    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-              "%s: Station ID Hash attached for session id %d",
-              __func__, pAdapter->sessionId);
-
-    return VOS_STATUS_SUCCESS;
-}
-
-/**
- * hdd_sta_id_hash_detach() - deinit sta_id to macaddr hash
- * @pAdapter: adapter handle
- *
- * Return: vos status
- */
-VOS_STATUS hdd_sta_id_hash_detach(hdd_adapter_t *pAdapter)
-{
-    int hash_elem, i;
-    v_SIZE_t size;
-
-    spin_lock_bh( &pAdapter->sta_hash_lock);
-    if (pAdapter->is_sta_id_hash_initialized != VOS_TRUE) {
-        spin_unlock_bh( &pAdapter->sta_hash_lock);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                  "%s: hash not initialized for session id %d",
-                  __func__, pAdapter->sessionId);
-        return VOS_STATUS_SUCCESS;
-    }
-
-    pAdapter->is_sta_id_hash_initialized = VOS_FALSE;
-    spin_unlock_bh( &pAdapter->sta_hash_lock);
-
-    hash_elem = 1 << pAdapter->sta_id_hash.idx_bits;
-
-    /* free all station info*/
-    for (i = 0; i < hash_elem; i++) {
-        hdd_list_size(&pAdapter->sta_id_hash.bins[i], &size);
-        if (size != 0) {
-            VOS_STATUS status;
-            hdd_staid_hash_node_t *sta_info_node = NULL;
-            hdd_staid_hash_node_t *next_node = NULL;
-            status = hdd_list_peek_front ( &pAdapter->sta_id_hash.bins[i],
-                                           (hdd_list_node_t**) &sta_info_node );
-
-            while ( NULL != sta_info_node && VOS_STATUS_SUCCESS == status )
-            {
-                status = hdd_list_remove_node( &pAdapter->sta_id_hash.bins[i],
-                                               &sta_info_node->node);
-                vos_mem_free(sta_info_node);
-
-                status = hdd_list_peek_next (&pAdapter->sta_id_hash.bins[i],
-                                            (hdd_list_node_t*)sta_info_node,
-                                            (hdd_list_node_t**)&next_node);
-                sta_info_node = next_node;
-            }
-        }
-    }
-
-    vos_mem_free(pAdapter->sta_id_hash.bins);
-    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-              "%s: Station ID Hash detached for session id %d",
-              __func__, pAdapter->sessionId);
-    return VOS_STATUS_SUCCESS;
-}
-
-/**
- * hdd_sta_id_hash_calculate_index() - derive index from macaddr
- * @pAdapter: adapter handle
- * @mac_addr_in: input mac address
- *
- * Return: index derived from mac address
- */
-int hdd_sta_id_hash_calculate_index(hdd_adapter_t *pAdapter,
-                               v_MACADDR_t *mac_addr_in)
-{
-    uint16 index;
-    struct hdd_align_mac_addr_t * mac_addr =
-                     (struct hdd_align_mac_addr_t *)mac_addr_in;
-
-    index = mac_addr->bytes_ab ^
-            mac_addr->bytes_cd ^ mac_addr->bytes_ef;
-    index ^= index >> pAdapter->sta_id_hash.idx_bits;
-    index &= pAdapter->sta_id_hash.mask;
-    return index;
-}
-
-/**
- * hdd_sta_id_hash_add_entry() - add entry in hash
- * @pAdapter: adapter handle
- * @sta_id: station id
- * @mac_addr: mac address
- *
- * Return: vos status
- */
-VOS_STATUS hdd_sta_id_hash_add_entry(hdd_adapter_t *pAdapter,
-                                    v_U8_t sta_id, v_MACADDR_t *mac_addr)
-{
-    uint16 index;
-    hdd_staid_hash_node_t *sta_info_node = NULL;
-
-    index = hdd_sta_id_hash_calculate_index(pAdapter, mac_addr);
-    sta_info_node = vos_mem_malloc(sizeof(hdd_staid_hash_node_t));
-    if (!sta_info_node) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: malloc failed", __func__);
-        return VOS_STATUS_E_NOMEM;
-    }
-
-    sta_info_node->sta_id = sta_id;
-    vos_mem_copy(&sta_info_node->mac_addr, mac_addr, sizeof(v_MACADDR_t));
-
-    spin_lock_bh( &pAdapter->sta_hash_lock);
-    if (pAdapter->is_sta_id_hash_initialized != VOS_TRUE) {
-        spin_unlock_bh( &pAdapter->sta_hash_lock);
-        vos_mem_free(sta_info_node);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                  "%s: hash is not initialized for session id %d",
-                  __func__, pAdapter->sessionId);
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    hdd_list_insert_back ( &pAdapter->sta_id_hash.bins[index],
-                           (hdd_list_node_t*) sta_info_node );
-    spin_unlock_bh( &pAdapter->sta_hash_lock);
-    return VOS_STATUS_SUCCESS;
-}
-
-/**
- * hdd_sta_id_hash_remove_entry() - remove entry from hash
- * @pAdapter: adapter handle
- * @sta_id: station id
- * @mac_addr: mac address
- *
- * Return: vos status
- */
-VOS_STATUS hdd_sta_id_hash_remove_entry(hdd_adapter_t *pAdapter,
-                                       v_U8_t sta_id, v_MACADDR_t *mac_addr)
-{
-    uint16 index;
-    VOS_STATUS status;
-    hdd_staid_hash_node_t *sta_info_node = NULL;
-    hdd_staid_hash_node_t *next_node = NULL;
-
-    spin_lock_bh( &pAdapter->sta_hash_lock);
-    if (pAdapter->is_sta_id_hash_initialized != VOS_TRUE) {
-        spin_unlock_bh( &pAdapter->sta_hash_lock);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: hash is not initialized for session id %d",
-                  __func__, pAdapter->sessionId);
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    index = hdd_sta_id_hash_calculate_index(pAdapter, mac_addr);
-    status = hdd_list_peek_front ( &pAdapter->sta_id_hash.bins[index],
-                                   (hdd_list_node_t**) &sta_info_node );
-
-    while ( NULL != sta_info_node && VOS_STATUS_SUCCESS == status )
-    {
-        if (sta_info_node->sta_id == sta_id) {
-            status = hdd_list_remove_node( &pAdapter->sta_id_hash.bins[index],
-                                       &sta_info_node->node);
-            vos_mem_free(sta_info_node);
-            break;
-        }
-        status = hdd_list_peek_next (&pAdapter->sta_id_hash.bins[index],
-                (hdd_list_node_t*)sta_info_node, (hdd_list_node_t**)&next_node);
-        sta_info_node = next_node;
-    }
-    spin_unlock_bh( &pAdapter->sta_hash_lock);
-    return status;
-}
-
-/**
- * hdd_sta_id_find_from_mac_addr() - find sta id from mac address
- * @pAdapter: adapter handle
- * @mac_addr_in: mac address
- *
- * Return: station id
- */
-int hdd_sta_id_find_from_mac_addr(hdd_adapter_t *pAdapter,
-                                  v_MACADDR_t *mac_addr_in)
-{
-    uint8 is_found = 0;
-    uint8 sta_id = HDD_WLAN_INVALID_STA_ID;
-    uint16 index;
-    VOS_STATUS status;
-    hdd_staid_hash_node_t *sta_info_node = NULL;
-    hdd_staid_hash_node_t *next_node = NULL;
-
-    spin_lock_bh( &pAdapter->sta_hash_lock);
-    if (pAdapter->is_sta_id_hash_initialized != VOS_TRUE) {
-        spin_unlock_bh( &pAdapter->sta_hash_lock);
-        hddLog(VOS_TRACE_LEVEL_INFO,
-                  FL("hash is not initialized for session id %d"),
-                  pAdapter->sessionId);
-        return HDD_WLAN_INVALID_STA_ID;
-    }
-
-    index = hdd_sta_id_hash_calculate_index(pAdapter, mac_addr_in);
-    status = hdd_list_peek_front ( &pAdapter->sta_id_hash.bins[index],
-                                   (hdd_list_node_t**) &sta_info_node );
-
-    while ( NULL != sta_info_node && VOS_STATUS_SUCCESS == status )
-    {
-        if (vos_mem_compare(&sta_info_node->mac_addr,
-                            mac_addr_in, sizeof(v_MACADDR_t))) {
-            is_found = 1;
-            sta_id = sta_info_node->sta_id;
-            break;
-        }
-        status = hdd_list_peek_next (&pAdapter->sta_id_hash.bins[index],
-                                     (hdd_list_node_t*)sta_info_node,
-                                     (hdd_list_node_t**)&next_node);
-        sta_info_node = next_node;
-    }
-    spin_unlock_bh( &pAdapter->sta_hash_lock);
-    return sta_id;
-}
-
-/*FW memory dump feature*/
-/**
- * This structure hold information about the /proc file
- *
- */
-static struct proc_dir_entry *proc_file, *proc_dir;
-
-/**
- * memdump_read() - perform read operation in memory dump proc file
- *
- * @file  - handle for the proc file.
- * @buf   - pointer to user space buffer.
- * @count - number of bytes to be read.
- * @pos   - offset in the from buffer.
- *
- * This function performs read operation for the memory dump proc file.
- *
- * Return: number of bytes read on success, error code otherwise.
- */
-static ssize_t memdump_read(struct file *file, char __user *buf,
-                    size_t count, loff_t *pos)
-{
-    int status;
-    hdd_context_t *hdd_ctx = (hdd_context_t *)PDE_DATA(file_inode(file));
-    size_t ret_count;
-    loff_t bytes_left;
-    ENTER();
-
-    hddLog(LOG1, FL("Read req for size:%zu pos:%llu"), count, *pos);
-    status = wlan_hdd_validate_context(hdd_ctx);
-    if (0 != status) {
-        return -EINVAL;
-    }
-
-    if (!wlan_fwr_mem_dump_test_and_set_read_allowed_bit()) {
-        hddLog(LOGE, FL("Current mem dump request timed out/failed"));
-        return -EINVAL;
-    }
-
-    /* run fs_read_handler in an atomic context*/
-    vos_ssr_protect(__func__);
-    ret_count = wlan_fwr_mem_dump_fsread_handler( buf, count, pos, &bytes_left);
-    if(bytes_left == 0)
-    {
-        /*Free the fwr mem dump buffer */
-        wlan_free_fwr_mem_dump_buffer();
-        wlan_set_fwr_mem_dump_state(FW_MEM_DUMP_IDLE);
-        ret_count=0;
-    }
-    /*if SSR/unload code is waiting for memdump_read to finish,signal it*/
-    vos_ssr_unprotect(__func__);
-    EXIT();
-    return ret_count;
-}
-
-/**
- * struct memdump_fops - file operations for memory dump feature
- * @read - read function for memory dump operation.
- *
- * This structure initialize the file operation handle for memory
- * dump feature
- */
-static const struct file_operations memdump_fops = {
-    read: memdump_read
-};
-
-/*
-* wlan_hdd_fw_mem_dump_cb : callback for Fw mem dump request
-* To be passed by HDD to WDA and called upon receiving of response
-* from firmware
-* @fwMemDumpReqContext : memory dump request context
-* @dump_rsp : dump response from HAL
-* Returns none
-*/
-void wlan_hdd_fw_mem_dump_cb(void *fwMemDumpReqContext,
-                         tAniFwrDumpRsp *dump_rsp)
-{
-    struct hdd_fw_mem_dump_req_ctx *pHddFwMemDumpCtx = (struct hdd_fw_mem_dump_req_ctx *)fwMemDumpReqContext;
-
-    ENTER();
-    spin_lock(&hdd_context_lock);
-    if(!pHddFwMemDumpCtx || (FW_MEM_DUMP_MAGIC != pHddFwMemDumpCtx->magic)) {
-       spin_unlock(&hdd_context_lock);
-       return;
-    }
-    /* report the status to requesting function and free mem.*/
-    if (dump_rsp->dump_status != eHAL_STATUS_SUCCESS) {
-       hddLog(LOGE, FL("fw dump request declined by fwr"));
-       //set the request completion variable
-       complete(&(pHddFwMemDumpCtx->req_completion));
-       //Free the allocated fwr dump
-       wlan_free_fwr_mem_dump_buffer();
-       wlan_set_fwr_mem_dump_state(FW_MEM_DUMP_IDLE);
-    }
-    else {
-       hddLog(LOG1, FL("fw dump request accepted by fwr"));
-       /* register the HDD callback which will be called by SVC */
-       wlan_set_svc_fw_mem_dump_req_cb((void*)wlan_hdd_fw_mem_dump_req_cb,(void*)pHddFwMemDumpCtx);
-    }
-    spin_unlock(&hdd_context_lock);
-    EXIT();
-
-}
-
-/**
- * memdump_procfs_remove() - Remove file/dir under procfs for memory dump
- *
- * This function removes file/dir under proc file system that was
- * processing firmware memory dump
- *
- * Return:  None
- */
-static void memdump_procfs_remove(void)
-{
-    remove_proc_entry(PROCFS_MEMDUMP_NAME, proc_dir);
-    hddLog(LOG1 , FL("/proc/%s/%s removed\n"),
-           PROCFS_MEMDUMP_DIR, PROCFS_MEMDUMP_NAME);
-    remove_proc_entry(PROCFS_MEMDUMP_DIR, NULL);
-    hddLog(LOG1 , FL("/proc/%s removed\n"), PROCFS_MEMDUMP_DIR);
-}
-
-/**
- * memdump_procfs_init() - Initialize procfs for memory dump
- *
- * @vos_ctx - Global vos context.
- *
- * This function create file under proc file system to be used later for
- * processing firmware memory dump
- *
- * Return:   0 on success, error code otherwise.
- */
-static int memdump_procfs_init(void *vos_ctx)
-{
-    hdd_context_t *hdd_ctx;
-
-    hdd_ctx = vos_get_context(VOS_MODULE_ID_HDD, vos_ctx);
-    if (!hdd_ctx) {
-        hddLog(LOGE , FL("Invalid HDD context"));
-        return -EINVAL;
-    }
-
-    proc_dir = proc_mkdir(PROCFS_MEMDUMP_DIR, NULL);
-    if (proc_dir == NULL) {
-        remove_proc_entry(PROCFS_MEMDUMP_DIR, NULL);
-        hddLog(LOGE , FL("Error: Could not initialize /proc/%s"),
-               PROCFS_MEMDUMP_DIR);
-        return -ENOMEM;
-    }
-
-    proc_file = proc_create_data(PROCFS_MEMDUMP_NAME,
-                                 S_IRUSR | S_IWUSR, proc_dir,
-                                 &memdump_fops, hdd_ctx);
-    if (proc_file == NULL) {
-        remove_proc_entry(PROCFS_MEMDUMP_NAME, proc_dir);
-        hddLog(LOGE , FL("Error: Could not initialize /proc/%s"),
-               PROCFS_MEMDUMP_NAME);
-        return -ENOMEM;
-    }
-
-    hddLog(LOG1 , FL("/proc/%s/%s created"),
-           PROCFS_MEMDUMP_DIR, PROCFS_MEMDUMP_NAME);
-
-    return 0;
-}
-
-/**
- * memdump_init() - Initialization function for memory dump feature
- *
- * This function creates proc file for memdump feature and registers
- * HDD callback function with SME.
- *
- * Return - 0 on success, error otherwise
- */
-int memdump_init(void)
-{
-    hdd_context_t *hdd_ctx;
-    void *vos_ctx;
-    int status = 0;
-
-    vos_ctx = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-    if (!vos_ctx) {
-        hddLog(LOGE, FL("Invalid VOS context"));
-        return -EINVAL;
-    }
-
-    hdd_ctx = vos_get_context(VOS_MODULE_ID_HDD, vos_ctx);
-    if (!hdd_ctx) {
-        hddLog(LOGE , FL("Invalid HDD context"));
-        return -EINVAL;
-    }
-
-    status = memdump_procfs_init(vos_ctx);
-    if (status) {
-        hddLog(LOGE , FL("Failed to create proc file"));
-        return status;
-    }
-
-    return 0;
-}
-
-/**
- * memdump_deinit() - De initialize memdump feature
- *
- * This function removes proc file created for memdump feature.
- *
- * Return: None
- */
-int memdump_deinit(void)
-{
-    hdd_context_t *hdd_ctx;
-    void *vos_ctx;
-
-    vos_ctx = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-    if (!vos_ctx) {
-        hddLog(LOGE, FL("Invalid VOS context"));
-        return -EINVAL;
-    }
-
-    hdd_ctx = vos_get_context(VOS_MODULE_ID_HDD, vos_ctx);
-    if(!hdd_ctx) {
-        hddLog(LOGE , FL("Invalid HDD context"));
-        return -EINVAL;
-    }
-
-    memdump_procfs_remove();
-    return 0;
-}
-
-/**
- * wlan_hdd_fw_mem_dump_req(pHddCtx) - common API(cfg80211/ioctl) for requesting fw mem dump to SME
- * Return: HAL status
- */
-
-int wlan_hdd_fw_mem_dump_req(hdd_context_t * pHddCtx)
-{
-   tAniFwrDumpReq fw_mem_dump_req={0};
-   struct hdd_fw_mem_dump_req_ctx fw_mem_dump_ctx;
-   eHalStatus status = eHAL_STATUS_FAILURE;
-   int ret=0, result;
-   ENTER();
-
-   /*Check whether a dump request is already going on
-    *Caution this function will free previously held memory if new dump request is allowed*/
-   if (!wlan_fwr_mem_dump_test_and_set_write_allowed_bit()) {
-       hddLog(LOGE, FL("Fw memdump already in progress"));
-       return -EBUSY;
-   }
-   //Allocate memory for fw mem dump buffer
-   ret = wlan_fwr_mem_dump_buffer_allocation();
-   if(ret == -EFAULT)
+   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+   while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
    {
-      hddLog(LOGE, FL("Fwr mem dump not supported by FW"));
-      return ret;
+      pAdapter = pAdapterNode->pAdapter;
+      if (NULL != pAdapter)
+      {
+          /* Disable TX on the interface, after this hard_start_xmit() will
+           * not be called on that interface
+           */
+          hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
+          netif_tx_disable(pAdapter->dev);
+          /* Mark the interface status as "down" for outside world */
+          netif_carrier_off(pAdapter->dev);
+          pAdapter->dev->netdev_ops = &nullify_netdev_ops;
+      }
+      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+      pAdapterNode = pNext;
    }
-   if (0 != ret) {
-       hddLog(LOGE, FL("Fwr mem Allocation failed"));
-       return -ENOMEM;
-   }
-   init_completion(&fw_mem_dump_ctx.req_completion);
-   fw_mem_dump_ctx.magic = FW_MEM_DUMP_MAGIC;
-   fw_mem_dump_ctx.status = false;
-
-   fw_mem_dump_req.fwMemDumpReqCallback = wlan_hdd_fw_mem_dump_cb;
-   fw_mem_dump_req.fwMemDumpReqContext = &fw_mem_dump_ctx;
-   status = sme_FwMemDumpReq(pHddCtx->hHal, &fw_mem_dump_req);
-   if(eHAL_STATUS_SUCCESS != status)
-   {
-       hddLog(VOS_TRACE_LEVEL_ERROR,
-          "%s: fw_mem_dump_req failed ", __func__);
-       wlan_free_fwr_mem_dump_buffer();
-       ret = -EFAULT;
-       goto cleanup;
-   }
-   /*wait for fw mem dump completion to send event to userspace*/
-   result =
-     wait_for_completion_timeout(&fw_mem_dump_ctx.req_completion,
-                            msecs_to_jiffies(FW_MEM_DUMP_TIMEOUT_MS));
-   if (0 >= result )
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,
-          "%s: fw_mem_dump_req timeout %d ", __func__,result);
-      ret = -ETIMEDOUT;
-   }
-cleanup:
-   spin_lock(&hdd_context_lock);
-   fw_mem_dump_ctx.magic = 0;
-   if(!ret && !fw_mem_dump_ctx.status)
-      ret = -EFAULT;
-   spin_unlock(&hdd_context_lock);
-
-   EXIT();
-   return ret;
 }
 
-/**
- * HDD callback which will be called by SVC to indicate mem dump completion.
- */
-void wlan_hdd_fw_mem_dump_req_cb(struct hdd_fw_mem_dump_req_ctx* pHddFwMemDumpCtx)
-{
-   if (!pHddFwMemDumpCtx) {
-       hddLog(VOS_TRACE_LEVEL_ERROR,
-          "%s: HDD context not valid ", __func__);
-       return;
-   }
-   spin_lock(&hdd_context_lock);
-   /* check the req magic and set status */
-   if (pHddFwMemDumpCtx->magic == FW_MEM_DUMP_MAGIC)
-   {
-       pHddFwMemDumpCtx->status = true;
-       //signal the completion
-       complete(&(pHddFwMemDumpCtx->req_completion));
-   }
-   else
-   {
-       hddLog(VOS_TRACE_LEVEL_ERROR,
-          "%s: fw mem dump request possible timeout ", __func__);
-   }
-   spin_unlock(&hdd_context_lock);
-}
-
-void hdd_initialize_adapter_common(hdd_adapter_t *pAdapter)
-{
-        if (NULL == pAdapter)
-        {
-            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: pAdapter is NULL ", __func__);
-            return;
-        }
-        init_completion(&pAdapter->session_open_comp_var);
-        init_completion(&pAdapter->session_close_comp_var);
-        init_completion(&pAdapter->disconnect_comp_var);
-        init_completion(&pAdapter->linkup_event_var);
-        init_completion(&pAdapter->cancel_rem_on_chan_var);
-        init_completion(&pAdapter->rem_on_chan_ready_event);
-        init_completion(&pAdapter->pno_comp_var);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-        init_completion(&pAdapter->offchannel_tx_event);
-#endif
-        init_completion(&pAdapter->tx_action_cnf_event);
-#ifdef FEATURE_WLAN_TDLS
-        init_completion(&pAdapter->tdls_add_station_comp);
-        init_completion(&pAdapter->tdls_del_station_comp);
-        init_completion(&pAdapter->tdls_mgmt_comp);
-        init_completion(&pAdapter->tdls_link_establish_req_comp);
-#endif
-
-#ifdef WLAN_FEATURE_RMC
-        init_completion(&pAdapter->ibss_peer_info_comp);
-#endif /* WLAN_FEATURE_RMC */
-        init_completion(&pAdapter->ula_complete);
-        init_completion(&pAdapter->change_country_code);
-
-#ifdef FEATURE_WLAN_BATCH_SCAN
-        init_completion(&pAdapter->hdd_set_batch_scan_req_var);
-        init_completion(&pAdapter->hdd_get_batch_scan_req_var);
-#endif
-
-        return;
-}
-
-
 //Register the module init/exit functions
 module_init(hdd_module_init);
 module_exit(hdd_module_exit);
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_oemdata.c b/wlan/prima/CORE/HDD/src/wlan_hdd_oemdata.c
index ca2c812..da578bc 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_oemdata.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_oemdata.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -45,10 +45,6 @@
 #include <linux/wireless.h>
 #include <wlan_hdd_includes.h>
 #include <net/arp.h>
-#include <vos_sched.h>
-#include "qwlan_version.h"
-
-static struct hdd_context_s *pHddCtx;
 
 /*---------------------------------------------------------------------------------------------
 
@@ -101,7 +97,7 @@
 
 /**--------------------------------------------------------------------------------------------
 
-  \brief __iw_get_oem_data_rsp() -
+  \brief iw_get_oem_data_rsp() - 
 
   This function gets the oem data response. This invokes
   the respective sme functionality. Function for handling the oem data rsp 
@@ -115,8 +111,8 @@
   \return - 0 for success, non zero for failure
 
 -----------------------------------------------------------------------------------------------*/
-int __iw_get_oem_data_rsp(
-        struct net_device *dev,
+int iw_get_oem_data_rsp(
+        struct net_device *dev, 
         struct iw_request_info *info,
         union iwreq_data *wrqu,
         char *extra)
@@ -125,23 +121,16 @@
     eHalStatus                            status;
     struct iw_oem_data_rsp*               pHddOemDataRsp;
     tOemDataRsp*                          pSmeOemDataRsp;
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
 
-    ENTER();
-    pAdapter = (netdev_priv(dev));
-    if (NULL == pAdapter)
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+       return -EBUSY;
     }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    rc = wlan_hdd_validate_context(pHddCtx);
-    if (0 != rc)
-    {
-        return rc;
-    }
+
     do
     {
         //get the oem data response from sme
@@ -168,28 +157,12 @@
         }
     } while(0);
 
-    EXIT();
     return rc;
 }
 
-int iw_get_oem_data_rsp(
-        struct net_device *dev,
-        struct iw_request_info *info,
-        union iwreq_data *wrqu,
-        char *extra)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __iw_get_oem_data_rsp(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 /**--------------------------------------------------------------------------------------------
 
-  \brief __iw_set_oem_data_req() -
+  \brief iw_set_oem_data_req() - 
 
   This function sets the oem data req configuration. This invokes
   the respective sme oem data req functionality. Function for 
@@ -203,8 +176,8 @@
   \return - 0 for success, non zero for failure
 
 -----------------------------------------------------------------------------------------------*/
-int __iw_set_oem_data_req(
-        struct net_device *dev,
+int iw_set_oem_data_req(
+        struct net_device *dev, 
         struct iw_request_info *info,
         union iwreq_data *wrqu,
         char *extra)
@@ -213,47 +186,17 @@
     eHalStatus status = eHAL_STATUS_SUCCESS;
     struct iw_oem_data_req *pOemDataReq = NULL;
     tOemDataReqConfig oemDataReqConfig;
+
     tANI_U32 oemDataReqID = 0;
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    hdd_wext_state_t *pwextBuf;
 
-    ENTER();
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
+    hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
 
-    if (!capable(CAP_NET_ADMIN))
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("permission check failed"));
-        return -EPERM;
-    }
-
-    pAdapter = (netdev_priv(dev));
-    if (NULL == pAdapter)
-    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    rc = wlan_hdd_validate_context(pHddCtx);
-    if (0 != rc)
-    {
-        return rc;
-    }
-
-    pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-    if (NULL == pwextBuf)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pwextBuf is NULL",__func__);
-        return -EINVAL;
-    }
-
-    if (pHddCtx->isPnoEnable)
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                   FL("pno scan in progress"));
-        return -EBUSY;
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+       return -EBUSY;
     }
 
     do
@@ -300,697 +243,8 @@
 
     } while(0);
 
-    EXIT();
     return rc;
 }
 
-int iw_set_oem_data_req(
-        struct net_device *dev,
-        struct iw_request_info *info,
-        union iwreq_data *wrqu,
-        char *extra)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __iw_set_oem_data_req(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief iw_get_oem_data_cap()
-
-  This function gets the capability information for OEM Data Request
-  and Response.
-
-  \param - dev  - Pointer to the net device
-         - info - Pointer to the t_iw_oem_data_cap
-         - wrqu - Pointer to the iwreq data
-         - extra - Pointer to the data
-
-  \return - 0 for success, non zero for failure
-
-----------------------------------------------------------------------------*/
-int iw_get_oem_data_cap(
-        struct net_device *dev,
-        struct iw_request_info *info,
-        union iwreq_data *wrqu,
-        char *extra)
-{
-    eHalStatus status;
-    t_iw_oem_data_cap oemDataCap;
-    t_iw_oem_data_cap *pHddOemDataCap;
-    hdd_adapter_t *pAdapter = netdev_priv(dev);
-    hdd_context_t *pHddContext;
-    hdd_config_t *pConfig;
-    tANI_U32 numChannels;
-    tANI_U8 chanList[OEM_CAP_MAX_NUM_CHANNELS];
-    tANI_U32 i;
-    int ret;
-
-    ENTER();
-
-    if (!pAdapter)
-    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s:Invalid context, pAdapter is null", __func__);
-       return -EINVAL;
-    }
-
-    pHddContext = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddContext);
-    if (0 != ret)
-      return ret;
-
-    pConfig = pHddContext->cfg_ini;
-
-    do
-    {
-       vos_mem_zero(&oemDataCap, sizeof(oemDataCap));
-       strlcpy(oemDataCap.oem_target_signature, OEM_TARGET_SIGNATURE,
-               OEM_TARGET_SIGNATURE_LEN);
-       oemDataCap.oem_target_type = TARGET_TYPE_PRONTO;
-       oemDataCap.oem_fw_version = 0;
-       oemDataCap.driver_version.major = QWLAN_VERSION_MAJOR;
-       oemDataCap.driver_version.minor = QWLAN_VERSION_MINOR;
-       oemDataCap.driver_version.patch = QWLAN_VERSION_PATCH;
-       oemDataCap.driver_version.build = QWLAN_VERSION_BUILD;
-       oemDataCap.allowed_dwell_time_min = pConfig->nNeighborScanMinChanTime;
-       oemDataCap.allowed_dwell_time_max = pConfig->nNeighborScanMaxChanTime;
-       oemDataCap.curr_dwell_time_min =
-               sme_getNeighborScanMinChanTime(pHddContext->hHal);
-       oemDataCap.curr_dwell_time_max =
-               sme_getNeighborScanMaxChanTime(pHddContext->hHal);
-       oemDataCap.supported_bands = pConfig->nBandCapability;
-
-       /* request for max num of channels */
-       numChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
-       status = sme_GetCfgValidChannels(pHddContext->hHal,
-                                        &chanList[0],
-                                        &numChannels);
-       if (eHAL_STATUS_SUCCESS != status)
-       {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   "%s:failed to get valid channel list", __func__);
-         return -ENOENT;
-       }
-       else
-       {
-         /* make sure num channels is not more than chan list array */
-         if (numChannels > OEM_CAP_MAX_NUM_CHANNELS)
-         {
-           VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                     "%s:Num of channels(%d) more than length(%d) of chanlist",
-                     __func__, numChannels, OEM_CAP_MAX_NUM_CHANNELS);
-           return -ENOMEM;
-         }
-
-         oemDataCap.num_channels = numChannels;
-         for (i = 0; i < numChannels; i++)
-         {
-           oemDataCap.channel_list[i] = chanList[i];
-         }
-       }
-
-       pHddOemDataCap = (t_iw_oem_data_cap *)(extra);
-       vos_mem_copy(pHddOemDataCap, &oemDataCap, sizeof(*pHddOemDataCap));
-    } while (0);
-
-    EXIT();
-    return 0;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief send_oem_reg_rsp_nlink_msg() - send oem registration response
-
-  This function sends oem message to registered application process
-
-  \param -
-     - none
-
-  \return - none
-
-  --------------------------------------------------------------------------*/
-static void send_oem_reg_rsp_nlink_msg(void)
-{
-   struct sk_buff *skb;
-   struct nlmsghdr *nlh;
-   tAniMsgHdr *aniHdr;
-   tANI_U8 *buf;
-   tANI_U8 *numInterfaces;
-   tANI_U8 *deviceMode;
-   tANI_U8 *vdevId;
-   hdd_adapter_list_node_t *pAdapterNode = NULL;
-   hdd_adapter_list_node_t *pNext = NULL;
-   hdd_adapter_t *pAdapter = NULL;
-   VOS_STATUS status = 0;
-
-   /* OEM message is always to a specific process and cannot be a broadcast */
-   if (pHddCtx->oem_pid == 0)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: invalid dest pid", __func__);
-      return;
-   }
-
-   skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), GFP_KERNEL);
-   if (skb == NULL)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: alloc_skb failed", __func__);
-      return;
-   }
-
-   nlh = (struct nlmsghdr *)skb->data;
-   nlh->nlmsg_pid = 0;  /* from kernel */
-   nlh->nlmsg_flags = 0;
-   nlh->nlmsg_seq = 0;
-   nlh->nlmsg_type = WLAN_NL_MSG_OEM;
-   aniHdr = NLMSG_DATA(nlh);
-   aniHdr->type = ANI_MSG_APP_REG_RSP;
-
-   /* Fill message body:
-    *   First byte will be number of interfaces, followed by
-    *   two bytes for each interfaces
-    *     - one byte for device mode
-    *     - one byte for vdev id
-    */
-   buf = (char *) ((char *)aniHdr + sizeof(tAniMsgHdr));
-   numInterfaces = buf++;
-   *numInterfaces = 0;
-
-   /* Iterate through each of the adapters and fill device mode and vdev id */
-   status = hdd_get_front_adapter(pHddCtx, &pAdapterNode);
-   while ((VOS_STATUS_SUCCESS == status) && pAdapterNode)
-   {
-     pAdapter = pAdapterNode->pAdapter;
-     if (pAdapter)
-     {
-       deviceMode = buf++;
-       vdevId = buf++;
-       *deviceMode = pAdapter->device_mode;
-       *vdevId = pAdapter->sessionId;
-       (*numInterfaces)++;
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                 "%s: numInterfaces: %d, deviceMode: %d, vdevId: %d",
-                 __func__, *numInterfaces, *deviceMode, *vdevId);
-     }
-     status = hdd_get_next_adapter(pHddCtx, pAdapterNode, &pNext);
-     pAdapterNode = pNext;
-   }
-
-   aniHdr->length = sizeof(tANI_U8) + (*numInterfaces) * 2 * sizeof(tANI_U8);
-   nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + aniHdr->length));
-
-   skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr) + aniHdr->length)));
-
-   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-             "%s: sending App Reg Response length (%d) to process pid (%d)",
-             __func__, aniHdr->length, pHddCtx->oem_pid);
-
-   (void)nl_srv_ucast(skb, pHddCtx->oem_pid, MSG_DONTWAIT);
-
-   return;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief send_oem_err_rsp_nlink_msg() - send oem error response
-
-  This function sends error response to oem app
-
-  \param -
-     - app_pid - PID of oem application process
-
-  \return - none
-
-  --------------------------------------------------------------------------*/
-static void send_oem_err_rsp_nlink_msg(v_SINT_t app_pid, tANI_U8 error_code)
-{
-   struct sk_buff *skb;
-   struct nlmsghdr *nlh;
-   tAniMsgHdr *aniHdr;
-   tANI_U8 *buf;
-
-   skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), GFP_KERNEL);
-   if (skb == NULL)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: alloc_skb failed", __func__);
-      return;
-   }
-
-   nlh = (struct nlmsghdr *)skb->data;
-   nlh->nlmsg_pid = 0;  /* from kernel */
-   nlh->nlmsg_flags = 0;
-   nlh->nlmsg_seq = 0;
-   nlh->nlmsg_type = WLAN_NL_MSG_OEM;
-   aniHdr = NLMSG_DATA(nlh);
-   aniHdr->type = ANI_MSG_OEM_ERROR;
-   aniHdr->length = sizeof(tANI_U8);
-   nlh->nlmsg_len = NLMSG_LENGTH(sizeof(tAniMsgHdr) + aniHdr->length);
-
-   /* message body will contain one byte of error code */
-   buf = (char *) ((char *) aniHdr + sizeof(tAniMsgHdr));
-   *buf = error_code;
-
-   skb_put(skb, NLMSG_SPACE(sizeof(tAniMsgHdr) + aniHdr->length));
-
-   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-             "%s: sending oem error response to process pid (%d)",
-             __func__, app_pid);
-
-   (void)nl_srv_ucast(skb, app_pid, MSG_DONTWAIT);
-
-   return;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief send_oem_data_rsp_msg() - send oem data response
-
-  This function sends oem data rsp message to registered application process
-  over the netlink socket.
-
-  \param -
-     - oemDataRsp - Pointer to OEM Data Response struct
-
-  \return - 0 for success, non zero for failure
-
-  --------------------------------------------------------------------------*/
-void send_oem_data_rsp_msg(tANI_U32 length, tANI_U8 *oemDataRsp)
-{
-   struct sk_buff *skb;
-   struct nlmsghdr *nlh;
-   tAniMsgHdr *aniHdr;
-   tANI_U8 *oemData;
-
-   /* OEM message is always to a specific process and cannot be a broadcast */
-   if (pHddCtx->oem_pid == 0)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: invalid dest pid", __func__);
-      return;
-   }
-
-   if (length > NEW_OEM_DATA_RSP_SIZE)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: invalid length of Oem Data response", __func__);
-      return;
-   }
-
-   skb = alloc_skb(NLMSG_SPACE(sizeof(tAniMsgHdr) + length),
-                   GFP_KERNEL);
-   if (skb == NULL)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: alloc_skb failed", __func__);
-      return;
-   }
-
-   nlh = (struct nlmsghdr *)skb->data;
-   nlh->nlmsg_pid = 0;  /* from kernel */
-   nlh->nlmsg_flags = 0;
-   nlh->nlmsg_seq = 0;
-   nlh->nlmsg_type = WLAN_NL_MSG_OEM;
-   aniHdr = NLMSG_DATA(nlh);
-   aniHdr->type = ANI_MSG_OEM_DATA_RSP;
-
-   aniHdr->length = length;
-   nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + aniHdr->length));
-   oemData = (tANI_U8 *) ((char *)aniHdr + sizeof(tAniMsgHdr));
-   vos_mem_copy(oemData, oemDataRsp, length);
-
-   skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr) + aniHdr->length)));
-
-   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-             "%s: sending Oem Data Response of len (%d) to process pid (%d)",
-             __func__, length, pHddCtx->oem_pid);
-
-   (void)nl_srv_ucast(skb, pHddCtx->oem_pid, MSG_DONTWAIT);
-
-   return;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief oem_process_channel_info_req_msg() - process oem channel_info request
-
-  This function responds with channel info to oem process
-
-  \param -
-     - numOfChannels - number of channels
-     - chanList - channel list
-
-  \return - 0 for success, non zero for failure
-
-  --------------------------------------------------------------------------*/
-static int oem_process_channel_info_req_msg(int numOfChannels, char *chanList)
-{
-   struct sk_buff *skb;
-   struct nlmsghdr *nlh;
-   tAniMsgHdr *aniHdr;
-   tHddChannelInfo *pHddChanInfo;
-   tHddChannelInfo hddChanInfo;
-   tANI_U8 chanId;
-   tANI_U32 reg_info_1;
-   tANI_U32 reg_info_2;
-   eHalStatus status = eHAL_STATUS_FAILURE;
-   int i;
-   tANI_U8 *buf;
-
-   /* OEM message is always to a specific process and cannot be a broadcast */
-   if (pHddCtx->oem_pid == 0)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: invalid dest pid", __func__);
-      return -1;
-   }
-
-   skb = alloc_skb(NLMSG_SPACE(sizeof(tAniMsgHdr) + sizeof(tANI_U8) +
-                   numOfChannels * sizeof(tHddChannelInfo)), GFP_KERNEL);
-   if (skb == NULL)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: alloc_skb failed", __func__);
-      return -1;
-   }
-
-   nlh = (struct nlmsghdr *)skb->data;
-   nlh->nlmsg_pid = 0;  /* from kernel */
-   nlh->nlmsg_flags = 0;
-   nlh->nlmsg_seq = 0;
-   nlh->nlmsg_type = WLAN_NL_MSG_OEM;
-   aniHdr = NLMSG_DATA(nlh);
-   aniHdr->type = ANI_MSG_CHANNEL_INFO_RSP;
-
-   aniHdr->length = sizeof(tANI_U8) + numOfChannels * sizeof(tHddChannelInfo);
-   nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + aniHdr->length));
-
-   /* First byte of message body will have num of channels */
-   buf = (char *) ((char *)aniHdr + sizeof(tAniMsgHdr));
-   *buf++ = numOfChannels;
-
-   /* Next follows channel info struct for each channel id.
-       * If chan id is wrong or SME returns failure for a channel
-       * then fill in 0 in channel info for that particular channel
-       */
-   for (i = 0 ; i < numOfChannels; i++)
-   {
-      pHddChanInfo = (tHddChannelInfo *) ((char *) buf +
-                                        i * sizeof(tHddChannelInfo));
-
-      chanId = chanList[i];
-      status = sme_getRegInfo(pHddCtx->hHal, chanId,
-                              &reg_info_1, &reg_info_2);
-      if (eHAL_STATUS_SUCCESS == status)
-      {
-         /* band center freq1, and freq2 depends on peer's capability
-                  * and at this time we might not be associated on the given
-                  * channel, so fill freq1=mhz, and freq2=0
-                  */
-         hddChanInfo.chan_id = chanId;
-         hddChanInfo.reserved0 = 0;
-         hddChanInfo.mhz = vos_chan_to_freq(chanId);
-         hddChanInfo.band_center_freq1 = hddChanInfo.mhz;
-         hddChanInfo.band_center_freq2 = 0;
-
-         /* set only DFS flag in info, rest of the fields will be filled in
-                 *  by the OEM App
-                 */
-         hddChanInfo.info = 0;
-         if (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(chanId))
-             hddChanInfo.info |= (1 << WLAN_HAL_CHAN_FLAG_DFS);
-
-         hddChanInfo.reg_info_1 = reg_info_1;
-         hddChanInfo.reg_info_2 = reg_info_2;
-      }
-      else
-      {
-         /* chanId passed to sme_getRegInfo is not valid, fill in zeros
-                  * in channel info struct
-                  */
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                   "%s: sme_getRegInfo failed for chan (%d), return info 0",
-                   __func__, chanId);
-         hddChanInfo.chan_id = chanId;
-         hddChanInfo.reserved0 = 0;
-         hddChanInfo.mhz = 0;
-         hddChanInfo.band_center_freq1 = 0;
-         hddChanInfo.band_center_freq2 = 0;
-         hddChanInfo.info = 0;
-         hddChanInfo.reg_info_1 = 0;
-         hddChanInfo.reg_info_2 = 0;
-      }
-      vos_mem_copy(pHddChanInfo, &hddChanInfo, sizeof(tHddChannelInfo));
-   }
-
-   skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr) + aniHdr->length)));
-
-   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-             "%s: sending channel info resp for num channels (%d) to pid (%d)",
-             __func__, numOfChannels, pHddCtx->oem_pid);
-
-   (void)nl_srv_ucast(skb, pHddCtx->oem_pid, MSG_DONTWAIT);
-
-   return 0;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief oem_process_data_req_msg() - process oem data request
-
-  This function sends oem message to SME
-
-  \param -
-     - oemDataLen - Length to OEM Data buffer
-     - oemData - Pointer to OEM Data buffer
-
-  \return - eHalStatus enumeration
-
-  --------------------------------------------------------------------------*/
-void oem_process_data_req_msg(int oemDataLen, char *oemData)
-{
-   tOemDataReqNewConfig oemDataReqNewConfig;
-   hdd_adapter_t *pAdapter = NULL;
-
-   /* for now, STA interface only */
-   pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION);
-   if (!pAdapter)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: No adapter for STA mode", __func__);
-      return;
-   }
-
-   if (!oemData)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: oemData is null", __func__);
-      return;
-   }
-
-   vos_mem_zero(&oemDataReqNewConfig, sizeof(tOemDataReqNewConfig));
-   vos_mem_copy(&oemDataReqNewConfig.selfMacAddr,
-                pAdapter->macAddressCurrent.bytes, sizeof(tSirMacAddr));
-   vos_mem_copy(&oemDataReqNewConfig.oemDataReqNew, oemData, oemDataLen);
-
-   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-             "selfMacAddr: " MAC_ADDRESS_STR" ",
-              MAC_ADDR_ARRAY(oemDataReqNewConfig.selfMacAddr));
-
-   sme_OemDataReqNew(pHddCtx->hHal,
-                           &oemDataReqNewConfig);
-}
-
-/*
- * Callback function invoked by Netlink service for all netlink
- * messages (from user space) addressed to WLAN_NL_MSG_OEM
- */
-
-/**
- * oem_msg_callback() - callback invoked by netlink service
- * @skb:    skb with netlink message
- *
- * This function gets invoked by netlink service when a message
- * is received from user space addressed to WLAN_NL_MSG_OEM
- *
- * Return: zero on success
- *         On error, error number will be returned.
- */
-static int oem_msg_callback(struct sk_buff *skb)
-{
-   struct nlmsghdr *nlh;
-   tAniMsgHdr *msg_hdr;
-   int ret;
-   char *sign_str = NULL;
-   char* aniMsgBody;
-   tANI_U32 *oemMsgSubType;
-
-   nlh = (struct nlmsghdr *)skb->data;
-
-   if (!nlh) {
-       hddLog(LOGE, FL("Netlink header null"));
-       return -EPERM;
-   }
-
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret) {
-       hddLog(LOGE, FL("HDD context is not valid"));
-       return ret;
-   }
-
-   msg_hdr = NLMSG_DATA(nlh);
-
-   if (!msg_hdr) {
-       hddLog(LOGE, FL("Message header null"));
-       send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid, OEM_ERR_NULL_MESSAGE_HEADER);
-       return -EPERM;
-   }
-
-   if (nlh->nlmsg_len < NLMSG_LENGTH(sizeof(tAniMsgHdr) + msg_hdr->length)) {
-       hddLog(LOGE, FL("Invalid nl msg len, nlh->nlmsg_len (%d), msg_hdr->len (%d)"),
-              nlh->nlmsg_len, msg_hdr->length);
-       send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
-                                  OEM_ERR_INVALID_MESSAGE_LENGTH);
-       return -EPERM;
-   }
-
-   hddLog(LOG1, FL("Received App msg type: %d"), msg_hdr->type);
-
-   switch (msg_hdr->type) {
-   case ANI_MSG_APP_REG_REQ:
-      /* Registration request is only allowed for Qualcomm Application */
-      hddLog(LOG1, FL("Received App Req Req from App process pid(%d), len(%d)"),
-                   nlh->nlmsg_pid, msg_hdr->length);
-
-      sign_str = (char *)((char *)msg_hdr + sizeof(tAniMsgHdr));
-      if ((OEM_APP_SIGNATURE_LEN == msg_hdr->length) &&
-          (0 == strncmp(sign_str, OEM_APP_SIGNATURE_STR,
-                        OEM_APP_SIGNATURE_LEN))) {
-          hddLog(LOG1, FL("Valid App Req Req from oem app process pid(%d)"),
-                       nlh->nlmsg_pid);
-
-          pHddCtx->oem_app_registered = TRUE;
-          pHddCtx->oem_pid = nlh->nlmsg_pid;
-          send_oem_reg_rsp_nlink_msg();
-      } else {
-          hddLog(LOGE, FL("Invalid signature in App Reg Request from pid(%d)"),
-                 nlh->nlmsg_pid);
-          send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
-                                       OEM_ERR_INVALID_SIGNATURE);
-          return -EPERM;
-      }
-      break;
-
-   case ANI_MSG_OEM_DATA_REQ:
-      hddLog(LOG1, FL("Received Oem Data Request length(%d) from pid: %d"),
-                   msg_hdr->length, nlh->nlmsg_pid);
-
-      if ((!pHddCtx->oem_app_registered) ||
-          (nlh->nlmsg_pid != pHddCtx->oem_pid)) {
-          /* either oem app is not registered yet or pid is different */
-          hddLog(LOGE, FL("OEM DataReq: app not registered(%d) or incorrect pid(%d)"),
-                 pHddCtx->oem_app_registered, nlh->nlmsg_pid);
-          send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
-                                       OEM_ERR_APP_NOT_REGISTERED);
-          return -EPERM;
-      }
-
-      if ((!msg_hdr->length) || (OEM_DATA_REQ_SIZE < msg_hdr->length)) {
-          hddLog(LOGE, FL("Invalid length (%d) in Oem Data Request"),
-                       msg_hdr->length);
-          send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
-                                       OEM_ERR_INVALID_MESSAGE_LENGTH);
-          return -EPERM;
-      }
-      aniMsgBody = (char *)((char *)msg_hdr + sizeof(tAniMsgHdr));
-      oemMsgSubType = (tANI_U32*) aniMsgBody;
-      hddLog(LOGE, FL("oemMsgSubType: 0x%x"), *oemMsgSubType);
-
-      oem_process_data_req_msg(msg_hdr->length,
-                              (char *) ((char *)msg_hdr +
-                              sizeof(tAniMsgHdr)));
-      break;
-
-   case ANI_MSG_CHANNEL_INFO_REQ:
-      hddLog(LOG1,
-             FL("Received channel info request, num channel(%d) from pid: %d"),
-             msg_hdr->length, nlh->nlmsg_pid);
-
-      if ((!pHddCtx->oem_app_registered) ||
-          (nlh->nlmsg_pid != pHddCtx->oem_pid)) {
-          /* either oem app is not registered yet or pid is different */
-          hddLog(LOGE,
-                 FL("Chan InfoReq: app not registered(%d) or incorrect pid(%d)"),
-                 pHddCtx->oem_app_registered, nlh->nlmsg_pid);
-          send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
-                                     OEM_ERR_APP_NOT_REGISTERED);
-          return -EPERM;
-      }
-
-      /* message length contains list of channel ids */
-      if ((!msg_hdr->length) ||
-          (WNI_CFG_VALID_CHANNEL_LIST_LEN < msg_hdr->length)) {
-          hddLog(LOGE,
-                 FL("Invalid length (%d) in channel info request"),
-                 msg_hdr->length);
-          send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
-                                    OEM_ERR_INVALID_MESSAGE_LENGTH);
-          return -EPERM;
-      }
-      oem_process_channel_info_req_msg(msg_hdr->length,
-                            (char *)((char*)msg_hdr + sizeof(tAniMsgHdr)));
-      break;
-
-   default:
-      hddLog(LOGE,
-             FL("Received Invalid message type (%d), length (%d)"),
-             msg_hdr->type, msg_hdr->length);
-      send_oem_err_rsp_nlink_msg(nlh->nlmsg_pid,
-                                 OEM_ERR_INVALID_MESSAGE_TYPE);
-      return -EPERM;
-   }
-   return 0;
-}
-
-static int __oem_msg_callback(struct sk_buff *skb)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = oem_msg_callback(skb);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief oem_activate_service() - Activate oem message handler
-
-  This function registers a handler to receive netlink message from
-  an OEM application process.
-
-  \param -
-     - pAdapter - pointer to HDD adapter
-
-  \return - 0 for success, non zero for failure
-
-  --------------------------------------------------------------------------*/
-int oem_activate_service(void *pAdapter)
-{
-   pHddCtx = (struct hdd_context_s*) pAdapter;
-
-   /* Register the msg handler for msgs addressed to WLAN_NL_MSG_OEM */
-   nl_srv_register(WLAN_NL_MSG_OEM, __oem_msg_callback);
-   return 0;
-}
-
 
 #endif
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_p2p.c b/wlan/prima/CORE/HDD/src/wlan_hdd_p2p.c
index 12593cb..7b4d461 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_p2p.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_p2p.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -31,6 +31,9 @@
 
   \brief WLAN Host Device Driver implementation for P2P commands interface
 
+  Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+  Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -75,7 +78,7 @@
        CASE_RETURN_STRING(SIR_MAC_ACTION_UNPROT_WNM);
        CASE_RETURN_STRING(SIR_MAC_ACTION_TDLS);
        CASE_RETURN_STRING(SIR_MAC_ACITON_MESH);
-       CASE_RETURN_STRING(SIR_MAC_ACTION_MHF);
+       CASE_RETURN_STRING(SIR_MAC_ACTION_MULTIHOP);
        CASE_RETURN_STRING(SIR_MAC_SELF_PROTECTED);
        CASE_RETURN_STRING(SIR_MAC_ACTION_WME);
        CASE_RETURN_STRING(SIR_MAC_ACTION_VHT);
@@ -105,6 +108,7 @@
 tP2PConnectionStatus globalP2PConnectionStatus = P2P_NOT_ACTIVE;
 
 #endif
+#ifdef WLAN_FEATURE_TDLS_DEBUG
 #define MAX_TDLS_ACTION_FRAME_TYPE 11
 const char *tdls_action_frame_type[] = {"TDLS Setup Request",
                                         "TDLS Setup Response",
@@ -117,6 +121,7 @@
                                         "TDLS Peer PSM Response",
                                         "TDLS Peer Traffic Response",
                                         "TDLS Discovery Request" };
+#endif
 
 extern struct net_device_ops net_ops_struct;
 
@@ -173,47 +178,36 @@
 {
     hdd_adapter_t *pAdapter = (hdd_adapter_t*) pCtx;
     hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
-    hdd_remain_on_chan_ctx_t *pRemainChanCtx = NULL;
+    hdd_remain_on_chan_ctx_t *pRemainChanCtx = cfgState->remain_on_chan_ctx;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    rem_on_channel_request_type_t req_type;
 
     if (pHddCtx == NULL)
     {
         hddLog(LOGE, "%s: Hdd Context is NULL", __func__);
         return eHAL_STATUS_FAILURE;
     }
-
-    mutex_lock(&pHddCtx->roc_lock);
-
-    pRemainChanCtx = cfgState->remain_on_chan_ctx;
     if (pRemainChanCtx == NULL)
     {
-        hddLog( LOGW,
-                "%s: No Rem on channel pending for which Rsp is received", __func__);
-        mutex_unlock(&pHddCtx->roc_lock);
-        return eHAL_STATUS_SUCCESS;
+       hddLog( LOGW,
+          "%s: No Rem on channel pending for which Rsp is received", __func__);
+       return eHAL_STATUS_SUCCESS;
     }
 
+    mutex_lock(&pHddCtx->roc_lock);
     hddLog( VOS_TRACE_LEVEL_INFO,
             "Received ROC rsp (request type %d, channel %d, cookie %llu",
             pRemainChanCtx->rem_on_chan_request,
             pRemainChanCtx->chan.center_freq,
             pRemainChanCtx->cookie);
-    if(!VOS_IS_STATUS_SUCCESS(vos_timer_stop(
-                    &pRemainChanCtx->hdd_remain_on_chan_timer)))
-    {
-        hddLog( LOGE, FL("Failed to stop hdd_remain_on_chan_timer"));
-    }
-    if(!VOS_IS_STATUS_SUCCESS(vos_timer_destroy(
-                    &pRemainChanCtx->hdd_remain_on_chan_timer)))
-    {
-        hddLog( LOGE, FL("Failed to destroy hdd_remain_on_chan_timer"));
-    }
+    cfgState->remain_on_chan_ctx = NULL;
+    vos_timer_stop(&pRemainChanCtx->hdd_remain_on_chan_timer);
+    vos_timer_destroy(&pRemainChanCtx->hdd_remain_on_chan_timer);
+    mutex_unlock(&pHddCtx->roc_lock);
     if ( REMAIN_ON_CHANNEL_REQUEST == pRemainChanCtx->rem_on_chan_request )
     {
         if( cfgState->buf )
         {
-           hddLog( LOG1,
+           hddLog( LOGP,
                    "%s: We need to receive yet an ack from one of tx packet",
                    __func__);
         }
@@ -229,11 +223,8 @@
                               pRemainChanCtx->chan_type,
 #endif
                               GFP_KERNEL);
-        pAdapter->lastRocTs = vos_timer_get_system_time();
     }
 
-    req_type = pRemainChanCtx->rem_on_chan_request;
-    mutex_unlock(&pHddCtx->roc_lock);
 
     if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
          ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
@@ -241,7 +232,7 @@
        )
     {
         tANI_U8 sessionId = pAdapter->sessionId;
-        if( REMAIN_ON_CHANNEL_REQUEST == req_type )
+        if( REMAIN_ON_CHANNEL_REQUEST == pRemainChanCtx->rem_on_chan_request )
         {
             sme_DeregisterMgmtFrame(
                        hHal, sessionId,
@@ -249,42 +240,32 @@
                        NULL, 0 );
         }
     }
-    else if (WLAN_HDD_P2P_GO == pAdapter->device_mode)
+    else if ( ( WLAN_HDD_SOFTAP== pAdapter->device_mode ) ||
+              ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
+            )
     {
         WLANSAP_DeRegisterMgmtFrame(
                 (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
                 (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_PROBE_REQ << 4),
                 NULL, 0 );
     }
-    mutex_lock(&pHddCtx->roc_lock);
-    if ( pRemainChanCtx )
+    if (pRemainChanCtx->action_pkt_buff.frame_ptr != NULL
+       && pRemainChanCtx->action_pkt_buff.frame_length != 0)
     {
-        if (pRemainChanCtx->action_pkt_buff.frame_ptr != NULL
-                && pRemainChanCtx->action_pkt_buff.frame_length != 0)
-        {
-            vos_mem_free(pRemainChanCtx->action_pkt_buff.frame_ptr);
-        }
+        vos_mem_free(pRemainChanCtx->action_pkt_buff.frame_ptr);
     }
-
-    hddLog( LOG1, FL(
-                "Freeing ROC ctx cfgState->remain_on_chan_ctx=%p"),
-            cfgState->remain_on_chan_ctx);
     vos_mem_free( pRemainChanCtx );
     pRemainChanCtx = NULL;
-    cfgState->remain_on_chan_ctx = NULL;
-    mutex_unlock(&pHddCtx->roc_lock);
-    if (eHAL_STATUS_SUCCESS != status)
-        complete(&pAdapter->rem_on_chan_ready_event);
     complete(&pAdapter->cancel_rem_on_chan_var);
     pAdapter->is_roc_inprogress = FALSE;
-    hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
+    hdd_allow_suspend();
     return eHAL_STATUS_SUCCESS;
 }
 
 VOS_STATUS wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter)
 {
     hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
-    hdd_remain_on_chan_ctx_t *pRemainChanCtx = NULL;
+    hdd_remain_on_chan_ctx_t *pRemainChanCtx = cfgState->remain_on_chan_ctx;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     int status = 0;
 
@@ -295,22 +276,14 @@
     }
 
     mutex_lock(&pHddCtx->roc_lock);
-    pRemainChanCtx = cfgState->remain_on_chan_ctx;
-    if(pRemainChanCtx != NULL)
+    if(cfgState->remain_on_chan_ctx != NULL)
     {
-        if(VOS_TIMER_STATE_RUNNING == vos_timer_getCurrentState(
-                    &pRemainChanCtx->hdd_remain_on_chan_timer))
-        {
-            hddLog(VOS_TRACE_LEVEL_INFO,
-                    "Cancel Existing ROC (cookie=%llu)",
-                    pRemainChanCtx->cookie);
+        hddLog(VOS_TRACE_LEVEL_INFO,
+               "Cancel Existing ROC (cookie=%llu)",
+                cfgState->remain_on_chan_ctx->cookie);
 
-            if(!VOS_IS_STATUS_SUCCESS(vos_timer_stop(
-                           &pRemainChanCtx->hdd_remain_on_chan_timer)))
-            {
-                hddLog( LOGE, FL("Failed to stop hdd_remain_on_chan_timer"));
-            }
-        }
+        vos_timer_stop(&cfgState->remain_on_chan_ctx->hdd_remain_on_chan_timer);
+
         /* Wait till remain on channel ready indication before issuing cancel
          * remain on channel request, otherwise if remain on channel not
          * received and if the driver issues cancel remain on channel then lim
@@ -318,97 +291,53 @@
          */
         if (pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress != TRUE)
         {
-            mutex_unlock(&pHddCtx->roc_lock);
             status = wait_for_completion_interruptible_timeout(
                                         &pAdapter->rem_on_chan_ready_event,
                                         msecs_to_jiffies(WAIT_REM_CHAN_READY));
             if (0 >= status)
             {
-                mutex_lock(&pHddCtx->roc_lock);
-                pRemainChanCtx = cfgState->remain_on_chan_ctx;
-                if (pRemainChanCtx)
-                    pRemainChanCtx->is_pending_roc_cancelled = TRUE;
-                mutex_unlock(&pHddCtx->roc_lock);
                 hddLog( LOGE,
-                        "%s: timeout waiting for remain on channel"
-                        " ready indication %d",
+                       "%s: timeout waiting for remain on channel"
+                       " ready indication %d",
                         __func__, status);
-                vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                      WLAN_LOG_INDICATOR_HOST_DRIVER,
-                      WLAN_LOG_REASON_HDD_TIME_OUT,
-                      FALSE, TRUE);
+                pRemainChanCtx->is_pending_roc_cancelled = TRUE;
+                mutex_unlock(&pHddCtx->roc_lock);
                 return VOS_STATUS_E_FAILURE;
             }
 
-            mutex_lock(&pHddCtx->roc_lock);
-            pRemainChanCtx = cfgState->remain_on_chan_ctx;
-            if (NULL == pRemainChanCtx)
-            {
-                mutex_unlock(&pHddCtx->roc_lock);
-                hddLog( LOGE,
-                        "%s-%d: pRemainChanCtx is NULL",
-                        __func__, __LINE__);
-                return VOS_STATUS_E_FAILURE;
-            }
-            /* Check again if cancel remain on channel is started.
-             * If its started wait for its completiona and return.
-             */
-            if (TRUE == pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress)
-            {
-                mutex_unlock(&pHddCtx->roc_lock);
-                hddLog( LOG1,
-                      "ROC timer cancellation in progress,"
-                      " wait for completion");
-                status = wait_for_completion_interruptible_timeout(
-                                     &pAdapter->cancel_rem_on_chan_var,
-                                     msecs_to_jiffies(WAIT_CANCEL_REM_CHAN));
-                if (0 >= status)
-                {
-                    hddLog( LOGE,
-                          "%s:wait on cancel_rem_on_chan_var failed %d",
-                           __func__, status);
-                    return VOS_STATUS_E_FAILURE;
-                }
-                return VOS_STATUS_SUCCESS;
-            }
-            else
-                pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress = TRUE;
             INIT_COMPLETION(pAdapter->cancel_rem_on_chan_var);
+            pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress = TRUE;
             mutex_unlock(&pHddCtx->roc_lock);
 
-            /* Issue abort remain on chan request to sme.
-             * The remain on channel callback will make sure the remain_on_chan
-             * expired event is sent.
-             */
-            if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
-                   ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
-                   ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode ))
-            {
-                if (eHAL_STATUS_SUCCESS !=
-                    sme_CancelRemainOnChannel( WLAN_HDD_GET_HAL_CTX( pAdapter ),
-                                                     pAdapter->sessionId ))
-                {
-                    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                            FL("Failed to Cancel Remain on Channel"));
-                }
-            }
-            else if (WLAN_HDD_P2P_GO == pAdapter->device_mode)
-            {
-                 WLANSAP_CancelRemainOnChannel(
-                         (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
-            }
+             /* Issue abort remain on chan request to sme.
+              * The remain on channel callback will make sure the remain_on_chan
+              * expired event is sent.
+              */
+              if (( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
+                 ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
+                 ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode ))
+              {
+                  sme_CancelRemainOnChannel( WLAN_HDD_GET_HAL_CTX( pAdapter ),
+                                                     pAdapter->sessionId );
+              }
+              else if ( (WLAN_HDD_SOFTAP== pAdapter->device_mode) ||
+                      (WLAN_HDD_P2P_GO == pAdapter->device_mode))
+              {
+                   WLANSAP_CancelRemainOnChannel(
+                          (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
+              }
 
-            status = wait_for_completion_interruptible_timeout(
-                                    &pAdapter->cancel_rem_on_chan_var,
-                                    msecs_to_jiffies(WAIT_CANCEL_REM_CHAN));
-            hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
-            if (0 >= status)
-            {
-                hddLog(LOGE,
-                       FL("Timeout waiting for cancel remain on channel ready indication %d"),
-                       status);
-                return VOS_STATUS_E_FAILURE;
-            }
+              status = wait_for_completion_interruptible_timeout(
+                                       &pAdapter->cancel_rem_on_chan_var,
+                                       msecs_to_jiffies(WAIT_CANCEL_REM_CHAN));
+              if (0 >= status)
+              {
+                  hddLog( LOGE,
+                          "%s: timeout waiting for cancel remain on channel"
+                          " ready indication %d",
+                           __func__, status);
+              }
+              hdd_allow_suspend();
          }
          else
          {
@@ -467,249 +396,47 @@
 void wlan_hdd_remain_on_chan_timeout(void *data)
 {
     hdd_adapter_t *pAdapter = (hdd_adapter_t *)data;
-    hdd_remain_on_chan_ctx_t *pRemainChanCtx = NULL;
+    hdd_remain_on_chan_ctx_t *pRemainChanCtx;
     hdd_cfg80211_state_t *cfgState;
-    hdd_context_t *pHddCtx;
-
-    if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
+    if ( NULL == pAdapter )
     {
-        hddLog( LOGE, FL("pAdapter is invalid %p !!!"), pAdapter);
+        hddLog( LOGE, FL("pAdapter is NULL !!!"));
         return;
     }
-    pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
     cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
-    mutex_lock(&pHddCtx->roc_lock);
     pRemainChanCtx = cfgState->remain_on_chan_ctx;
-
     if (NULL == pRemainChanCtx)
     {
         hddLog( LOGE, FL("No Remain on channel is pending"));
-        mutex_unlock(&pHddCtx->roc_lock);
         return;
     }
-
     if ( TRUE == pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress )
     {
-        mutex_unlock(&pHddCtx->roc_lock);
         hddLog( LOGE, FL("Cancellation already in progress"));
         return;
     }
 
     pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress = TRUE;
     INIT_COMPLETION(pAdapter->cancel_rem_on_chan_var);
-    mutex_unlock(&pHddCtx->roc_lock);
     hddLog( LOG1,"%s: Cancel Remain on Channel on timeout", __func__);
     if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
           ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
            ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
        )
     {
-        if (eHAL_STATUS_SUCCESS !=
-                sme_CancelRemainOnChannel( WLAN_HDD_GET_HAL_CTX( pAdapter),
-                    pAdapter->sessionId ))
-        {
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    FL("Failed to Cancel Remain on Channel"));
-        }
+        sme_CancelRemainOnChannel( WLAN_HDD_GET_HAL_CTX( pAdapter ),
+                                                     pAdapter->sessionId );
     }
-    else if (WLAN_HDD_P2P_GO == pAdapter->device_mode)
+    else if ( ( WLAN_HDD_SOFTAP== pAdapter->device_mode ) ||
+                  ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
+                )
     {
-        WLANSAP_CancelRemainOnChannel(
-                (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
+         WLANSAP_CancelRemainOnChannel(
+                         (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
     }
-
-    wlan_hdd_start_stop_tdls_source_timer(pHddCtx, eTDLS_SUPPORT_ENABLED);
-
-    hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
+    hdd_allow_suspend();
 }
 
-static int wlan_hdd_p2p_start_remain_on_channel(
-        hdd_adapter_t *pAdapter)
-{
-    VOS_STATUS status = VOS_STATUS_SUCCESS;
-    hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
-    hdd_adapter_t *pAdapter_temp;
-    v_BOOL_t isGoPresent = VOS_FALSE;
-    hdd_context_t *pHddCtx;
-    hdd_cfg80211_state_t *cfgState;
-    hdd_remain_on_chan_ctx_t *pRemainChanCtx = NULL;
-    rem_on_channel_request_type_t request_type;
-    unsigned int duration;
-    v_U16_t hw_value;
-
-    int ret = 0;
-
-    ENTER();
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
-    if (NULL == cfgState)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: cfgState is not valid ",__func__);
-        return -EINVAL;
-    }
-    mutex_lock(&pHddCtx->roc_lock);
-    pRemainChanCtx = cfgState->remain_on_chan_ctx;
-    if ( pRemainChanCtx  == NULL)
-    {
-        mutex_unlock(&pHddCtx->roc_lock);
-        hddLog( LOGE,
-                "%s-%d: pRemainChanCtx is NULL",
-                __func__, __LINE__);
-        return ret;
-    }
-    request_type = pRemainChanCtx->rem_on_chan_request;
-    /* Initialize Remain on chan timer */
-    status = vos_timer_init(&pRemainChanCtx->hdd_remain_on_chan_timer,
-            VOS_TIMER_TYPE_SW,
-            wlan_hdd_remain_on_chan_timeout,
-            pAdapter);
-    if (status != VOS_STATUS_SUCCESS)
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR,
-                FL("Not able to initalize remain_on_chan timer"));
-        hddLog( LOG1, FL(
-                    "Freeing ROC ctx cfgState->remain_on_chan_ctx=%p"),
-                cfgState->remain_on_chan_ctx);
-        cfgState->remain_on_chan_ctx = NULL;
-        vos_mem_free(pRemainChanCtx);
-        mutex_unlock(&pHddCtx->roc_lock);
-        return -EINVAL;
-    }
-
-    duration = pRemainChanCtx->duration;
-    hw_value = pRemainChanCtx->chan.hw_value;
-    mutex_unlock(&pHddCtx->roc_lock);
-
-    status =  hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
-    while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
-    {
-        pAdapter_temp = pAdapterNode->pAdapter;
-        if (WLAN_HDD_P2P_GO == pAdapter_temp->device_mode)
-        {
-            isGoPresent = VOS_TRUE;
-        }
-        status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
-        pAdapterNode = pNext;
-    }
-    hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
-    //call sme API to start remain on channel.
-    if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
-            ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
-            ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
-       )
-    {
-        tANI_U8 sessionId = pAdapter->sessionId;
-        //call sme API to start remain on channel.
-        if (eHAL_STATUS_SUCCESS != sme_RemainOnChannel(
-                WLAN_HDD_GET_HAL_CTX(pAdapter), sessionId,
-                hw_value, duration,
-                wlan_hdd_remain_on_channel_callback, pAdapter,
-                (tANI_U8)(request_type == REMAIN_ON_CHANNEL_REQUEST)? TRUE:FALSE))
-        {
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    FL(" RemainOnChannel returned fail"));
-
-            mutex_lock(&pHddCtx->roc_lock);
-            pRemainChanCtx = cfgState->remain_on_chan_ctx;
-            hddLog( LOG1, FL(
-                        "Freeing ROC ctx cfgState->remain_on_chan_ctx=%p"),
-                         cfgState->remain_on_chan_ctx);
-            if (pRemainChanCtx)
-            {
-                if(!VOS_IS_STATUS_SUCCESS(vos_timer_destroy
-                            (&pRemainChanCtx->hdd_remain_on_chan_timer)))
-                {
-                    hddLog( LOGE, FL(
-                        "Failed to destroy hdd_remain_on_chan_timer"));
-                }
-                vos_mem_free(pRemainChanCtx);
-                cfgState->remain_on_chan_ctx = NULL;
-            }
-            mutex_unlock(&pHddCtx->roc_lock);
-            hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
-            return -EINVAL;
-        }
-
-        if( REMAIN_ON_CHANNEL_REQUEST == request_type)
-        {
-            if( eHAL_STATUS_SUCCESS != sme_RegisterMgmtFrame(
-                        WLAN_HDD_GET_HAL_CTX(pAdapter),
-                        sessionId, (SIR_MAC_MGMT_FRAME << 2) |
-                        (SIR_MAC_MGMT_PROBE_REQ << 4), NULL, 0 ))
-            {
-                hddLog(VOS_TRACE_LEVEL_ERROR,    "sme_RegisterMgmtFrame returned fail");
-            }
-        }
-
-    }
-    else if (WLAN_HDD_P2P_GO == pAdapter->device_mode)
-    {
-        //call sme API to start remain on channel.
-        if (VOS_STATUS_SUCCESS != WLANSAP_RemainOnChannel(
-                    (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
-                    hw_value, duration,
-                    wlan_hdd_remain_on_channel_callback, pAdapter ))
-
-        {
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    "%s: WLANSAP_RemainOnChannel returned fail", __func__);
-            mutex_lock(&pHddCtx->roc_lock);
-            pRemainChanCtx = cfgState->remain_on_chan_ctx;
-            hddLog( LOG1, FL(
-                        "Freeing ROC ctx cfgState->remain_on_chan_ctx=%p"),
-                         cfgState->remain_on_chan_ctx);
-            if (pRemainChanCtx)
-            {
-                if(!VOS_IS_STATUS_SUCCESS(vos_timer_destroy
-                            (&pRemainChanCtx->hdd_remain_on_chan_timer)))
-                {
-                    hddLog( LOGE, FL(
-                        "Failed to destroy hdd_remain_on_chan_timer"));
-                }
-                vos_mem_free (pRemainChanCtx);
-                cfgState->remain_on_chan_ctx = NULL;
-            }
-            mutex_unlock(&pHddCtx->roc_lock);
-            hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
-            return -EINVAL;
-        }
-
-
-        if (VOS_STATUS_SUCCESS != WLANSAP_RegisterMgmtFrame(
-                    (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
-                    (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_PROBE_REQ << 4),
-                    NULL, 0 ))
-        {
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    "%s: WLANSAP_RegisterMgmtFrame returned fail", __func__);
-            WLANSAP_CancelRemainOnChannel(
-                    (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
-            hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
-            return -EINVAL;
-        }
-
-    }
-
-    wlan_hdd_start_stop_tdls_source_timer(pHddCtx, eTDLS_SUPPORT_DISABLED);
-
-    pAdapter->is_roc_inprogress = TRUE;
-    EXIT();
-    return 0;
-}
-
-
 static int wlan_hdd_request_remain_on_channel( struct wiphy *wiphy,
                                    struct net_device *dev,
                                    struct ieee80211_channel *chan,
@@ -722,12 +449,14 @@
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     hdd_remain_on_chan_ctx_t *pRemainChanCtx;
     hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
+    VOS_STATUS vos_status = VOS_STATUS_E_FAILURE;
     hdd_context_t *pHddCtx = NULL;
+    hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+    hdd_adapter_t *pAdapter_temp;
+    v_BOOL_t isGoPresent = VOS_FALSE;
     VOS_STATUS checkReadyInd;
-    hdd_adapter_t *pStaAdapter;
     int status = 0;
 
-    ENTER();
     if (NULL == pAdapter)
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -737,8 +466,11 @@
 
     pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -768,26 +500,22 @@
      * wlan driver is keep on receiving the remain on channel command
      * and which is resulting in crash. So not allowing any remain on
      * channel requets when Load/Unload is in progress*/
-    if(hdd_isConnectionInProgress((hdd_context_t *)pAdapter->pHddCtx))
+    if (hdd_isConnectionInProgress((hdd_context_t *)pAdapter->pHddCtx))
     {
         hddLog( LOGE,
                "%s: Connection is in progress", __func__);
         return -EBUSY;
     }
 
-    mutex_lock(&pHddCtx->roc_lock);
-
     pRemainChanCtx = vos_mem_malloc( sizeof(hdd_remain_on_chan_ctx_t) );
     if( NULL == pRemainChanCtx )
     {
         hddLog(VOS_TRACE_LEVEL_FATAL,
              "%s: Not able to allocate memory for Channel context",
                                          __func__);
-        mutex_unlock(&pHddCtx->roc_lock);
         return -ENOMEM;
     }
 
-    vos_mem_zero(pRemainChanCtx, sizeof (hdd_remain_on_chan_ctx_t));
     vos_mem_copy( &pRemainChanCtx->chan, chan,
                    sizeof(struct ieee80211_channel) );
 
@@ -806,38 +534,105 @@
     pRemainChanCtx->action_pkt_buff.frame_length = 0;
     pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress = FALSE;
     pRemainChanCtx->is_pending_roc_cancelled = FALSE;
-
+    /* Initialize Remain on chan timer */
+    vos_status = vos_timer_init(&pRemainChanCtx->hdd_remain_on_chan_timer,
+                                VOS_TIMER_TYPE_SW,
+                                wlan_hdd_remain_on_chan_timeout,
+                                pAdapter);
+    if (vos_status != VOS_STATUS_SUCCESS)
+    {
+         hddLog(VOS_TRACE_LEVEL_ERROR,
+             "%s: Not able to initalize remain_on_chan timer", __func__);
+    }
+    status =  hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+    while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+    {
+        pAdapter_temp = pAdapterNode->pAdapter;
+        if (WLAN_HDD_P2P_GO == pAdapter_temp->device_mode)
+        {
+            isGoPresent = VOS_TRUE;
+        }
+        status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+        pAdapterNode = pNext;
+    }
+    hdd_prevent_suspend();
     INIT_COMPLETION(pAdapter->rem_on_chan_ready_event);
 
-    if (REMAIN_ON_CHANNEL_REQUEST == request_type)
+    //call sme API to start remain on channel.
+    if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
+         ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
+         ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
+       )
     {
-        pStaAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION);
-        if((NULL != pStaAdapter)&&
-                hdd_connIsConnected( WLAN_HDD_GET_STATION_CTX_PTR(pStaAdapter)))
+        tANI_U8 sessionId = pAdapter->sessionId;
+        //call sme API to start remain on channel.
+        if (eHAL_STATUS_SUCCESS != sme_RemainOnChannel(
+             WLAN_HDD_GET_HAL_CTX(pAdapter), sessionId,
+             chan->hw_value, duration,
+             wlan_hdd_remain_on_channel_callback, pAdapter,
+             (tANI_U8)(request_type == REMAIN_ON_CHANNEL_REQUEST)? TRUE:FALSE))
         {
-            if (pAdapter->lastRocTs !=0 &&
-                    ((vos_timer_get_system_time() - pAdapter->lastRocTs )
-                     < pHddCtx->cfg_ini->gP2PListenDeferInterval))
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    FL(" RemainOnChannel returned fail"));
+            cfgState->remain_on_chan_ctx = NULL;
+            vos_timer_destroy(&pRemainChanCtx->hdd_remain_on_chan_timer);
+            vos_mem_free (pRemainChanCtx);
+            hdd_allow_suspend();
+            return -EINVAL;
+        }
+
+        if( REMAIN_ON_CHANNEL_REQUEST == request_type)
+        {
+            if( eHAL_STATUS_SUCCESS != sme_RegisterMgmtFrame(
+                                      WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                      sessionId, (SIR_MAC_MGMT_FRAME << 2) |
+                                      (SIR_MAC_MGMT_PROBE_REQ << 4), NULL, 0 ))
             {
-                if (pRemainChanCtx->duration > HDD_P2P_MAX_ROC_DURATION)
-                    pRemainChanCtx->duration = HDD_P2P_MAX_ROC_DURATION;
-
-                mutex_unlock(&pHddCtx->roc_lock);
-
-                schedule_delayed_work(&pAdapter->roc_work,
-                        msecs_to_jiffies(pHddCtx->cfg_ini->gP2PListenDeferInterval));
-                hddLog(VOS_TRACE_LEVEL_INFO, "Defer interval is %hu, pAdapter %p",
-                        pHddCtx->cfg_ini->gP2PListenDeferInterval, pAdapter);
-                return 0;
+                hddLog(VOS_TRACE_LEVEL_ERROR,
+                       "sme_RegisterMgmtFrame returned fail");
             }
         }
+
+    }
+    else if ( ( WLAN_HDD_SOFTAP== pAdapter->device_mode ) ||
+              ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
+            )
+    {
+        //call sme API to start remain on channel.
+        if (VOS_STATUS_SUCCESS != WLANSAP_RemainOnChannel(
+                          (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                          chan->hw_value, duration,
+                          wlan_hdd_remain_on_channel_callback, pAdapter ))
+
+        {
+           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "%s: WLANSAP_RemainOnChannel returned fail", __func__);
+           cfgState->remain_on_chan_ctx = NULL;
+           vos_timer_destroy(&pRemainChanCtx->hdd_remain_on_chan_timer);
+           vos_mem_free (pRemainChanCtx);
+           hdd_allow_suspend();
+           return -EINVAL;
+        }
+
+
+        if (VOS_STATUS_SUCCESS != WLANSAP_RegisterMgmtFrame(
+                    (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                    (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_PROBE_REQ << 4),
+                    NULL, 0 ))
+        {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "%s: WLANSAP_RegisterMgmtFrame returned fail", __func__);
+            WLANSAP_CancelRemainOnChannel(
+                    (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
+            hdd_allow_suspend();
+            return -EINVAL;
+        }
+
     }
 
-    mutex_unlock(&pHddCtx->roc_lock);
-    status = wlan_hdd_p2p_start_remain_on_channel(pAdapter);
+    pAdapter->is_roc_inprogress = TRUE;
+    return 0;
 
-    EXIT();
-    return status;
 }
 
 int __wlan_hdd_cfg80211_remain_on_channel( struct wiphy *wiphy,
@@ -855,37 +650,18 @@
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
     struct net_device *dev = wdev->netdev;
 #endif
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
-
-    ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
 
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                      TRACE_CODE_HDD_REMAIN_ON_CHANNEL,
                      pAdapter->sessionId, REMAIN_ON_CHANNEL_REQUEST));
-    ret = wlan_hdd_request_remain_on_channel(wiphy, dev,
+    return wlan_hdd_request_remain_on_channel(wiphy, dev,
                                         chan,
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
                                         channel_type,
 #endif
                                         duration, cookie,
                                         REMAIN_ON_CHANNEL_REQUEST);
-    EXIT();
-    return ret;
 }
 
 int wlan_hdd_cfg80211_remain_on_channel( struct wiphy *wiphy,
@@ -924,23 +700,16 @@
 {
     hdd_cfg80211_state_t *cfgState = NULL;
     hdd_remain_on_chan_ctx_t* pRemainChanCtx = NULL;
-    hdd_context_t *pHddCtx;
     VOS_STATUS status;
     if (NULL == pAdapter)
     {
        hddLog(LOGE, FL("pAdapter is NULL"));
        return;
     }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    if (NULL == pHddCtx)
-    {
-        hddLog(LOGE, FL("pHddCtx is NULL"));
-        return;
-    }
     cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
-    pAdapter->startRocTs = vos_timer_get_system_time();
-    mutex_lock(&pHddCtx->roc_lock);
     pRemainChanCtx = cfgState->remain_on_chan_ctx;
+    pAdapter->startRocTs = vos_timer_get_system_time();
+    hddLog( LOG1, "Ready on chan ind");
     if( pRemainChanCtx != NULL )
     {
         MTRACE(vos_trace(VOS_MODULE_ID_HDD,
@@ -977,19 +746,7 @@
         // Check for cached action frame
         if ( pRemainChanCtx->action_pkt_buff.frame_length != 0 )
         {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-            cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr,
-                             pRemainChanCtx->action_pkt_buff.freq, 0,
-                             pRemainChanCtx->action_pkt_buff.frame_ptr,
-                             pRemainChanCtx->action_pkt_buff.frame_length,
-                             NL80211_RXMGMT_FLAG_ANSWERED);
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
-            cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr,
-                             pRemainChanCtx->action_pkt_buff.freq, 0,
-                             pRemainChanCtx->action_pkt_buff.frame_ptr,
-                             pRemainChanCtx->action_pkt_buff.frame_length,
-                             NL80211_RXMGMT_FLAG_ANSWERED, GFP_ATOMIC);
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
             cfg80211_rx_mgmt( pAdapter->dev->ieee80211_ptr,
                               pRemainChanCtx->action_pkt_buff.freq, 0,
                               pRemainChanCtx->action_pkt_buff.frame_ptr,
@@ -1019,7 +776,6 @@
         complete(&pAdapter->rem_on_chan_ready_event);
         if (TRUE == pRemainChanCtx->is_pending_roc_cancelled)
         {
-            mutex_unlock(&pHddCtx->roc_lock);
             /* since pRemainChanCtx->is_pending_roc_cancelled is
              * set, it means Cancel Reamain on channel command is
              * pending because remain on channel event was not
@@ -1028,14 +784,9 @@
              */
             wlan_hdd_cancel_existing_remain_on_channel(pAdapter);
         }
-        else
-        {
-            mutex_unlock(&pHddCtx->roc_lock);
-        }
     }
     else
     {
-        mutex_unlock(&pHddCtx->roc_lock);
         hddLog( LOGW, "%s: No Pending Remain on channel Request", __func__);
     }
     return;
@@ -1054,12 +805,10 @@
 #endif
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
-    hdd_remain_on_chan_ctx_t *pRemainChanCtx = NULL;
+    hdd_remain_on_chan_ctx_t *pRemainChanCtx = cfgState->remain_on_chan_ctx;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
     int status;
     u64 cookie_dummy;
-
-    ENTER();
     cookie_dummy = cookie << 32;
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                      TRACE_CODE_HDD_CFG80211_CANCEL_REMAIN_ON_CHANNEL,
@@ -1070,6 +819,8 @@
 
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
     hddLog( LOG1, "Cancel remain on channel req (cookie = %llu)", cookie);
@@ -1078,19 +829,17 @@
      * Need to check cookie and cancel accordingly
      */
     mutex_lock(&pHddCtx->roc_lock);
-    pRemainChanCtx = cfgState->remain_on_chan_ctx;
     if( (cfgState->remain_on_chan_ctx == NULL) ||
         (cfgState->remain_on_chan_ctx->cookie != cookie) )
     {
-        mutex_unlock(&pHddCtx->roc_lock);
         hddLog( LOGE,
             "%s: No Remain on channel pending with specified cookie value",
              __func__);
+        mutex_unlock(&pHddCtx->roc_lock);
         return -EINVAL;
     }
     if (TRUE != pRemainChanCtx->is_pending_roc_cancelled)
     {
-       mutex_unlock(&pHddCtx->roc_lock);
        /* wait until remain on channel ready event received
         * for already issued remain on channel request */
        status = wait_for_completion_interruptible_timeout(&pAdapter->rem_on_chan_ready_event,
@@ -1100,18 +849,11 @@
            hddLog( LOGE,
                    "%s: timeout waiting for remain on channel ready indication %d",
                    __func__, status);
-           mutex_lock(&pHddCtx->roc_lock);
-           if (cfgState->remain_on_chan_ctx)
-               cfgState->remain_on_chan_ctx->is_pending_roc_cancelled = TRUE;
+           pRemainChanCtx->is_pending_roc_cancelled = TRUE;
            mutex_unlock(&pHddCtx->roc_lock);
-           vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                 WLAN_LOG_INDICATOR_HOST_DRIVER,
-                 WLAN_LOG_REASON_HDD_TIME_OUT,
-                 FALSE, TRUE);
            return 0;
 
        }
-        mutex_lock(&pHddCtx->roc_lock);
     }
     else
     {
@@ -1122,14 +864,9 @@
     }
     if (NULL != cfgState->remain_on_chan_ctx)
     {
-        if(!VOS_IS_STATUS_SUCCESS(vos_timer_stop(
-                    &cfgState->remain_on_chan_ctx->hdd_remain_on_chan_timer)))
-        {
-            hddLog( LOGE, FL("Failed to stop hdd_remain_on_chan_timer"));
-        }
+        vos_timer_stop(&cfgState->remain_on_chan_ctx->hdd_remain_on_chan_timer);
         if (TRUE == pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress)
         {
-            mutex_unlock(&pHddCtx->roc_lock);
             hddLog( LOG1,
                     FL("ROC timer cancellation in progress,"
                        " wait for completion"));
@@ -1142,34 +879,33 @@
                         "%s:wait on cancel_rem_on_chan_var failed %d",
                         __func__, status);
             }
+            mutex_unlock(&pHddCtx->roc_lock);
             return 0;
         }
         else
             pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress = TRUE;
     }
-    INIT_COMPLETION(pAdapter->cancel_rem_on_chan_var);
     mutex_unlock(&pHddCtx->roc_lock);
+    INIT_COMPLETION(pAdapter->cancel_rem_on_chan_var);
     /* Issue abort remain on chan request to sme.
      * The remain on channel callback will make sure the remain_on_chan
      * expired event is sent.
      */
     if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
          ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
-         ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode ))
+         ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
+       )
     {
         tANI_U8 sessionId = pAdapter->sessionId;
-        if (eHAL_STATUS_SUCCESS !=
-                sme_CancelRemainOnChannel( WLAN_HDD_GET_HAL_CTX( pAdapter ),
-                                           sessionId ))
-        {
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    FL("Failed to Cancel Remain on Channel"));
-        }
+        sme_CancelRemainOnChannel( WLAN_HDD_GET_HAL_CTX( pAdapter ),
+                                            sessionId );
     }
-    else if (WLAN_HDD_P2P_GO == pAdapter->device_mode)
+    else if ( (WLAN_HDD_SOFTAP== pAdapter->device_mode) ||
+              (WLAN_HDD_P2P_GO == pAdapter->device_mode)
+            )
     {
         WLANSAP_CancelRemainOnChannel(
-                (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
+                                (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
     }
     else
     {
@@ -1184,9 +920,7 @@
         hddLog( LOGE,
               "%s:wait on cancel_rem_on_chan_var failed %d", __func__, status);
     }
-    hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
-
-    EXIT();
+    hdd_allow_suspend();
     return 0;
 }
 
@@ -1250,7 +984,7 @@
 #endif
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
     hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
-    hdd_remain_on_chan_ctx_t *pRemainChanCtx = NULL;
+    hdd_remain_on_chan_ctx_t *pRemainChanCtx = cfgState->remain_on_chan_ctx;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
     tANI_U8 type = WLAN_HDD_GET_TYPE_FRM_FC(buf[0]);
     tANI_U8 subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(buf[0]);
@@ -1259,17 +993,18 @@
     int status;
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-    uint8_t home_ch = 0;
+    hdd_adapter_t *goAdapter;
 #endif
 
-    ENTER();
-    MTRACE(vos_trace(VOS_MODULE_ID_HDD,
+     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
                       TRACE_CODE_HDD_ACTION, pAdapter->sessionId,
                       pAdapter->device_mode ));
     status = wlan_hdd_validate_context(pHddCtx);
 
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -1314,14 +1049,11 @@
     noack = dont_wait_for_ack;
 #endif
 
-
     //If the wait is coming as 0 with off channel set
     //then set the wait to 200 ms
     if (offchan && !wait)
     {
         wait = ACTION_FRAME_DEFAULT_WAIT;
-        mutex_lock(&pHddCtx->roc_lock);
-        pRemainChanCtx = cfgState->remain_on_chan_ctx;
         if (pRemainChanCtx)
         {
             tANI_U32 current_time = vos_timer_get_system_time();
@@ -1330,7 +1062,6 @@
             if ( remaining_roc_time > ACTION_FRAME_DEFAULT_WAIT)
                 wait = remaining_roc_time;
         }
-        mutex_unlock(&pHddCtx->roc_lock);
     }
 
     //Call sme API to send out a action frame.
@@ -1394,21 +1125,12 @@
     }
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-    if ( (( WLAN_HDD_SOFTAP == pAdapter->device_mode ) ||
-          ( WLAN_HDD_P2P_GO == pAdapter->device_mode )) &&
-          (test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)))
-    {
-        home_ch = pAdapter->sessionCtx.ap.operatingChannel;
-    }
-    else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) &&
-            (pAdapter->sessionCtx.station.conn_info.connState ==
-             eConnectionState_Associated))
-    {
-        home_ch = pAdapter->sessionCtx.station.conn_info.operationChannel;
-    }
+    goAdapter = hdd_get_adapter( pAdapter->pHddCtx, WLAN_HDD_P2P_GO );
+
     //If GO adapter exists and operating on same frequency
     //then we will not request remain on channel
-    if (ieee80211_frequency_to_channel(chan->center_freq) == home_ch)
+    if( goAdapter && ( ieee80211_frequency_to_channel(chan->center_freq)
+                         == goAdapter->sessionCtx.ap.operatingChannel ) )
     {
         /*  if GO exist and is not off channel
          *  wait time should be zero.
@@ -1426,13 +1148,12 @@
         // In case of P2P Client mode if we are already
         // on the same channel then send the frame directly
         mutex_lock(&pHddCtx->roc_lock);
-        pRemainChanCtx = cfgState->remain_on_chan_ctx;
-        if( (pRemainChanCtx != NULL) &&
+        if( (cfgState->remain_on_chan_ctx != NULL) &&
             (cfgState->current_freq == chan->center_freq)
           )
         {
             if ( VOS_TIMER_STATE_RUNNING == vos_timer_getCurrentState(
-                      &pRemainChanCtx->hdd_remain_on_chan_timer) )
+                      &cfgState->remain_on_chan_ctx->hdd_remain_on_chan_timer) )
             {
                /* Some times FW is taking almost 500 msec for
                 * full 15 retries, which leads to ROC expiration
@@ -1453,26 +1174,20 @@
                 else if ( actionFrmType == WLAN_HDD_GO_NEG_CNF ||
                           actionFrmType == WLAN_HDD_INVITATION_RESP )
                    wait = wait + ACTION_FRAME_ACK_WAIT;
-
-                if (!VOS_IS_STATUS_SUCCESS(vos_timer_stop(
-                                &pRemainChanCtx->hdd_remain_on_chan_timer)))
-                {
-                    hddLog( LOGE, FL("Failed to stop hdd_remain_on_chan_timer"));
-                }
+                vos_timer_stop(
+                      &cfgState->remain_on_chan_ctx->hdd_remain_on_chan_timer);
                 status = vos_timer_start(
-                       &pRemainChanCtx->hdd_remain_on_chan_timer,
+                       &cfgState->remain_on_chan_ctx->hdd_remain_on_chan_timer,
                        wait);
-
-                mutex_unlock(&pHddCtx->roc_lock);
-
-                hddLog(VOS_TRACE_LEVEL_INFO,
-                   "action frame: extending the wait time %u",
-                   wait);
-
                 if ( status != VOS_STATUS_SUCCESS )
                 {
                     hddLog( LOGE, "Remain on Channel timer start failed");
                 }
+
+                hddLog(VOS_TRACE_LEVEL_INFO,
+                   "action frame: extending the wait time %u",
+                   wait);
+                mutex_unlock(&pHddCtx->roc_lock);
                 goto send_frame;
             }
             else
@@ -1551,12 +1266,13 @@
 
         vos_mem_copy( cfgState->buf, buf, len);
 
-        mutex_lock(&pHddCtx->roc_lock);
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
         if( cfgState->remain_on_chan_ctx )
         {
+            mutex_lock(&pHddCtx->roc_lock);
             cfgState->action_cookie = cfgState->remain_on_chan_ctx->cookie;
             *cookie = cfgState->action_cookie;
+            mutex_unlock(&pHddCtx->roc_lock);
         }
         else
         {
@@ -1566,7 +1282,6 @@
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
         }
 #endif
-        mutex_unlock(&pHddCtx->roc_lock);
     }
 
     if ( (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
@@ -1604,8 +1319,8 @@
         }
     }
     else if( ( WLAN_HDD_SOFTAP== pAdapter->device_mode ) ||
-            ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
-           )
+              ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
+            )
      {
         if( VOS_STATUS_SUCCESS !=
              WLANSAP_SendAction( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
@@ -1633,14 +1348,10 @@
                             pAdapter->dev,
 #endif
                             *cookie, buf, len, FALSE, GFP_KERNEL );
-    EXIT();
     return 0;
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-int wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
-                     struct cfg80211_mgmt_tx_params *params, u64 *cookie)
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
 int wlan_hdd_mgmt_tx( struct wiphy *wiphy, struct wireless_dev *wdev,
                      struct ieee80211_channel *chan, bool offchan,
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
@@ -1674,12 +1385,7 @@
     int ret;
 
     vos_ssr_protect(__func__);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-    ret =  __wlan_hdd_mgmt_tx(wiphy, wdev, params->chan, params->offchan,
-                              params->wait, params->buf, params->len,
-                              params->no_cck, params->dont_wait_for_ack,
-                              cookie);
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
     ret =  __wlan_hdd_mgmt_tx(wiphy, wdev,
                               chan, offchan,
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
@@ -1771,25 +1477,11 @@
 
     cfgState->actionFrmState = HDD_IDLE;
 
+    hddLog( LOG1, "Send Action cnf, actionSendSuccess %d", actionSendSuccess);
     if( NULL == cfgState->buf )
     {
         return;
     }
-    if (cfgState->is_go_neg_ack_received)
-    {
-        cfgState->is_go_neg_ack_received = 0;
-        /* Sometimes its possible that host may receive the ack for GO
-         * negotiation req after sending go negotaition confirmation,
-         * in such case drop the ack received for the go negotiation
-         * request, so that supplicant waits for the confirmation ack
-         * from firmware.
-         */
-        hddLog( LOG1, FL("Drop the pending ack received in cfgState->actionFrmState %d"),
-                cfgState->actionFrmState);
-        return;
-    }
-
-    hddLog( LOG1, "Send Action cnf, actionSendSuccess %d", actionSendSuccess);
 
     /* If skb is NULL it means this packet was received on CFG80211 interface
      * else it was received on Monitor interface */
@@ -1880,7 +1572,7 @@
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                "%s: P2P_SET GO NoA: fail to read param "
-               "count=%d duration=%d interval=%d ",
+               "count=%d duration=%d interval=%d \n",
                 __func__, count, start_time, duration);
         return -EINVAL;
     }
@@ -1966,7 +1658,7 @@
     {
         VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  "%s: P2P_SET GO PS: fail to read param "
-                 " legacy_ps=%d opp_ps=%d ctwindow=%d ",
+                 " legacy_ps=%d opp_ps=%d ctwindow=%d \n",
                  __func__, legacy_ps, opp_ps, ctwindow);
         return -EINVAL;
     }
@@ -2124,12 +1816,13 @@
     hdd_adapter_t *pAdapter = NULL;
     hdd_scaninfo_t *pScanInfo = NULL;
     int ret = 0;
-
     ENTER();
 
     ret = wlan_hdd_validate_context(pHddCtx);
     if (0 != ret)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
        return ERR_PTR(-EINVAL);
 #else
@@ -2193,19 +1886,6 @@
         return -EINVAL;
 #endif
     }
-
-    if ((type == NL80211_IFTYPE_P2P_CLIENT) ||
-          (type == NL80211_IFTYPE_P2P_GO))
-    {
-        /* Below function Notifies Mode change and
-         * If p2p session is detected then invokes functionality to
-         * Teardown TDLS links and disable offchannel if any. Since
-         * TDLS is not supported in case of concurrency.
-         */
-        hddLog(LOG1, FL("Interface type = %d"), type);
-        hdd_tdls_notify_mode_change(pAdapter, pHddCtx);
-    }
-
     EXIT();
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
     return pAdapter->dev->ieee80211_ptr;
@@ -2271,7 +1951,6 @@
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
     hdd_adapter_t *pVirtAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     int status;
-
     ENTER();
 
     MTRACE(vos_trace(VOS_MODULE_ID_HDD,
@@ -2284,6 +1963,8 @@
 
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -2379,9 +2060,7 @@
      skb->ip_summed = CHECKSUM_NONE;
 #ifdef WLAN_OPEN_SOURCE
 #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-     vos_wake_lock_timeout_release(&pHddCtx->rx_wake_lock,
-                                   HDD_WAKE_LOCK_DURATION,
-                                   WIFI_POWER_EVENT_WAKELOCK_HOLD_RX);
+     wake_lock_timeout(&pHddCtx->rx_wake_lock, msecs_to_jiffies(HDD_WAKE_LOCK_DURATION));
 #endif
 #endif
      rxstat = netif_rx_ni(skb);
@@ -2395,12 +2074,12 @@
      return ;
 }
 
-void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter,
+void hdd_indicateMgmtFrame( hdd_adapter_t *pAdapter,
                             tANI_U32 nFrameLength,
                             tANI_U8* pbFrames,
                             tANI_U8 frameType,
                             tANI_U32 rxChan,
-                            tANI_S8 rxRssi)
+                            tANI_S8 rxRssi )
 {
     tANI_U16 freq;
     tANI_U16 extend_time;
@@ -2413,8 +2092,8 @@
     VOS_STATUS status;
     hdd_remain_on_chan_ctx_t* pRemainChanCtx = NULL;
 
-    hddLog(VOS_TRACE_LEVEL_INFO, FL("Frame Type = %d Frame Length = %d"),
-                     frameType, nFrameLength);
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d",
+            __func__, frameType, nFrameLength);
 
     if (NULL == pAdapter)
     {
@@ -2506,6 +2185,7 @@
     }
 
     cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
+    pRemainChanCtx = cfgState->remain_on_chan_ctx;
 
     if ((type == SIR_MAC_MGMT_FRAME) &&
         (subType == SIR_MAC_MGMT_ACTION))
@@ -2552,9 +2232,6 @@
                     }
                 }
 #endif
-             mutex_lock(&pHddCtx->roc_lock);
-             pRemainChanCtx = cfgState->remain_on_chan_ctx;
-
              if (pRemainChanCtx != NULL && VOS_TIMER_STATE_RUNNING
                                  == vos_timer_getCurrentState(&pRemainChanCtx->hdd_remain_on_chan_timer))
              {
@@ -2573,12 +2250,8 @@
                               extend_time = ACTION_FRAME_DEFAULT_WAIT;
                       if (completion_done(&pAdapter->rem_on_chan_ready_event))
                       {
-                          if(!VOS_IS_STATUS_SUCCESS(vos_timer_stop(
-                                   &pRemainChanCtx->hdd_remain_on_chan_timer)))
-                          {
-                              hddLog( LOGE, FL(
-                                    "Failed to stop hdd_remain_on_chan_timer"));
-                          }
+                          vos_timer_stop(
+                                    &pRemainChanCtx->hdd_remain_on_chan_timer);
                           status = vos_timer_start(
                                      &pRemainChanCtx->hdd_remain_on_chan_timer,
                                      extend_time);
@@ -2609,40 +2282,34 @@
                                       "Frames are pending. dropping frame !!!",
                                       __func__);
                           }
-                          mutex_unlock(&pHddCtx->roc_lock);
                           return;
                       }
                  }
              }
              if (pRemainChanCtx != NULL &&
-                  vos_timer_is_initialized(
-                     &cfgState->remain_on_chan_ctx->hdd_remain_on_chan_timer) &&
                   VOS_TIMER_STATE_RUNNING != vos_timer_getCurrentState(
                       &cfgState->remain_on_chan_ctx->hdd_remain_on_chan_timer))
                  hddLog( LOG1, "%s:"
                          "Rcvd action frame after timer expired ", __func__);
 
-             mutex_unlock(&pHddCtx->roc_lock);
-
              if (((actionFrmType == WLAN_HDD_PROV_DIS_RESP) &&
                    (cfgState->actionFrmState == HDD_PD_REQ_ACK_PENDING)) ||
                   ((actionFrmType == WLAN_HDD_GO_NEG_RESP) &&
                    (cfgState->actionFrmState == HDD_GO_NEG_REQ_ACK_PENDING)))
              {
-                 hddLog(LOG1, "%s: ACK_PENDING and But received RESP for Action frame ",
+                  hddLog(LOG1, "%s: ACK_PENDING and But received RESP for Action frame ",
                          __func__);
-                 cfgState->is_go_neg_ack_received = 1;
-
-                 hdd_sendActionCnf(pAdapter, TRUE);
-             }
+                  hdd_sendActionCnf(pAdapter, TRUE);
+                }
             }
 #ifdef FEATURE_WLAN_TDLS
             else if(pbFrames[WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET+1] == WLAN_HDD_PUBLIC_ACTION_TDLS_DISC_RESP)
             {
                 u8 *mac = &pbFrames[WLAN_HDD_80211_FRM_DA_OFFSET+6];
-                hddLog(VOS_TRACE_LEVEL_INFO,"[TDLS] TDLS Discovery Response," MAC_ADDRESS_STR " RSSI[%d] <--- OTA",
+#ifdef WLAN_FEATURE_TDLS_DEBUG
+                hddLog(VOS_TRACE_LEVEL_ERROR,"[TDLS] TDLS Discovery Response," MAC_ADDRESS_STR " RSSI[%d] <--- OTA",
                  MAC_ADDR_ARRAY(mac),rxRssi);
-
+#endif
                 wlan_hdd_tdls_set_rssi(pAdapter, mac, rxRssi);
                 wlan_hdd_tdls_recv_discovery_resp(pAdapter, mac);
             }
@@ -2658,25 +2325,22 @@
                                 pScanInfo->sessionId,
                                 eCSR_SCAN_ABORT_DEFAULT);
          }
-
+#ifdef WLAN_FEATURE_TDLS_DEBUG
         if(pbFrames[WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET] == WLAN_HDD_TDLS_ACTION_FRAME)
         {
             actionFrmType = pbFrames[WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET+1];
             if(actionFrmType >= MAX_TDLS_ACTION_FRAME_TYPE)
             {
-                hddLog(VOS_TRACE_LEVEL_INFO,"[TDLS] Action type[%d] <--- OTA",
+                hddLog(VOS_TRACE_LEVEL_ERROR,"[TDLS] unknown[%d] <--- OTA",
                                                             actionFrmType);
             }
             else
             {
-                hddLog(VOS_TRACE_LEVEL_INFO,"[TDLS] %s <--- OTA",
+                hddLog(VOS_TRACE_LEVEL_ERROR,"[TDLS] %s <--- OTA",
                     tdls_action_frame_type[actionFrmType]);
             }
-            vos_tdls_tx_rx_mgmt_event(SIR_MAC_ACTION_TDLS,
-              SIR_MAC_ACTION_RX, SIR_MAC_MGMT_ACTION,
-              actionFrmType, &pbFrames[WLAN_HDD_80211_FRM_DA_OFFSET+6]);
         }
-
+#endif
         if((pbFrames[WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET] == WLAN_HDD_QOS_ACTION_FRAME)&&
              (pbFrames[WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET+1] == WLAN_HDD_QOS_MAP_CONFIGURE) )
         {
@@ -2687,13 +2351,8 @@
 
     //Indicate Frame Over Normal Interface
     hddLog( LOG1, FL("Indicate Frame over NL80211 Interface"));
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-    cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, freq, 0, pbFrames,
-                     nFrameLength, NL80211_RXMGMT_FLAG_ANSWERED);
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
-    cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, freq, 0, pbFrames,
-                     nFrameLength, NL80211_RXMGMT_FLAG_ANSWERED, GFP_ATOMIC);
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
     cfg80211_rx_mgmt( pAdapter->dev->ieee80211_ptr, freq, 0,
                       pbFrames, nFrameLength,
                       GFP_ATOMIC );
@@ -2820,9 +2479,7 @@
     memset( skb->cb, 0, sizeof( skb->cb ) );
 #ifdef WLAN_OPEN_SOURCE
 #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-    vos_wake_lock_timeout_release(&pHddCtx->rx_wake_lock,
-                                  HDD_WAKE_LOCK_DURATION,
-                                  WIFI_POWER_EVENT_WAKELOCK_HOLD_RX);
+    wake_lock_timeout(&pHddCtx->rx_wake_lock, msecs_to_jiffies(HDD_WAKE_LOCK_DURATION));
 #endif
 #endif
     if (in_interrupt())
@@ -2831,23 +2488,7 @@
         netif_rx_ni( skb );
 
     /* Enable Queues which we have disabled earlier */
-    hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
     netif_tx_start_all_queues( pAdapter->dev );
 
 }
 
-void __hdd_p2p_roc_work_queue(struct work_struct *work)
-{
-    hdd_adapter_t *pAdapter = container_of(to_delayed_work(work), hdd_adapter_t, roc_work);
-    hddLog( VOS_TRACE_LEVEL_INFO, FL("%s: "), __func__);
-    wlan_hdd_p2p_start_remain_on_channel(pAdapter);
-    return;
-}
-
-void hdd_p2p_roc_work_queue(struct work_struct *work)
-{
-    vos_ssr_protect(__func__);
-    __hdd_p2p_roc_work_queue(work);
-    vos_ssr_unprotect(__func__);
-    return;
-}
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_scan.c b/wlan/prima/CORE/HDD/src/wlan_hdd_scan.c
index 3cc5b1d..e31c1ce 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_scan.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_scan.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -31,6 +31,9 @@
 
   \brief WLAN Host Device Driver implementation
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -67,7 +70,7 @@
 
 #include <linux/wireless.h>
 #include <net/cfg80211.h>
-#include <vos_sched.h>
+
 
 #define WEXT_CSCAN_HEADER               "CSCAN S\x01\x00\x00S\x00"
 #define WEXT_CSCAN_HEADER_SIZE          12
@@ -514,7 +517,7 @@
    event.cmd = IWEVCUSTOM;
    p = custom;
    p += scnprintf(p, MAX_CUSTOM_LEN, " Age: %lu",
-                 vos_timer_get_system_time() - descriptor->nReceivedTime);
+                 vos_timer_get_system_ticks() - descriptor->nReceivedTime);
    event.u.data.length = p - custom;
    current_event = iwe_stream_add_point (scanInfo->info,current_event, end,
                                          &event, custom);
@@ -531,76 +534,6 @@
 
 /**---------------------------------------------------------------------------
 
-  \brief hdd_processSpoofMacAddrRequest() -
-
-   The function is called from scan completion callback and from
-   cfg80211 vendor command
-
-  \param  - pHddCtx - Pointer to the HDD Context.
-
-  \return - 0 for success, non zero for failure
-
-  --------------------------------------------------------------------------*/
-
-void __hdd_processSpoofMacAddrRequest(struct work_struct *work)
-{
-    hdd_context_t *pHddCtx =
-        container_of(to_delayed_work(work), hdd_context_t, spoof_mac_addr_work);
-
-    ENTER();
-
-    if (wlan_hdd_validate_context(pHddCtx))
-        return;
-
-    mutex_lock(&pHddCtx->spoofMacAddr.macSpoofingLock);
-
-    if (pHddCtx->spoofMacAddr.isEnabled) {
-        if (VOS_STATUS_SUCCESS != vos_randomize_n_bytes(
-                (void *)(&pHddCtx->spoofMacAddr.randomMacAddr.bytes[3]),
-                VOS_MAC_ADDR_LAST_3_BYTES)) {
-                pHddCtx->spoofMacAddr.isEnabled = FALSE;
-                mutex_unlock(&pHddCtx->spoofMacAddr.macSpoofingLock);
-                hddLog(LOGE, FL("Failed to generate random Mac Addr"));
-                return;
-        }
-    }
-
-    hddLog(LOG1, FL("New Mac Addr Generated "MAC_ADDRESS_STR),
-                 MAC_ADDR_ARRAY(pHddCtx->spoofMacAddr.randomMacAddr.bytes));
-
-    if (pHddCtx->scan_info.mScanPending != TRUE)
-    {
-        pHddCtx->spoofMacAddr.isReqDeferred = FALSE;
-        hddLog(LOG1, FL("Processing Spoof request now"));
-        /* Inform SME about spoof mac addr request*/
-        if ( eHAL_STATUS_SUCCESS != sme_SpoofMacAddrReq(pHddCtx->hHal,
-                &pHddCtx->spoofMacAddr.randomMacAddr))
-        {
-            hddLog(LOGE, FL("Sending Spoof request failed - Disable spoofing"));
-            pHddCtx->spoofMacAddr.isEnabled = FALSE;
-        }
-    } else
-    {
-        hddLog(LOG1, FL("Scan in Progress. Spoofing Deferred"));
-        pHddCtx->spoofMacAddr.isReqDeferred = TRUE;
-    }
-
-    mutex_unlock(&pHddCtx->spoofMacAddr.macSpoofingLock);
-
-    EXIT();
-
-    return;
-}
-
-void hdd_processSpoofMacAddrRequest(struct work_struct *work)
-{
-    vos_ssr_protect(__func__);
-    __hdd_processSpoofMacAddrRequest(work);
-    vos_ssr_unprotect(__func__);
-}
-
-/**---------------------------------------------------------------------------
-
   \brief hdd_ScanRequestCallback() -
 
    The sme module calls this callback function once it finish the scan request
@@ -667,7 +600,7 @@
 
 /**---------------------------------------------------------------------------
 
-  \brief __iw_set_scan() -
+  \brief iw_set_scan() -
 
    This function process the scan request from the wpa_supplicant
    and set the scan request to the SME
@@ -681,43 +614,21 @@
   --------------------------------------------------------------------------*/
 
 
-int __iw_set_scan(struct net_device *dev, struct iw_request_info *info,
+int iw_set_scan(struct net_device *dev, struct iw_request_info *info,
                  union iwreq_data *wrqu, char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   hdd_wext_state_t *pwextBuf;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev) ;
+   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+   hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
    tCsrScanRequest scanRequest;
    v_U32_t scanId = 0;
    eHalStatus status = eHAL_STATUS_SUCCESS;
    struct iw_scan_req *scanReq = (struct iw_scan_req *)extra;
-   int ret = 0;
 
    ENTER();
 
    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: enter !!!",__func__);
 
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-   pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-   if (NULL == pwextBuf)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: pwextBuf is NULL",__func__);
-       return -EINVAL;
-   }
 #ifdef WLAN_BTAMP_FEATURE
    //Scan not supported when AMP traffic is on.
    if( VOS_TRUE == WLANBAP_AmpSessionOn() ) 
@@ -732,6 +643,10 @@
        return eHAL_STATUS_SUCCESS;
    }
 
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+      return eHAL_STATUS_SUCCESS;
+   }
    vos_mem_zero( &scanRequest, sizeof(scanRequest));
 
    if (NULL != wrqu->data.pointer)
@@ -752,8 +667,7 @@
 
       if (wrqu->data.flags & IW_SCAN_THIS_ESSID)  {
 
-          if(scanReq->essid_len  &&
-               (scanReq->essid_len <= SIR_MAC_MAX_SSID_LENGTH)) {
+          if(scanReq->essid_len) {
               scanRequest.SSIDs.numOfSSIDs = 1;
               scanRequest.SSIDs.SSIDList =( tCsrSSIDInfo *)vos_mem_malloc(sizeof(tCsrSSIDInfo));
               if(scanRequest.SSIDs.SSIDList) {
@@ -767,10 +681,6 @@
                 VOS_ASSERT(0);
               }
           }
-          else
-          {
-            hddLog(LOGE, FL("Invalid essid length : %d"), scanReq->essid_len);
-          }
       }
 
        /* set min and max channel time */
@@ -837,24 +747,7 @@
        scanRequest.uIEFieldLen = pHddCtx->scan_info.scanAddIE.length;
        scanRequest.pIEField = pHddCtx->scan_info.scanAddIE.addIEdata;
    }
-   if (pHddCtx->spoofMacAddr.isEnabled &&
-       pHddCtx->cfg_ini->enableMacSpoofing == 1)
-   {
-        hddLog(LOG1, FL("MAC Spoofing enabled for current scan"));
-        /*
-         * Updating SelfSta Mac Addr in TL which will be used to get
-         * staidx to fill TxBds for probe request during current scan
-         */
-        status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext,
-             &pHddCtx->spoofMacAddr.randomMacAddr,
-             &pAdapter->macAddressCurrent);
 
-        if (status != eHAL_STATUS_SUCCESS)
-        {
-           hddLog(LOGE, FL("Failed to update MAC Spoof Addr in TL"));
-           goto error;
-        }
-   }
    status = sme_ScanRequest( (WLAN_HDD_GET_CTX(pAdapter))->hHal, pAdapter->sessionId,&scanRequest, &scanId, &hdd_ScanRequestCallback, dev ); 
    if (!HAL_STATUS_SUCCESS(status))
    {
@@ -872,24 +765,14 @@
        vos_mem_free(scanRequest.SSIDs.SSIDList);
 
    EXIT();
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit !!!",__func__);
    return status;
 }
 
-int iw_set_scan(struct net_device *dev, struct iw_request_info *info,
-                union iwreq_data *wrqu, char *extra)
-{
-   int ret;
-
-   vos_ssr_protect(__func__);
-   ret = __iw_set_scan(dev, info, wrqu, extra);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
 /**---------------------------------------------------------------------------
 
-  \brief __iw_get_scan() -
+  \brief iw_get_scan() -
 
    This function returns the scan results to the wpa_supplicant
 
@@ -902,50 +785,34 @@
   --------------------------------------------------------------------------*/
 
 
-int __iw_get_scan(struct net_device *dev,
-                struct iw_request_info *info,
-                union iwreq_data *wrqu, char *extra)
+int iw_get_scan(struct net_device *dev,
+                         struct iw_request_info *info,
+                         union iwreq_data *wrqu, char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   tHalHandle hHal;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev) ;
+   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+   tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
    tCsrScanResultInfo *pScanResult;
    eHalStatus status = eHAL_STATUS_SUCCESS;
    hdd_scan_info_t scanInfo;
    tScanResultHandle pResult;
-   int i = 0, ret = 0;
+   int i = 0;
 
-   ENTER();
    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: enter buffer length %d!!!",
        __func__, (wrqu->data.length)?wrqu->data.length:IW_SCAN_MAX_DATA);
-
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-   hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-   if (NULL == hHal)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Hal Context is NULL",__func__);
-       return -EINVAL;
-   }
+   ENTER();
 
    if (TRUE == pHddCtx->scan_info.mScanPending)
    {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:mScanPending is TRUE !!!",__func__);
        return -EAGAIN;
    }
+
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+      return -EAGAIN;
+   }
+
    scanInfo.dev = dev;
    scanInfo.start = extra;
    scanInfo.info = info;
@@ -964,7 +831,7 @@
    if (NULL == pResult)
    {
        // no scan results
-       hddLog(LOG1,"__iw_get_scan: NULL Scan Result ");
+       hddLog(LOG1,"iw_get_scan: NULL Scan Result ");
        return 0;
    }
 
@@ -983,24 +850,11 @@
 
    sme_ScanResultPurge(hHal, pResult);
 
-   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit total %d BSS reported !!!",__func__, i);
    EXIT();
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit total %d BSS reported !!!",__func__, i);
    return status;
 }
 
-int iw_get_scan(struct net_device *dev,
-                struct iw_request_info *info,
-                union iwreq_data *wrqu, char *extra)
-{
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __iw_get_scan(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
 #if 0
 static eHalStatus hdd_CscanRequestCallback(tHalHandle halHandle, void *pContext,
                          tANI_U32 scanId, eCsrScanStatus status)
@@ -1323,10 +1177,9 @@
 }
 
 /* Abort any MAC scan if in progress */
-tSirAbortScanStatus hdd_abort_mac_scan(hdd_context_t* pHddCtx,
-                                       tANI_U8 sessionId,
-                                       eCsrAbortReason reason)
+void hdd_abort_mac_scan(hdd_context_t* pHddCtx, tANI_U8 sessionId,
+                        eCsrAbortReason reason)
 {
-    return sme_AbortMacScan(pHddCtx->hHal, sessionId, reason);
+    sme_AbortMacScan(pHddCtx->hHal, sessionId, reason);
 }
 
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_softap_tx_rx.c b/wlan/prima/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
index 6e02ec3..ddd1616 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -30,6 +30,9 @@
   \file  wlan_hdd_softap_tx_rx.c
   
   \brief Linux HDD Tx/RX APIs
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
   
   ==========================================================================*/
 
@@ -46,7 +49,6 @@
 #include <linux/etherdevice.h>
 //#include <vos_list.h>
 #include <vos_types.h>
-#include <vos_sched.h>
 #include <aniGlobal.h>
 #include <halTypes.h>
 #include <net/ieee80211_radiotap.h>
@@ -56,9 +58,8 @@
 #else
 #include <mach/subsystem_restart.h>
 #endif
-#include "sapInternal.h"
-#include  "wlan_hdd_trace.h"
-#include "vos_diag_core_event.h"
+
+
 /*--------------------------------------------------------------------------- 
   Preprocessor definitions and constants
   -------------------------------------------------------------------------*/ 
@@ -96,8 +97,6 @@
 #define HDD_SAP_TX_TIMEOUT_RATELIMIT_BURST    1
 #define HDD_SAP_TX_STALL_SSR_THRESHOLD        5
 #define HDD_SAP_TX_STALL_RECOVERY_THRESHOLD HDD_SAP_TX_STALL_SSR_THRESHOLD - 2
-#define HDD_SAP_TX_STALL_FATAL_EVENT_THRESHOLD    2
-
 
 static DEFINE_RATELIMIT_STATE(hdd_softap_tx_timeout_rs,                 \
                               HDD_SAP_TX_TIMEOUT_RATELIMIT_INTERVAL,    \
@@ -116,10 +115,11 @@
    hdd_context_t *pHddCtx = (hdd_context_t *)pUsrData;
    v_TIME_t       currentTS;
 
-   ENTER();
-   if (0 != (wlan_hdd_validate_context(pHddCtx)))
+   if (NULL == pHddCtx)
    {
-       return;
+      VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
+              "%s: Invalid user data, context", __func__);
+      return;
    }
 
    currentTS = vos_timer_get_system_time();
@@ -137,7 +137,6 @@
                       pHddCtx->cfg_ini->trafficIdleTimeout);
    }
 
-   EXIT();
    return;
 }
 
@@ -147,10 +146,12 @@
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     VOS_STATUS status = VOS_STATUS_SUCCESS;
 
-    ENTER();
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (0 != status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -177,8 +178,6 @@
         VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
                   "%s  Traffic Monitor is not Enable in ini file", __func__);
     }
-
-    EXIT();
     return status;
 }
 
@@ -187,10 +186,12 @@
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     VOS_STATUS status = VOS_STATUS_SUCCESS;
 
-    ENTER();
     status = wlan_hdd_validate_context(pHddCtx);
+
     if (-ENODEV == status)
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: HDD context is not valid", __func__);
         return status;
     }
 
@@ -209,7 +210,6 @@
         vos_lock_destroy(&pHddCtx->traffic_monitor.trafficLock);
         pHddCtx->traffic_monitor.isInitialized = 0;
     }
-    EXIT();
     return VOS_STATUS_SUCCESS;
 }
 
@@ -229,28 +229,20 @@
    skb_list_node_t *pktNode = NULL;
    struct sk_buff *skb = NULL;
 
-   v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-   ptSapContext pSapCtx = NULL;
-   pSapCtx = VOS_GET_SAP_CB(pVosContext);
-   if(pSapCtx == NULL){
-       VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-            FL("psapCtx is NULL"));
-       return VOS_STATUS_E_FAULT;
-   }
-   spin_lock_bh( &pSapCtx->staInfo_lock );
+   spin_lock_bh( &pAdapter->staInfo_lock );
    for (STAId = 0; STAId < WLAN_MAX_STA_COUNT; STAId++)
    {
-      if (FALSE == pSapCtx->aStaInfo[STAId].isUsed)
+      if (FALSE == pAdapter->aStaInfo[STAId].isUsed)
       {
          continue;
       }
 
       for (i = 0; i < NUM_TX_QUEUES; i ++)
       {
-         spin_lock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[i].lock);
+         spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i].lock);
          while (true) 
          {
-            status = hdd_list_remove_front ( &pSapCtx->aStaInfo[STAId].wmm_tx_queue[i], &anchor);
+            status = hdd_list_remove_front ( &pAdapter->aStaInfo[STAId].wmm_tx_queue[i], &anchor);
 
             if (VOS_STATUS_E_EMPTY != status)
             {
@@ -267,52 +259,17 @@
             //current list is empty
             break;
          }
-         pSapCtx->aStaInfo[STAId].txSuspended[i] = VOS_FALSE;
-         spin_unlock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[i].lock);
+         pAdapter->aStaInfo[STAId].txSuspended[i] = VOS_FALSE;
+         spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i].lock);
       }
-      pSapCtx->aStaInfo[STAId].vosLowResource = VOS_FALSE;
+      pAdapter->aStaInfo[STAId].vosLowResource = VOS_FALSE;
    }
 
-   spin_unlock_bh( &pSapCtx->staInfo_lock );
+   spin_unlock_bh( &pAdapter->staInfo_lock );
 
    return status;
 }
 
-/**
- * hdd_softap_get_connected_sta() -  provide number of connected STA
- * @pHostapdAdapter: pAdapter for SAP
- *
- * This function is invoked for SAP mode to get connected STA.
- *
- * Return:  Total number of connected STA to SAP.
- */
-v_U8_t hdd_softap_get_connected_sta(hdd_adapter_t *pHostapdAdapter)
-{
-    v_U8_t i, sta_ct = 0;
-    v_CONTEXT_t pVosContext = NULL;
-    ptSapContext pSapCtx = NULL;
-
-    pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
-    pSapCtx = VOS_GET_SAP_CB(pVosContext);
-    if (pSapCtx == NULL) {
-        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                 FL("psapCtx is NULL"));
-        goto error;
-    }
-
-    spin_lock_bh(&pSapCtx->staInfo_lock);
-    // get stations associated with SAP
-    for (i = 0; i < WLAN_MAX_STA_COUNT; i++) {
-        if (pSapCtx->aStaInfo[i].isUsed &&
-                  (!vos_is_macaddr_broadcast(&pSapCtx->aStaInfo[i].macAddrSTA)))
-               sta_ct++;
-    }
-    spin_unlock_bh( &pSapCtx->staInfo_lock );
-
-error:
-    return sta_ct;
-}
-
 /**============================================================================
   @brief hdd_softap_hard_start_xmit() - Function registered with the Linux OS for 
   transmitting packets. There are 2 versions of this function. One that uses
@@ -341,26 +298,6 @@
    //Extract the destination address from ethernet frame
    v_MACADDR_t *pDestMacAddress = (v_MACADDR_t*)skb->data;
    int os_status = NETDEV_TX_OK; 
-   struct sk_buff *skb1;
-
-   v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-   ptSapContext pSapCtx = NULL;
-   pSapCtx = VOS_GET_SAP_CB(pVosContext);
-   if(pSapCtx == NULL){
-       VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-             FL("psapCtx is NULL"));
-       ++pAdapter->stats.tx_dropped;
-       ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
-       kfree_skb(skb);
-       return os_status;
-   }
-
-   if (pHddCtx == NULL)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-            FL("pHddCtx is NULL"));
-      goto xmit_done;
-   }
 
    pDestMacAddress = (v_MACADDR_t*)skb->data;
    
@@ -369,7 +306,7 @@
    VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
               "%s: enter", __func__);
 
-   spin_lock_bh( &pSapCtx->staInfo_lock );
+   spin_lock_bh( &pAdapter->staInfo_lock );
    if (vos_is_macaddr_broadcast( pDestMacAddress ) || vos_is_macaddr_group(pDestMacAddress))
    {
       //The BC/MC station ID is assigned during BSS starting phase. SAP will return the station 
@@ -385,7 +322,7 @@
    }
    else
    {
-      STAId = hdd_sta_id_find_from_mac_addr(pAdapter, pDestMacAddress);
+      STAId = *(v_U8_t *)(((v_U8_t *)(skb->data)) - 1);
       if (STAId == HDD_WLAN_INVALID_STA_ID)
       {
          VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_WARN,
@@ -395,7 +332,7 @@
          kfree_skb(skb);
          goto xmit_done;
       }
-      else if (FALSE == pSapCtx->aStaInfo[STAId].isUsed )
+      else if (FALSE == pAdapter->aStaInfo[STAId].isUsed )
       {
          VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_WARN,
                     "%s: STA %d is unregistered", __func__, STAId);
@@ -405,8 +342,8 @@
          goto xmit_done;
       }
 
-      if ( (WLANTL_STA_CONNECTED != pSapCtx->aStaInfo[STAId].tlSTAState) &&
-         (WLANTL_STA_AUTHENTICATED != pSapCtx->aStaInfo[STAId].tlSTAState) )
+      if ( (WLANTL_STA_CONNECTED != pAdapter->aStaInfo[STAId].tlSTAState) && 
+           (WLANTL_STA_AUTHENTICATED != pAdapter->aStaInfo[STAId].tlSTAState) )
       {
          VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_WARN,
                     "%s: Station not connected yet", __func__);
@@ -415,7 +352,7 @@
          kfree_skb(skb);
          goto xmit_done;
       }
-      else if(WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[STAId].tlSTAState)
+      else if(WLANTL_STA_CONNECTED == pAdapter->aStaInfo[STAId].tlSTAState)
       {
         if(ntohs(skb->protocol) != HDD_ETHERTYPE_802_1_X)
         {
@@ -439,47 +376,40 @@
    VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
               "%s: Classified as ac %d up %d", __func__, ac, up);
 
-   if (( NULL != pHddCtx ) &&
-         (pHddCtx->cfg_ini->gEnableDebugLog & VOS_PKT_PROTO_TYPE_DHCP))
+   if ( ( NULL != pHddCtx ) && pHddCtx->cfg_ini->enableDhcpDebug )
    {
        hdd_dump_dhcp_pkt(skb, TX_PATH);
    }
 
    // If the memory differentiation mode is enabled, the memory limit of each queue will be 
    // checked. Over-limit packets will be dropped.
-    spin_lock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
-    hdd_list_size(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac], &pktListSize);
+    spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+    hdd_list_size(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &pktListSize);
     if(pktListSize >= pAdapter->aTxQueueLimit[ac])
     {
        VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_WARN,
             "%s: station %d ac %d queue over limit %d", __func__, STAId, ac, pktListSize);
-       ++pAdapter->hdd_stats.hddTxRxStats.txXmitBackPressured;
-       ++pAdapter->hdd_stats.hddTxRxStats.txXmitBackPressuredAC[ac];
-       pSapCtx->aStaInfo[STAId].txSuspended[ac] = VOS_TRUE;
+       pAdapter->aStaInfo[STAId].txSuspended[ac] = VOS_TRUE;
        netif_stop_subqueue(dev, skb_get_queue_mapping(skb));
        txSuspended = VOS_TRUE;
-       MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_STOP_NETDEV,
-                        pAdapter->sessionId, ac));
     }
 
     /* If 3/4th of the max queue size is used then enable the flag.
      * This flag indicates to place the DHCP packets in VOICE AC queue.*/
    if (WLANTL_AC_BE == ac)
    {
-      if (pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].count >= HDD_TX_QUEUE_LOW_WATER_MARK)
+      if (pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].count >= HDD_TX_QUEUE_LOW_WATER_MARK)
       {
-          if (!(pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].ratelimit_count % 0x40))
-              VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+          VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
                      "%s: TX queue for Best Effort AC is 3/4th full", __func__);
-          pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].ratelimit_count++;
-          pSapCtx->aStaInfo[STAId].vosLowResource = VOS_TRUE;
+          pAdapter->aStaInfo[STAId].vosLowResource = VOS_TRUE;
       }
       else
       {
-          pSapCtx->aStaInfo[STAId].vosLowResource = VOS_FALSE;
+          pAdapter->aStaInfo[STAId].vosLowResource = VOS_FALSE;
       }
    }
-   spin_unlock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+   spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
 
    if (VOS_TRUE == txSuspended)
    {
@@ -501,9 +431,10 @@
 
    INIT_LIST_HEAD(&pktNode->anchor);
 
-   spin_lock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
-   status = hdd_list_insert_back_size(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac], &pktNode->anchor, &pktListSize );
-   spin_unlock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+   spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+   status = hdd_list_insert_back_size(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &pktNode->anchor, &pktListSize );
+   spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+
    if ( !VOS_IS_STATUS_SUCCESS( status ) )
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_WARN,
@@ -532,23 +463,13 @@
 
          //Remove the packet from queue. It must be at the back of the queue, as TX thread cannot preempt us in the middle
          //as we are in a soft irq context. Also it must be the same packet that we just allocated.
-         spin_lock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
-         status = hdd_list_remove_back( &pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac], &anchor);
-         spin_unlock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
-         /* Free the skb only if we are able to remove it from the list.
-          * If we are not able to retrieve it from the list it means that
-          * the skb was pulled by TX Thread and is use so we should not free
-          * it here
-          */
-         if (VOS_IS_STATUS_SUCCESS(status))
-         {
-            pktNode = list_entry(anchor, skb_list_node_t, anchor);
-            skb1 = pktNode->skb;
-            kfree_skb(skb1);
-         }
+         spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+         status = hdd_list_remove_back( &pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &anchor);
+         spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
          ++pAdapter->stats.tx_dropped;
          ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
          ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
+         kfree_skb(skb);
          goto xmit_done;
       }
    }
@@ -558,7 +479,7 @@
               "%s: exit", __func__);
 
 xmit_done:
-   spin_unlock_bh( &pSapCtx->staInfo_lock );
+   spin_unlock_bh( &pAdapter->staInfo_lock );
    return os_status;
 }
 
@@ -584,25 +505,14 @@
    hdd_adapter_t *pAdapter = (hdd_adapter_t *)netdev_priv(dev);
    v_U8_t ac;
    vos_list_node_t *anchor = NULL;
-   struct sk_buff *skb1;
 
-   v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-   ptSapContext pSapCtx = NULL;
-   pSapCtx = VOS_GET_SAP_CB(pVosContext);
-   if(pSapCtx == NULL){
-       VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-             FL("psapCtx is NULL"));
-       kfree_skb(skb);
-       status = VOS_STATUS_E_FAILURE;
-       return status;
-   }
    ++pAdapter->hdd_stats.hddTxRxStats.txXmitCalled;
 
    VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
               "%s: enter", __func__);
 
-   spin_lock_bh( &pSapCtx->staInfo_lock );
-   if ( FALSE == pSapCtx->aStaInfo[STAId].isUsed )
+   spin_lock_bh( &pAdapter->staInfo_lock );
+   if ( FALSE == pAdapter->aStaInfo[STAId].isUsed )
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_WARN,
                  "%s: STA %d is unregistered", __func__, STAId );
@@ -612,7 +522,7 @@
    }
 
    /* If the QoS is not enabled on the receiving station, then send it with BE priority */
-   if ( !pSapCtx->aStaInfo[STAId].isQosEnabled )
+   if ( !pAdapter->aStaInfo[STAId].isQosEnabled )
        up = SME_QOS_WMM_UP_BE;
 
    ac = hddWmmUpToAcMap[up];
@@ -633,9 +543,9 @@
 
    INIT_LIST_HEAD(&pktNode->anchor);
 
-   spin_lock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
-   hdd_list_size(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac], &pktListSize);
-   if(pSapCtx->aStaInfo[STAId].txSuspended[ac] ||
+   spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+   hdd_list_size(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &pktListSize);
+   if(pAdapter->aStaInfo[STAId].txSuspended[ac] ||
        pktListSize >= pAdapter->aTxQueueLimit[ac])
    {
        VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_WARN,
@@ -645,12 +555,12 @@
         * triggered in fetch cbk after recovery.
         */
        kfree_skb(skb);
-       spin_unlock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+       spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
        status = VOS_STATUS_E_FAILURE;
        goto xmit_end;
    }
-   status = hdd_list_insert_back_size(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac], &pktNode->anchor, &pktListSize );
-   spin_unlock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+   status = hdd_list_insert_back_size(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &pktNode->anchor, &pktListSize );
+   spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
 
    if ( !VOS_IS_STATUS_SUCCESS( status ) )
    {
@@ -681,23 +591,13 @@
 
          //Remove the packet from queue. It must be at the back of the queue, as TX thread cannot preempt us in the middle
          //as we are in a soft irq context. Also it must be the same packet that we just allocated.
-         spin_lock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
-         status = hdd_list_remove_back( &pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac], &anchor);
-         spin_unlock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
-         /* Free the skb only if we are able to remove it from the list.
-          * If we are not able to retrieve it from the list it means that
-          * the skb was pulled by TX Thread and is use so we should not free
-          * it here
-          */
-         if (VOS_IS_STATUS_SUCCESS(status))
-         {
-            pktNode = list_entry(anchor, skb_list_node_t, anchor);
-            skb1 = pktNode->skb;
-            kfree_skb(skb1);
-         }
+         spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+         status = hdd_list_remove_back( &pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &anchor);
+         spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
          ++pAdapter->stats.tx_dropped;
          ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
          ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
+         kfree_skb(skb);
          status = VOS_STATUS_E_FAILURE;
          goto xmit_end;
       }
@@ -706,24 +606,23 @@
    VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO_LOW, "%s: exit", __func__);
 
 xmit_end:
-   spin_unlock_bh( &pSapCtx->staInfo_lock );
+   spin_unlock_bh( &pAdapter->staInfo_lock );
    return status;
 }
 
 /**============================================================================
-  @brief __hdd_softap_tx_timeout() - Function called by OS if there is any
+  @brief hdd_softap_tx_timeout() - Function called by OS if there is any
   timeout during transmission. Since HDD simply enqueues packet
   and returns control to OS right away, this would never be invoked
 
   @param dev : [in] pointer to Libra network device
   @return    : None
   ===========================================================================*/
-void __hdd_softap_tx_timeout(struct net_device *dev)
+void hdd_softap_tx_timeout(struct net_device *dev)
 {
    hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
    struct netdev_queue *txq;
    int i = 0;
-   int status = 0;
    hdd_context_t *pHddCtx;
 
    VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
@@ -738,15 +637,15 @@
    }
 
    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   status = wlan_hdd_validate_context(pHddCtx);
-   if (status != 0)
-   {
+   if (pHddCtx->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                       "%s:LOGP in Progress. Ignore!!!",__func__);
        return;
    }
 
    ++pAdapter->hdd_stats.hddTxRxStats.txTimeoutCount;
 
-   for (i = 0; i < NUM_TX_QUEUES; i++)
+   for (i = 0; i < 8; i++)
    {
       txq = netdev_get_tx_queue(dev, i);
       VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
@@ -754,7 +653,7 @@
    }
 
    VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-             "carrier state: %d", netif_carrier_ok(dev));
+              "carrier state: %d", netif_carrier_ok(dev));
 
    ++pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount;
 
@@ -773,8 +672,6 @@
                 "%s: Cannot recover from Data stall Issue SSR",
                 __func__);
       WLANTL_FatalError();
-      // reset count after issuing the SSR
-      pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount = 0;
       return;
    }
 
@@ -789,48 +686,24 @@
       hdd_wmm_tx_snapshot(pAdapter);
       WLANTL_TLDebugMessage(WLANTL_DEBUG_TX_SNAPSHOT);
    }
-   /* Call fatal event if data stall is for
-    * HDD_TX_STALL_FATAL_EVENT_THRESHOLD times
-    */
-   if (HDD_SAP_TX_STALL_FATAL_EVENT_THRESHOLD ==
-       pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount)
-      vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                   WLAN_LOG_INDICATOR_HOST_DRIVER,
-                   WLAN_LOG_REASON_DATA_STALL,
-                   FALSE, TRUE);
+
 } 
 
-void hdd_softap_tx_timeout(struct net_device *dev)
-{
-   vos_ssr_protect(__func__);
-   __hdd_softap_tx_timeout(dev);
-   vos_ssr_unprotect(__func__);
-   return;
-}
 
 /**============================================================================
-  @brief __hdd_softap_stats() - Function registered with the Linux OS for
+  @brief hdd_softap_stats() - Function registered with the Linux OS for 
   device TX/RX statistic
 
   @param dev      : [in] pointer to Libra network device
   
   @return         : pointer to net_device_stats structure
   ===========================================================================*/
-struct net_device_stats* __hdd_softap_stats(struct net_device *dev)
+struct net_device_stats* hdd_softap_stats(struct net_device *dev)
 {
    hdd_adapter_t* priv = netdev_priv(dev);
    return &priv->stats;
 }
 
-struct net_device_stats* hdd_softap_stats(struct net_device *dev)
-{
-   struct net_device_stats *priv_stats;
-   vos_ssr_protect(__func__);
-   priv_stats = __hdd_softap_stats(dev);
-   vos_ssr_unprotect(__func__);
-
-   return priv_stats;
-}
 
 /**============================================================================
   @brief hdd_softap_init_tx_rx() - Init function to initialize Tx/RX
@@ -847,8 +720,6 @@
    v_SIZE_t size = 0;
 
    v_U8_t STAId = 0;
-   v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-   ptSapContext pSapCtx = NULL;
 
    v_U8_t pACWeights[] = {
                            HDD_SOFTAP_BK_WEIGHT_DEFAULT, 
@@ -856,13 +727,6 @@
                            HDD_SOFTAP_VI_WEIGHT_DEFAULT, 
                            HDD_SOFTAP_VO_WEIGHT_DEFAULT
                          };
-   pSapCtx = VOS_GET_SAP_CB(pVosContext);
-   if(pSapCtx == NULL){
-       VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-             FL("psapCtx is NULL"));
-       return VOS_STATUS_E_FAULT;
-   }
-
 
    pAdapter->isVosOutOfResource = VOS_FALSE;
    pAdapter->isVosLowResource = VOS_FALSE;
@@ -880,12 +744,14 @@
    pAdapter->aTxQueueLimit[WLANTL_AC_VI] = HDD_SOFTAP_TX_VI_QUEUE_MAX_LEN;
    pAdapter->aTxQueueLimit[WLANTL_AC_VO] = HDD_SOFTAP_TX_VO_QUEUE_MAX_LEN;
 
+   spin_lock_init( &pAdapter->staInfo_lock );
+
    for (STAId = 0; STAId < WLAN_MAX_STA_COUNT; STAId++)
    {
-      vos_mem_zero(&pSapCtx->aStaInfo[STAId], sizeof(hdd_station_info_t));
+      vos_mem_zero(&pAdapter->aStaInfo[STAId], sizeof(hdd_station_info_t));
       for (i = 0; i < NUM_TX_QUEUES; i ++)
       {
-         hdd_list_init(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN);
+         hdd_list_init(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN);
       }
    }
 
@@ -942,26 +808,18 @@
    skb_list_node_t *pktNode = NULL;
    struct sk_buff *skb = NULL;
 
-   v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-   ptSapContext pSapCtx = NULL;
-   pSapCtx = VOS_GET_SAP_CB(pVosContext);
-   if(pSapCtx == NULL){
-       VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-            FL("psapCtx is NULL"));
-       return VOS_STATUS_E_FAULT;
-   }
-   if (FALSE == pSapCtx->aStaInfo[STAId].isUsed)
+   if (FALSE == pAdapter->aStaInfo[STAId].isUsed)
    {
       return VOS_STATUS_SUCCESS;
    }
 
    for (i = 0; i < NUM_TX_QUEUES; i ++)
    {
-      spin_lock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[i].lock);
+      spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i].lock);
       while (true) 
       {
          if (VOS_STATUS_E_EMPTY !=
-              hdd_list_remove_front(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[i],
+              hdd_list_remove_front(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i],
                                     &anchor))
          {
             //If success then we got a valid packet from some AC
@@ -977,7 +835,7 @@
          //current list is empty
          break;
       }
-      spin_unlock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[i].lock);
+      spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i].lock);
    }
 
    return VOS_STATUS_SUCCESS;
@@ -996,50 +854,26 @@
 VOS_STATUS hdd_softap_init_tx_rx_sta( hdd_adapter_t *pAdapter, v_U8_t STAId, v_MACADDR_t *pmacAddrSTA)
 {
    v_U8_t i = 0;
-   VOS_STATUS status;
-   v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-   ptSapContext pSapCtx = NULL;
-
-   pSapCtx = VOS_GET_SAP_CB(pVosContext);
-   if(pSapCtx == NULL){
-       VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-            FL("psapCtx is NULL"));
-       return VOS_STATUS_E_FAULT;
-   }
-
-   spin_lock_bh( &pSapCtx->staInfo_lock );
-   if (pSapCtx->aStaInfo[STAId].isUsed)
+   spin_lock_bh( &pAdapter->staInfo_lock );
+   if (pAdapter->aStaInfo[STAId].isUsed)
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
                  "%s: Reinit station %d", __func__, STAId );
-      spin_unlock_bh( &pSapCtx->staInfo_lock );
+      spin_unlock_bh( &pAdapter->staInfo_lock );
       return VOS_STATUS_E_FAILURE;
    }
 
-   vos_mem_zero(&pSapCtx->aStaInfo[STAId], sizeof(hdd_station_info_t));
+   vos_mem_zero(&pAdapter->aStaInfo[STAId], sizeof(hdd_station_info_t));
    for (i = 0; i < NUM_TX_QUEUES; i ++)
    {
-      hdd_list_init(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN);
+      hdd_list_init(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN);
    }
 
-   pSapCtx->aStaInfo[STAId].isUsed = TRUE;
-   pSapCtx->aStaInfo[STAId].isDeauthInProgress = FALSE;
-   vos_copy_macaddr( &pSapCtx->aStaInfo[STAId].macAddrSTA, pmacAddrSTA);
+   pAdapter->aStaInfo[STAId].isUsed = TRUE;
+   pAdapter->aStaInfo[STAId].isDeauthInProgress = FALSE;
+   vos_copy_macaddr( &pAdapter->aStaInfo[STAId].macAddrSTA, pmacAddrSTA);
 
-   spin_unlock_bh( &pSapCtx->staInfo_lock );
-
-   status = hdd_sta_id_hash_add_entry(pAdapter, STAId, pmacAddrSTA);
-   if (status != VOS_STATUS_SUCCESS) {
-       VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-                 FL("Not able to add staid hash %d"), STAId);
-       return VOS_STATUS_E_FAILURE;
-   }
-
-   VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
-             FL("New station added sta_id %d mac:"
-             MAC_ADDRESS_STR), STAId,
-             MAC_ADDR_ARRAY(pmacAddrSTA->bytes));
-
+   spin_unlock_bh( &pAdapter->staInfo_lock );
    return VOS_STATUS_SUCCESS;
 }
 
@@ -1062,43 +896,21 @@
    hdd_hostapd_state_t *pHostapdState;
    v_U8_t i;
 
-   v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-   ptSapContext pSapCtx = NULL;
-   pSapCtx = VOS_GET_SAP_CB(pVosContext);
-   if(pSapCtx == NULL){
-       VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-             FL("psapCtx is NULL"));
-       return VOS_STATUS_E_FAULT;
-   }
    pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter);
 
-   spin_lock_bh( &pSapCtx->staInfo_lock );
-   if (FALSE == pSapCtx->aStaInfo[STAId].isUsed)
+   spin_lock_bh( &pAdapter->staInfo_lock );
+   if (FALSE == pAdapter->aStaInfo[STAId].isUsed)
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
                  "%s: Deinit station not inited %d", __func__, STAId );
-      spin_unlock_bh( &pSapCtx->staInfo_lock );
+      spin_unlock_bh( &pAdapter->staInfo_lock );
       return VOS_STATUS_E_FAILURE;
    }
 
    status = hdd_softap_flush_tx_queues_sta(pAdapter, STAId);
 
-   pSapCtx->aStaInfo[STAId].isUsed = FALSE;
-   pSapCtx->aStaInfo[STAId].isDeauthInProgress = FALSE;
-
-   status = hdd_sta_id_hash_remove_entry(pAdapter,
-                STAId, &pSapCtx->aStaInfo[STAId].macAddrSTA);
-   if (status != VOS_STATUS_SUCCESS) {
-       spin_unlock_bh( &pSapCtx->staInfo_lock );
-       VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-                 FL("Not able to remove staid hash %d"), STAId);
-       return VOS_STATUS_E_FAILURE;
-   }
-
-   VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
-             FL("station removed sta_id %d mac:"
-             MAC_ADDRESS_STR), STAId,
-             MAC_ADDR_ARRAY(pSapCtx->aStaInfo[STAId].macAddrSTA.bytes));
+   pAdapter->aStaInfo[STAId].isUsed = FALSE;
+   pAdapter->aStaInfo[STAId].isDeauthInProgress = FALSE;
 
    /* if this STA had any of its WMM TX queues suspended, then the
       associated queue on the network interface was disabled.  check
@@ -1112,17 +924,17 @@
       for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++)
       {
          tlAC = hdd_QdiscAcToTlAC[ac];
-         txSuspended[ac] = pSapCtx->aStaInfo[STAId].txSuspended[tlAC];
+         txSuspended[ac] = pAdapter->aStaInfo[STAId].txSuspended[tlAC];
       }
    }
-   vos_mem_zero(&pSapCtx->aStaInfo[STAId], sizeof(hdd_station_info_t));
+   vos_mem_zero(&pAdapter->aStaInfo[STAId], sizeof(hdd_station_info_t));
 
    /* re-init spin lock, since netdev can still open adapter until
     * driver gets unloaded
     */
    for (i = 0; i < NUM_TX_QUEUES; i ++)
    {
-      hdd_list_init(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[i],
+      hdd_list_init(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i],
                     HDD_TX_QUEUE_MAX_LEN);
    }
 
@@ -1139,7 +951,7 @@
       }
    }
 
-   spin_unlock_bh( &pSapCtx->staInfo_lock );
+   spin_unlock_bh( &pAdapter->staInfo_lock );
    return status;
 }
 
@@ -1196,10 +1008,10 @@
 
    //Get the Adapter context.
    pAdapter = (hdd_adapter_t *)netdev_priv(((struct sk_buff *)pOsPkt)->dev);
-   if((pAdapter == NULL) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
+   if(pAdapter == NULL)
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: HDD adapter context is invalid", __func__);
+                 "%s: HDD adapter context is Null", __func__);
    }
    else
    {
@@ -1252,8 +1064,7 @@
    v_U8_t STAId = WLAN_MAX_STA_COUNT;   
    hdd_context_t *pHddCtx = NULL;
    v_U8_t proto_type = 0;
-   v_CONTEXT_t pVosContext = NULL;
-   ptSapContext pSapCtx = NULL;
+
    //Sanity check on inputs
    if ( ( NULL == vosContext ) || 
         ( NULL == pStaId ) || 
@@ -1288,15 +1099,8 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
-   pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-   pSapCtx = VOS_GET_SAP_CB(pVosContext);
-   if(pSapCtx == NULL){
-       VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-             FL("psapCtx is NULL"));
-       return VOS_STATUS_E_FAULT;
-   }
-
-   if (FALSE == pSapCtx->aStaInfo[STAId].isUsed )
+ 
+   if (FALSE == pAdapter->aStaInfo[STAId].isUsed )
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
                  "%s: Unregistered STAId %d passed by TL", __func__, STAId);
@@ -1362,21 +1166,21 @@
    /* Only fetch this station and this AC. Return VOS_STATUS_E_EMPTY if nothing there. Do not get next AC
       as the other branch does.
    */
-   spin_lock_bh( &pSapCtx->staInfo_lock );
-   spin_lock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
-   hdd_list_size(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac], &size);
+   spin_lock_bh( &pAdapter->staInfo_lock );
+   spin_lock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+   hdd_list_size(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &size);
 
    if (0 == size)
    {
-      spin_unlock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
-      spin_unlock_bh( &pSapCtx->staInfo_lock );
+      spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+      spin_unlock_bh( &pAdapter->staInfo_lock );
       vos_pkt_return_packet(pVosPacket);
       return VOS_STATUS_E_EMPTY;
    }
 
-   status = hdd_list_remove_front( &pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac], &anchor );
-   spin_unlock_bh(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[ac].lock);
-   spin_unlock_bh( &pSapCtx->staInfo_lock );
+   status = hdd_list_remove_front( &pAdapter->aStaInfo[STAId].wmm_tx_queue[ac], &anchor );
+   spin_unlock_bh(&pAdapter->aStaInfo[STAId].wmm_tx_queue[ac].lock);
+   spin_unlock_bh( &pAdapter->staInfo_lock );
 
    VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
                        "%s: AC %d has packets pending", __func__, ac);
@@ -1439,18 +1243,17 @@
 
    pPktMetaInfo->ucIsEapol = 0;
 
-   if(pSapCtx->aStaInfo[STAId].tlSTAState != WLANTL_STA_AUTHENTICATED)
+   if(pAdapter->aStaInfo[STAId].tlSTAState != WLANTL_STA_AUTHENTICATED) 
    {
       if (TRUE == hdd_IsEAPOLPacket( pVosPacket ))
       {
+         VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO_HIGH,
+                    "%s: VOS packet is EAPOL packet", __func__);
          pPktMetaInfo->ucIsEapol = 1;
-         wlan_hdd_log_eapol(skb,
-                            WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED);
       }
    }
-
-   if ((NULL != pHddCtx) &&
-       (pHddCtx->cfg_ini->gEnableDebugLog))
+ 
+   if (pHddCtx->cfg_ini->gEnableDebugLog)
    {
       proto_type = vos_pkt_get_proto_type(skb,
                                           pHddCtx->cfg_ini->gEnableDebugLog);
@@ -1464,15 +1267,9 @@
          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                    "SAP TX DHCP");
       }
-      else if (VOS_PKT_PROTO_TYPE_ARP & proto_type)
-      {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                   "SAP TX ARP");
-      }
    }
 //xg: @@@@: temporarily disble these. will revisit later
    {
-      pPktMetaInfo->ac = ac;
       pPktMetaInfo->ucUP = pktNode->userPriority;
       pPktMetaInfo->ucTID = pPktMetaInfo->ucUP;
    }
@@ -1487,15 +1284,13 @@
    pPktMetaInfo->ucBcast = vos_is_macaddr_broadcast( pDestMacAddress ) ? 1 : 0;
    pPktMetaInfo->ucMcast = vos_is_macaddr_group( pDestMacAddress ) ? 1 : 0;
 
-   if ( (pSapCtx->aStaInfo[STAId].txSuspended[ac]) &&
+   if ( (pAdapter->aStaInfo[STAId].txSuspended[ac]) &&
         (size <= ((pAdapter->aTxQueueLimit[ac]*3)/4) ))
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
                  "%s: TX queue re-enabled", __func__);
-      pSapCtx->aStaInfo[STAId].txSuspended[ac] = VOS_FALSE;
+      pAdapter->aStaInfo[STAId].txSuspended[ac] = VOS_FALSE;
       netif_wake_subqueue(pAdapter->dev, skb_get_queue_mapping(skb));
-      MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_WAKE_NETDEV,
-                       pAdapter->sessionId, ac));
    }    
 
    // We're giving the packet to TL so consider it transmitted from
@@ -1540,22 +1335,14 @@
    v_SIZE_t size = 0;
    hdd_adapter_t* pAdapter = (hdd_adapter_t *)userData;
    v_U8_t STAId = WLAN_MAX_STA_COUNT;
-   v_CONTEXT_t pVosContext = NULL;
-   ptSapContext pSapCtx = NULL;
-
-   if (pAdapter == NULL || WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)
+ 
+   if(pAdapter == NULL)
    {
-      VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-                 FL("Invalid adapter %p"), pAdapter);
+      VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: HDD adapter context is Null", __func__);
       return VOS_STATUS_E_FAILURE;
    }
-   pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-   pSapCtx = VOS_GET_SAP_CB(pVosContext);
-   if(pSapCtx == NULL){
-       VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-             FL("psapCtx is NULL"));
-       return VOS_STATUS_E_FAULT;
-   }
+
    //Return the packet to VOS. We just needed to know that VOS is out of low resource
    //situation. Here we will only signal TL that there is a pending data for a STA. 
    //VOS packet will be requested (if needed) when TL comes back to fetch data.
@@ -1568,13 +1355,13 @@
    // Traffic stalling
    for (STAId = 0; STAId < WLAN_MAX_STA_COUNT; STAId++)
    {
-      if ((pSapCtx->aStaInfo[STAId].tlSTAState == WLANTL_STA_AUTHENTICATED) ||
-           (pSapCtx->aStaInfo[STAId].tlSTAState == WLANTL_STA_CONNECTED))
+      if ((pAdapter->aStaInfo[STAId].tlSTAState == WLANTL_STA_AUTHENTICATED) ||
+           (pAdapter->aStaInfo[STAId].tlSTAState == WLANTL_STA_CONNECTED))
       {
          for( i=NUM_TX_QUEUES-1; i>=0; --i )
          {
             size = 0;
-            hdd_list_size(&pSapCtx->aStaInfo[STAId].wmm_tx_queue[i], &size);
+            hdd_list_size(&pAdapter->aStaInfo[STAId].wmm_tx_queue[i], &size);
             if ( size > 0 )
             {
                status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
@@ -1687,7 +1474,8 @@
       }
 
       // Extract the OS packet (skb).
-      status = vos_pkt_get_os_packet( pVosPacket, (v_VOID_t **)&skb, VOS_FALSE );
+      // Tell VOS to detach the OS packet from the VOS packet
+      status = vos_pkt_get_os_packet( pVosPacket, (v_VOID_t **)&skb, VOS_TRUE );
       if(!VOS_IS_STATUS_SUCCESS( status ))
       {
          ++pAdapter->hdd_stats.hddTxRxStats.rxDropped;
@@ -1695,11 +1483,7 @@
                     "%s: Failure extracting skb from vos pkt", __func__);
          return VOS_STATUS_E_FAILURE;
       }
-
-      if (TRUE == hdd_IsEAPOLPacket(pVosPacket))
-          wlan_hdd_log_eapol(skb, WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED);
-
-      pVosPacket->pSkb = NULL;
+   
       //hdd_softap_dump_sk_buff(skb);
 
       skb->dev = pAdapter->dev;
@@ -1728,11 +1512,6 @@
             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                       "SAP RX DHCP");
          }
-         else if (VOS_PKT_PROTO_TYPE_ARP & proto_type)
-         {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                      "SAP RX ARP");
-         }
       }
 
       if (WLAN_RX_BCMC_STA_ID == pRxMetaInfo->ucDesSTAId)
@@ -1765,19 +1544,17 @@
       {
          VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO_LOW,
                           "%s: send one packet to kernel", __func__);
-         if ((NULL != pHddCtx) &&
-             (pHddCtx->cfg_ini->gEnableDebugLog & VOS_PKT_PROTO_TYPE_DHCP))
+         if ( pHddCtx->cfg_ini->enableDhcpDebug )
          {
              hdd_dump_dhcp_pkt(skb, RX_PATH);
          }
 
          skb->protocol = eth_type_trans(skb, skb->dev);
          skb->ip_summed = CHECKSUM_NONE;
+#ifdef WLAN_OPEN_SOURCE
 #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-       vos_wake_lock_timeout_release(&pHddCtx->rx_wake_lock,
-                    HDD_WAKE_LOCK_DURATION,
-                    WIFI_POWER_EVENT_WAKELOCK_HOLD_RX);
-
+         wake_lock_timeout(&pHddCtx->rx_wake_lock, msecs_to_jiffies(HDD_WAKE_LOCK_DURATION));
+#endif
 #endif
          rxstat = netif_rx_ni(skb);
          if (NET_RX_SUCCESS == rxstat)
@@ -1878,21 +1655,13 @@
    hdd_context_t *pHddCtx = pAdapter->pHddCtx;
    hdd_adapter_t *pmonAdapter = NULL;
 
-   v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-   ptSapContext pSapCtx = NULL;
-   pSapCtx = VOS_GET_SAP_CB(pVosContext);
-   if(pSapCtx == NULL){
-       VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-             FL("psapCtx is NULL"));
-       return VOS_STATUS_E_FAULT;
-   }
    //eCsrEncryptionType connectedCipherAlgo;
    //v_BOOL_t  fConnected;
    
    /*
     * Clean up old entry if it is not cleaned up properly
    */
-   if ( pSapCtx->aStaInfo[staId].isUsed )
+   if ( pAdapter->aStaInfo[staId].isUsed )
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
                  "clean up old entry for STA %d", staId);
@@ -1977,31 +1746,32 @@
    // state.
    
    //VOS_ASSERT( fConnected );
-   pSapCtx->aStaInfo[staId].ucSTAId = staId;
-   pSapCtx->aStaInfo[staId].isQosEnabled = fWmmEnabled;
+   pAdapter->aStaInfo[staId].ucSTAId = staId;
+   pAdapter->aStaInfo[staId].isQosEnabled = fWmmEnabled;
+
    if ( !fAuthRequired )
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
                  "open/shared auth StaId= %d.  Changing TL state to AUTHENTICATED at Join time",
-                  pSapCtx->aStaInfo[staId].ucSTAId );
+                  pAdapter->aStaInfo[staId].ucSTAId );
    
       // Connections that do not need Upper layer auth, transition TL directly
       // to 'Authenticated' state.      
       vosStatus = WLANTL_ChangeSTAState( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staDesc.ucSTAId, 
                                          WLANTL_STA_AUTHENTICATED );
   
-      pSapCtx->aStaInfo[staId].tlSTAState = WLANTL_STA_AUTHENTICATED;
+      pAdapter->aStaInfo[staId].tlSTAState = WLANTL_STA_AUTHENTICATED;
       pAdapter->sessionCtx.ap.uIsAuthenticated = VOS_TRUE;
    }                                            
    else
    {
 
       VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
-                 "ULA auth StaId= %d.  Changing TL state to CONNECTED at Join time", pSapCtx->aStaInfo[staId].ucSTAId );
+                 "ULA auth StaId= %d.  Changing TL state to CONNECTED at Join time", pAdapter->aStaInfo[staId].ucSTAId );
    
       vosStatus = WLANTL_ChangeSTAState( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staDesc.ucSTAId, 
                                          WLANTL_STA_CONNECTED );
-      pSapCtx->aStaInfo[staId].tlSTAState = WLANTL_STA_CONNECTED;
+      pAdapter->aStaInfo[staId].tlSTAState = WLANTL_STA_CONNECTED;
 
       pAdapter->sessionCtx.ap.uIsAuthenticated = VOS_FALSE;
 
@@ -2013,12 +1783,10 @@
                   "Turn on Monitor the carrier");
        netif_carrier_on(pmonAdapter->dev);
            //Enable Tx queue
-       hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
        netif_tx_start_all_queues(pmonAdapter->dev);
     }
    netif_carrier_on(pAdapter->dev);
    //Enable Tx queue
-   hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
    netif_tx_start_all_queues(pAdapter->dev);
 
    return( vosStatus );
@@ -2045,20 +1813,11 @@
 
 VOS_STATUS hdd_softap_stop_bss( hdd_adapter_t *pAdapter)
 {
+    hdd_context_t *pHddCtx;
     VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
     v_U8_t staId = 0;
-    hdd_context_t *pHddCtx;
-
-    v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-    ptSapContext pSapCtx = NULL;
-    pSapCtx = VOS_GET_SAP_CB(pVosContext);
-    if(pSapCtx == NULL){
-        VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-             FL("psapCtx is NULL"));
-        return VOS_STATUS_E_FAULT;
-    }
-
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
     /*bss deregister is not allowed during wlan driver loading or unloading*/
     if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx))
     {
@@ -2077,7 +1836,7 @@
 
     for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++)
     {
-        if (pSapCtx->aStaInfo[staId].isUsed)// This excludes BC sta as it is already deregistered
+        if (pAdapter->aStaInfo[staId].isUsed)// This excludes BC sta as it is already deregistered
         {
             vosStatus = hdd_softap_DeregisterSTA( pAdapter, staId);
             if (!VOS_IS_STATUS_SUCCESS(vosStatus))
@@ -2097,13 +1856,6 @@
     VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS;
     v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
 
-    ptSapContext pSapCtx = NULL;
-    pSapCtx = VOS_GET_SAP_CB(pVosContext);
-    if(pSapCtx == NULL){
-        VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-             FL("psapCtx is NULL"));
-        return VOS_STATUS_E_FAULT;
-    }
     VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
                "%s: enter", __func__);
 
@@ -2114,7 +1866,7 @@
         return VOS_STATUS_E_FAILURE;
     }
 
-    if (FALSE == vos_is_macaddr_equal(&pSapCtx->aStaInfo[ucSTAId].macAddrSTA, pDestMacAddress))
+    if (FALSE == vos_is_macaddr_equal(&pAdapter->aStaInfo[ucSTAId].macAddrSTA, pDestMacAddress))
     {
          VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
                     "%s: Station MAC address does not matching", __func__);
@@ -2127,7 +1879,7 @@
 
     if (VOS_STATUS_SUCCESS == vosStatus)
     {
-       pSapCtx->aStaInfo[ucSTAId].tlSTAState = WLANTL_STA_AUTHENTICATED;
+       pAdapter->aStaInfo[ucSTAId].tlSTAState = WLANTL_STA_AUTHENTICATED;
     }
 
     VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
@@ -2141,18 +1893,10 @@
 {
     v_U8_t i;
 
-    v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-    ptSapContext pSapCtx = NULL;
-    pSapCtx = VOS_GET_SAP_CB(pVosContext);
-    if(pSapCtx == NULL){
-        VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-             FL("psapCtx is NULL"));
-        return VOS_STATUS_E_FAULT;
-    }
     for (i = 0; i < WLAN_MAX_STA_COUNT; i++)
     {
-        if (vos_mem_compare(&pSapCtx->aStaInfo[i].macAddrSTA, pMacAddress, sizeof(v_MACADDR_t)) &&
-            pSapCtx->aStaInfo[i].isUsed)
+        if (vos_mem_compare(&pAdapter->aStaInfo[i].macAddrSTA, pMacAddress, sizeof(v_MACADDR_t)) &&
+            pAdapter->aStaInfo[i].isUsed)
         {
             *staId = i;
             return VOS_STATUS_SUCCESS;
@@ -2166,18 +1910,10 @@
 {
     v_U8_t i;
 
-    v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-    ptSapContext pSapCtx = NULL;
-    pSapCtx = VOS_GET_SAP_CB(pVosContext);
-    if(pSapCtx == NULL){
-        VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-             FL("psapCtx is NULL"));
-        return VOS_STATUS_E_FAULT;
-    }
     for (i = 0; i < WLAN_MAX_STA_COUNT; i++)
     {
-        if (pSapCtx->aStaInfo[i].isUsed &&
-            (!vos_is_macaddr_broadcast(&pSapCtx->aStaInfo[i].macAddrSTA)))
+        if (pAdapter->aStaInfo[i].isUsed &&
+            (!vos_is_macaddr_broadcast(&pAdapter->aStaInfo[i].macAddrSTA)))
         {
             *staId = i;
             return VOS_STATUS_SUCCESS;
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_tdls.c b/wlan/prima/CORE/HDD/src/wlan_hdd_tdls.c
index b6b7906..026a335 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_tdls.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_tdls.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -43,8 +43,6 @@
 #include <net/ieee80211_radiotap.h>
 #include "wlan_hdd_tdls.h"
 #include "wlan_hdd_cfg80211.h"
-#include "wlan_hdd_assoc.h"
-#include "sme_Api.h"
 #include "vos_sched.h"
 
 static tANI_S32 wlan_hdd_get_tdls_discovery_peer_cnt(tdlsCtx_t *pHddTdlsCtx);
@@ -53,10 +51,16 @@
 static void wlan_hdd_tdls_peer_timers_destroy(tdlsCtx_t *pHddTdlsCtx);
 int wpa_tdls_is_allowed_force_peer(tdlsCtx_t *pHddTdlsCtx, u8 *mac);
 #ifdef CONFIG_TDLS_IMPLICIT
-static void wlan_hdd_tdls_implicit_send_discovery_request(tdlsCtx_t *pHddTdlsCtx);
+static void wlan_hdd_tdls_pre_setup(struct work_struct *work);
 #endif
 
-static u8 wlan_hdd_tdls_hash_key (const u8 *mac)
+#ifndef WLAN_FEATURE_TDLS_DEBUG
+#define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_INFO
+#else
+#define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_WARN
+#endif
+
+static u8 wlan_hdd_tdls_hash_key (u8 *mac)
 {
     int i;
     u8 key = 0;
@@ -67,222 +71,61 @@
     return key;
 }
 
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-/**
- * hdd_send_wlan_tdls_teardown_event()- send TDLS teardown event
- *
- * @reason: reason for tear down.
- * @peer_mac: peer mac
- *
- * This Function send TDLS teardown diag event
- *
- * Return: void.
- */
-void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
-                                      uint8_t *peer_mac)
+#ifdef CONFIG_TDLS_IMPLICIT
+static void wlan_hdd_tdls_pre_setup_init_work(tdlsCtx_t * pHddTdlsCtx,
+                                              hddTdlsPeer_t *curr_candidate)
 {
-   WLAN_VOS_DIAG_EVENT_DEF(tdls_tear_down,
-                      struct vos_event_tdls_teardown);
-   vos_mem_zero(&tdls_tear_down,
-                    sizeof(tdls_tear_down));
+    if (TDLS_CTX_MAGIC != pHddTdlsCtx->magic)
+    {
+        pHddTdlsCtx->curr_candidate = curr_candidate;
+        pHddTdlsCtx->magic = TDLS_CTX_MAGIC;
 
-   tdls_tear_down.reason = reason;
-   vos_mem_copy(tdls_tear_down.peer_mac,
-        peer_mac, HDD_MAC_ADDR_LEN);
-   WLAN_VOS_DIAG_EVENT_REPORT(&tdls_tear_down,
-       EVENT_WLAN_TDLS_TEARDOWN);
+        schedule_work(&pHddTdlsCtx->implicit_setup);
+    }
 }
-
-/**
- * hdd_wlan_tdls_enable_link_event()- send TDLS enable link event
- *
- * @peer_mac: peer mac
- * @is_off_chan_supported: Does peer supports off chan
- * @is_off_chan_configured: If off channel is configured
- * @is_off_chan_established: If off chan is established
- *
- * This Function send TDLS enable link diag event
- *
- * Return: void.
- */
-
-void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac,
-                           uint8_t is_off_chan_supported,
-                           uint8_t is_off_chan_configured,
-                           uint8_t is_off_chan_established)
-{
-   WLAN_VOS_DIAG_EVENT_DEF(tdls_event,
-                 struct vos_event_tdls_enable_link);
-   vos_mem_zero(&tdls_event,
-                          sizeof(tdls_event));
-
-   vos_mem_copy(tdls_event.peer_mac,
-                     peer_mac, HDD_MAC_ADDR_LEN);
-
-   tdls_event.is_off_chan_supported =
-                  is_off_chan_supported;
-   tdls_event.is_off_chan_configured =
-                  is_off_chan_configured;
-   tdls_event.is_off_chan_established =
-                  is_off_chan_established;
-
-   WLAN_VOS_DIAG_EVENT_REPORT(&tdls_event,
-       EVENT_WLAN_TDLS_ENABLE_LINK);
-}
-
-/**
- * hdd_wlan_block_scan_by_tdls()- send event
- * if scan is blocked by tdls
- *
- * This Function send send diag event if scan is
- * blocked by tdls
- *
- * Return: void.
- */
-
-void hdd_wlan_block_scan_by_tdls(void)
-{
-  WLAN_VOS_DIAG_EVENT_DEF(tdls_scan_block_status,
-                     struct vos_event_tdls_scan_rejected);
-
-  vos_mem_zero(&tdls_scan_block_status,
-               sizeof(tdls_scan_block_status));
-
-  tdls_scan_block_status.status = true;
-  WLAN_VOS_DIAG_EVENT_REPORT(&tdls_scan_block_status,
-                                 EVENT_TDLS_SCAN_BLOCK);
-}
-
 #endif
 
-
-/**
- * wlan_hdd_tdls_disable_offchan_and_teardown_links - Disable offchannel
- * and teardown TDLS links
- * @hddCtx : pointer to hdd context
- *
- * Return: None
- */
-void wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx)
+static v_VOID_t wlan_hdd_tdls_start_peer_discover_timer(tdlsCtx_t *pHddTdlsCtx,
+                                                        tANI_BOOLEAN mutexLock,
+                                                        v_U32_t discoveryExpiry)
 {
-    u16 connected_tdls_peers = 0;
-    u8 staIdx;
-    hddTdlsPeer_t *curr_peer = NULL;
-    hdd_adapter_t *adapter = NULL;
-    bool tdls_unlock = FALSE;
+    hdd_station_ctx_t *pHddStaCtx;
+    hdd_context_t *pHddCtx;
 
-    if (eTDLS_SUPPORT_NOT_ENABLED == hddctx->tdls_mode) {
-        hddLog(LOG1, FL("TDLS mode is disabled OR not enabled in FW"));
-        return ;
+    if ((NULL == pHddTdlsCtx) || (NULL == pHddTdlsCtx->pAdapter) )
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               FL(" pHddTdlsCtx or pAdapter points to NULL"));
+        return;
     }
 
-    adapter = hdd_get_adapter(hddctx, WLAN_HDD_INFRA_STATION);
+    pHddCtx = WLAN_HDD_GET_CTX( pHddTdlsCtx->pAdapter );
 
-    if (adapter == NULL) {
-        hddLog(LOGE, FL("Station Adapter Not Found"));
-        goto done;
+    if(0 != (wlan_hdd_validate_context(pHddCtx)))
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
+        return;
     }
 
-    connected_tdls_peers = wlan_hdd_tdlsConnectedPeers(adapter);
-    if (!connected_tdls_peers) {
-        hddLog(LOG1, FL("No TDLS connected peers to delete TDLS peers"));
-        goto done;
+    if ( mutexLock )
+    {
+       mutex_lock(&pHddCtx->tdls_lock);
     }
 
-    /* TDLS is not supported in case of concurrency
-     * Disable TDLS Offchannel to avoid more than two concurrent channels.
-     */
-    if (connected_tdls_peers == 1) {
-        tSirMacAddr peer_mac;
-        int32_t channel;
+    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pHddTdlsCtx->pAdapter);
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+    wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter,
+                                &pHddTdlsCtx->peerDiscoverTimer,
+                                discoveryExpiry);
+#endif
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "beacon rssi: %d",
+               pHddTdlsCtx->ap_rssi);
 
-        mutex_lock(&hddctx->tdls_lock);
-        curr_peer = wlan_hdd_tdls_get_connected_peer(adapter);
-        if (curr_peer && (curr_peer->isOffChannelConfigured == TRUE)) {
-            hddLog(LOG1, FL("%s: Concurrency detected, Disable "
-                        "TDLS channel switch"), __func__);
-            curr_peer->isOffChannelEstablished = FALSE;
-            channel = curr_peer->peerParams.channel;
-            vos_mem_copy(peer_mac, curr_peer->peerMac, sizeof(tSirMacAddr));
-            mutex_unlock(&hddctx->tdls_lock);
+    if ( mutexLock )
+        mutex_unlock(&pHddCtx->tdls_lock);
 
-            sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(adapter),
-                    adapter->sessionId,
-                    peer_mac,
-                    channel,
-                    TDLS_OFF_CHANNEL_BW_OFFSET,
-                    TDLS_CHANNEL_SWITCH_DISABLE);
-            tdls_unlock = TRUE;
-        }
-        if (tdls_unlock == FALSE)
-            mutex_unlock(&hddctx->tdls_lock);
-    }
-
-    /* Send Msg to PE for sending deauth and deleting all the TDLS peers */
-    sme_DeleteAllTDLSPeers(hddctx->hHal, adapter->sessionId);
-
-    /* As mentioned above TDLS is not supported in case of concurrency
-     * Find the connected peer and generate TDLS teardown indication to
-     * supplicant.
-     */
-    for (staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) {
-        if (!hddctx->tdlsConnInfo[staIdx].staId)
-            continue;
-
-        mutex_lock(&hddctx->tdls_lock);
-        curr_peer = wlan_hdd_tdls_find_all_peer(hddctx,
-                hddctx->tdlsConnInfo[staIdx].peerMac.bytes);
-
-        if (!curr_peer)
-        {
-            mutex_unlock(&hddctx->tdls_lock);
-            continue;
-        }
-
-        wlan_hdd_tdls_reset_peer(adapter, curr_peer->peerMac);
-
-        hddLog(LOG1, FL("indicate TDLS teardown (staId %d)"),
-                         curr_peer->staId);
-
-        /* Indicate teardown to supplicant */
-        wlan_hdd_tdls_indicate_teardown(
-                curr_peer->pHddTdlsCtx->pAdapter,
-                curr_peer,
-                eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
-        hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_CONCURRENCY,
-                                            curr_peer->peerMac);
-        mutex_unlock(&hddctx->tdls_lock);
-
-        /* Del Sta happened already as part of sme_DeleteAllTDLSPeers
-         * Hence clear hdd data structure.
-         */
-        hdd_roamDeregisterTDLSSTA(adapter,
-                                  hddctx->tdlsConnInfo[staIdx].staId);
-        wlan_hdd_tdls_decrement_peer_count(adapter);
-
-        hddctx->tdlsConnInfo[staIdx].staId = 0 ;
-        hddctx->tdlsConnInfo[staIdx].sessionId = 255;
-        vos_mem_zero(&hddctx->tdlsConnInfo[staIdx].peerMac,
-                 sizeof(v_MACADDR_t)) ;
-        wlan_hdd_tdls_check_bmps(adapter);
-    }
-
-done:
-    wlan_hdd_tdls_set_mode(hddctx, eTDLS_SUPPORT_DISABLED, FALSE,
-                           HDD_SET_TDLS_MODE_SOURCE_P2P);
-    hddLog(LOG1, FL("TDLS Support Disabled"));
-}
-
-/**
- * hdd_tdls_notify_mode_change - Notify mode change
- * @adapter: pointer to hdd adapter
- * @hddCtx : pointer to hdd context
- *
- * Return: None
- */
-void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter, hdd_context_t *hddctx)
-{
-        wlan_hdd_tdls_disable_offchan_and_teardown_links(hddctx);
+    return;
 }
 
 #ifdef TDLS_USE_SEPARATE_DISCOVERY_TIMER
@@ -292,37 +135,38 @@
     struct list_head *head;
     struct list_head *pos;
     hddTdlsPeer_t *curr_peer;
+    hdd_station_ctx_t *pHddStaCtx;
     hdd_context_t *pHddCtx;
-    tdlsCtx_t *pHddTdlsCtx;
+    tdlsCtx_t *pHddTdlsCtx = (tdlsCtx_t *)userData;
     int discover_req_sent = 0;
     v_U32_t discover_expiry = TDLS_SUB_DISCOVERY_PERIOD;
-    v_CONTEXT_t pVosContext;
+    tANI_BOOLEAN doMutexLock = eANI_BOOLEAN_TRUE;
 
-    ENTER();
-
-    pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL);
-    if (NULL == pVosContext)
+    if ((NULL == pHddTdlsCtx) || (NULL == pHddTdlsCtx->pAdapter) )
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-               FL("pVosContext points to NULL"));
+               FL(" pHddTdlsCtx or pAdapter points to NULL"));
         return;
     }
 
-    pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext);
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
+    if (WLAN_HDD_ADAPTER_MAGIC != pHddTdlsCtx->pAdapter->magic)
     {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               FL("pAdapter  has invalid magic"));
+        return;
+    }
+    pHddCtx = WLAN_HDD_GET_CTX( pHddTdlsCtx->pAdapter );
+
+    if(0 != (wlan_hdd_validate_context(pHddCtx)))
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return;
     }
 
     mutex_lock(&pHddCtx->tdls_lock);
-    pHddTdlsCtx = (tdlsCtx_t *)userData;
-    if (0 != (wlan_hdd_validate_tdls_context(pHddCtx, pHddTdlsCtx)))
-    {
-        mutex_unlock(&pHddCtx->tdls_lock);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("Invalid pHddTdlsCtx context"));
-        return;
-    }
+
+    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pHddTdlsCtx->pAdapter);
 
     VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: ", __func__);
 
@@ -335,7 +179,7 @@
         list_for_each (pos, head) {
             curr_peer = list_entry (pos, hddTdlsPeer_t, node);
 
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                        "%d " MAC_ADDRESS_STR " %d %d, %d %d %d %d", i,
                        MAC_ADDR_ARRAY(curr_peer->peerMac),
                        curr_peer->discovery_processed,
@@ -359,17 +203,16 @@
 
                         if (curr_peer->discovery_attempt <
                             pHddTdlsCtx->threshold_config.discovery_tries_n) {
-                            cfg80211_tdls_oper_request(
-                                               pHddTdlsCtx->pAdapter->dev,
-                                               curr_peer->peerMac,
-                                               NL80211_TDLS_DISCOVERY_REQ,
-                                               FALSE,
-                                               GFP_KERNEL);
+                            sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter),
+                                                  pHddTdlsCtx->pAdapter->sessionId,
+                                                  curr_peer->peerMac,
+                                                  WLAN_TDLS_DISCOVERY_REQUEST,
+                                                  1, 0, 0, NULL, 0, 0);
                             curr_peer->discovery_attempt++;
                         }
                         else
                         {
-                           VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                           VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                                      "%s: Maximum Discovery retries reached", __func__);
                            curr_peer->tdls_support = eTDLS_CAP_NOT_SUPPORTED;
                         }
@@ -384,16 +227,18 @@
 exit_loop:
 
     if (0 != pHddTdlsCtx->discovery_peer_cnt) {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                   "discovery_peer_cnt is %d , Starting SUB_DISCOVERY_TIMER",
                   pHddTdlsCtx->discovery_peer_cnt);
         discover_expiry = TDLS_SUB_DISCOVERY_PERIOD;
+        doMutexLock = eANI_BOOLEAN_FALSE;
         goto done;
     }
     discover_expiry = pHddTdlsCtx->threshold_config.discovery_period_t;
 
     wlan_hdd_tdls_peer_reset_discovery_processed(pHddTdlsCtx);
 
+    mutex_unlock(&pHddCtx->tdls_lock);
 
     /* Commenting out the following function as it was introducing
      * a race condition when pHddTdlsCtx is deleted. Also , this
@@ -406,174 +251,59 @@
      */
 
 done:
-    mutex_unlock(&pHddCtx->tdls_lock);
-    EXIT();
+    wlan_hdd_tdls_start_peer_discover_timer(pHddTdlsCtx, doMutexLock, discover_expiry);
+
+    if ( !doMutexLock )
+        mutex_unlock(&pHddCtx->tdls_lock);
     return;
 }
 #endif
 
-static v_VOID_t wlan_hdd_tdls_idle_cb( v_PVOID_t userData )
-{
-#ifdef CONFIG_TDLS_IMPLICIT
-    tdlsConnInfo_t *tdlsInfo = (tdlsConnInfo_t *) userData;
-    hddTdlsPeer_t *curr_peer;
-    tdlsCtx_t *pHddTdlsCtx;
-    hdd_context_t *pHddCtx;
-    v_CONTEXT_t pVosContext;
-    hdd_adapter_t *pAdapter = NULL;
-
-    ENTER();
-
-    if (!tdlsInfo->staId)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                FL("peer (staidx %u) doesn't exists"), tdlsInfo->staId);
-        return;
-    }
-
-    pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL);
-    if (NULL == pVosContext)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("pVosContext points to NULL"));
-        return;
-    }
-
-    pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext);
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-    {
-        return;
-    }
-
-    pAdapter = hdd_get_adapter_by_sme_session_id(pHddCtx, tdlsInfo->sessionId);
-
-    if (!pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                FL("pAdapter is NULL"));
-        return;
-    }
-
-    mutex_lock(&pHddCtx->tdls_lock);
-
-    curr_peer = wlan_hdd_tdls_find_peer(pAdapter,
-            (u8 *) &tdlsInfo->peerMac.bytes[0], FALSE);
-
-    if (NULL == curr_peer)
-    {
-      mutex_unlock(&pHddCtx->tdls_lock);
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-              FL("Invalid tdls idle timer expired"));
-      return;
-    }
-
-    pHddTdlsCtx = curr_peer->pHddTdlsCtx;
-    if (0 != (wlan_hdd_validate_tdls_context(pHddCtx, pHddTdlsCtx)))
-    {
-        mutex_unlock(&pHddCtx->tdls_lock);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("Invalid pHddTdlsCtx context"));
-        return;
-    }
-
-    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-              "%s: Tx/Rx Idle " MAC_ADDRESS_STR " tx_pkt: %d, rx_pkt: %d, idle_packet_n: %d",
-              __func__, MAC_ADDR_ARRAY(curr_peer->peerMac),
-              curr_peer->tx_pkt,
-              curr_peer->rx_pkt,
-              curr_peer->pHddTdlsCtx->threshold_config.idle_packet_n);
-
-    /* Check tx/rx statistics on this tdls link for recent activities and
-     * then decide whether to tear down the link or keep it.
-     */
-    if ((curr_peer->tx_pkt >= curr_peer->pHddTdlsCtx->threshold_config.idle_packet_n) || (curr_peer->rx_pkt >= curr_peer->pHddTdlsCtx->threshold_config.idle_packet_n))
-    {
-      /* this tdls link got back to normal, so keep it */
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-               "%s: tdls link to " MAC_ADDRESS_STR " back to normal, will stay",
-               __func__, MAC_ADDR_ARRAY(curr_peer->peerMac));
-    }
-    else
-    {
-      /* this tdls link needs to get torn down */
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "%s: trigger tdls link to " MAC_ADDRESS_STR " down",
-                __func__, MAC_ADDR_ARRAY(curr_peer->peerMac));
-
-      wlan_hdd_tdls_indicate_teardown(curr_peer->pHddTdlsCtx->pAdapter,
-                                      curr_peer,
-                                      eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
-      hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_TXRX_THRESHOLD,
-                                           curr_peer->peerMac);
-
-    }
-    mutex_unlock(&pHddCtx->tdls_lock);
-    EXIT();
-#endif
-}
-
 static v_VOID_t wlan_hdd_tdls_update_peer_cb( v_PVOID_t userData )
 {
     int i;
     struct list_head *head;
     struct list_head *pos;
     hddTdlsPeer_t *curr_peer;
-    tdlsCtx_t *pHddTdlsCtx;
+    tdlsCtx_t *pHddTdlsCtx = (tdlsCtx_t *)userData;
     hdd_context_t *pHddCtx;
-    v_CONTEXT_t pVosContext;
 
-    ENTER();
-    pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL);
-    if (NULL == pVosContext)
+    if ((NULL == pHddTdlsCtx) || (NULL == pHddTdlsCtx->pAdapter) )
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-               FL("pVosContext points to NULL"));
+               FL(" pHddTdlsCtx or pAdapter points to NULL"));
         return;
     }
-    pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext);
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
+    if (WLAN_HDD_ADAPTER_MAGIC != pHddTdlsCtx->pAdapter->magic)
     {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               FL("pAdapter  has invalid magic"));
         return;
     }
+    pHddCtx = WLAN_HDD_GET_CTX( pHddTdlsCtx->pAdapter );
+
+    if(0 != (wlan_hdd_validate_context(pHddCtx)))
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
+        return;
+    }
+
     mutex_lock(&pHddCtx->tdls_lock);
-    pHddTdlsCtx = (tdlsCtx_t *)userData;
-    if (0 != (wlan_hdd_validate_tdls_context(pHddCtx, pHddTdlsCtx)))
-    {
-        mutex_unlock(&pHddCtx->tdls_lock);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 FL("Invalid pHddTdlsCtx context"));
-        return;
-    }
+
     for (i = 0; i < 256; i++) {
         head = &pHddTdlsCtx->peer_list[i];
 
         list_for_each (pos, head) {
             curr_peer = list_entry (pos, hddTdlsPeer_t, node);
 
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                        "%s: " MAC_ADDRESS_STR " link_status %d"
                        " tdls_support %d", __func__, MAC_ADDR_ARRAY(curr_peer->peerMac),
                        curr_peer->link_status, curr_peer->tdls_support);
 
-            if ((pHddCtx->tdls_mode == eTDLS_SUPPORT_DISABLED) &&
-                    (eTDLS_LINK_DISCOVERING == curr_peer->link_status)) {
-                curr_peer->tdls_support = eTDLS_CAP_UNKNOWN;
-                wlan_hdd_tdls_set_peer_link_status(
-                        curr_peer,
-                        eTDLS_LINK_IDLE,
-                        eTDLS_LINK_UNSPECIFIED);
-
-                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                        "%s: TDLS is disabled. Resetting link_status of peer "
-                        MAC_ADDRESS_STR " to %d, tdls_support %d", __func__,
-                        MAC_ADDR_ARRAY(curr_peer->peerMac),
-                        curr_peer->link_status, curr_peer->tdls_support);
-
-                goto next_peer;
-            }
-
             if (eTDLS_CAP_SUPPORTED == curr_peer->tdls_support) {
-                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                     "tx %d, rx %d (thr.pkt %d/idle %d), rssi %d (thr.trig %d/hys %d/tear %d)",
                        curr_peer->tx_pkt, curr_peer->rx_pkt,
                         pHddTdlsCtx->threshold_config.tx_packet_n,
@@ -588,7 +318,7 @@
 
                     if (pHddCtx->cfg_ini->fTDLSExternalControl &&
                         (FALSE == curr_peer->isForcedPeer)) {
-                        goto next_peer;
+                        continue;
                     }
 
                     if (curr_peer->tx_pkt >=
@@ -597,16 +327,14 @@
                         if (HDD_MAX_NUM_TDLS_STA > wlan_hdd_tdlsConnectedPeers(pHddTdlsCtx->pAdapter))
                         {
 
-                            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                                       "Tput trigger TDLS pre-setup");
+                            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "Tput trigger TDLS pre-setup");
 #ifdef CONFIG_TDLS_IMPLICIT
-                            pHddTdlsCtx->curr_candidate = curr_peer;
-                            wlan_hdd_tdls_implicit_send_discovery_request(pHddTdlsCtx);
+                            wlan_hdd_tdls_pre_setup_init_work(pHddTdlsCtx, curr_peer);
 #endif
                         }
                         else
                         {
-                            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                                       "%s: Maximum peer connected already! %d",
                                       __func__, wlan_hdd_tdlsConnectedPeers(pHddTdlsCtx->pAdapter) );
                         }
@@ -625,10 +353,6 @@
                         wlan_hdd_tdls_indicate_teardown(pHddTdlsCtx->pAdapter,
                                                         curr_peer,
                                                         eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
-                        hdd_send_wlan_tdls_teardown_event(
-                               eTDLS_TEARDOWN_RSSI_THRESHOLD,
-                               curr_peer->peerMac);
-
 #endif
                         goto next_peer;
                     }
@@ -642,17 +366,6 @@
                             pHddTdlsCtx->threshold_config.idle_packet_n) &&
                         (curr_peer->rx_pkt <
                             pHddTdlsCtx->threshold_config.idle_packet_n))) {
-                        if (!vos_timer_is_initialized(&curr_peer->peerIdleTimer))
-                        {
-                            v_U8_t staId = (v_U8_t)curr_peer->staId;
-                            tdlsConnInfo_t *tdlsInfo;
-
-                            tdlsInfo = wlan_hdd_get_conn_info(pHddCtx, staId);
-                            vos_timer_init(&curr_peer->peerIdleTimer,
-                                    VOS_TIMER_TYPE_SW,
-                                    wlan_hdd_tdls_idle_cb,
-                                    tdlsInfo);
-                        }
                         if (VOS_TIMER_STATE_RUNNING !=
                                 vos_timer_getCurrentState(&curr_peer->peerIdleTimer)) {
                             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
@@ -663,11 +376,8 @@
                                                         pHddTdlsCtx->threshold_config.idle_timeout_t);
                         }
                     } else {
-                        if (vos_timer_is_initialized(
-                                &curr_peer->peerIdleTimer) &&
-                            VOS_TIMER_STATE_RUNNING ==
-                                vos_timer_getCurrentState(
-                                             &curr_peer->peerIdleTimer)) {
+                        if (VOS_TIMER_STATE_RUNNING ==
+                                vos_timer_getCurrentState(&curr_peer->peerIdleTimer)) {
                             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
                                     "Tx/Rx Idle timer stop: " MAC_ADDRESS_STR "!",
                                        MAC_ADDR_ARRAY(curr_peer->peerMac));
@@ -691,7 +401,7 @@
 
                 if (pHddCtx->cfg_ini->fTDLSExternalControl &&
                     (FALSE == curr_peer->isForcedPeer)) {
-                    goto next_peer;
+                    continue;
                 }
                 if (!TDLS_IS_CONNECTED(curr_peer)) {
                     if (curr_peer->tx_pkt >=
@@ -703,11 +413,9 @@
                          */
                         if (curr_peer->isForcedPeer || curr_peer->discovery_attempt++ <
                                  pHddTdlsCtx->threshold_config.discovery_tries_n) {
-                            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                                       "TDLS UNKNOWN discover ");
+                            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "TDLS UNKNOWN discover ");
 #ifdef CONFIG_TDLS_IMPLICIT
-                            pHddTdlsCtx->curr_candidate = curr_peer;
-                            wlan_hdd_tdls_implicit_send_discovery_request(pHddTdlsCtx);
+                            wlan_hdd_tdls_pre_setup_init_work(pHddTdlsCtx, curr_peer);
 #endif
                         }
                         else
@@ -733,7 +441,71 @@
                                 &pHddTdlsCtx->peerUpdateTimer,
                                 pHddTdlsCtx->threshold_config.tx_period_t);
     mutex_unlock(&pHddCtx->tdls_lock);
-    EXIT();
+}
+
+static v_VOID_t wlan_hdd_tdls_idle_cb( v_PVOID_t userData )
+{
+#ifdef CONFIG_TDLS_IMPLICIT
+    hddTdlsPeer_t *curr_peer = (hddTdlsPeer_t *)userData;
+    tdlsCtx_t *pHddTdlsCtx;
+    hdd_context_t *pHddCtx;
+
+    if (NULL == curr_peer)
+    {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+              FL("Invalid tdls idle timer expired"));
+      return;
+    }
+    pHddTdlsCtx = curr_peer->pHddTdlsCtx;
+
+    if ((NULL == pHddTdlsCtx) || (NULL == pHddTdlsCtx->pAdapter) )
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               FL(" pHddTdlsCtx or pAdapter points to NULL"));
+        return;
+    }
+
+    pHddCtx = WLAN_HDD_GET_CTX( pHddTdlsCtx->pAdapter );
+
+    if(0 != (wlan_hdd_validate_context(pHddCtx)))
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
+        return;
+    }
+
+    VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
+              "%s: Tx/Rx Idle " MAC_ADDRESS_STR " tx_pkt: %d, rx_pkt: %d, idle_packet_n: %d",
+              __func__, MAC_ADDR_ARRAY(curr_peer->peerMac),
+              curr_peer->tx_pkt,
+              curr_peer->rx_pkt,
+              curr_peer->pHddTdlsCtx->threshold_config.idle_packet_n);
+
+    mutex_lock(&pHddCtx->tdls_lock);
+
+    /* Check tx/rx statistics on this tdls link for recent activities and
+     * then decide whether to tear down the link or keep it.
+     */
+    if ((curr_peer->tx_pkt >= curr_peer->pHddTdlsCtx->threshold_config.idle_packet_n) || (curr_peer->rx_pkt >= curr_peer->pHddTdlsCtx->threshold_config.idle_packet_n))
+    {
+      /* this tdls link got back to normal, so keep it */
+      VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
+               "%s: tdls link to " MAC_ADDRESS_STR " back to normal, will stay",
+               __func__, MAC_ADDR_ARRAY(curr_peer->peerMac));
+    }
+    else
+    {
+      /* this tdls link needs to get torn down */
+      VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
+                "%s: trigger tdls link to " MAC_ADDRESS_STR " down",
+                __func__, MAC_ADDR_ARRAY(curr_peer->peerMac));
+
+      wlan_hdd_tdls_indicate_teardown(curr_peer->pHddTdlsCtx->pAdapter,
+                                      curr_peer,
+                                      eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
+    }
+    mutex_unlock(&pHddCtx->tdls_lock);
+#endif
 }
 
 static v_VOID_t wlan_hdd_tdls_discovery_timeout_peer_cb(v_PVOID_t userData)
@@ -744,41 +516,40 @@
     struct list_head *pos, *q;
     tdlsCtx_t *pHddTdlsCtx;
     hdd_context_t *pHddCtx;
-    v_CONTEXT_t pVosContext;
 
-    ENTER();
-    pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL);
-    if (NULL == pVosContext)
+    pHddTdlsCtx = (tdlsCtx_t *)userData;
+
+    if ((NULL == pHddTdlsCtx) || (NULL == pHddTdlsCtx->pAdapter) )
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-               FL("pVosContext points to NULL"));
+               FL(" pHddTdlsCtx or pAdapter points to NULL"));
         return;
     }
 
-    pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext);
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
+    if (WLAN_HDD_ADAPTER_MAGIC != pHddTdlsCtx->pAdapter->magic)
     {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               FL("pAdapter  has invalid magic"));
+        return;
+    }
+    pHddCtx = WLAN_HDD_GET_CTX( pHddTdlsCtx->pAdapter );
+
+    if(0 != (wlan_hdd_validate_context(pHddCtx)))
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return;
     }
 
     mutex_lock(&pHddCtx->tdls_lock);
 
-    pHddTdlsCtx = (tdlsCtx_t *)userData;
-    if (0 != (wlan_hdd_validate_tdls_context(pHddCtx, pHddTdlsCtx)))
-    {
-        mutex_unlock(&pHddCtx->tdls_lock);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("Invalid pHddTdlsCtx context"));
-        return;
-    }
-
     for (i = 0; i < 256; i++) {
         head = &pHddTdlsCtx->peer_list[i];
         list_for_each_safe (pos, q, head) {
             tmp = list_entry(pos, hddTdlsPeer_t, node);
             if (eTDLS_LINK_DISCOVERING == tmp->link_status)
             {
-                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                            "%s: " MAC_ADDRESS_STR " to idle state", __func__,
                            MAC_ADDR_ARRAY(tmp->peerMac));
                            wlan_hdd_tdls_set_peer_link_status(
@@ -795,78 +566,33 @@
     mutex_unlock(&pHddCtx->tdls_lock);
 
     wlan_hdd_tdls_check_bmps(pHddTdlsCtx->pAdapter);
-    EXIT();
+
     return;
 }
 
-v_VOID_t wlan_hdd_tdls_initiator_wait_cb( v_PVOID_t userData )
+static v_VOID_t wlan_hdd_tdls_initiator_wait_cb( v_PVOID_t userData )
 {
-    tdlsConnInfo_t *tdlsInfo = (tdlsConnInfo_t *) userData;
+    hddTdlsPeer_t *curr_peer = (hddTdlsPeer_t *)userData;
     tdlsCtx_t   *pHddTdlsCtx;
-    hdd_context_t *pHddCtx = NULL;
-    hdd_adapter_t *pAdapter = NULL;
-    v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL);
-    hddTdlsPeer_t *curr_peer = NULL;
 
-    ENTER();
-
-    if (!tdlsInfo->staId)
+    if ( NULL == curr_peer )
     {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 FL("peer (staidx %u) doesn't exists"), tdlsInfo->staId);
-        return;
-    }
-    if (!pVosContext)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                FL("pVosContext is NULL"));
+                 FL("curr_peer is NULL"));
         return;
     }
 
-    pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
-    if (!pHddCtx)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                FL("pHddCtx is NULL"));
-        return;
-    }
-
-    pAdapter = hdd_get_adapter_by_sme_session_id(pHddCtx, tdlsInfo->sessionId);
-
-    if (!pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                FL("pAdapter is NULL"));
-        return;
-    }
-
-    mutex_lock(&pHddCtx->tdls_lock);
-    curr_peer = wlan_hdd_tdls_find_peer(pAdapter,
-            (u8 *) &tdlsInfo->peerMac.bytes[0], FALSE);
-    if (curr_peer == NULL)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                FL("peer doesn't exists"));
-        mutex_unlock(&pHddCtx->tdls_lock);
-        return;
-    }
     pHddTdlsCtx = curr_peer->pHddTdlsCtx;
 
     if ( NULL == pHddTdlsCtx )
     {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  FL("pHddTdlsCtx is NULL"));
         return;
     }
-    if (0 != (wlan_hdd_validate_context(
-              WLAN_HDD_GET_CTX(pHddTdlsCtx->pAdapter))))
-    {
-        return;
-    }
+
     WLANTL_ResumeDataTx( (WLAN_HDD_GET_CTX(pHddTdlsCtx->pAdapter))->pvosContext,
                            (v_U8_t *)&curr_peer->staId);
-    mutex_unlock(&pHddCtx->tdls_lock);
-    EXIT();
 }
 
 static void wlan_hdd_tdls_free_list(tdlsCtx_t *pHddTdlsCtx)
@@ -878,7 +604,7 @@
 
     if (NULL == pHddTdlsCtx)
     {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  FL("pHddTdlsCtx is NULL"));
        return;
     }
@@ -894,15 +620,39 @@
     }
 }
 
+static void wlan_hdd_tdls_schedule_scan(struct work_struct *work)
+{
+    tdls_scan_context_t *scan_ctx =
+          container_of(work, tdls_scan_context_t, tdls_scan_work.work);
+
+    if (NULL == scan_ctx)
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("scan_ctx is NULL"));
+        return;
+    }
+
+    if (unlikely(TDLS_CTX_MAGIC != scan_ctx->magic))
+        return;
+
+    scan_ctx->attempt++;
+
+    wlan_hdd_cfg80211_scan(scan_ctx->wiphy,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+                           scan_ctx->dev,
+#endif
+                           scan_ctx->scan_request);
+}
+
 void wlan_hdd_tdls_btCoex_cb(void *data, int indType)
 {
     hdd_adapter_t *pAdapter;
     hdd_context_t *pHddCtx;
     u16 connectedTdlsPeers;
+    tdlsCtx_t *pHddTdlsCtx;
     hddTdlsPeer_t *currPeer;
-    tANI_U16 numCurrTdlsPeers = 0;
+    hdd_scaninfo_t *pScanInfo;
 
-    ENTER();
     if ((NULL == data) || (indType < 0))
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -913,6 +663,8 @@
     pHddCtx     = (hdd_context_t *)data;
     if (0 != (wlan_hdd_validate_context(pHddCtx)))
     {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  FL("pHddCtx is not valid"));
         return;
     }
 
@@ -933,23 +685,38 @@
         return;
     }
 
+    pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
+    if (NULL == pHddTdlsCtx)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  FL("pHddTdlsCtx is not valid"));
+        return;
+    }
+
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
               "%s: BtCoex notification type %d", __func__, indType);
    /* BtCoex notification type enabled, Disable TDLS */
    if (indType == SIR_COEX_IND_TYPE_TDLS_DISABLE)
    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                   FL("BtCoex notification, Disable TDLS"));
-        mutex_lock(&pHddCtx->tdls_lock);
+
+        pScanInfo =  &pHddCtx->scan_info;
+        // Lets do abort scan if scan is pending
+        if ((pScanInfo != NULL) && pScanInfo->mScanPending)
+        {
+             hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId,
+                                eCSR_SCAN_ABORT_DEFAULT);
+        }
+
         /* tdls is in progress */
-        currPeer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0, FALSE);
+        currPeer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0);
         if (NULL != currPeer)
         {
             wlan_hdd_tdls_set_peer_link_status (currPeer,
                                                 eTDLS_LINK_IDLE,
                                                 eTDLS_LINK_UNSPECIFIED);
         }
-        mutex_unlock(&pHddCtx->tdls_lock);
 
         /* while tdls is up */
         if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode ||
@@ -957,8 +724,8 @@
         {
             connectedTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter);
             /* disable implicit trigger logic & tdls operatoin */
-            wlan_hdd_tdls_set_mode(pHddCtx, eTDLS_SUPPORT_DISABLED, FALSE,
-                                   HDD_SET_TDLS_MODE_SOURCE_BTC);
+            wlan_hdd_tdls_set_mode(pHddCtx, eTDLS_SUPPORT_DISABLED, FALSE);
+            pHddCtx->is_tdls_btc_enabled = FALSE;
 
             /* teardown the peers on the btcoex */
             if (connectedTdlsPeers)
@@ -966,61 +733,44 @@
                tANI_U8 staIdx;
                hddTdlsPeer_t *curr_peer;
 
-               mutex_lock(&pHddCtx->tdls_lock);
                for (staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++)
                {
                     if (pHddCtx->tdlsConnInfo[staIdx].staId)
                     {
-                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                                  ("%s: indicate TDLS teardown (staId %d)"),
+                        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
+                                  ("%s: indicate TDLS teadown (staId %d)"),
                                   __func__,pHddCtx->tdlsConnInfo[staIdx].staId);
 
-#ifdef CONFIG_TDLS_IMPLICIT
+                        #ifdef CONFIG_TDLS_IMPLICIT
                         curr_peer = wlan_hdd_tdls_find_all_peer(pHddCtx,
                                    pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes);
                         if(curr_peer) {
                            wlan_hdd_tdls_indicate_teardown(
                                    curr_peer->pHddTdlsCtx->pAdapter, curr_peer,
                                    eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
-                           hdd_send_wlan_tdls_teardown_event(
-                                                eTDLS_TEARDOWN_BTCOEX,
-                                                curr_peer->peerMac);
                         }
-#endif
+                        #endif
                     }
                }
-               mutex_unlock(&pHddCtx->tdls_lock);
             }
         }
-        /* stop TCP delack timer if BtCoex is enable  */
-        set_bit(WLAN_BTCOEX_MODE, &pHddCtx->mode);
-        hdd_manage_delack_timer(pHddCtx);
    }
    /* BtCoex notification type enabled, Enable TDLS */
    else if (indType == SIR_COEX_IND_TYPE_TDLS_ENABLE)
    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                   FL("BtCoex notification, Enable TDLS"));
         /* if tdls was enabled before btCoex, re-enable tdls mode */
         if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode_last ||
             eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == pHddCtx->tdls_mode_last)
         {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                       ("%s: revert tdls mode %d"), __func__,
                       pHddCtx->tdls_mode_last);
-            wlan_hdd_tdls_set_mode(pHddCtx, pHddCtx->tdls_mode_last, FALSE,
-                                   HDD_SET_TDLS_MODE_SOURCE_BTC);
+            pHddCtx->is_tdls_btc_enabled = TRUE;
+            wlan_hdd_tdls_set_mode(pHddCtx, pHddCtx->tdls_mode_last, FALSE);
         }
-
-        clear_bit(WLAN_BTCOEX_MODE, &pHddCtx->mode);
-        numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter);
-        if(numCurrTdlsPeers == 0) {
-             /* start delack timer if BtCoex is disable and tdls is not present */
-             hdd_manage_delack_timer(pHddCtx);
-        }
-  }
-
-   EXIT();
+   }
    return;
 }
 
@@ -1028,11 +778,13 @@
 void  wlan_hdd_tdls_init(hdd_context_t *pHddCtx )
 {
     v_U8_t staIdx;
-    eHalStatus status;
 
     pHddCtx->connected_peer_count = 0;
 
-    wlan_hdd_init_deinit_defer_scan_context(&pHddCtx->scan_ctxt);
+    pHddCtx->tdls_scan_ctxt.magic = 0;
+    pHddCtx->tdls_scan_ctxt.attempt = 0;
+    pHddCtx->tdls_scan_ctxt.reject = 0;
+    pHddCtx->tdls_scan_ctxt.scan_request = NULL;
 
     for (staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++)
     {
@@ -1041,31 +793,17 @@
          vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac,
                                             sizeof(v_MACADDR_t)) ;
     }
+    pHddCtx->is_tdls_btc_enabled = TRUE;
+    sme_RegisterBtCoexTDLSCallback(pHddCtx->hHal, wlan_hdd_tdls_btCoex_cb);
 
-    status = sme_RegisterBtCoexTDLSCallback(pHddCtx->hHal,
-                                            wlan_hdd_tdls_btCoex_cb);
-    if (status != eHAL_STATUS_SUCCESS) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to register BT Coex TDLS callback"));
-    }
-
-    if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) &&
-        (TRUE == sme_IsFeatureSupportedByFW(TDLS)))
+    if (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger)
     {
-        if (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger)
-        {
-            pHddCtx->tdls_mode = eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY;
-            hddLog(LOGE, FL("TDLS Implicit trigger not enabled!"));
-            return;
-        }
-        pHddCtx->tdls_mode = eTDLS_SUPPORT_ENABLED;
+        pHddCtx->tdls_mode = eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY;
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s TDLS Implicit trigger not enabled!", __func__);
     }
     else
     {
-        hddLog(LOGE,
-               FL("TDLS not enabled (%d) or FW doesn't support (%d)"),
-               pHddCtx->cfg_ini->fEnableTDLSSupport,
-               sme_IsFeatureSupportedByFW(TDLS));
-        pHddCtx->tdls_mode = eTDLS_SUPPORT_NOT_ENABLED;
+        pHddCtx->tdls_mode = eTDLS_SUPPORT_ENABLED;
     }
 }
 
@@ -1077,34 +815,34 @@
     if (NULL == pHddCtx)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s pHddCtx is NULL", __func__);
-        return -EINVAL;
+        return -1;
     }
 
-    if (test_bit(TDLS_INIT_DONE, &pAdapter->event_flags))
-    {
-        hddLog(LOG1,
-                FL("TDLS INIT DONE set to 1, no point in re-init"));
-        /* Return success as TDLS is already initialized */
-        return 0;
-    }
 
     if ((FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport) ||
         (FALSE == sme_IsFeatureSupportedByFW(TDLS)))
     {
         pHddCtx->tdls_mode = eTDLS_SUPPORT_NOT_ENABLED;
         pAdapter->sessionCtx.station.pHddTdlsCtx = NULL;
-        hddLog(VOS_TRACE_LEVEL_INFO, "%s TDLS not enabled (%d) or FW doesn't support (%d)!",
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s TDLS not enabled (%d) or FW doesn't support (%d)!",
         __func__, pHddCtx->cfg_ini->fEnableTDLSSupport,
         sme_IsFeatureSupportedByFW(TDLS));
-        return -EINVAL;
+        return 0;
     }
     /* TDLS is supported only in STA / P2P Client modes,
      * hence the check for TDLS support in a specific Device mode.
+     * Do not return a failure rather do not continue further
+     * with the initialization as tdls_init would be called
+     * during the open adapter for a p2p interface at which point
+     * the device mode would be a P2P_DEVICE. The point here is to
+     * continue initialization for STA / P2P Client modes.
+     * TDLS exit also check for the device mode for clean up hence
+     * there is no issue even if success is returned.
      */
     if (0 == WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s TDLS is not supported in mode : %d", __func__, pAdapter->device_mode);
-        return -EINVAL;
+        return 0;
     }
     /* Check for the valid pHddTdlsCtx. If valid do not further
      * allocate the memory, rather continue with the initialization.
@@ -1119,7 +857,8 @@
         if (NULL == pHddTdlsCtx) {
             hddLog(VOS_TRACE_LEVEL_ERROR, "%s malloc failed!", __func__);
             pAdapter->sessionCtx.station.pHddTdlsCtx = NULL;
-            return -ENOMEM;
+            mutex_unlock(&pHddCtx->tdls_lock);
+            return -1;
         }
         /* initialize TDLS pAdater context */
         vos_mem_zero(pHddTdlsCtx, sizeof(tdlsCtx_t));
@@ -1167,25 +906,20 @@
     pHddTdlsCtx->threshold_config.rssi_trigger_threshold = pHddCtx->cfg_ini->fTDLSRSSITriggerThreshold;
     pHddTdlsCtx->threshold_config.rssi_teardown_threshold = pHddCtx->cfg_ini->fTDLSRSSITeardownThreshold;
 
-    set_bit(TDLS_INIT_DONE, &pAdapter->event_flags);
+    INIT_WORK(&pHddTdlsCtx->implicit_setup, wlan_hdd_tdls_pre_setup);
+    INIT_DELAYED_WORK(&pHddCtx->tdls_scan_ctxt.tdls_scan_work, wlan_hdd_tdls_schedule_scan);
 
     return 0;
 }
 
-void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter, tANI_BOOLEAN mutexLock)
+void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter)
 {
     tdlsCtx_t *pHddTdlsCtx;
     hdd_context_t *pHddCtx;
 
-    if (!pAdapter) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL"));
-        return;
-    }
-
     /*
      * NOTE: The Callers of this function should ensure to acquire the
-     * tdls_lock to avoid any concurrent access to the Adapter and logp
-     * protection has to be ensured.
+     * tdls_lock to avoid any concurrent access to the Adapter.
      */
 
     pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
@@ -1196,29 +930,32 @@
                 "%s: HDD context is Null", __func__);
         return ;
     }
-    if (!test_bit(TDLS_INIT_DONE, &pAdapter->event_flags))
+
+    if (pHddCtx->isLogpInProgress)
     {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "%s: TDLS INIT DONE set to 0, no point in exit", __func__);
-        return;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "%s: LOGP in Progress. Ignore!!!", __func__);
+        return ;
     }
-    clear_bit(TDLS_INIT_DONE, &pAdapter->event_flags);
 
     pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
     if (NULL == pHddTdlsCtx)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                FL("pHddTdlsCtx is NULL"));
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddTdlsCtx is NULL"));
         return;
     }
+#ifdef WLAN_OPEN_SOURCE
+    cancel_work_sync(&pHddTdlsCtx->implicit_setup);
+    cancel_delayed_work_sync(&pHddCtx->tdls_scan_ctxt.tdls_scan_work);
+#endif
 
     /* must stop timer here before freeing peer list, because peerIdleTimer is
     part of peer list structure. */
     wlan_hdd_tdls_timers_destroy(pHddTdlsCtx);
     wlan_hdd_tdls_free_list(pHddTdlsCtx);
 
-    wlan_hdd_init_deinit_defer_scan_context(&pHddCtx->scan_ctxt);
-
+    wlan_hdd_tdls_free_scan_request(&pHddCtx->tdls_scan_ctxt);
     pHddTdlsCtx->magic = 0;
     pHddTdlsCtx->pAdapter = NULL;
     vos_mem_free(pHddTdlsCtx);
@@ -1248,14 +985,12 @@
         head = &pHddTdlsCtx->peer_list[i];
         list_for_each (pos, head) {
             curr_peer = list_entry (pos, hddTdlsPeer_t, node);
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                        "%s: " MAC_ADDRESS_STR " -> stop idle timer",
                        __func__,
                        MAC_ADDR_ARRAY(curr_peer->peerMac));
-            if (vos_timer_is_initialized(&curr_peer->peerIdleTimer))
-                vos_timer_stop ( &curr_peer->peerIdleTimer );
-            if (vos_timer_is_initialized(&curr_peer->initiatorWaitTimeoutTimer))
-                vos_timer_stop( &curr_peer->initiatorWaitTimeoutTimer );
+            vos_timer_stop ( &curr_peer->peerIdleTimer );
+            vos_timer_stop( &curr_peer->initiatorWaitTimeoutTimer );
         }
     }
 }
@@ -1292,25 +1027,17 @@
         list_for_each (pos, head) {
             curr_peer = list_entry (pos, hddTdlsPeer_t, node);
 
-            if (vos_timer_is_initialized(&curr_peer->peerIdleTimer)){
-                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                        "%s: " MAC_ADDRESS_STR " -> destroy idle timer",
-                        __func__,
-                        MAC_ADDR_ARRAY(curr_peer->peerMac));
-                vos_timer_stop ( &curr_peer->peerIdleTimer );
-                vos_timer_destroy ( &curr_peer->peerIdleTimer );
-            }
-            if (vos_timer_is_initialized(&curr_peer->initiatorWaitTimeoutTimer))
-            {
-                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                        "%s: " MAC_ADDRESS_STR " -> destroy initiatorWaitTimeoutTimer",
-                        __func__,
-                        MAC_ADDR_ARRAY(curr_peer->peerMac));
-                vos_timer_stop(&curr_peer->initiatorWaitTimeoutTimer);
-                vos_timer_destroy(&curr_peer->initiatorWaitTimeoutTimer);
-            }
+            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
+                       "%s: " MAC_ADDRESS_STR " -> destroy idle timer",
+                       __func__,
+                       MAC_ADDR_ARRAY(curr_peer->peerMac));
+            vos_timer_stop ( &curr_peer->peerIdleTimer );
+            vos_timer_destroy ( &curr_peer->peerIdleTimer );
+            vos_timer_stop(&curr_peer->initiatorWaitTimeoutTimer);
+            vos_timer_destroy(&curr_peer->initiatorWaitTimeoutTimer);
         }
     }
+
 }
 
 /* destroy all the tdls timers running */
@@ -1324,42 +1051,28 @@
    if mac address doesn't exist, create a list and add, return pointer
    return NULL if fails to get new mac address
 */
-hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                      const u8 *mac
-#else
-                                      u8 *mac
-#endif
-          )
+hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter, u8 *mac)
 {
     struct list_head *head;
     hddTdlsPeer_t *peer;
     u8 key;
     tdlsCtx_t *pHddTdlsCtx;
-    hdd_context_t *pHddCtx;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-
-    if (!pAdapter) {
-        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL"));
-        return NULL;
-    }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
+    if(0 != (wlan_hdd_validate_context(pHddCtx)))
     {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return 0;
     }
 
     /* if already there, just update */
-    peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE);
+    peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
     if (peer != NULL)
     {
         return peer;
     }
 
-    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-              FL("peer mac address %pM"), mac);
-
     /* not found, allocate and add the list */
     peer = vos_mem_malloc(sizeof(hddTdlsPeer_t));
     if (NULL == peer) {
@@ -1367,13 +1080,16 @@
         return NULL;
     }
 
+    mutex_lock(&pHddCtx->tdls_lock);
+
     pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
 
     if (NULL == pHddTdlsCtx)
     {
-        vos_mem_free(peer);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                  FL("pHddTdlsCtx is NULL"));
+        vos_mem_free(peer);
+        mutex_unlock(&pHddCtx->tdls_lock);
         return NULL;
     }
 
@@ -1383,44 +1099,39 @@
     vos_mem_zero(peer, sizeof(hddTdlsPeer_t));
     vos_mem_copy(peer->peerMac, mac, sizeof(peer->peerMac));
     peer->pHddTdlsCtx = pHddTdlsCtx;
+
+    vos_timer_init(&peer->peerIdleTimer,
+                    VOS_TIMER_TYPE_SW,
+                    wlan_hdd_tdls_idle_cb,
+                    peer);
+
+    vos_timer_init(&peer->initiatorWaitTimeoutTimer,
+                    VOS_TIMER_TYPE_SW,
+                    wlan_hdd_tdls_initiator_wait_cb,
+                    peer);
+
     list_add_tail(&peer->node, head);
+    mutex_unlock(&pHddCtx->tdls_lock);
 
     return peer;
 }
 
-/*
- * NOTE:
- * The Callers of this function should ensure to release the
- * tdls_lock before calling this function to avoid deadlocks.
- */
-
 int wlan_hdd_tdls_set_cap(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                   const u8* mac,
-#else
                                    u8* mac,
-#endif
                                    tTDLSCapType cap)
 {
     hddTdlsPeer_t *curr_peer;
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-        return -EINVAL;
-
-    mutex_lock(&pHddCtx->tdls_lock);
     curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac);
     if (curr_peer == NULL)
     {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  "%s: curr_peer is NULL", __func__);
-        mutex_unlock(&pHddCtx->tdls_lock);
         return -1;
     }
 
     curr_peer->tdls_support = cap;
 
-    mutex_unlock(&pHddCtx->tdls_lock);
     return 0;
 }
 
@@ -1463,11 +1174,7 @@
 }
 
 void wlan_hdd_tdls_set_link_status(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                   const u8 *mac,
-#else
-                                   u8 *mac,
-#endif
+                                   u8* mac,
                                    tTDLSLinkStatus linkStatus,
                                    tTDLSLinkReason reason)
 {
@@ -1477,29 +1184,15 @@
     tANI_S32 res = 0;
     /*EXT TDLS*/
     hddTdlsPeer_t *curr_peer;
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    if (pHddCtx == NULL)
-    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 FL("pHddCtx is NULL"));
-        return;
-    }
-
-    mutex_lock(&pHddCtx->tdls_lock);
-    curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE);
+    curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
     if (curr_peer == NULL)
     {
-       mutex_unlock(&pHddCtx->tdls_lock);
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  "%s: curr_peer is NULL", __func__);
         return;
     }
 
-    hddLog(VOS_TRACE_LEVEL_INFO,
-           "tdls set peer " MAC_ADDRESS_STR " link status to %u",
-           MAC_ADDR_ARRAY(curr_peer->peerMac), linkStatus);
-
     curr_peer->link_status= linkStatus;
 
     /*EXT TDLS*/
@@ -1509,15 +1202,13 @@
         /*save the reason for any further query*/
         curr_peer->reason = reason;
         wlan_hdd_tdls_get_wifi_hal_state(curr_peer, &state, &res);
-        mutex_unlock(&pHddCtx->tdls_lock);
+
         (*curr_peer->state_change_notification)(mac,
                                              state,
                                              res,
-                                             pAdapter);
-    }
-    else
-        mutex_unlock(&pHddCtx->tdls_lock);
+                                             curr_peer->pHddTdlsCtx->pAdapter);
 
+    }
     /*EXT TDLS*/
     return;
 }
@@ -1525,24 +1216,13 @@
 int wlan_hdd_tdls_recv_discovery_resp(hdd_adapter_t *pAdapter, u8 *mac)
 {
     hddTdlsPeer_t *curr_peer;
-    tdlsCtx_t *pHddTdlsCtx = NULL;
+    tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
     hdd_context_t *pHddCtx;
 
-    ENTER();
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    if (0 != wlan_hdd_validate_context(pHddCtx))
-        return -1;
-
-    mutex_lock(&pHddCtx->tdls_lock);
-
-    pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
     if ( NULL == pHddTdlsCtx )
     {
-        mutex_unlock(&pHddCtx->tdls_lock);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("pHddTdlsCtx is NULL device mode = %d"),
-                  pAdapter->device_mode);
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddTdlsCtx is NULL device mode = %d"), pAdapter->device_mode);
         return -1;
     }
 
@@ -1550,7 +1230,8 @@
 
     if(0 != (wlan_hdd_validate_context(pHddCtx)))
     {
-        mutex_unlock(&pHddCtx->tdls_lock);
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return 0;
     }
 
@@ -1558,7 +1239,6 @@
 
     if (NULL == curr_peer)
     {
-       mutex_unlock(&pHddCtx->tdls_lock);
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  FL("curr_peer is NULL"));
         return -1;
@@ -1567,21 +1247,21 @@
     if (pHddTdlsCtx->discovery_sent_cnt)
         pHddTdlsCtx->discovery_sent_cnt--;
 
+    mutex_lock(&pHddCtx->tdls_lock);
 
     wlan_hdd_tdls_check_power_save_prohibited(pAdapter);
 
+    mutex_unlock(&pHddCtx->tdls_lock);
     if (0 == pHddTdlsCtx->discovery_sent_cnt)
     {
         vos_timer_stop(&pHddTdlsCtx->peerDiscoveryTimeoutTimer);
     }
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+    VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                "Discovery(%u) Response from " MAC_ADDRESS_STR " link_status %d",
                pHddTdlsCtx->discovery_sent_cnt, MAC_ADDR_ARRAY(curr_peer->peerMac),
                curr_peer->link_status);
 
-    curr_peer->tdls_support = eTDLS_CAP_SUPPORTED;
-
     if (eTDLS_LINK_DISCOVERING == curr_peer->link_status)
     {
         /* Since we are here, it means Throughput threshold is alredy met. Make sure RSSI
@@ -1591,40 +1271,15 @@
             wlan_hdd_tdls_set_peer_link_status(curr_peer,
                                                eTDLS_LINK_DISCOVERED,
                                                eTDLS_LINK_SUCCESS);
-
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
             "Rssi Threshold met: "MAC_ADDRESS_STR" rssi = %d threshold= %d" ,
              MAC_ADDR_ARRAY(curr_peer->peerMac), curr_peer->rssi,
              pHddTdlsCtx->threshold_config.rssi_trigger_threshold);
-
-            if (pHddCtx->tdls_mode != eTDLS_SUPPORT_DISABLED)
-            {
-                /* TDLS can be disabled from multiple sources like
-                 * scan, p2p-listen, p2p, btc etc ...
-                 * Dont initiate tdls setup if tdls is disabled
-                 */
-                cfg80211_tdls_oper_request(pAdapter->dev, curr_peer->peerMac,
-                                           NL80211_TDLS_SETUP, FALSE,
-                                           GFP_KERNEL);
-            }
-            else
-            {
-                curr_peer->tdls_support = eTDLS_CAP_UNKNOWN;
-                wlan_hdd_tdls_set_peer_link_status(
-                        curr_peer,
-                        eTDLS_LINK_IDLE,
-                        eTDLS_LINK_UNSPECIFIED);
-
-                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                        "%s: TDLS is disabled. Resetting link_status of peer "
-                        MAC_ADDRESS_STR " to %d, tdls_support %d", __func__,
-                        MAC_ADDR_ARRAY(curr_peer->peerMac),
-                        curr_peer->link_status, curr_peer->tdls_support);
-            }
+            cfg80211_tdls_oper_request(pAdapter->dev, curr_peer->peerMac, NL80211_TDLS_SETUP, FALSE, GFP_KERNEL);
         }
         else
         {
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, 
             "Rssi Threshold not met: "MAC_ADDRESS_STR" rssi = %d threshold = %d ",
             MAC_ADDR_ARRAY(curr_peer->peerMac), curr_peer->rssi,
             pHddTdlsCtx->threshold_config.rssi_trigger_threshold);
@@ -1639,42 +1294,29 @@
                                                eTDLS_LINK_IDLE,
                                                eTDLS_LINK_UNSPECIFIED);
         }
-        mutex_unlock(&pHddCtx->tdls_lock);
     }
     else
     {
-        mutex_unlock(&pHddCtx->tdls_lock);
         wlan_hdd_tdls_check_bmps(pAdapter);
     }
 
-    EXIT();
+    curr_peer->tdls_support = eTDLS_CAP_SUPPORTED;
     return 0;
 }
 
 int wlan_hdd_tdls_set_peer_caps(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                const u8 *mac,
-#else
                                 u8 *mac,
-#endif
                                 tCsrStaParams *StaParams,
                                 tANI_BOOLEAN isBufSta,
-                                tANI_BOOLEAN isOffChannelSupported,
-                                tANI_BOOLEAN isQosWmmSta)
+                                tANI_BOOLEAN isOffChannelSupported)
 {
     hddTdlsPeer_t *curr_peer;
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-        return -EINVAL;
-
-    mutex_lock(&pHddCtx->tdls_lock);
     curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac);
     if (curr_peer == NULL)
     {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  "%s: curr_peer is NULL", __func__);
-        mutex_unlock(&pHddCtx->tdls_lock);
         return -1;
     }
 
@@ -1696,33 +1338,20 @@
 
     curr_peer->supported_oper_classes_len =
                StaParams->supported_oper_classes_len;
-    curr_peer->qos = isQosWmmSta;
-
-    mutex_unlock(&pHddCtx->tdls_lock);
+    curr_peer->qos = StaParams->capability & CAPABILITIES_QOS_OFFSET;
     return 0;
 }
 
-int wlan_hdd_tdls_get_link_establish_params(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                            const u8 *mac,
-#else
-                                            u8 *mac,
-#endif
+int wlan_hdd_tdls_get_link_establish_params(hdd_adapter_t *pAdapter, u8 *mac,
                                             tCsrTdlsLinkEstablishParams* tdlsLinkEstablishParams)
 {
     hddTdlsPeer_t *curr_peer;
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-        return -EINVAL;
-
-    mutex_lock(&pHddCtx->tdls_lock);
     curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac);
     if (curr_peer == NULL)
     {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  "%s: curr_peer is NULL", __func__);
-        mutex_unlock(&pHddCtx->tdls_lock);
         return -1;
     }
 
@@ -1748,98 +1377,72 @@
                  curr_peer->supported_oper_classes_len;
     tdlsLinkEstablishParams->qos = curr_peer->qos;
 
-    mutex_unlock(&pHddCtx->tdls_lock);
     return 0;
 }
 
-int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                           const u8 *mac,
-#else
-                           u8 *mac,
-#endif
-                           tANI_S8 rxRssi)
+int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, u8 *mac, tANI_S8 rxRssi)
 {
     hddTdlsPeer_t *curr_peer;
-    hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
 
-    if (0 != (wlan_hdd_validate_context(hdd_ctx))) {
-        return -1;
-    }
-
-    mutex_lock(&hdd_ctx->tdls_lock);
-    curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE);
+    curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
     if (curr_peer == NULL)
     {
-        mutex_unlock(&hdd_ctx->tdls_lock);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                FL("curr_peer is NULL"));
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 "%s: curr_peer is NULL", __func__);
         return -1;
     }
 
     curr_peer->rssi = rxRssi;
-    mutex_unlock(&hdd_ctx->tdls_lock);
 
     return 0;
 }
 
-int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                const u8 *mac,
-#else
-                                u8 *mac,
-#endif
-                                tANI_U8 responder)
+int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter, u8 *mac, tANI_U8 responder)
 {
     hddTdlsPeer_t *curr_peer;
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-        return -EINVAL;
-
-    mutex_lock(&pHddCtx->tdls_lock);
     curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac);
     if (curr_peer == NULL)
     {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  "%s: curr_peer is NULL", __func__);
-        mutex_unlock(&pHddCtx->tdls_lock);
         return -1;
     }
 
     curr_peer->is_responder = responder;
 
-    mutex_unlock(&pHddCtx->tdls_lock);
     return 0;
 }
 
-int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                const u8 *mac,
-#else
-                                u8 *mac,
-#endif
-                                tANI_U8 uSignature)
+int wlan_hdd_tdls_get_responder(hdd_adapter_t *pAdapter, u8 *mac)
 {
     hddTdlsPeer_t *curr_peer;
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-        return -EINVAL;
+    curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
+    if (curr_peer == NULL)
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 "%s: curr_peer is NULL", __func__);
+        return -1;
+    }
 
-    mutex_lock(&pHddCtx->tdls_lock);
+    return (curr_peer->is_responder);
+}
+
+int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter, u8 *mac, tANI_U8 uSignature)
+{
+    hddTdlsPeer_t *curr_peer;
+
     curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac);
     if (curr_peer == NULL)
     {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  "%s: curr_peer is NULL", __func__);
-        mutex_unlock(&pHddCtx->tdls_lock);
         return -1;
     }
 
     curr_peer->signature = uSignature;
 
-    mutex_unlock(&pHddCtx->tdls_lock);
     return 0;
 }
 
@@ -1854,112 +1457,28 @@
     memcpy(mac, skb->data+6, 6);
 }
 
-/**
- * wlan_hdd_tdls_is_forced_peer - function to check if peer is forced peer
- * @adapter: pointer to hdd apater
- * @mac: peer mac address
- *
- * Function identified is the peer is forced for tdls connection
- *
- * return: true: peer is forced false: peer is not forced
- */
-static bool wlan_hdd_tdls_is_forced_peer(hdd_adapter_t *adapter,
-                                         const u8 *mac)
-{
-    hddTdlsPeer_t *peer;
-    hdd_context_t *hddctx = WLAN_HDD_GET_CTX(adapter);
-    bool is_forced_peer;
-
-    mutex_lock(&hddctx->tdls_lock);
-    peer = wlan_hdd_tdls_find_peer(adapter, mac, FALSE);
-    if (!peer)
-    {
-        is_forced_peer = false;
-        goto ret;
-    }
-
-    if (!peer->isForcedPeer)
-    {
-        is_forced_peer = false;
-        goto ret;
-    }
-    is_forced_peer = true;
-
-ret:
-    mutex_unlock(&hddctx->tdls_lock);
-    return is_forced_peer;
-}
-
-/**
- * wlan_hdd_tdls_increment_pkt_count - function to increment tdls tx packet cnt
- * @pAdapter: pointer to hdd adapter
- * @skb: pointer to sk_buff
- *
- * Function to increment packet count if packet is destined to tdls peer
- *
- * return: None
- */
-static void wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter,
-                                      struct sk_buff *skb)
+int wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter, u8 *mac, u8 tx)
 {
     hddTdlsPeer_t *curr_peer;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    hdd_station_ctx_t *hdd_sta_ctx;
-    u8 mac[6];
-
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-        return;
 
     if (eTDLS_SUPPORT_ENABLED != pHddCtx->tdls_mode)
-        goto error;
+        return -1;
 
-    if (!pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger)
-        goto error;
-
-    wlan_hdd_tdls_extract_da(skb, mac);
-
-    if (pHddCtx->cfg_ini->fTDLSExternalControl)
-    {
-        if (!wlan_hdd_tdls_is_forced_peer(pAdapter, mac))
-            goto error;
-    }
-
-    hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-
-    if (vos_is_macaddr_group((v_MACADDR_t *)mac))
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
-                  "broadcast packet, not adding to peer list");
-        goto error;
-    }
-
-    if (memcmp(hdd_sta_ctx->conn_info.bssId, mac, 6) == 0) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
-                  "packet da is bssid, not adding to peer list");
-        goto error;
-    }
-
-    mutex_lock(&pHddCtx->tdls_lock);
     curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac);
     if (curr_peer == NULL)
     {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                  FL("curr_peer is NULL"));
-        mutex_unlock(&pHddCtx->tdls_lock);
-        goto error;
+        return -1;
     }
 
-    curr_peer->tx_pkt++;
+    if (tx)
+        curr_peer->tx_pkt++;
+    else
+        curr_peer->rx_pkt++;
 
-    mutex_unlock(&pHddCtx->tdls_lock);
-
-error:
-    return;
-}
-
-void wlan_hdd_tdls_notify_packet(hdd_adapter_t *adapter, struct sk_buff *skb)
-{
-    wlan_hdd_tdls_increment_pkt_count(adapter, skb);
+    return 0;
 }
 
 static int wlan_hdd_tdls_check_config(tdls_config_params_t *config)
@@ -2042,28 +1561,14 @@
     tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
     eTDLSSupportMode req_tdls_mode;
 
-    if ((TRUE != pHddCtx->cfg_ini->fEnableTDLSSupport) &&
-        (TRUE != sme_IsFeatureSupportedByFW(TDLS)))
-    {
-        hddLog(LOGE,
-               FL("TDLS not enabled (%d) or FW doesn't support (%d)"),
-               pHddCtx->cfg_ini->fEnableTDLSSupport,
-               sme_IsFeatureSupportedByFW(TDLS));
-        pHddCtx->tdls_mode = eTDLS_SUPPORT_NOT_ENABLED;
-        return -EINVAL;
-    }
-
-    mutex_lock(&pHddCtx->tdls_lock);
     if (NULL == pHddTdlsCtx)
     {
-        mutex_unlock(&pHddCtx->tdls_lock);
         hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS not enabled!"));
         return -1;
     }
 
     if (wlan_hdd_tdls_check_config(config) != 0)
     {
-        mutex_unlock(&pHddCtx->tdls_lock);
         return -1;
     }
 
@@ -2071,7 +1576,6 @@
     req_tdls_mode = config->tdls + 1;
     if (pHddCtx->tdls_mode == req_tdls_mode)
     {
-        mutex_unlock(&pHddCtx->tdls_lock);
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s already in mode %d", __func__, config->tdls);
         return -1;
     }
@@ -2095,75 +1599,54 @@
             config->rssi_trigger_threshold,
             config->rssi_teardown_threshold);
 
-    mutex_unlock(&pHddCtx->tdls_lock);
-
-    wlan_hdd_tdls_set_mode(pHddCtx, req_tdls_mode, TRUE,
-                           HDD_SET_TDLS_MODE_SOURCE_USER);
+    wlan_hdd_tdls_set_mode(pHddCtx, req_tdls_mode, TRUE);
 
     return 0;
 }
 
-int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                             const u8 *mac,
-#else
-                             u8 *mac,
-#endif
-                             u8 staId)
+int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter, u8 *mac, u8 staId)
 {
     hddTdlsPeer_t *curr_peer;
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-        return -EINVAL;
-
-    mutex_lock(&pHddCtx->tdls_lock);
     curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac);
     if (curr_peer == NULL)
     {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  "%s: curr_peer is NULL", __func__);
-        mutex_unlock(&pHddCtx->tdls_lock);
         return -1;
     }
 
     curr_peer->staId = staId;
 
-    mutex_unlock(&pHddCtx->tdls_lock);
     return 0;
 }
 
-int wlan_hdd_tdls_set_force_peer(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                 const u8 *mac,
-#else
-                                 u8 *mac,
-#endif
+int wlan_hdd_tdls_set_force_peer(hdd_adapter_t *pAdapter, u8 *mac,
                                  tANI_BOOLEAN forcePeer)
 {
-    /* NOTE:
-     * Hold mutex tdls_lock before calling this function
-     */
     hddTdlsPeer_t *curr_peer;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
     if ((NULL == pHddCtx)) return -1;
 
+    mutex_lock(&pHddCtx->tdls_lock);
+
     curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE);
     if (curr_peer == NULL)
         goto error;
     curr_peer->isForcedPeer = forcePeer;
 
+    mutex_unlock(&pHddCtx->tdls_lock);
     return 0;
 error:
+    mutex_unlock(&pHddCtx->tdls_lock);
     return -1;
 }
 
 /* if peerMac is found, then it returns pointer to hddTdlsPeer_t
    otherwise, it returns NULL
 */
-hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter,
-                                       const u8 *mac,
+hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter, u8 *mac,
                                        tANI_BOOLEAN mutexLock)
 {
     u8 key;
@@ -2175,6 +1658,8 @@
 
     if(0 != (wlan_hdd_validate_context(pHddCtx)))
     {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return 0;
     }
 
@@ -2197,6 +1682,8 @@
     list_for_each(pos, head) {
         curr_peer = list_entry (pos, hddTdlsPeer_t, node);
         if (!memcmp(mac, curr_peer->peerMac, 6)) {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                     "findTdlsPeer: found staId %d", curr_peer->staId);
             if ( mutexLock )
                 mutex_unlock(&pHddCtx->tdls_lock);
             return curr_peer;
@@ -2204,17 +1691,10 @@
     }
     if ( mutexLock )
         mutex_unlock(&pHddCtx->tdls_lock);
-
     return NULL;
 }
 
-hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(hdd_context_t *pHddCtx,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                           const u8 *mac
-#else
-                                           u8 *mac
-#endif
-)
+hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(hdd_context_t *pHddCtx, u8 *mac)
 {
     hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
     hdd_adapter_t *pAdapter = NULL;
@@ -2222,6 +1702,7 @@
     hddTdlsPeer_t *curr_peer= NULL;
     VOS_STATUS status = 0;
 
+    mutex_lock(&pHddCtx->tdls_lock);
     status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
     while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
     {
@@ -2233,32 +1714,25 @@
             curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE);
             if (curr_peer)
             {
+                mutex_unlock(&pHddCtx->tdls_lock);
                 return curr_peer;
             }
         }
         status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
         pAdapterNode = pNext;
     }
+    mutex_unlock(&pHddCtx->tdls_lock);
     return curr_peer;
 }
 
 
-int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                             const u8 *mac
-#else
-                             u8 *mac
-#endif
-)
+int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter, u8 *mac)
 {
     hdd_context_t *pHddCtx;
     hddTdlsPeer_t *curr_peer;
 
     pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
 
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-        return -EINVAL;
-
     curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac);
     if (curr_peer == NULL)
     {
@@ -2283,14 +1757,9 @@
         pHddCtx->isTdlsScanCoexistence = FALSE;
     }
 
-    if((eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode) &&
-            (vos_timer_is_initialized(&curr_peer->peerIdleTimer)) &&
-            (VOS_TIMER_STATE_RUNNING ==
-             vos_timer_getCurrentState(&curr_peer->peerIdleTimer)))
-    {
+    if(eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode) {
         vos_timer_stop( &curr_peer->peerIdleTimer );
     }
-
     return 0;
 }
 
@@ -2351,7 +1820,7 @@
         head = &pHddTdlsCtx->peer_list[i];
         list_for_each_safe (pos, q, head) {
             tmp = list_entry(pos, hddTdlsPeer_t, node);
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                       "%s, %d, " MAC_ADDRESS_STR, __func__, i,
                       MAC_ADDR_ARRAY(tmp->peerMac));
             discovery_peer_cnt++;
@@ -2362,30 +1831,20 @@
 
 tANI_U16 wlan_hdd_tdlsConnectedPeers(hdd_adapter_t *pAdapter)
 {
-    hdd_context_t *pHddCtx = NULL;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("invalid pAdapter: %p"), pAdapter);
-        return 0;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-
-    ENTER();
     if(0 != (wlan_hdd_validate_context(pHddCtx)))
     {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return 0;
     }
-    EXIT();
+
     return pHddCtx->connected_peer_count;
 }
 
-hddTdlsPeer_t *wlan_hdd_tdls_get_connected_peer(hdd_adapter_t *pAdapter)
+hddTdlsPeer_t *wlan_hdd_tdls_get_first_connected_peer(hdd_adapter_t *pAdapter)
 {
-    /* NOTE:
-     * Hold mutext tdls_lock before calling this function
-     */
     int i;
     struct list_head *head;
     struct list_head *pos;
@@ -2393,14 +1852,17 @@
     tdlsCtx_t *pHddTdlsCtx;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    ENTER();
     if(0 != (wlan_hdd_validate_context(pHddCtx)))
     {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return NULL;
     }
 
+    mutex_lock(&pHddCtx->tdls_lock);
     pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
     if (NULL == pHddTdlsCtx) {
+        mutex_unlock(&pHddCtx->tdls_lock);
         return NULL;
     }
     for (i = 0; i < 256; i++) {
@@ -2410,15 +1872,15 @@
             curr_peer= list_entry (pos, hddTdlsPeer_t, node);
             if (curr_peer && (curr_peer->link_status == eTDLS_LINK_CONNECTED))
             {
-               VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+               mutex_unlock(&pHddCtx->tdls_lock);
+               VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                           "%s: " MAC_ADDRESS_STR " eTDLS_LINK_CONNECTED",
                            __func__, MAC_ADDR_ARRAY(curr_peer->peerMac));
                return curr_peer;
             }
         }
     }
-
-    EXIT();
+    mutex_unlock(&pHddCtx->tdls_lock);
     return NULL;
 }
 
@@ -2432,9 +1894,10 @@
     tdlsCtx_t *pHddTdlsCtx;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    ENTER();
     if(0 != (wlan_hdd_validate_context(pHddCtx)))
     {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return 0;
     }
 
@@ -2475,8 +1938,6 @@
         }
     }
     mutex_unlock(&pHddCtx->tdls_lock);
-
-    EXIT();
     return init_len-buflen;
 }
 
@@ -2496,20 +1957,21 @@
 
     if (0 != wlan_hdd_sta_tdls_init(pAdapter))
     {
+        hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wlan_hdd_sta_tdls_init failed",__func__);
         mutex_unlock(&pHddCtx->tdls_lock);
-        hddLog(LOGE, FL("wlan_hdd_sta_tdls_init failed"));
         return;
     }
+    set_bit(TDLS_INIT_DONE, &pAdapter->event_flags);
 
     pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
     if ((NULL == pHddTdlsCtx))
     {
-       mutex_unlock(&pHddCtx->tdls_lock);
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
                FL("pHddCtx or  pHddTdlsCtx points to NULL device mode = %d"), pAdapter->device_mode);
+       mutex_unlock(&pHddCtx->tdls_lock);
        return;
     }
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+    VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
     "%s, update %d discover %d", __func__,
         pHddTdlsCtx->threshold_config.tx_period_t,
         pHddTdlsCtx->threshold_config.discovery_period_t);
@@ -2520,6 +1982,11 @@
        pHddTdlsCtx->discovery_sent_cnt = 0;
        wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter);
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+       wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter,
+                                   &pHddTdlsCtx->peerDiscoverTimer,
+                                   pHddTdlsCtx->threshold_config.discovery_period_t);
+#endif
        wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter,
                                    &pHddTdlsCtx->peerUpdateTimer,
                                    pHddTdlsCtx->threshold_config.tx_period_t);
@@ -2530,31 +1997,39 @@
 
 void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter)
 {
-    tdlsCtx_t *pHddTdlsCtx;
-    hdd_context_t *pHddCtx;
+    tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s", __func__);
+    if (NULL == pHddCtx)
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+               FL(" pHddCtx points to NULL"));
+       return;
+    }
 
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-
-    if (0 != wlan_hdd_validate_context(pHddCtx))
-        return;
+    VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,"%s", __func__);
 
     mutex_lock(&pHddCtx->tdls_lock);
-
-    pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
     if (NULL == pHddTdlsCtx)
     {
-       mutex_unlock(&pHddCtx->tdls_lock);
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  FL("pHddTdlsCtx is NULL"));
+        mutex_unlock(&pHddCtx->tdls_lock);
         return;
     }
 
+#ifdef WLAN_OPEN_SOURCE
+    cancel_work_sync(&pHddTdlsCtx->implicit_setup);
+#endif
+
     pHddTdlsCtx->discovery_sent_cnt = 0;
     wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter);
 
-    wlan_hdd_tdls_exit(pAdapter, TRUE);
+    if(test_bit(TDLS_INIT_DONE, &pAdapter->event_flags))
+    {
+       wlan_hdd_tdls_exit(pAdapter);
+       clear_bit(TDLS_INIT_DONE, &pAdapter->event_flags);
+    }
 
     mutex_unlock(&pHddCtx->tdls_lock);
 }
@@ -2562,8 +2037,8 @@
 void wlan_hdd_tdls_mgmt_completion_callback(hdd_adapter_t *pAdapter, tANI_U32 statusCode)
 {
     pAdapter->mgmtTxCompletionStatus = statusCode;
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-               "%s: Mgmt TX Completion %d",__func__, statusCode);
+    VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,"%s: Mgmt TX Completion %d",
+               __func__, statusCode);
     complete(&pAdapter->tdls_mgmt_comp);
 }
 
@@ -2571,9 +2046,10 @@
 {
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    ENTER();
     if(0 != (wlan_hdd_validate_context(pHddCtx)))
     {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return;
     }
 
@@ -2582,21 +2058,20 @@
     pHddCtx->connected_peer_count++;
     wlan_hdd_tdls_check_power_save_prohibited(pAdapter);
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: %d",
+    VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: %d",
                __func__, pHddCtx->connected_peer_count);
 
     mutex_unlock(&pHddCtx->tdls_lock);
-
-    EXIT();
 }
 
 void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter)
 {
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    ENTER();
     if(0 != (wlan_hdd_validate_context(pHddCtx)))
     {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return;
     }
 
@@ -2606,64 +2081,42 @@
         pHddCtx->connected_peer_count--;
     wlan_hdd_tdls_check_power_save_prohibited(pAdapter);
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: %d",
+    VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: %d",
                __func__, pHddCtx->connected_peer_count);
 
     mutex_unlock(&pHddCtx->tdls_lock);
 
-    EXIT();
 }
 
 void wlan_hdd_tdls_check_bmps(hdd_adapter_t *pAdapter)
 {
-
-    tdlsCtx_t *pHddTdlsCtx = NULL;
-    hdd_context_t *pHddCtx = NULL;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+    tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
     hddTdlsPeer_t *curr_peer;
 
-    if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("invalid pAdapter: %p"), pAdapter);
-        return;
-    }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-
-    if (NULL == pHddCtx)
+    if ((NULL == pHddCtx) || (NULL == pHddTdlsCtx))
     {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-               FL("pHddCtx points to NULL"));
+               FL(" pHddCtx or  pHddTdlsCtx points to NULL"));
        return;
     }
 
-    mutex_lock(&pHddCtx->tdls_lock);
-    curr_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0, FALSE);
+    curr_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0);
     if (NULL != curr_peer)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                 "%s: tdls in progress. Dont check for BMPS " MAC_ADDRESS_STR,
                 __func__, MAC_ADDR_ARRAY (curr_peer->peerMac));
-        mutex_unlock(&pHddCtx->tdls_lock);
         return;
     }
 
-    pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
-    if (NULL == pHddTdlsCtx)
-    {
-        mutex_unlock(&pHddCtx->tdls_lock);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                FL("pHddTdlsCtx points to NULL"));
-        return;
-    }
-    if ((TDLS_CTX_MAGIC != pHddCtx->scan_ctxt.magic) &&
+    if ((TDLS_CTX_MAGIC != pHddCtx->tdls_scan_ctxt.magic) &&
         (0 == pHddCtx->connected_peer_count) &&
         (0 == pHddTdlsCtx->discovery_sent_cnt))
     {
-        mutex_unlock(&pHddCtx->tdls_lock);
         if (FALSE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter)))
         {
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                        "%s: No TDLS peer connected/discovery sent. Enable BMPS",
                        __func__);
             hdd_enable_bmps_imps(pHddCtx);
@@ -2671,10 +2124,9 @@
     }
     else
     {
-        mutex_unlock(&pHddCtx->tdls_lock);
         if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter)))
         {
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                        "%s: TDLS peer connected. Disable BMPS", __func__);
             hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION);
         }
@@ -2682,18 +2134,27 @@
     return;
 }
 
+u8 wlan_hdd_tdls_is_peer_progress(hdd_adapter_t *pAdapter, u8 *mac)
+{
+    hddTdlsPeer_t *curr_peer;
+
+    curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
+    if (curr_peer == NULL)
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 "%s: curr_peer is NULL", __func__);
+        return 0;
+    }
+
+    return (eTDLS_LINK_CONNECTING == curr_peer->link_status);
+}
+
 /* return pointer to hddTdlsPeer_t if TDLS is ongoing. Otherwise return NULL.
  * mac - if NULL check for all the peer list, otherwise, skip this mac when skip_self is TRUE
  * skip_self - if TRUE, skip this mac. otherwise, check all the peer list. if
    mac is NULL, this argument is ignored, and check for all the peer list.
  */
-static hddTdlsPeer_t *wlan_hdd_tdls_find_progress_peer(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                                       const u8 *mac,
-#else
-                                                       u8 *mac,
-#endif
-                                                       u8 skip_self)
+static hddTdlsPeer_t *wlan_hdd_tdls_find_progress_peer(hdd_adapter_t *pAdapter, u8 *mac, u8 skip_self)
 {
     int i;
     struct list_head *head;
@@ -2703,7 +2164,7 @@
 
     if (NULL == pHddTdlsCtx)
     {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  FL("pHddTdlsCtx is NULL"));
         return NULL;
     }
@@ -2719,7 +2180,7 @@
             {
                 if (eTDLS_LINK_CONNECTING == curr_peer->link_status)
                 {
-                  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                  VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                             "%s:" MAC_ADDRESS_STR " eTDLS_LINK_CONNECTING",
                             __func__, MAC_ADDR_ARRAY(curr_peer->peerMac));
                   return curr_peer;
@@ -2730,13 +2191,7 @@
     return NULL;
 }
 
-hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                         const u8 *mac,
-#else
-                                         u8 *mac,
-#endif
-                                         u8 skip_self, tANI_BOOLEAN mutexLock)
+hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx, u8 *mac, u8 skip_self)
 {
     hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
     hdd_adapter_t *pAdapter = NULL;
@@ -2744,10 +2199,8 @@
     hddTdlsPeer_t *curr_peer= NULL;
     VOS_STATUS status = 0;
 
-    if (mutexLock)
-    {
-        mutex_lock(&pHddCtx->tdls_lock);
-    }
+    mutex_lock(&pHddCtx->tdls_lock);
+
     status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
     while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
     {
@@ -2759,16 +2212,14 @@
             curr_peer = wlan_hdd_tdls_find_progress_peer(pAdapter, mac, skip_self);
             if (curr_peer)
             {
-                if (mutexLock)
-                    mutex_unlock(&pHddCtx->tdls_lock);
+                mutex_unlock(&pHddCtx->tdls_lock);
                 return curr_peer;
             }
         }
         status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
         pAdapterNode = pNext;
     }
-    if (mutexLock)
-        mutex_unlock(&pHddCtx->tdls_lock);
+    mutex_unlock(&pHddCtx->tdls_lock);
     return NULL;
 }
 
@@ -2785,6 +2236,11 @@
     wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter);
 
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+    wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter,
+                                &pHddTdlsCtx->peerDiscoverTimer,
+                                pHddTdlsCtx->threshold_config.discovery_period_t);
+#endif
     wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter,
                                 &pHddTdlsCtx->peerUpdateTimer,
                                 pHddTdlsCtx->threshold_config.tx_period_t);
@@ -2792,19 +2248,19 @@
 
 void wlan_hdd_tdls_set_mode(hdd_context_t *pHddCtx,
                             eTDLSSupportMode tdls_mode,
-                            v_BOOL_t bUpdateLast,
-                            enum tdls_disable_source source)
+                            v_BOOL_t bUpdateLast)
 {
     hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
     VOS_STATUS status;
     hdd_adapter_t *pAdapter;
     tdlsCtx_t *pHddTdlsCtx;
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-               "%s mode %d", __func__, (int)tdls_mode);
+    VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,"%s mode %d", __func__, (int)tdls_mode);
 
     if(0 != (wlan_hdd_validate_context(pHddCtx)))
     {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return;
     }
 
@@ -2812,26 +2268,8 @@
 
     if (pHddCtx->tdls_mode == tdls_mode)
     {
+        hddLog(TDLS_LOG_LEVEL, "%s already in mode %d", __func__, (int)tdls_mode);
         mutex_unlock(&pHddCtx->tdls_lock);
-        hddLog(VOS_TRACE_LEVEL_INFO, "%s already in mode %d", __func__,
-                                     (int)tdls_mode);
-
-        if (tdls_mode == eTDLS_SUPPORT_DISABLED)
-        {
-            /*
-             * TDLS is already disabled hence set source mask and return
-             */
-            set_bit((unsigned long)source, &pHddCtx->tdls_source_bitmap);
-            return;
-        }
-        if (tdls_mode == eTDLS_SUPPORT_ENABLED)
-        {
-            /*
-             * TDLS is already disabled hence set source mask and return
-             */
-            clear_bit((unsigned long)source, &pHddCtx->tdls_source_bitmap);
-            return;
-        }
         return;
     }
 
@@ -2844,40 +2282,10 @@
        if (NULL != pHddTdlsCtx)
        {
            if(eTDLS_SUPPORT_ENABLED == tdls_mode)
-           {
-               clear_bit((unsigned long)source, &pHddCtx->tdls_source_bitmap);
-
-               /*
-                * Check if any TDLS source bit is set and if bitmap is
-                * not zero then we should not enable TDLS
-                */
-               if (pHddCtx->tdls_source_bitmap)
-               {
-                   mutex_unlock(&pHddCtx->tdls_lock);
-                   return;
-               }
                wlan_hdd_tdls_implicit_enable(pHddTdlsCtx);
-           }
-           else if((eTDLS_SUPPORT_DISABLED == tdls_mode))
-           {
-               set_bit((unsigned long)source, &pHddCtx->tdls_source_bitmap);
+           else if((eTDLS_SUPPORT_DISABLED == tdls_mode) ||
+                   (eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == tdls_mode))
                wlan_hdd_tdls_implicit_disable(pHddTdlsCtx);
-           }
-           else if ((eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == tdls_mode))
-           {
-               clear_bit((unsigned long)source, &pHddCtx->tdls_source_bitmap);
-
-               /*
-                * Check if any TDLS source bit is set and if bitmap is
-                * not zero then we should not enable TDLS
-                */
-               if (pHddCtx->tdls_source_bitmap)
-               {
-                   mutex_unlock(&pHddCtx->tdls_lock);
-                   return;
-               }
-               wlan_hdd_tdls_implicit_disable(pHddTdlsCtx);
-           }
        }
        status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
        pAdapterNode = pNext;
@@ -2893,31 +2301,42 @@
     pHddCtx->tdls_mode = tdls_mode;
 
     mutex_unlock(&pHddCtx->tdls_lock);
-
 }
 
-static
-void wlan_hdd_tdls_implicit_send_discovery_request(tdlsCtx_t * pHddTdlsCtx)
+static void __wlan_hdd_tdls_pre_setup(struct work_struct *work)
 {
-    hdd_context_t *pHddCtx = NULL;
-    hddTdlsPeer_t *curr_peer = NULL, *temp_peer = NULL;
+    tdlsCtx_t *pHddTdlsCtx =
+       container_of(work, tdlsCtx_t, implicit_setup);
+    hdd_context_t *pHddCtx;
+    hddTdlsPeer_t *curr_peer;
+    hddTdlsPeer_t *temp_peer;
+    int status;
 
-    ENTER();
     if (NULL == pHddTdlsCtx)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  FL("pHddTdlsCtx is NULL"));
         return;
     }
 
+    if (unlikely(TDLS_CTX_MAGIC != pHddTdlsCtx->magic))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 "%s: tdls magic no missmatch %u", __func__, pHddTdlsCtx->magic);
+        return;
+    }
+
     pHddCtx = WLAN_HDD_GET_CTX(pHddTdlsCtx->pAdapter);
 
     if(0 != (wlan_hdd_validate_context(pHddCtx)))
     {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return;
     }
 
     curr_peer = pHddTdlsCtx->curr_candidate;
+
     if (NULL == curr_peer)
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -2926,13 +2345,17 @@
         return;
     }
 
-    /* This function is called in mutex_lock */
-    temp_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0, FALSE);
+    if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter)))
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,"%s: Disable BMPS", __func__);
+        hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION);
+    }
+
+    temp_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0);
     if (NULL != temp_peer)
     {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                  "%s: " MAC_ADDRESS_STR " ongoing. pre_setup ignored",
-                  __func__, MAC_ADDR_ARRAY(temp_peer->peerMac));
+        VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: " MAC_ADDRESS_STR " ongoing. pre_setup ignored",
+            __func__, MAC_ADDR_ARRAY(temp_peer->peerMac));
         goto done;
     }
 
@@ -2941,31 +2364,49 @@
                                            eTDLS_LINK_DISCOVERING,
                                            eTDLS_LINK_SUCCESS);
 
-    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-              "%s: Implicit TDLS, Send Discovery request event", __func__);
+    status = wlan_hdd_cfg80211_send_tdls_discover_req(pHddTdlsCtx->pAdapter->wdev.wiphy,
+                                            pHddTdlsCtx->pAdapter->dev,
+                                            curr_peer->peerMac);
 
-    cfg80211_tdls_oper_request(pHddTdlsCtx->pAdapter->dev,
-                                   curr_peer->peerMac,
-                                   NL80211_TDLS_DISCOVERY_REQ,
-                                   FALSE,
-                                   GFP_KERNEL);
+    if (0 != status)
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: " MAC_ADDRESS_STR " discovery could not sent",
+            __func__, MAC_ADDR_ARRAY(curr_peer->peerMac));
+        if (eTDLS_CAP_UNKNOWN != curr_peer->tdls_support)
+            wlan_hdd_tdls_set_peer_link_status(curr_peer,
+                                               eTDLS_LINK_IDLE,
+                                               eTDLS_LINK_UNSPECIFIED);
+        goto done;
+    }
+
     pHddTdlsCtx->discovery_sent_cnt++;
 
+    mutex_lock(&pHddCtx->tdls_lock);
+
     wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter);
 
     wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter,
                                 &pHddTdlsCtx->peerDiscoveryTimeoutTimer,
                                 pHddTdlsCtx->threshold_config.tx_period_t - TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE);
 
-    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-              "%s: discovery count %u timeout %u msec",
-              __func__, pHddTdlsCtx->discovery_sent_cnt,
-              pHddTdlsCtx->threshold_config.tx_period_t - TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE);
+    mutex_unlock(&pHddCtx->tdls_lock);
+    VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: discovery count %u timeout %u msec",
+               __func__, pHddTdlsCtx->discovery_sent_cnt,
+               pHddTdlsCtx->threshold_config.tx_period_t - TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE);
 
 done:
     pHddTdlsCtx->curr_candidate = NULL;
     pHddTdlsCtx->magic = 0;
-    EXIT();
+    return;
+}
+
+
+static void wlan_hdd_tdls_pre_setup(struct work_struct *work)
+{
+    vos_ssr_protect(__func__);
+    __wlan_hdd_tdls_pre_setup(work);
+    vos_ssr_unprotect(__func__);
+
     return;
 }
 
@@ -2995,19 +2436,8 @@
 
 void wlan_hdd_tdls_check_power_save_prohibited(hdd_adapter_t *pAdapter)
 {
-    tdlsCtx_t *pHddTdlsCtx = NULL;
-    hdd_context_t *pHddCtx = NULL;
-
-
-    if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("invalid pAdapter: %p"), pAdapter);
-        return;
-    }
-
-    pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+    tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
     if ((NULL == pHddTdlsCtx) || (NULL == pHddCtx))
     {
@@ -3026,6 +2456,70 @@
     return;
 }
 
+void wlan_hdd_tdls_free_scan_request (tdls_scan_context_t *tdls_scan_ctx)
+{
+    if (NULL == tdls_scan_ctx)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("tdls_scan_ctx is NULL"));
+        return;
+    }
+
+    tdls_scan_ctx->attempt = 0;
+    tdls_scan_ctx->reject = 0;
+    tdls_scan_ctx->magic = 0;
+    tdls_scan_ctx->scan_request = NULL;
+        return;
+}
+
+int wlan_hdd_tdls_copy_scan_context(hdd_context_t *pHddCtx,
+                            struct wiphy *wiphy,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+                            struct net_device *dev,
+#endif
+                            struct cfg80211_scan_request *request)
+{
+    tdls_scan_context_t *scan_ctx;
+
+    if(0 != (wlan_hdd_validate_context(pHddCtx)))
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
+        return 0;
+    }
+
+    scan_ctx = &pHddCtx->tdls_scan_ctxt;
+
+    scan_ctx->wiphy = wiphy;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+    scan_ctx->dev = dev;
+#endif
+
+    scan_ctx->scan_request = request;
+    return 0;
+}
+
+static void wlan_hdd_tdls_scan_init_work(hdd_context_t *pHddCtx,
+                                struct wiphy *wiphy,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+                                struct net_device *dev,
+#endif
+                                struct cfg80211_scan_request *request,
+                                unsigned long delay)
+{
+    if (TDLS_CTX_MAGIC != pHddCtx->tdls_scan_ctxt.magic)
+    {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+        wlan_hdd_tdls_copy_scan_context(pHddCtx, wiphy, dev, request);
+#else
+        wlan_hdd_tdls_copy_scan_context(pHddCtx, wiphy, request);
+#endif
+        pHddCtx->tdls_scan_ctxt.attempt = 0;
+        pHddCtx->tdls_scan_ctxt.magic = TDLS_CTX_MAGIC;
+    }
+    schedule_delayed_work(&pHddCtx->tdls_scan_ctxt.tdls_scan_work, delay);
+}
+
 /* return negative = caller should stop and return error code immediately
    return 0 = caller should stop and return success immediately
    return 1 = caller can continue to scan
@@ -3043,54 +2537,50 @@
     unsigned long delay;
     hdd_config_t  *cfg_param = pHddCtx->cfg_ini;
 
-    ENTER();
     if(0 != (wlan_hdd_validate_context(pHddCtx)))
     {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return 0;
     }
 
     /* if tdls is not enabled, then continue scan */
-    if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode))
+    if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) ||
+        (pHddCtx->is_tdls_btc_enabled == FALSE))
         return 1;
-
-    mutex_lock(&pHddCtx->tdls_lock);
-    curr_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0, FALSE);
+    curr_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0);
     if (NULL != curr_peer)
     {
-        if (pHddCtx->scan_ctxt.reject++ >= TDLS_MAX_SCAN_REJECT)
+        if (pHddCtx->tdls_scan_ctxt.reject++ >= TDLS_MAX_SCAN_REJECT)
         {
-            pHddCtx->scan_ctxt.reject = 0;
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            pHddCtx->tdls_scan_ctxt.reject = 0;
+            VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                     "%s: " MAC_ADDRESS_STR ". scan rejected %d. force it to idle",
-                    __func__, MAC_ADDR_ARRAY (curr_peer->peerMac), pHddCtx->scan_ctxt.reject);
+                    __func__, MAC_ADDR_ARRAY (curr_peer->peerMac), pHddCtx->tdls_scan_ctxt.reject);
 
             wlan_hdd_tdls_set_peer_link_status (curr_peer,
                                                 eTDLS_LINK_IDLE,
                                                 eTDLS_LINK_UNSPECIFIED);
-            mutex_unlock(&pHddCtx->tdls_lock);
             return 1;
         }
-        mutex_unlock(&pHddCtx->tdls_lock);
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                 "%s: tdls in progress. scan rejected %d",
-                __func__, pHddCtx->scan_ctxt.reject);
+                __func__, pHddCtx->tdls_scan_ctxt.reject);
         return -EBUSY;
     }
-    else
-        mutex_unlock(&pHddCtx->tdls_lock);
 
     /* tdls teardown is ongoing */
     if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)
     {
         connectedTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter);
-        if (connectedTdlsPeers && (pHddCtx->scan_ctxt.attempt < TDLS_MAX_SCAN_SCHEDULE))
+        if (connectedTdlsPeers && (pHddCtx->tdls_scan_ctxt.attempt < TDLS_MAX_SCAN_SCHEDULE))
         {
             delay = (unsigned long)(TDLS_DELAY_SCAN_PER_CONNECTION*connectedTdlsPeers);
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                     "%s: tdls disabled, but still connected_peers %d attempt %d. schedule scan %lu msec",
-                    __func__, connectedTdlsPeers, pHddCtx->scan_ctxt.attempt, delay);
+                    __func__, connectedTdlsPeers, pHddCtx->tdls_scan_ctxt.attempt, delay);
 
-            wlan_hdd_defer_scan_init_work (pHddCtx, wiphy,
+            wlan_hdd_tdls_scan_init_work (pHddCtx, wiphy,
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
                                           dev,
 #endif
@@ -3100,9 +2590,9 @@
             return 0;
         }
         /* no connected peer or max retry reached, scan continue */
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                 "%s: tdls disabled. connected_peers %d attempt %d. scan allowed",
-                __func__, connectedTdlsPeers, pHddCtx->scan_ctxt.attempt);
+                __func__, connectedTdlsPeers, pHddCtx->tdls_scan_ctxt.attempt);
         return 1;
     }
 
@@ -3115,7 +2605,7 @@
      */
     if (pHddCtx->cfg_ini->fEnableTDLSScan == 1)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                    FL("Allow SCAN in all TDLS cases"));
         return 1;
     }
@@ -3131,39 +2621,34 @@
              (TRUE == sme_IsFeatureSupportedByFW(TDLS_SCAN_COEXISTENCE)) &&
              (connectedTdlsPeers == 1) )
         {
-            mutex_lock(&pHddCtx->tdls_lock);
             /* get connected peer information */
-            connected_peer = wlan_hdd_tdls_get_connected_peer(pAdapter);
+            connected_peer = wlan_hdd_tdls_get_first_connected_peer(pAdapter);
             if (NULL == connected_peer) {
-                mutex_unlock(&pHddCtx->tdls_lock);
                 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
                     "%s: Invalid connected_peer, Continue Scanning", __func__);
                 /* scan should continue */
                 return 1;
             }
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                       ("%s: TDLS Scan Co-exist supported connectedTdlsPeers =%d buffersta =%d"),
                        __func__,connectedTdlsPeers,connected_peer->isBufSta);
 
             if (connected_peer->isBufSta)
             {
-                mutex_unlock(&pHddCtx->tdls_lock);
-                pHddCtx->isTdlsScanCoexistence = TRUE;
-                if ((cfg_param->dynSplitscan) && (!pHddCtx->issplitscan_enabled))
-                {
-                    pHddCtx->issplitscan_enabled = TRUE;
-                    sme_enable_disable_split_scan(
-                            WLAN_HDD_GET_HAL_CTX(pAdapter),
-                            cfg_param->nNumStaChanCombinedConc,
-                            cfg_param->nNumP2PChanCombinedConc);
-                }
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                        ("%s:%d TDLS Scan Co-exist supported splitscan_enabled =%d "),
-                        __func__, __LINE__, pHddCtx->issplitscan_enabled);
-                return 1;
+                 pHddCtx->isTdlsScanCoexistence = TRUE;
+                 if ((cfg_param->dynSplitscan) && (!pHddCtx->issplitscan_enabled))
+                 {
+                           pHddCtx->issplitscan_enabled = TRUE;
+                           sme_enable_disable_split_scan(
+                                               WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                               cfg_param->nNumStaChanCombinedConc,
+                                               cfg_param->nNumP2PChanCombinedConc);
+                 }
+                 VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
+                           ("%s:%d TDLS Scan Co-exist supported splitscan_enabled =%d "),
+                            __func__, __LINE__, pHddCtx->issplitscan_enabled);
+                 return 1;
             }
-            else
-                mutex_unlock(&pHddCtx->tdls_lock);
 
         }
         else
@@ -3176,7 +2661,7 @@
              */
             pHddCtx->isTdlsScanCoexistence = FALSE;
         }
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                   ("%s: TDLS Scan Co-exist not supported connectedTdlsPeers =%d"
                    " TDLSScanCoexSupport param =%d TDLS_SCAN_COEXISTENCE =%d"),
                     __func__, connectedTdlsPeers,
@@ -3184,8 +2669,7 @@
                     sme_IsFeatureSupportedByFW(TDLS_SCAN_COEXISTENCE));
 
         /* disable implicit trigger logic & tdls operatoin */
-        wlan_hdd_tdls_set_mode(pHddCtx, eTDLS_SUPPORT_DISABLED, FALSE,
-                               HDD_SET_TDLS_MODE_SOURCE_SCAN);
+        wlan_hdd_tdls_set_mode(pHddCtx, eTDLS_SUPPORT_DISABLED, FALSE);
         /* fall back to the implementation of teardown the peers on the scan
          * when the number of connected peers are more than one. TDLS Scan
          * coexistance feature is exercised only when a single peer is
@@ -3198,39 +2682,29 @@
             tANI_U8 staIdx;
             hddTdlsPeer_t *curr_peer;
 
-            mutex_lock(&pHddCtx->tdls_lock);
             for (staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++)
             {
                 if (pHddCtx->tdlsConnInfo[staIdx].staId)
                 {
-                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                                   ("%s: indicate TDLS teardown (staId %d)"),
-                                   __func__, pHddCtx->tdlsConnInfo[staIdx].staId) ;
+                    VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
+                                   ("%s: indicate TDLS teadown (staId %d)"), __func__, pHddCtx->tdlsConnInfo[staIdx].staId) ;
 
 #ifdef CONFIG_TDLS_IMPLICIT
-                    curr_peer = wlan_hdd_tdls_find_all_peer(pHddCtx,
-                            pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes);
-                    if(curr_peer) {
-                        wlan_hdd_tdls_indicate_teardown(
-                                curr_peer->pHddTdlsCtx->pAdapter, curr_peer,
-                                eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
-                        hdd_send_wlan_tdls_teardown_event(
-                                               eTDLS_TEARDOWN_SCAN,
-                                               curr_peer->peerMac);
-                    }
+                    curr_peer = wlan_hdd_tdls_find_all_peer(pHddCtx, pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes);
+                    if(curr_peer)
+                        wlan_hdd_tdls_indicate_teardown(curr_peer->pHddTdlsCtx->pAdapter, curr_peer, eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
 #endif
                 }
             }
-            mutex_unlock(&pHddCtx->tdls_lock);
             /* schedule scan */
             delay = (unsigned long)(TDLS_DELAY_SCAN_PER_CONNECTION*connectedTdlsPeers);
 
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                     "%s: tdls enabled (mode %d), connected_peers %d. schedule scan %lu msec",
                     __func__, pHddCtx->tdls_mode, wlan_hdd_tdlsConnectedPeers(pAdapter),
                     delay);
 
-            wlan_hdd_defer_scan_init_work (pHddCtx, wiphy,
+            wlan_hdd_tdls_scan_init_work (pHddCtx, wiphy,
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
                                           dev,
 #endif
@@ -3240,11 +2714,10 @@
             return 0;
         }
         /* no connected peer, scan continue */
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                 "%s: tdls_mode %d, and no tdls connection. scan allowed",
                  __func__, pHddCtx->tdls_mode);
     }
-    EXIT();
     return 1;
 }
 
@@ -3252,35 +2725,29 @@
 {
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    ENTER();
     if(0 != (wlan_hdd_validate_context(pHddCtx)))
     {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 FL("pHddCtx is not valid"));
         return;
     }
 
-    /* if tdls is not enabled then don't revert tdls mode */
-    if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode)) {
-            hddLog(VOS_TRACE_LEVEL_INFO, FL("Failed to revert: Mode=%d"),
-                   pHddCtx->tdls_mode);
-            return;
-    }
+    if (pHddCtx->is_tdls_btc_enabled == FALSE)
+        return;
 
     /* free allocated memory at scan time */
-    wlan_hdd_init_deinit_defer_scan_context(&pHddCtx->scan_ctxt);
+    wlan_hdd_tdls_free_scan_request (&pHddCtx->tdls_scan_ctxt);
 
     /* if tdls was enabled before scan, re-enable tdls mode */
     if(eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode_last ||
        eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == pHddCtx->tdls_mode_last)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                        ("%s: revert tdls mode %d"), __func__, pHddCtx->tdls_mode_last);
 
-        wlan_hdd_tdls_set_mode(pHddCtx, pHddCtx->tdls_mode_last, FALSE,
-                               HDD_SET_TDLS_MODE_SOURCE_SCAN);
+        wlan_hdd_tdls_set_mode(pHddCtx, pHddCtx->tdls_mode_last, FALSE);
     }
     wlan_hdd_tdls_check_bmps(pAdapter);
-
-    EXIT();
 }
 
 void wlan_hdd_tdls_timer_restart(hdd_adapter_t *pAdapter,
@@ -3316,8 +2783,7 @@
 {
     hdd_context_t *pHddCtx;
 
-    if ((NULL == pAdapter || WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) ||
-        (NULL == curr_peer))
+    if (NULL == pAdapter || NULL == curr_peer)
     {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                  FL("parameters passed are invalid"));
@@ -3326,8 +2792,7 @@
 
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-    if ((eTDLS_LINK_CONNECTED != curr_peer->link_status) &&
-        (eTDLS_LINK_CONNECTING != curr_peer->link_status))
+    if (eTDLS_LINK_CONNECTED != curr_peer->link_status)
         return;
 
     /* Throughput Monitor shall disable the split scan when
@@ -3344,8 +2809,6 @@
     wlan_hdd_tdls_set_peer_link_status(curr_peer,
                                        eTDLS_LINK_TEARING,
                                        eTDLS_LINK_UNSPECIFIED);
-    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-              FL("Setting NL80211_TDLS_TEARDOWN, reason %d"), reason);
     cfg80211_tdls_oper_request(pAdapter->dev,
                                curr_peer->peerMac,
                                NL80211_TDLS_TEARDOWN,
@@ -3358,9 +2821,6 @@
 int wlan_hdd_set_callback(hddTdlsPeer_t *curr_peer,
                          cfg80211_exttdls_callback callback)
 {
-    /* NOTE:
-     * Hold mutex tdls_lock before calling this function
-     */
 
     hdd_context_t *pHddCtx;
     hdd_adapter_t   *pAdapter;
@@ -3371,9 +2831,14 @@
     pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     if ((NULL == pHddCtx)) return -1;
 
+    mutex_lock(&pHddCtx->tdls_lock);
+
     curr_peer->state_change_notification = callback;
 
+    mutex_unlock(&pHddCtx->tdls_lock);
     return 0;
+
+
 }
 
 void wlan_hdd_tdls_get_wifi_hal_state(hddTdlsPeer_t *curr_peer,
@@ -3393,14 +2858,7 @@
             *state = WIFI_TDLS_TRYING;
             break;
         case eTDLS_LINK_CONNECTED:
-            if (TRUE == curr_peer->isOffChannelEstablished)
-            {
-                *state = WIFI_TDLS_ESTABLISHED_OFF_CHANNEL;
-            }
-            else
-            {
-                *state = WIFI_TDLS_ESTABLISHED;
-            }
+            *state = WIFI_TDLS_ESTABLISHED;
             break;
         case eTDLS_LINK_TEARING:
             *state = WIFI_TDLS_DROPPED;
@@ -3410,20 +2868,14 @@
 }
 
 int wlan_hdd_tdls_get_status(hdd_adapter_t *pAdapter,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                             const tANI_U8* mac,
-#else
                              tANI_U8* mac,
-#endif
                              tANI_S32 *state,
                              tANI_S32 *reason)
 {
 
     hddTdlsPeer_t *curr_peer;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-
-    mutex_lock(&pHddCtx->tdls_lock);
-    curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE);
+    curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
     if (curr_peer == NULL)
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -3447,7 +2899,6 @@
             wlan_hdd_tdls_get_wifi_hal_state(curr_peer, state, reason);
         }
     }
-    mutex_unlock(&pHddCtx->tdls_lock);
     return (0);
 }
 
@@ -3455,14 +2906,13 @@
                    tANI_U8 *ptr)
 {
     int tdls_scan_type;
-    hdd_context_t *pHddCtx;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     if (NULL == pAdapter)
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: pAdapter is NULL", __func__);
         return -EINVAL;
     }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     tdls_scan_type = ptr[9] - '0';
 
     if (tdls_scan_type <= 2)
@@ -3479,150 +2929,6 @@
         return -EINVAL;
     }
 }
-int wlan_hdd_validate_tdls_context(hdd_context_t *pHddCtx,
-                                   tdlsCtx_t *pHddTdlsCtx)
-{
-    VOS_STATUS status;
-    int found = 0;
-    hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
-    hdd_adapter_t      *pAdapter;
-
-    if (NULL == pHddTdlsCtx)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("TDLS context is NULL"));
-        return -EINVAL;
-    }
-    status = hdd_get_front_adapter(pHddCtx, &pAdapterNode);
-    while (NULL != pAdapterNode && VOS_STATUS_SUCCESS == status)
-    {
-        pAdapter = pAdapterNode->pAdapter;
-        if (NULL != pAdapter)
-        {
-           if (pHddTdlsCtx == pAdapter->sessionCtx.station.pHddTdlsCtx &&
-              (NULL != pHddTdlsCtx->pAdapter) &&
-              (WLAN_HDD_ADAPTER_MAGIC == pHddTdlsCtx->pAdapter->magic))
-           {
-               found = 1;
-               break;
-           }
-        }
-        status = hdd_get_next_adapter (pHddCtx, pAdapterNode, &pNext);
-        pAdapterNode = pNext;
-    }
-    if (found == 1)
-    {
-        return 0;
-    }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("TDLS context doesnot belongs to valid adapter"));
-        return -EINVAL;
-    }
-}
-
-
-void wlan_hdd_tdls_update_rx_pkt_cnt_n_rssi(hdd_adapter_t *pAdapter,
-        u8 *mac, v_S7_t rssiAvg)
-{
-    hddTdlsPeer_t *curr_peer;
-    hdd_context_t *pHddCtx = NULL;
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    mutex_lock(&pHddCtx->tdls_lock);
-    curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE);
-    if ((NULL != curr_peer) &&
-            (eTDLS_LINK_CONNECTED == curr_peer->link_status))
-    {
-        curr_peer->rx_pkt++;
-        curr_peer->rssi = rssiAvg;
-    }
-    mutex_unlock(&pHddCtx->tdls_lock);
-    VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-            "mac : " MAC_ADDRESS_STR "rssi is %d",
-            MAC_ADDR_ARRAY(mac), rssiAvg);
-}
-
-/**
- * wlan_hdd_tdls_reenable() - Re-Enable TDLS
- * @hddctx: pointer to hdd context
- *
- * Function re-enable's TDLS which might be disabled during concurrency
- *
- * Return: None
- */
-void wlan_hdd_tdls_reenable(hdd_context_t *pHddCtx)
-{
-
-    if ((TRUE != pHddCtx->cfg_ini->fEnableTDLSSupport) ||
-        (TRUE != sme_IsFeatureSupportedByFW(TDLS))) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("tdls support not enabled"));
-        return;
-    }
-
-    /* if tdls is not enabled then don't revert tdls mode */
-    if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode)) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("TDLS disabled so no need to enable: Mode=%d"),
-                  pHddCtx->tdls_mode);
-            return;
-    }
-
-    if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode_last ||
-         eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY ==
-                               pHddCtx->tdls_mode_last) {
-            /* Enable TDLS support Once P2P session ends since
-             * upond detection of concurrency TDLS might be disabled
-             */
-             hddLog(LOG1, FL("TDLS mode set to %d"), pHddCtx->tdls_mode_last);
-             wlan_hdd_tdls_set_mode(pHddCtx, pHddCtx->tdls_mode_last,
-                                    FALSE, HDD_SET_TDLS_MODE_SOURCE_P2P);
-    }
-}
-
-tdlsConnInfo_t *wlan_hdd_get_conn_info(hdd_context_t *pHddCtx,
-                                       tANI_U8 idx)
-{
-    tANI_U8 staIdx;
-
-    /* check if there is available index for this new TDLS STA */
-    for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ )
-    {
-        if (idx == pHddCtx->tdlsConnInfo[staIdx].staId )
-        {
-            hddLog(LOG1, FL("tdls peer with staIdx %u exists"), idx );
-            return (&pHddCtx->tdlsConnInfo[staIdx]);
-        }
-    }
-    hddLog(LOGE, FL("tdls peer with staIdx %u not exists"), idx );
-    return NULL;
-}
-
-void wlan_hdd_change_tdls_mode(void *data)
-{
-    hdd_context_t *hdd_ctx = (hdd_context_t *)data;
-
-    wlan_hdd_tdls_set_mode(hdd_ctx, eTDLS_SUPPORT_ENABLED, FALSE,
-                           HDD_SET_TDLS_MODE_SOURCE_OFFCHANNEL);
-}
-
-void wlan_hdd_start_stop_tdls_source_timer(hdd_context_t *pHddCtx,
-                                           eTDLSSupportMode tdls_mode)
-{
-    if (VOS_TIMER_STATE_RUNNING ==
-            vos_timer_getCurrentState(&pHddCtx->tdls_source_timer))
-        vos_timer_stop(&pHddCtx->tdls_source_timer);
-
-    if (tdls_mode == eTDLS_SUPPORT_DISABLED) {
-        wlan_hdd_tdls_set_mode(pHddCtx, tdls_mode, FALSE,
-                               HDD_SET_TDLS_MODE_SOURCE_OFFCHANNEL);
-    }
-
-    vos_timer_start(&pHddCtx->tdls_source_timer,
-                    pHddCtx->cfg_ini->tdls_enable_defer_time);
-
-    return;
-}
 
 /*EXT TDLS*/
+
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_trace.c b/wlan/prima/CORE/HDD/src/wlan_hdd_trace.c
index 6901109..fb7095b 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_trace.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_trace.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -74,15 +74,6 @@
            CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS);
            CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_SET_TXPOWER);
            CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_GET_TXPOWER);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_SCAN);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_SET_CHANNEL);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_ADD_BEACON);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_SET_BEACON);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_CHANGE_IFACE);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CHANGE_STATION);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_UPDATE_BSS);
            CASE_RETURN_STRING(TRACE_CODE_HDD_REMAIN_ON_CHANNEL);
            CASE_RETURN_STRING(TRACE_CODE_HDD_REMAINCHANREADYHANDLER);
            CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_CANCEL_REMAIN_ON_CHANNEL);
@@ -93,22 +84,11 @@
            CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_DEL_STA);
            CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_ADD_STA);
            CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_SET_PMKSA);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_DEL_PMKSA);
            CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES);
            CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_TDLS_MGMT);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_TDLS_OPER);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_RESUME_WLAN);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_SET_MAC_ACL);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_TESTMODE);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_CFG80211_DUMP_SURVEY);
            CASE_RETURN_STRING(TRACE_CODE_HDD_UNSUPPORTED_IOCTL);
            CASE_RETURN_STRING(TRACE_CODE_HDD_SETROAMSCANCHANNELMINTIME_IOCTL);
            CASE_RETURN_STRING(TRACE_CODE_HDD_GETROAMSCANCHANNELMINTIME_IOCTL);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_STOP_NETDEV);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_WAKE_NETDEV);
-           CASE_RETURN_STRING(TRACE_CODE_HDD_FLUSH_TX_QUEUES);
            default:
                return ("UNKNOWN");
                break;
@@ -117,83 +97,12 @@
 
 void hddTraceDump(void *pMac, tpvosTraceRecord pRecord, tANI_U16 recIndex)
 {
-    if (TRACE_CODE_HDD_RX_SME_MSG == pRecord->code)
-    {
-        hddLog(LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-            recIndex, pRecord->time, pRecord->session, "RX SME MSG:",
-            get_eRoamCmdStatus_str(pRecord->data), pRecord->data);
-    }
-    else
-    {
-        hddLog(LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-            recIndex, pRecord->time, pRecord->session, "HDD Event:",
-            hddTraceGetEventString(pRecord->code), pRecord->data);
-    }
+    hddLog(LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ",
+                  recIndex, pRecord->time, pRecord->session,
+                  "HDD Event:", hddTraceGetEventString(pRecord->code), pRecord->data);
 }
 
 void hddTraceInit()
 {
     vosTraceRegister(VOS_MODULE_ID_HDD, (tpvosTraceCb)&hddTraceDump);
 }
-
-/**
- * hdd_state_info_dump() - prints state information of hdd layer
- */
-static void hdd_state_info_dump(void)
-{
-    v_CONTEXT_t vos_ctx_ptr;
-    hdd_context_t *hdd_ctx_ptr = NULL;
-    hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL;
-    VOS_STATUS status;
-    hdd_station_ctx_t *hdd_sta_ctx = NULL;
-    hdd_adapter_t *adapter =NULL;
-
-    /* get the global voss context */
-    vos_ctx_ptr = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL);
-
-    if (!vos_ctx_ptr) {
-        hddLog(LOGE, FL("Invalid Global VOSS Context"));
-        VOS_ASSERT(0);
-        return;
-    }
-    hdd_ctx_ptr = vos_get_context(VOS_MODULE_ID_HDD, vos_ctx_ptr);
-    if (!hdd_ctx_ptr) {
-       hddLog(LOGE, FL("HDD context is Null"));
-       return;
-    }
-
-    hddLog(LOG1,
-           FL("mScanPending %d isWlanSuspended %d disable_dfs_flag %d"),
-           hdd_ctx_ptr->scan_info.mScanPending,
-           hdd_ctx_ptr->isWlanSuspended, hdd_ctx_ptr->disable_dfs_flag);
-
-    status = hdd_get_front_adapter(hdd_ctx_ptr, &adapter_node);
-
-    while (NULL != adapter_node && VOS_STATUS_SUCCESS == status) {
-       adapter = adapter_node->pAdapter;
-       if (adapter->dev)
-           hddLog(LOG1, FL("device name: %s"), adapter->dev->name);
-       switch (adapter->device_mode) {
-       case WLAN_HDD_INFRA_STATION:
-       case WLAN_HDD_P2P_CLIENT:
-           hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-           hddLog(LOG1, FL("connState: %d device_mode: %d"),
-                  hdd_sta_ctx->conn_info.connState, adapter->device_mode);
-           break;
-
-       default:
-           break;
-       }
-       status = hdd_get_next_adapter(hdd_ctx_ptr, adapter_node, &next);
-       adapter_node = next;
-    }
-}
-
-/**
- * hdd_register_debug_callback() - registration function for hdd layer
- * to print hdd state information
- */
-void hdd_register_debug_callback()
-{
-    vos_register_debug_callback(VOS_MODULE_ID_HDD, &hdd_state_info_dump);
-}
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_tx_rx.c b/wlan/prima/CORE/HDD/src/wlan_hdd_tx_rx.c
index 5404e1a..503e874 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_tx_rx.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_tx_rx.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -30,6 +30,9 @@
   \file  wlan_hdd_tx_rx.c
   
   \brief Linux HDD Tx/RX APIs
+         Copyright 2008 (c) Qualcomm, Incorporated.
+         All Rights Reserved.
+         Qualcomm Confidential and Proprietary.
   
   ==========================================================================*/
   
@@ -60,11 +63,10 @@
 #include "wlan_hdd_tdls.h"
 #endif
 
-#include "vos_diag_core_event.h"
+#ifdef DEBUG_ROAM_DELAY
 #include "vos_utils.h"
-#include  "sapInternal.h"
-#include  "wlan_hdd_trace.h"
-#include  "wlan_qct_wda.h"
+#endif
+
 /*--------------------------------------------------------------------------- 
   Preprocessor definitions and constants
   -------------------------------------------------------------------------*/ 
@@ -82,51 +84,12 @@
    WLANTL_AC_VI,
    WLANTL_AC_BE,
    WLANTL_AC_BK,
-   WLANTL_AC_HIGH_PRIO,
 };
 
 #define HDD_TX_TIMEOUT_RATELIMIT_INTERVAL 20*HZ
 #define HDD_TX_TIMEOUT_RATELIMIT_BURST    1
 #define HDD_TX_STALL_SSR_THRESHOLD        5
-#define HDD_TX_STALL_SSR_THRESHOLD_HIGH   13
 #define HDD_TX_STALL_RECOVERY_THRESHOLD HDD_TX_STALL_SSR_THRESHOLD - 2
-#define HDD_TX_STALL_KICKDXE_THRESHOLD  HDD_TX_STALL_SSR_THRESHOLD - 4
-#define HDD_TX_STALL_FATAL_EVENT_THRESHOLD 2
-#define EAPOL_MASK 0x8013
-#define EAPOL_M1_BIT_MASK 0x8000
-#define EAPOL_M2_BIT_MASK 0x0001
-#define EAPOL_M3_BIT_MASK 0x8013
-#define EAPOL_M4_BIT_MASK 0x0003
-
-
-int gRatefromIdx[] = {
- 10,20,55,100,
- 10,20,55,110,
- 60,90,120,180,240,360,480,540,
- 65,130,195,260,390,520,585,650,
- 72,144,217,289,434,578,650,722,
- 65,130,195,260,390,520,585,650,
- 135,270,405,540,810,1080,1215,1350,
- 150,300,450,600,900,1200,1350,1500,
- 135,270,405,540,810,1080,1215,1350,
- 1350,1350,65,130,195,260,390, 520,
- 585,650,780,1350,1350,1350,1350,1350,
- 1350,1350,1350,1350,655,722,866,1350,
- 1350,1350,135,270,405,540,810,1080,
- 1215,1350,1350,1620,1800,1350,1350,1350,
- 1350,1350,1350,1200,1350,1500,1350,1800,
- 2000,1350, 292,585,877,1170,1755,2340,
- 2632,2925,1350,3510,3900,1350,1350,1350,
- 1350,1350,1350,1350,2925,3250,1350,3900,
- 4333
- };
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-#define HDD_EAPOL_PACKET_TYPE_OFFSET  (15)
-#define HDD_EAPOL_KEY_INFO_OFFSET     (19)
-#define HDD_EAPOL_DEST_MAC_OFFSET     (0)
-#define HDD_EAPOL_SRC_MAC_OFFSET      (6)
-#endif /* FEATURE_WLAN_DIAG_SUPPORT */
-
 
 static DEFINE_RATELIMIT_STATE(hdd_tx_timeout_rs,                 \
                               HDD_TX_TIMEOUT_RATELIMIT_INTERVAL, \
@@ -241,9 +204,6 @@
 
    pAdapter->isVosLowResource = VOS_FALSE;
 
-   MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_FLUSH_TX_QUEUES,
-                    pAdapter->sessionId, 0));
-
    while (++i != NUM_TX_QUEUES) 
    {
       //Free up any packets in the Tx queue
@@ -284,33 +244,69 @@
 void hdd_flush_ibss_tx_queues( hdd_adapter_t *pAdapter, v_U8_t STAId)
 {
    v_U8_t i;
-   hdd_list_node_t *anchor = NULL;
+   v_SIZE_t size = 0;
+   v_U8_t skbStaIdx;
    skb_list_node_t *pktNode = NULL;
+   hdd_list_node_t *tmp = NULL, *next = NULL;
+   struct netdev_queue *txq;
    struct sk_buff *skb = NULL;
-   hdd_station_ctx_t *pHddStaCtx = &pAdapter->sessionCtx.station;
-   hdd_ibss_peer_info_t *pPeerInfo = &pHddStaCtx->ibss_peer_info;
 
-   for (i = 0; i < NUM_TX_QUEUES; i ++)
+   if (NULL == pAdapter)
    {
-      spin_lock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i].lock);
-      while (true)
+       VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
+              FL("pAdapter is NULL %u"), STAId);
+       VOS_ASSERT(0);
+       return;
+   }
+
+   for (i = 0; i < NUM_TX_QUEUES; i++)
+   {
+      spin_lock_bh(&pAdapter->wmm_tx_queue[i].lock);
+
+      if ( list_empty( &pAdapter->wmm_tx_queue[i].anchor ) )
       {
-         if (VOS_STATUS_E_EMPTY !=
-              hdd_list_remove_front(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i],
-                                    &anchor))
-         {
-            //If success then we got a valid packet from some AC
-            pktNode = list_entry(anchor, skb_list_node_t, anchor);
-            skb = pktNode->skb;
-            ++pAdapter->stats.tx_dropped;
-            ++pAdapter->hdd_stats.hddTxRxStats.txFlushed;
-            ++pAdapter->hdd_stats.hddTxRxStats.txFlushedAC[i];
-            kfree_skb(skb);
-            continue;
-         }
-         break;
+         spin_unlock_bh(&pAdapter->wmm_tx_queue[i].lock);
+         continue;
       }
-      spin_unlock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i].lock);
+
+      /* Iterate through the queue and identify the data for STAId */
+      list_for_each_safe(tmp, next, &pAdapter->wmm_tx_queue[i].anchor)
+      {
+         pktNode = list_entry(tmp, skb_list_node_t, anchor);
+         if (pktNode != NULL)
+         {
+            skb = pktNode->skb;
+
+            /* Get the STAId from data */
+            skbStaIdx = *(v_U8_t *)(((v_U8_t *)(skb->data)) - 1);
+            if (skbStaIdx == STAId)
+            {
+               /* Data for STAId is freed along with the queue node */
+               list_del(tmp);
+               kfree_skb(skb);
+
+               ++pAdapter->hdd_stats.hddTxRxStats.txFlushed;
+               ++pAdapter->hdd_stats.hddTxRxStats.txFlushedAC[i];
+               pAdapter->wmm_tx_queue[i].count--;
+            }
+         }
+      }
+
+      /* Restart the queue only-if suspend and the queue was flushed */
+      hdd_list_size( &pAdapter->wmm_tx_queue[i], &size );
+      txq = netdev_get_tx_queue(pAdapter->dev, i);
+
+      if (VOS_TRUE == pAdapter->isTxSuspended[i] &&
+          size <= HDD_TX_QUEUE_LOW_WATER_MARK &&
+          netif_tx_queue_stopped(txq) )
+      {
+         netif_tx_start_queue(txq);
+         pAdapter->isTxSuspended[i] = VOS_FALSE;
+         ++pAdapter->hdd_stats.hddTxRxStats.txDequeDePressured;
+         ++pAdapter->hdd_stats.hddTxRxStats.txDequeDePressuredAC[i];
+      }
+
+      spin_unlock_bh(&pAdapter->wmm_tx_queue[i].lock);
    }
 }
 
@@ -368,7 +364,6 @@
                  "%s: TX queue[%d] re-enabled", __func__, ac);
       pAdapter->isTxSuspended[ac] = VOS_FALSE;      
       /* Enable Queues which we have disabled earlier */
-      hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
       netif_tx_start_all_queues( pAdapter->dev ); 
    }
 
@@ -381,10 +376,7 @@
    struct sk_buff* skb;
    hdd_adapter_t* pMonAdapter = NULL;
    struct ieee80211_hdr *hdr;
-   hdd_context_t *pHddCtx;
-   int ret = 0;
 
-   ENTER();
    if (pAdapter == NULL)
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
@@ -392,12 +384,7 @@
       VOS_ASSERT(0);
       return;
    }
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return;
-   }
+
    pMonAdapter = hdd_get_adapter( pAdapter->pHddCtx, WLAN_HDD_MONITOR );
    if (pMonAdapter == NULL)
    {
@@ -472,11 +459,9 @@
           "%s: WLANSAP_SendAction returned fail", __func__);
       hdd_sendActionCnf( pAdapter, FALSE );
    }
-   EXIT();
    return;
 
 mgmt_handled:
-   EXIT();
    hdd_sendActionCnf( pAdapter, TRUE );
    return;
 fail:
@@ -485,24 +470,165 @@
    return;
 }
 
-void __hdd_mon_tx_work_queue(struct work_struct *work)
+void hdd_mon_tx_work_queue(struct work_struct *work)
 {
    hdd_adapter_t* pAdapter = container_of(work, hdd_adapter_t, monTxWorkQueue);
    hdd_mon_tx_mgmt_pkt(pAdapter);
 }
 
-void hdd_mon_tx_work_queue(struct work_struct *work)
-{
-   vos_ssr_protect(__func__);
-   __hdd_mon_tx_work_queue(work);
-   vos_ssr_unprotect(__func__);
-}
-
 int hdd_mon_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-   VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-           "%s: Packet Rcvd at Monitor interface,"
-             " Dropping the packet",__func__);
+   v_U16_t rt_hdr_len;
+   struct ieee80211_hdr *hdr;
+   hdd_adapter_t *pPgBkAdapter, *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
+   struct ieee80211_radiotap_header *rtap_hdr =
+                        (struct ieee80211_radiotap_header *)skb->data;
+
+   /*Supplicant sends the EAPOL packet on monitor interface*/
+   pPgBkAdapter = pAdapter->sessionCtx.monitor.pAdapterForTx;    
+   if(pPgBkAdapter == NULL)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_FATAL,
+           "%s: No Adapter to piggy back. Dropping the pkt on monitor inf",
+                                                                 __func__);
+      goto fail; /* too short to be possibly valid */
+   }
+ 
+   /* check if toal skb length is greater then radio tab header length of not */
+   if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
+      goto fail; /* too short to be possibly valid */
+   
+   /* check if radio tap header version is correct or not */
+   if (unlikely(rtap_hdr->it_version))
+      goto fail; /* only version 0 is supported */
+ 
+   /*Strip off the radio tap header*/
+   rt_hdr_len = ieee80211_get_radiotap_len(skb->data);
+ 
+   /* check if skb length if greator then total radio tap header length ot not*/
+   if (unlikely(skb->len < rt_hdr_len))
+      goto fail;
+ 
+   /* Update the trans_start for this netdev */  
+   dev->trans_start = jiffies;
+   /*
+    * fix up the pointers accounting for the radiotap
+    * header still being in there.
+    */
+   skb_set_mac_header(skb, rt_hdr_len);
+   skb_set_network_header(skb, rt_hdr_len);
+   skb_set_transport_header(skb, rt_hdr_len); 
+
+   /* Pull rtap header out of the skb */
+   skb_pull(skb, rt_hdr_len);
+  
+   /*Supplicant adds: radiotap Hdr + radiotap data + 80211 Header. So after 
+    * radio tap header and 802.11 header starts 
+    */
+   hdr = (struct ieee80211_hdr *)skb->data;
+ 
+   /* Send data frames through the normal Data path. In this path we will 
+    * conver rcvd 802.11 packet to 802.3 packet */
+   if ( (hdr->frame_control & HDD_FRAME_TYPE_MASK)  == HDD_FRAME_TYPE_DATA)
+   { 
+      v_U8_t da[6];
+      v_U8_t sa[6];
+
+      memcpy (da, hdr->addr1, VOS_MAC_ADDR_SIZE);
+      memcpy (sa, hdr->addr2, VOS_MAC_ADDR_SIZE);
+ 
+      /* Pull 802.11 MAC header */ 
+      skb_pull(skb, HDD_80211_HEADER_LEN);
+ 
+      if ( HDD_FRAME_SUBTYPE_QOSDATA == 
+          (hdr->frame_control & HDD_FRAME_SUBTYPE_MASK))
+      {
+         skb_pull(skb, HDD_80211_HEADER_QOS_CTL);
+      }
+
+      /* Pull LLC header */ 
+      skb_pull(skb, HDD_LLC_HDR_LEN);
+
+      /* Create space for Ethernet header */ 
+      skb_push(skb, HDD_MAC_HDR_SIZE*2);
+      memcpy(&skb->data[0], da, HDD_MAC_HDR_SIZE);
+      memcpy(&skb->data[HDD_DEST_ADDR_OFFSET], sa, HDD_MAC_HDR_SIZE);
+
+      /* Only EAPOL Data packets are allowed through monitor interface */ 
+      if (vos_be16_to_cpu(
+         (*(unsigned short*)&skb->data[HDD_ETHERTYPE_802_1_X_FRAME_OFFSET]) ) 
+                                                     != HDD_ETHERTYPE_802_1_X)
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_FATAL,
+           "%s: Not a Eapol packet. Drop this frame", __func__);
+         //If not EAPOL frames, drop them.
+         kfree_skb(skb);
+         return NETDEV_TX_OK;
+      }
+
+      skb->protocol = htons(HDD_ETHERTYPE_802_1_X);
+ 
+      hdd_hostapd_select_queue(pPgBkAdapter->dev, skb);
+      return hdd_softap_hard_start_xmit( skb, pPgBkAdapter->dev );
+   }
+   else
+   {
+      VOS_STATUS status;
+      WLANTL_ACEnumType ac = 0;
+      skb_list_node_t *pktNode = NULL;
+      v_SIZE_t pktListSize = 0;
+
+      spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
+      //If we have already reached the max queue size, disable the TX queue
+      if ( pAdapter->wmm_tx_queue[ac].count == pAdapter->wmm_tx_queue[ac].max_size)
+      {
+         /* We want to process one packet at a time, so lets disable all TX queues
+           * and re-enable the queues once we get TX feedback for this packet */
+         netif_tx_stop_all_queues(pAdapter->dev);
+         pAdapter->isTxSuspended[ac] = VOS_TRUE;
+         spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);      
+         return NETDEV_TX_BUSY;   
+      }
+      spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);      
+
+      //Use the skb->cb field to hold the list node information
+      pktNode = (skb_list_node_t *)&skb->cb;
+
+      //Stick the OS packet inside this node.
+      pktNode->skb = skb;
+
+      INIT_LIST_HEAD(&pktNode->anchor);
+
+      //Insert the OS packet into the appropriate AC queue
+      spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
+      status = hdd_list_insert_back_size( &pAdapter->wmm_tx_queue[ac],
+                                          &pktNode->anchor, &pktListSize );
+      spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);
+
+      if ( !VOS_IS_STATUS_SUCCESS( status ) )
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
+                "%s:Insert Tx queue failed. Pkt dropped", __func__);
+         kfree_skb(skb);
+         return NETDEV_TX_OK;
+      }
+
+      if ( pktListSize == 1 )
+      {
+         /* In this context we cannot acquire any mutex etc. And to transmit 
+          * this packet we need to call SME API. So to take care of this we will
+          * schedule a workqueue 
+          */
+         schedule_work(&pPgBkAdapter->monTxWorkQueue);
+      }
+      return NETDEV_TX_OK;
+   }
+ 
+fail:
+   VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_WARN,
+           "%s: Packet Rcvd at Monitor interface is not proper,"
+           " Dropping the packet",
+            __func__);
    kfree_skb(skb);
    return NETDEV_TX_OK;
 }
@@ -604,195 +730,6 @@
 }
 
 /**============================================================================
-   @brief hdd_ibss_hard_start_xmit() - Function registered with the Linux OS for
-   transmitting packets in case of IBSS. There are 2 versions of this function.
-   One that uses locked queue and other that uses lockless queues. Both have been
-   retained to do some performance testing
-
-   @param skb      : [in]  pointer to OS packet (sk_buff)
-   @param dev      : [in] pointer to network device
-
-   @return         : NET_XMIT_DROP if packets are dropped
-                   : NET_XMIT_SUCCESS if packet is enqueued succesfully
-   ===========================================================================*/
- int hdd_ibss_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
- {
-    VOS_STATUS status;
-    WLANTL_ACEnumType ac;
-    sme_QosWmmUpType up;
-    skb_list_node_t *pktNode = NULL;
-    hdd_list_node_t *anchor = NULL;
-    v_SIZE_t pktListSize = 0;
-    hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_station_ctx_t *pHddStaCtx = &pAdapter->sessionCtx.station;
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    hdd_ibss_peer_info_t * pPeerInfo;
-    v_U8_t STAId = WLAN_MAX_STA_COUNT;
-    v_BOOL_t txSuspended = VOS_FALSE;
-    struct sk_buff *skb1;
-    v_MACADDR_t *pDestMacAddress = (v_MACADDR_t*)skb->data;
-
-    if (NULL == pHddCtx || NULL == pHddStaCtx) {
-        VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                   "%s HDD context is NULL", __func__);
-        return NETDEV_TX_BUSY;
-    }
-    pPeerInfo = &pHddStaCtx->ibss_peer_info;
-    ++pAdapter->hdd_stats.hddTxRxStats.txXmitCalled;
-
-    //Get TL AC corresponding to Qdisc queue index/AC.
-    ac = hdd_QdiscAcToTlAC[skb->queue_mapping];
-
-    if (eConnectionState_IbssDisconnected == pHddStaCtx->conn_info.connState)
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-                  "%s: Tx frame in disconnected state in IBSS mode", __func__);
-        ++pAdapter->stats.tx_dropped;
-        ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
-        ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
-        kfree_skb(skb);
-        return NETDEV_TX_OK;
-    }
-
-     STAId = hdd_sta_id_find_from_mac_addr(pAdapter, pDestMacAddress);
-     if ((STAId == HDD_WLAN_INVALID_STA_ID) &&
-           (vos_is_macaddr_broadcast( pDestMacAddress ) ||
-            vos_is_macaddr_group(pDestMacAddress)))
-     {
-          STAId = IBSS_BROADCAST_STAID;
-          VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO_LOW,
-                     "%s: BC/MC packet", __func__);
-     }
-     else if (STAId >= HDD_MAX_NUM_IBSS_STA)
-     {
-          VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-                     "%s: Received Unicast frame with invalid staID", __func__);
-          ++pAdapter->stats.tx_dropped;
-          ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
-          ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
-          kfree_skb(skb);
-          return NETDEV_TX_OK;
-     }
-
-    //user priority from IP header, which is already extracted and set from
-    //select_queue call back function
-    up = skb->priority;
-    ++pAdapter->hdd_stats.hddTxRxStats.txXmitClassifiedAC[ac];
-
-    VOS_TRACE( VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_INFO,
-               "%s: Classified as ac %d up %d", __func__, ac, up);
-
-    if ( pHddCtx->cfg_ini->gEnableDebugLog & VOS_PKT_PROTO_TYPE_DHCP )
-    {
-       hdd_dump_dhcp_pkt(skb, TX_PATH);
-    }
-
-     spin_lock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac].lock);
-     hdd_list_size(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac], &pktListSize);
-     if(pktListSize >= pAdapter->aTxQueueLimit[ac])
-     {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
-             "%s: station %d ac %d queue over limit %d", __func__, STAId, ac, pktListSize);
-        pPeerInfo->ibssStaInfo[STAId].txSuspended[ac] = VOS_TRUE;
-        netif_stop_subqueue(dev, skb_get_queue_mapping(skb));
-        txSuspended = VOS_TRUE;
-        spin_unlock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac].lock);
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
-                   "%s: TX queue full for AC=%d Disable OS TX queue",
-                   __func__, ac );
-         return NETDEV_TX_BUSY;
-     }
-
-     /* If 3/4th of the max queue size is used then enable the flag.
-      * This flag indicates to place the DHCP packets in VOICE AC queue.*/
-    if (WLANTL_AC_BE == ac)
-    {
-       if (pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac].count >= HDD_TX_QUEUE_LOW_WATER_MARK)
-       {
-           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
-                      "%s: TX queue for Best Effort AC is 3/4th full", __func__);
-           pAdapter->isVosLowResource = VOS_TRUE;
-       }
-       else
-       {
-           pAdapter->isVosLowResource = VOS_FALSE;
-       }
-    }
-
-    spin_unlock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac].lock);
-
-    //Use the skb->cb field to hold the list node information
-    pktNode = (skb_list_node_t *)&skb->cb;
-
-    //Stick the OS packet inside this node.
-    pktNode->skb = skb;
-
-    //Stick the User Priority inside this node
-    pktNode->userPriority = up;
-
-    INIT_LIST_HEAD(&pktNode->anchor);
-
-    spin_lock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac].lock);
-    status = hdd_list_insert_back_size( &pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac],
-                                       &pktNode->anchor, &pktListSize );
-    spin_unlock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac].lock);
-    if ( !VOS_IS_STATUS_SUCCESS( status ) )
-    {
-       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
-                  "%s:Insert Tx queue failed. Pkt dropped", __func__);
-       ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
-       ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
-       ++pAdapter->stats.tx_dropped;
-       kfree_skb(skb);
-       return NETDEV_TX_OK;
-    }
-
-    ++pAdapter->hdd_stats.hddTxRxStats.txXmitQueued;
-    ++pAdapter->hdd_stats.hddTxRxStats.txXmitQueuedAC[ac];
-    ++pAdapter->hdd_stats.hddTxRxStats.pkt_tx_count;
-
-    if (1 == pktListSize)
-    {
-       //Let TL know we have a packet to send for this AC
-       status = WLANTL_STAPktPending( pHddCtx->pvosContext, STAId, ac );
-
-       if ( !VOS_IS_STATUS_SUCCESS( status ) )
-       {
-          VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
-                   "%s: Failed to signal TL for AC=%d STAId =%d",
-                       __func__, ac, STAId );
-
-          /* Remove the packet from queue. It must be at the back of the queue, as TX thread
-           * cannot preempt us in the middle as we are in a soft irq context.
-           *  Also it must be the same packet that we just allocated.
-           */
-          spin_lock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac].lock);
-          status = hdd_list_remove_back( &pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac], &anchor);
-          spin_unlock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac].lock);
-          /* Free the skb only if we are able to remove it from the list.
-           * If we are not able to retrieve it from the list it means that
-           * the skb was pulled by TX Thread and is use so we should not free
-           * it here
-           */
-          if (VOS_IS_STATUS_SUCCESS(status))
-          {
-             pktNode = list_entry(anchor, skb_list_node_t, anchor);
-             skb1 = pktNode->skb;
-             kfree_skb(skb1);
-          }
-          ++pAdapter->stats.tx_dropped;
-          ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
-          ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
-          return NETDEV_TX_OK;
-       }
-    }
-
-    dev->trans_start = jiffies;
-
-    return NETDEV_TX_OK;
- }
-
-/**============================================================================
   @brief hdd_hard_start_xmit() - Function registered with the Linux OS for
   transmitting packets. There are 2 versions of this function. One that uses
   locked queue and other that uses lockless queues. Both have been retained to
@@ -807,7 +744,7 @@
 int hdd_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
    VOS_STATUS status;
-   WLANTL_ACEnumType qid, ac;
+   WLANTL_ACEnumType ac;
    sme_QosWmmUpType up;
    skb_list_node_t *pktNode = NULL;
    hdd_list_node_t *anchor = NULL;
@@ -818,13 +755,6 @@
    hdd_station_ctx_t *pHddStaCtx = &pAdapter->sessionCtx.station;
    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
    v_BOOL_t txSuspended = VOS_FALSE;
-   struct sk_buff *skb1;
-
-   if (NULL == pHddCtx) {
-       VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                  "%s HDD context is NULL", __func__);
-       return NETDEV_TX_BUSY;
-   }
 
    ++pAdapter->hdd_stats.hddTxRxStats.txXmitCalled;
 
@@ -835,60 +765,84 @@
        return NETDEV_TX_BUSY;
    }
 
-   //Get TL Q index corresponding to Qdisc queue index/AC.
-   qid = hdd_QdiscAcToTlAC[skb->queue_mapping];
-   ac  = qid;
+   //Get TL AC corresponding to Qdisc queue index/AC.
+   ac = hdd_QdiscAcToTlAC[skb->queue_mapping];
 
-   if (qid == WLANTL_AC_HIGH_PRIO)
+   if (WLAN_HDD_IBSS == pAdapter->device_mode)
    {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "%s It must be a Eapol/Wapi/DHCP packet device_mode:%d",
-                __func__, pAdapter->device_mode);
-      ac = hddWmmUpToAcMap[skb->priority];
-   }
+      v_MACADDR_t *pDestMacAddress = (v_MACADDR_t*)skb->data;
 
-      if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
+      if (eConnectionState_IbssDisconnected == pHddStaCtx->conn_info.connState)
       {
          VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-                FL("Tx frame in not associated state in %d context"),
-                    pAdapter->device_mode);
+                   "%s: Tx frame in disconnected state in IBSS mode", __func__);
          ++pAdapter->stats.tx_dropped;
          ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
-         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[qid];
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
          kfree_skb(skb);
          return NETDEV_TX_OK;
       }
+
+      STAId = *(v_U8_t *)(((v_U8_t *)(skb->data)) - 1);
+
+      if ((STAId == HDD_WLAN_INVALID_STA_ID) &&
+          (vos_is_macaddr_broadcast( pDestMacAddress ) ||
+           vos_is_macaddr_group(pDestMacAddress)))
+      {
+         STAId = IBSS_BROADCAST_STAID;
+         VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO_LOW,
+                    "%s: BC/MC packet", __func__);
+      }
+      else if (STAId == HDD_WLAN_INVALID_STA_ID)
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
+                    "%s: Received Unicast frame with invalid staID", __func__);
+         ++pAdapter->stats.tx_dropped;
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
+         kfree_skb(skb);
+         return NETDEV_TX_OK;
+      }
+   }
+   else
+   {
       STAId = pHddStaCtx->conn_info.staId[0];
+   }
 
    //user priority from IP header, which is already extracted and set from
    //select_queue call back function
    up = skb->priority;
 
-   ++pAdapter->hdd_stats.hddTxRxStats.txXmitClassifiedAC[qid];
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitClassifiedAC[ac];
 
 #ifdef HDD_WMM_DEBUG
    VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_FATAL,
               "%s: Classified as ac %d up %d", __func__, ac, up);
 #endif // HDD_WMM_DEBUG
 
-   if (pHddCtx->cfg_ini->gEnableRoamDelayStats)
+#ifdef DEBUG_ROAM_DELAY
+   vos_record_roam_event(e_HDD_FIRST_XMIT_TIME, (void *)skb, 0);
+   //Should we check below global to avoid function call each time ??
+/*
+   if(gRoamDelayMetaInfo.hdd_monitor_tx)
    {
-       vos_record_roam_event(e_HDD_FIRST_XMIT_TIME, (void *)skb, 0);
    }
+ */
+#endif
 
-   spin_lock(&pAdapter->wmm_tx_queue[qid].lock);
+   spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
    /*CR 463598,384996*/
    /*For every increment of 10 pkts in the queue, we inform TL about pending pkts.
     *We check for +1 in the logic,to take care of Zero count which
     *occurs very frequently in low traffic cases */
-   if((pAdapter->wmm_tx_queue[qid].count + 1) % 10 == 0)
+   if((pAdapter->wmm_tx_queue[ac].count + 1) % 10 == 0)
    {
       /* Use the following debug statement during Engineering Debugging.There are chance that this will lead to a Watchdog Bark
             * if it is in the mainline code and if the log level is enabled by someone for debugging
            VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,"%s:Queue is Filling up.Inform TL again about pending packets", __func__);*/
 
       status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
-                                    STAId, qid
+                                    STAId, ac
                                     );
       if ( !VOS_IS_STATUS_SUCCESS( status ) )
       {
@@ -897,30 +851,27 @@
                     __func__, status);
          ++pAdapter->stats.tx_dropped;
          ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
-         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[qid];
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
          kfree_skb(skb);
-         spin_unlock(&pAdapter->wmm_tx_queue[qid].lock);
+         spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);
          return NETDEV_TX_OK;
       }
    }
    //If we have already reached the max queue size, disable the TX queue
-   if ( pAdapter->wmm_tx_queue[qid].count == pAdapter->wmm_tx_queue[qid].max_size)
+   if ( pAdapter->wmm_tx_queue[ac].count == pAdapter->wmm_tx_queue[ac].max_size)
    {
          ++pAdapter->hdd_stats.hddTxRxStats.txXmitBackPressured;
-         ++pAdapter->hdd_stats.hddTxRxStats.txXmitBackPressuredAC[qid];
-         hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queue for QId %d"), qid);
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitBackPressuredAC[ac];
          netif_tx_stop_queue(netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)));
-         pAdapter->isTxSuspended[qid] = VOS_TRUE;
+         pAdapter->isTxSuspended[ac] = VOS_TRUE;
          txSuspended = VOS_TRUE;
-         MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_STOP_NETDEV,
-                          pAdapter->sessionId, qid));
    }
 
    /* If 3/4th of the max queue size is used then enable the flag.
     * This flag indicates to place the DHCP packets in VOICE AC queue.*/
-   if (WLANTL_AC_BE == qid)
+   if (WLANTL_AC_BE == ac)
    {
-      if (pAdapter->wmm_tx_queue[qid].count >= HDD_TX_QUEUE_LOW_WATER_MARK)
+      if (pAdapter->wmm_tx_queue[ac].count >= HDD_TX_QUEUE_LOW_WATER_MARK)
       {
           pAdapter->isVosLowResource = VOS_TRUE;
       }
@@ -930,10 +881,9 @@
       }
    }
 
-   spin_unlock(&pAdapter->wmm_tx_queue[qid].lock);
+   spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);
 
-   if (( NULL != pHddCtx ) &&
-      (pHddCtx->cfg_ini->gEnableDebugLog & VOS_PKT_PROTO_TYPE_DHCP))
+   if ( ( NULL != pHddCtx ) && pHddCtx->cfg_ini->enableDhcpDebug )
    {
        hdd_dump_dhcp_pkt(skb, TX_PATH);
    }
@@ -941,8 +891,8 @@
    if (VOS_TRUE == txSuspended)
    {
        VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-                  "%s: TX queue full for QId=%d Disable OS TX queue",
-                  __func__, qid );
+                  "%s: TX queue full for AC=%d Disable OS TX queue",
+                  __func__, ac );
       return NETDEV_TX_BUSY;
    }
 
@@ -959,22 +909,22 @@
    INIT_LIST_HEAD(&pktNode->anchor);
 
    //Insert the OS packet into the appropriate AC queue
-   spin_lock(&pAdapter->wmm_tx_queue[qid].lock);
-   status = hdd_list_insert_back_size( &pAdapter->wmm_tx_queue[qid], &pktNode->anchor, &pktListSize );
-   spin_unlock(&pAdapter->wmm_tx_queue[qid].lock);
+   spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
+   status = hdd_list_insert_back_size( &pAdapter->wmm_tx_queue[ac], &pktNode->anchor, &pktListSize );
+   spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);
 
    if ( !VOS_IS_STATUS_SUCCESS( status ) )
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_WARN,"%s:Insert Tx queue failed. Pkt dropped", __func__);
       ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
-      ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[qid];
+      ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
       ++pAdapter->stats.tx_dropped;
       kfree_skb(skb);
       return NETDEV_TX_OK;
    }
 
    ++pAdapter->hdd_stats.hddTxRxStats.txXmitQueued;
-   ++pAdapter->hdd_stats.hddTxRxStats.txXmitQueuedAC[qid];
+   ++pAdapter->hdd_stats.hddTxRxStats.txXmitQueuedAC[ac];
    ++pAdapter->hdd_stats.hddTxRxStats.pkt_tx_count;
 
    if (HDD_PSB_CHANGED == pAdapter->psbChanged)
@@ -997,39 +947,26 @@
       status = hdd_wmm_acquire_access( pAdapter, ac, &granted );
       pAdapter->psbChanged |= (1 << ac);
    }
-
-   if ( (granted && ( pktListSize == 1 )) ||
-        (qid == WLANTL_AC_HIGH_PRIO))
+   if ( granted && ( pktListSize == 1 ))
    {
       //Let TL know we have a packet to send for this AC
       //VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,"%s:Indicating Packet to TL", __func__);
       status = WLANTL_STAPktPending(
                                   (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
-                                   STAId, qid );
+                                   STAId, ac );
       if ( !VOS_IS_STATUS_SUCCESS( status ) )
       {
-         VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_WARN,
-                   "%s: Failed to signal TL for QId=%d", __func__, qid );
+         VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_WARN, "%s: Failed to signal TL for AC=%d", __func__, ac );
 
          //Remove the packet from queue. It must be at the back of the queue, as TX thread cannot preempt us in the middle
          //as we are in a soft irq context. Also it must be the same packet that we just allocated.
-         spin_lock(&pAdapter->wmm_tx_queue[qid].lock);
-         status = hdd_list_remove_back( &pAdapter->wmm_tx_queue[qid], &anchor );
-         spin_unlock(&pAdapter->wmm_tx_queue[qid].lock);
-         /* Free the skb only if we are able to remove it from the list.
-          * If we are not able to retrieve it from the list it means that
-          * the skb was pulled by TX Thread and is use so we should not free
-          * it here
-          */
-         if (VOS_IS_STATUS_SUCCESS(status))
-         {
-            pktNode = list_entry(anchor, skb_list_node_t, anchor);
-            skb1 = pktNode->skb;
-            kfree_skb(skb1);
-         }
+         spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
+         status = hdd_list_remove_back( &pAdapter->wmm_tx_queue[ac], &anchor );
+         spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);
          ++pAdapter->stats.tx_dropped;
          ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
-         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[qid];
+         ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac];
+         kfree_skb(skb);
          return NETDEV_TX_OK;
       }
    }
@@ -1074,17 +1011,12 @@
 void __hdd_tx_timeout(struct net_device *dev)
 {
    hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
-   hdd_context_t *pHddCtx;
    struct netdev_queue *txq;
-   hdd_remain_on_chan_ctx_t *pRemainChanCtx;
    int i = 0;
-   int status = 0;
    v_ULONG_t diff_in_jiffies = 0;
-   hdd_station_ctx_t *pHddStaCtx = NULL;
 
    VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-      "%s: Transmission timeout occurred jiffies %lu dev->trans_start %lu",
-        __func__,jiffies,dev->trans_start);
+      "%s: Transmission timeout occurred", __func__);
 
    if ( NULL == pAdapter )
    {
@@ -1094,21 +1026,6 @@
       return;
    }
 
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   status = wlan_hdd_validate_context(pHddCtx);
-   if (status !=0 )
-   {
-       return;
-   }
-
-   pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   if ( NULL == pHddStaCtx )
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-              FL("pHddStaCtx is NULL"));
-      return;
-   }
-
    ++pAdapter->hdd_stats.hddTxRxStats.txTimeoutCount;
 
    //Getting here implies we disabled the TX queues for too long. Queues are 
@@ -1130,12 +1047,11 @@
               pAdapter->isTxSuspended[2],
               pAdapter->isTxSuspended[3]);
 
-   for (i = 0; i < dev->num_tx_queues; i++)
+   for (i = 0; i < 8; i++)
    {
       txq = netdev_get_tx_queue(dev, i);
       VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                "Queue%d status: %d txq->trans_start %lu",
-                 i, netif_tx_queue_stopped(txq),txq->trans_start);
+                "Queue%d status: %d", i, netif_tx_queue_stopped(txq));
    }
 
    VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
@@ -1169,19 +1085,6 @@
    //update last jiffies after the check
    pAdapter->hdd_stats.hddTxRxStats.jiffiesLastTxTimeOut = jiffies;
 
-   if (!pHddStaCtx->conn_info.uIsAuthenticated) {
-      VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-                FL("TL is not in authenticated state so skipping SSR"));
-      pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount = 0;
-      goto print_log;
-   }
-   if (pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount ==
-          HDD_TX_STALL_KICKDXE_THRESHOLD)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD_SAP_DATA, VOS_TRACE_LEVEL_ERROR,
-                "%s: Request Kick DXE for recovery",__func__);
-      WLANTL_TLDebugMessage(WLANTL_DEBUG_KICKDXE);
-   }
    if (pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount ==
           HDD_TX_STALL_RECOVERY_THRESHOLD)
    {
@@ -1190,52 +1093,17 @@
       WLANTL_TLDebugMessage(WLANTL_DEBUG_FW_CLEANUP);
    }
 
-   /*
-    * This function is getting called in softirq context, So don't hold
-    * any mutex.
-    * There is no harm here in not holding the mutex as long as we are
-    * not accessing the pRemainChanCtx contents.
-    */
-   pRemainChanCtx = hdd_get_remain_on_channel_ctx(pHddCtx);
-   if (!pRemainChanCtx)
+   if (pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount >
+       HDD_TX_STALL_SSR_THRESHOLD)
    {
-      if (pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount >
-          HDD_TX_STALL_SSR_THRESHOLD)
-      {
-          // Driver could not recover, issue SSR
-          VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Cannot recover from Data stall Issue SSR",
-                      __func__);
-          WLANTL_FatalError();
-          // reset count after issuing the SSR
-          pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount = 0;
-          return;
-      }
-   }
-   else
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                "Remain on channel in progress");
-      /* The supplicant can retry "P2P Invitation Request" for 120 times
-       * and so there is a possbility that we can remain off channel for
-       * the entire duration of these retries(which can be max 60sec).
-       * If we encounter such a case, let us not trigger SSR after 30sec
-       * but wait for 60sec to let the device go on home channel and start
-       * tx. If tx does not start within 70sec we will issue SSR.
-       */
-      if (pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount >
-          HDD_TX_STALL_SSR_THRESHOLD_HIGH)
-      {
-          // Driver could not recover, issue SSR
-          VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Cannot recover from Data stall Issue SSR",
-                      __func__);
-          WLANTL_FatalError();
-          return;
-      }
+       // Driver could not recover, issue SSR
+       VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Cannot recover from Data stall Issue SSR",
+                   __func__);
+       WLANTL_FatalError();
+       return;
    }
 
-print_log:
    /* If Tx stalled for a long time then *hdd_tx_timeout* is called
     * every 5sec. The TL debug spits out a lot of information on the
     * serial console, if it is called every time *hdd_tx_timeout* is
@@ -1247,15 +1115,7 @@
       hdd_wmm_tx_snapshot(pAdapter);
       WLANTL_TLDebugMessage(WLANTL_DEBUG_TX_SNAPSHOT);
    }
-   /* Call fatal event if data stall is for
-    * HDD_TX_STALL_FATAL_EVENT_THRESHOLD times
-    */
-   if (HDD_TX_STALL_FATAL_EVENT_THRESHOLD ==
-       pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount)
-      vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                   WLAN_LOG_INDICATOR_HOST_DRIVER,
-                   WLAN_LOG_REASON_DATA_STALL,
-                   FALSE, TRUE);
+
 }
 
 /**============================================================================
@@ -1274,14 +1134,14 @@
 }
 
 /**============================================================================
-  @brief __hdd_stats() - Function registered with the Linux OS for
+  @brief hdd_stats() - Function registered with the Linux OS for 
   device TX/RX statistic
 
   @param dev      : [in] pointer to Libra network device
   
   @return         : pointer to net_device_stats structure
   ===========================================================================*/
-struct net_device_stats* __hdd_stats(struct net_device *dev)
+struct net_device_stats* hdd_stats(struct net_device *dev)
 {
    hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
 
@@ -1296,115 +1156,6 @@
    return &pAdapter->stats;
 }
 
-struct net_device_stats* hdd_stats(struct net_device *dev)
-{
-    struct net_device_stats* dev_stats;
-
-    vos_ssr_protect(__func__);
-    dev_stats = __hdd_stats(dev);
-    vos_ssr_unprotect(__func__);
-
-    return dev_stats;
-}
-
-/**============================================================================
-  @brief hdd_ibss_init_tx_rx() - Init function to initialize Tx/RX
-  modules in HDD
-
-  @param pAdapter : [in] pointer to adapter context
-  @return         : VOS_STATUS_E_FAILURE if any errors encountered
-                  : VOS_STATUS_SUCCESS otherwise
-  ===========================================================================*/
-void hdd_ibss_init_tx_rx( hdd_adapter_t *pAdapter )
-{
-   v_U8_t i;
-   v_U8_t STAId = 0;
-   hdd_station_ctx_t *pHddStaCtx = &pAdapter->sessionCtx.station;
-   hdd_ibss_peer_info_t *pPeerInfo = &pHddStaCtx->ibss_peer_info;
-   v_U8_t pACWeights[] = {
-                           HDD_SOFTAP_BK_WEIGHT_DEFAULT,
-                           HDD_SOFTAP_BE_WEIGHT_DEFAULT,
-                           HDD_SOFTAP_VI_WEIGHT_DEFAULT,
-                           HDD_SOFTAP_VO_WEIGHT_DEFAULT
-                         };
-
-   pAdapter->isVosOutOfResource = VOS_FALSE;
-   pAdapter->isVosLowResource = VOS_FALSE;
-
-   // Since SAP model is used for IBSS also. Using same queue length as in SAP.
-   pAdapter->aTxQueueLimit[WLANTL_AC_BK] = HDD_SOFTAP_TX_BK_QUEUE_MAX_LEN;
-   pAdapter->aTxQueueLimit[WLANTL_AC_BE] = HDD_SOFTAP_TX_BE_QUEUE_MAX_LEN;
-   pAdapter->aTxQueueLimit[WLANTL_AC_VI] = HDD_SOFTAP_TX_VI_QUEUE_MAX_LEN;
-   pAdapter->aTxQueueLimit[WLANTL_AC_VO] = HDD_SOFTAP_TX_VO_QUEUE_MAX_LEN;
-
-   for (STAId = 0; STAId < HDD_MAX_NUM_IBSS_STA; STAId++)
-   {
-      vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t));
-      for (i = 0; i < NUM_TX_QUEUES; i ++)
-      {
-         hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN);
-      }
-   }
-
-   /* Update the AC weights suitable for SoftAP mode of operation */
-   WLANTL_SetACWeights((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, pACWeights);
-}
-
-/**============================================================================
-  @brief hdd_ibss_deinit_tx_rx() - Deinit function to clean up Tx/RX
-  modules in HDD
-
-  @param pAdapter : [in] pointer to adapter context..
-  @return         : VOS_STATUS_E_FAILURE if any errors encountered.
-                  : VOS_STATUS_SUCCESS otherwise
-  ===========================================================================*/
-VOS_STATUS hdd_ibss_deinit_tx_rx( hdd_adapter_t *pAdapter )
-{
-   VOS_STATUS status = VOS_STATUS_SUCCESS;
-   v_U8_t STAId = 0;
-   hdd_station_ctx_t *pHddStaCtx = &pAdapter->sessionCtx.station;
-   hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info;
-   hdd_list_node_t *anchor = NULL;
-   skb_list_node_t *pktNode = NULL;
-   struct sk_buff *skb = NULL;
-   v_SINT_t i = -1;
-
-   for (STAId = 0; STAId < HDD_MAX_NUM_IBSS_STA; STAId++)
-   {
-      if (VOS_FALSE == pPeerInfo->ibssStaInfo[STAId].isUsed)
-      {
-         continue;
-      }
-      for (i = 0; i < NUM_TX_QUEUES; i ++)
-      {
-         spin_lock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i].lock);
-         while (true)
-         {
-            status = hdd_list_remove_front ( &pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i], &anchor);
-
-            if (VOS_STATUS_E_EMPTY != status)
-            {
-               //If success then we got a valid packet from some AC
-               pktNode = list_entry(anchor, skb_list_node_t, anchor);
-               skb = pktNode->skb;
-               ++pAdapter->stats.tx_dropped;
-               ++pAdapter->hdd_stats.hddTxRxStats.txFlushed;
-               ++pAdapter->hdd_stats.hddTxRxStats.txFlushedAC[i];
-               kfree_skb(skb);
-               continue;
-            }
-
-            //current list is empty
-            break;
-         }
-         pPeerInfo->ibssStaInfo[STAId].txSuspended[i] = VOS_FALSE;
-         spin_unlock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i].lock);
-      }
-   }
-   pAdapter->isVosLowResource = VOS_FALSE;
-
-   return status;
-}
 
 /**============================================================================
   @brief hdd_init_tx_rx() - Init function to initialize Tx/RX
@@ -1627,10 +1378,10 @@
    pHddCtx = (hdd_context_t *)vos_get_context( VOS_MODULE_ID_HDD, vosContext );
    //Get the Adapter context.
    pAdapter = hdd_get_adapter(pHddCtx,WLAN_HDD_INFRA_STATION);
-   if (pAdapter == NULL || WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)
+   if (pAdapter == NULL)
    {
-      VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-                    "%s: Invalid adapter %p", __func__, pAdapter);
+      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
+                              "%s: HDD adapter context is Null", __func__);
    }
    else
    {
@@ -1650,249 +1401,6 @@
    return status;
 }
 
-/**============================================================================
-  @brief hdd_ibss_tx_fetch_packet_cbk() - Callback function invoked by TL to
-  fetch a packet for transmission.
-
-  @param vosContext   : [in] pointer to VOS context
-  @param staId        : [in] Station for which TL is requesting a pkt
-  @param ac           : [in] access category requested by TL
-  @param pVosPacket   : [out] pointer to VOS packet packet pointer
-  @param pPktMetaInfo : [out] pointer to meta info for the pkt
-
-  @return             : VOS_STATUS_E_EMPTY if no packets to transmit
-                      : VOS_STATUS_E_FAILURE if any errors encountered
-                      : VOS_STATUS_SUCCESS otherwise
- ===========================================================================*/
-VOS_STATUS hdd_ibss_tx_fetch_packet_cbk( v_VOID_t *vosContext,
-                                    v_U8_t *pStaId,
-                                    WLANTL_ACEnumType  ac,
-                                    vos_pkt_t **ppVosPacket,
-                                    WLANTL_MetaInfoType *pPktMetaInfo )
-{
-   VOS_STATUS status = VOS_STATUS_E_FAILURE;
-   hdd_adapter_t *pAdapter = NULL;
-   hdd_list_node_t *anchor = NULL;
-   skb_list_node_t *pktNode = NULL;
-   struct sk_buff *skb = NULL;
-   vos_pkt_t *pVosPacket = NULL;
-   v_MACADDR_t* pDestMacAddress = NULL;
-   v_TIME_t timestamp;
-   v_SIZE_t size = 0;
-   v_U8_t STAId = WLAN_MAX_STA_COUNT;
-   hdd_context_t *pHddCtx = NULL;
-   hdd_station_ctx_t *pHddStaCtx = NULL;
-   hdd_ibss_peer_info_t *pPeerInfo = NULL;
-   v_U8_t proto_type = 0;
-   v_U16_t packet_size;
-
-   //Sanity check on inputs
-   if ( ( NULL == vosContext ) ||
-        ( NULL == pStaId ) ||
-        ( NULL == ppVosPacket ) ||
-        ( NULL == pPktMetaInfo ) )
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Null Params being passed", __func__);
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   //Get the HDD context.
-   pHddCtx = (hdd_context_t *)vos_get_context( VOS_MODULE_ID_HDD, vosContext );
-   if ( NULL == pHddCtx )
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: HDD adapter context is Null", __func__);
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   STAId = *pStaId;
-   pAdapter = pHddCtx->sta_to_adapter[STAId];
-   if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
-   {
-      VOS_ASSERT(0);
-      return VOS_STATUS_E_FAILURE;
-   }
-
-  pHddStaCtx = &pAdapter->sessionCtx.station;
-  pPeerInfo = &pHddStaCtx->ibss_peer_info;
-
-  if (FALSE == pPeerInfo->ibssStaInfo[STAId].isUsed )
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Unregistered STAId %d passed by TL", __func__, STAId);
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   ++pAdapter->hdd_stats.hddTxRxStats.txFetched;
-
-   *ppVosPacket = NULL;
-
-   //Make sure the AC being asked for is sane
-   if( ac > WLANTL_MAX_AC || ac < 0)
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Invalid AC %d passed by TL", __func__, ac);
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   ++pAdapter->hdd_stats.hddTxRxStats.txFetchedAC[ac];
-
-   //Get the vos packet before so that we are prepare for VOS low reseurce condition
-   //This simplifies the locking and unlocking of Tx queue
-   status = vos_pkt_wrap_data_packet( &pVosPacket,
-                                      VOS_PKT_TYPE_TX_802_3_DATA,
-                                      NULL, //OS Pkt is not being passed
-                                      hdd_tx_low_resource_cbk,
-                                      pAdapter );
-
-   if ((status == VOS_STATUS_E_ALREADY) || (status == VOS_STATUS_E_RESOURCES))
-   {
-      //Remember VOS is in a low resource situation
-      pAdapter->isVosOutOfResource = VOS_TRUE;
-      ++pAdapter->hdd_stats.hddTxRxStats.txFetchLowResources;
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_WARN,
-                 "%s: VOSS in Low Resource scenario", __func__);
-      //TL needs to handle this case. VOS_STATUS_E_EMPTY is returned when the queue is empty.
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   /* Only fetch this station and this AC. Return VOS_STATUS_E_EMPTY if nothing there.
-      Do not get next AC as the other branch does.
-   */
-   spin_lock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac].lock);
-   hdd_list_size(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac], &size);
-
-   if (0 == size)
-   {
-      spin_unlock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac].lock);
-      vos_pkt_return_packet(pVosPacket);
-      return VOS_STATUS_E_EMPTY;
-   }
-
-   status = hdd_list_remove_front( &pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac], &anchor );
-   spin_unlock_bh(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[ac].lock);
-
-   VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-                       "%s: AC %d has packets pending", __func__, ac);
-
-   if(VOS_STATUS_SUCCESS == status)
-   {
-      //If success then we got a valid packet from some AC
-      pktNode = list_entry(anchor, skb_list_node_t, anchor);
-      skb = pktNode->skb;
-   }
-   else
-   {
-      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeueError;
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Error in de-queuing skb from Tx queue status = %d",
-                 __func__, status );
-      vos_pkt_return_packet(pVosPacket);
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   //Attach skb to VOS packet.
-   status = vos_pkt_set_os_packet( pVosPacket, skb );
-   if (status != VOS_STATUS_SUCCESS)
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Error attaching skb", __func__);
-      vos_pkt_return_packet(pVosPacket);
-      ++pAdapter->stats.tx_dropped;
-      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeueError;
-      kfree_skb(skb);
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   //Return VOS packet to TL;
-   *ppVosPacket = pVosPacket;
-
-   //Fill out the meta information needed by TL
-   vos_pkt_get_timestamp( pVosPacket, &timestamp );
-   pPktMetaInfo->usTimeStamp = (v_U16_t)timestamp;
-   if ( 1 < size )
-   {
-       pPktMetaInfo->bMorePackets = 1; //HDD has more packets to send
-   }
-   else
-   {
-       pPktMetaInfo->bMorePackets = 0;
-   }
-
-   if(pAdapter->sessionCtx.station.conn_info.uIsAuthenticated == VOS_TRUE)
-      pPktMetaInfo->ucIsEapol = 0;
-   else
-      pPktMetaInfo->ucIsEapol = hdd_IsEAPOLPacket( pVosPacket ) ? 1 : 0;
-
-   if ((NULL != pHddCtx) &&
-       (pHddCtx->cfg_ini->gEnableDebugLog))
-   {
-      proto_type = vos_pkt_get_proto_type(skb,
-                                          pHddCtx->cfg_ini->gEnableDebugLog);
-      if (VOS_PKT_PROTO_TYPE_EAPOL & proto_type)
-      {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                   "IBSS STA TX EAPOL");
-      }
-      else if (VOS_PKT_PROTO_TYPE_DHCP & proto_type)
-      {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                   "IBSS STA TX DHCP");
-      }
-      else if (VOS_PKT_PROTO_TYPE_ARP & proto_type)
-      {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                   "IBSS STA TX ARP");
-      }
-   }
-
-   vos_pkt_get_packet_length( pVosPacket,&packet_size );
-   if ( HDD_ETHERTYPE_ARP_SIZE == packet_size )
-       pPktMetaInfo->ucIsArp = hdd_IsARP( pVosPacket ) ? 1 : 0;
-
-   pPktMetaInfo->ucUP = pktNode->userPriority;
-   pPktMetaInfo->ucTID = pPktMetaInfo->ucUP;
-   pPktMetaInfo->ucType = 0;
-
-   //Extract the destination address from ethernet frame
-   pDestMacAddress = (v_MACADDR_t*)skb->data;
-
-   // we need 802.3 to 802.11 frame translation
-   // (note that Bcast/Mcast will be translated in SW, unicast in HW)
-   pPktMetaInfo->ucDisableFrmXtl = 0;
-   pPktMetaInfo->ucBcast = vos_is_macaddr_broadcast( pDestMacAddress ) ? 1 : 0;
-   pPktMetaInfo->ucMcast = vos_is_macaddr_group( pDestMacAddress ) ? 1 : 0;
-
-   if ( (pPeerInfo->ibssStaInfo[STAId].txSuspended[ac]) &&
-        (size <= ((pAdapter->aTxQueueLimit[ac]*3)/4) ))
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-                 "%s: TX queue re-enabled", __func__);
-      pPeerInfo->ibssStaInfo[STAId].txSuspended[ac] = VOS_FALSE;
-      netif_wake_subqueue(pAdapter->dev, skb_get_queue_mapping(skb));
-   }
-
-   // We're giving the packet to TL so consider it transmitted from
-   // a statistics perspective.  We account for it here instead of
-   // when the packet is returned for two reasons.  First, TL will
-   // manipulate the skb to the point where the len field is not
-   // accurate, leading to inaccurate byte counts if we account for
-   // it later.  Second, TL does not provide any feedback as to
-   // whether or not the packet was successfully sent over the air,
-   // so the packet counts will be the same regardless of where we
-   // account for them
-   pAdapter->stats.tx_bytes += skb->len;
-   ++pAdapter->stats.tx_packets;
-   ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeued;
-   ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeuedAC[ac];
-   pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount = 0;
-
-   VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
-              "%s: Valid VOS PKT returned to TL", __func__);
-
-   return status;
-}
 
 /**============================================================================
   @brief hdd_tx_fetch_packet_cbk() - Callback function invoked by TL to 
@@ -1928,7 +1436,6 @@
    v_U16_t packet_size;
    tANI_U8   acAdmitted, i;
    v_U8_t proto_type = 0;
-   WLANTL_ACEnumType actualAC;
 
    //Sanity check on inputs
    if ( ( NULL == vosContext ) || 
@@ -1953,7 +1460,7 @@
    if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-              FL("invalid adapter:%p for staId:%u"), pAdapter, *pStaId);
+              FL("pAdapter is NULL %u"), *pStaId);
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
@@ -1963,10 +1470,10 @@
    *ppVosPacket = NULL;
 
    //Make sure the AC being asked for is sane
-   if (ac > WLANTL_AC_HIGH_PRIO || ac < 0)
+   if( ac >= WLANTL_MAX_AC || ac < 0)
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                            "%s: Invalid QId %d passed by TL", __func__, ac);
+                            "%s: Invalid AC %d passed by TL", __func__, ac);
       return VOS_STATUS_E_FAILURE;
    }
 
@@ -1977,6 +1484,23 @@
                               "%s: AC %d passed by TL", __func__, ac);
 #endif // HDD_WMM_DEBUG
 
+   // We find an AC with packets
+   // or we determine we have no more packets to send
+   // HDD is not allowed to change AC.
+
+   // has this AC been admitted? or 
+   // To allow EAPOL packets when not authenticated
+   if (unlikely((0==pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessAllowed) &&
+                (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.uIsAuthenticated))
+   {
+      ++pAdapter->hdd_stats.hddTxRxStats.txFetchEmpty;
+#ifdef HDD_WMM_DEBUG
+      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_FATAL,
+                 "%s: no packets pending", __func__);
+#endif // HDD_WMM_DEBUG
+      return VOS_STATUS_E_FAILURE;
+   }
+      
    // do we have any packets pending in this AC?
    hdd_list_size( &pAdapter->wmm_tx_queue[ac], &size ); 
    if( size >  0 )
@@ -1997,30 +1521,6 @@
       return VOS_STATUS_E_FAILURE;
    }
 
-   // Note here that we are not checking "wmmAcAccessAllowed" for packets
-   // in new queue since there is no one AC associated to the new queue.
-   // Since there will be either eapol or dhcp pkts in new queue overlooking
-   // this should be okay from implicit QoS perspective.
-   if (ac != WLANTL_AC_HIGH_PRIO)
-   {
-      // We find an AC with packets
-      // or we determine we have no more packets to send
-      // HDD is not allowed to change AC.
-
-      // has this AC been admitted? or
-      // To allow EAPOL packets when not authenticated
-      if (unlikely((0==pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessAllowed) &&
-                   (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.uIsAuthenticated))
-      {
-         ++pAdapter->hdd_stats.hddTxRxStats.txFetchEmpty;
-#ifdef HDD_WMM_DEBUG
-         VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_FATAL,
-                    "%s: no packets pending", __func__);
-#endif // HDD_WMM_DEBUG
-         return VOS_STATUS_E_FAILURE;
-      }
-   }
-
    //Get the vos packet. I don't want to dequeue and enqueue again if we are out of VOS resources 
    //This simplifies the locking and unlocking of Tx queue
    status = vos_pkt_wrap_data_packet( &pVosPacket, 
@@ -2049,14 +1549,6 @@
       //If success then we got a valid packet from some AC
       pktNode = list_entry(anchor, skb_list_node_t, anchor);
       skb = pktNode->skb;
-      actualAC = hddWmmUpToAcMap[pktNode->userPriority];
-      if (actualAC >= WLANTL_MAX_AC)
-      {
-         /* To fix klocwork */
-         VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_WARN,
-         "%s: Invalid AC for packet:%d", __func__, actualAC);
-         actualAC = WLANTL_AC_BE;
-      }
    }
    else
    {
@@ -2066,6 +1558,7 @@
       vos_pkt_return_packet(pVosPacket);
       return VOS_STATUS_E_FAILURE;
    }
+
    //Attach skb to VOS packet.
    status = vos_pkt_set_os_packet( pVosPacket, skb );
    if (status != VOS_STATUS_SUCCESS)
@@ -2089,14 +1582,43 @@
    }
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
-   if (vos_is_macaddr_multicast((v_MACADDR_t*)skb->data))
    {
-        pAdapter->hdd_stats.hddTxRxStats.txMcast[actualAC]++;
+       v_MACADDR_t *pDestMacAddress = (v_MACADDR_t*)skb->data;
+       /* vos_is_macaddr_group expects data in v_MACADDR_t format
+        */
+       if (vos_is_macaddr_group(pDestMacAddress))
+       {
+            pAdapter->hdd_stats.hddTxRxStats.txMcast[ac]++;
+       }
+
    }
 
 #endif
 
-   wlan_hdd_tdls_notify_packet(pAdapter, skb);
+#ifdef FEATURE_WLAN_TDLS
+    if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode)
+    {
+        hdd_station_ctx_t *pHddStaCtx = &pAdapter->sessionCtx.station;
+        u8 mac[6];
+
+        wlan_hdd_tdls_extract_da(skb, mac);
+
+        if (vos_is_macaddr_group((v_MACADDR_t *)mac)) {
+            VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO_MED,
+                      "broadcast packet, not adding to peer list");
+        } else if (memcmp(pHddStaCtx->conn_info.bssId,
+                            mac, 6) != 0) {
+            VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO_MED,
+                      "extract mac: " MAC_ADDRESS_STR,
+                      MAC_ADDR_ARRAY(mac) );
+
+            wlan_hdd_tdls_increment_pkt_count(pAdapter, mac, 1);
+        } else {
+            VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO_MED,
+                       "packet da is bssid, not adding to peer list");
+        }
+    }
+#endif
 
    //Return VOS packet to TL;
    *ppVosPacket = pVosPacket;
@@ -2108,31 +1630,23 @@
    
    if(pAdapter->sessionCtx.station.conn_info.uIsAuthenticated == VOS_TRUE)
       pPktMetaInfo->ucIsEapol = 0;       
-   else
+   else 
       pPktMetaInfo->ucIsEapol = hdd_IsEAPOLPacket( pVosPacket ) ? 1 : 0;
 
-   if (pPktMetaInfo->ucIsEapol)
-       wlan_hdd_log_eapol(skb, WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED);
-   if ((NULL != pHddCtx) &&
-       (pHddCtx->cfg_ini->gEnableDebugLog))
+   if (pHddCtx->cfg_ini->gEnableDebugLog)
    {
       proto_type = vos_pkt_get_proto_type(skb,
                                           pHddCtx->cfg_ini->gEnableDebugLog);
       if (VOS_PKT_PROTO_TYPE_EAPOL & proto_type)
       {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+         VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
                    "STA TX EAPOL");
       }
       else if (VOS_PKT_PROTO_TYPE_DHCP & proto_type)
       {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+         VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
                    "STA TX DHCP");
       }
-      else if (VOS_PKT_PROTO_TYPE_ARP & proto_type)
-      {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                   "STA TX ARP");
-      }
    }
 
    vos_pkt_get_packet_length( pVosPacket,&packet_size );
@@ -2156,10 +1670,10 @@
     *    delts Applications have to again do Addts or STA will never
     *    go for Addts.
     */
-   pPktMetaInfo->ac = actualAC;
-   if(!pAdapter->hddWmmStatus.wmmAcStatus[actualAC].wmmAcAccessRequired ||
-      (pAdapter->hddWmmStatus.wmmAcStatus[actualAC].wmmAcTspecValid &&
-       pAdapter->hddWmmStatus.wmmAcStatus[actualAC].wmmAcTspecInfo.medium_time))
+
+   if(!pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessRequired ||
+      (pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecValid &&
+       pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecInfo.medium_time))
    {
       pPktMetaInfo->ucUP = pktNode->userPriority;
       pPktMetaInfo->ucTID = pPktMetaInfo->ucUP;
@@ -2167,9 +1681,9 @@
    else
    {
      //Downgrade the UP
-      acAdmitted = pAdapter->hddWmmStatus.wmmAcStatus[actualAC].wmmAcTspecValid;
+      acAdmitted = pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecValid;
       newAc = WLANTL_AC_BK;
-      for (i=actualAC-1; i>0; i--)
+      for (i=ac-1; i>0; i--)
       {
          if (pAdapter->hddWmmStatus.wmmAcStatus[i].wmmAcAccessRequired == 0)
          {
@@ -2184,10 +1698,9 @@
                 pktNode->userPriority, pPktMetaInfo->ucUP);
    }
 
-   if (pHddCtx->cfg_ini->gEnableRoamDelayStats)
-   {
-       vos_record_roam_event(e_TL_FIRST_XMIT_TIME, NULL, 0);
-   }
+#ifdef DEBUG_ROAM_DELAY
+   vos_record_roam_event(e_TL_FIRST_XMIT_TIME, NULL, 0);
+#endif
 
    pPktMetaInfo->ucType = 0;          //FIXME Don't know what this is
    pPktMetaInfo->ucDisableFrmXtl = 0; //802.3 frame so we need to xlate
@@ -2218,8 +1731,6 @@
       pAdapter->isTxSuspended[ac] = VOS_FALSE;      
       netif_tx_wake_queue(netdev_get_tx_queue(pAdapter->dev, 
                                         skb_get_queue_mapping(skb) ));
-      MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_WAKE_NETDEV,
-                       pAdapter->sessionId, ac));
    }
 
 
@@ -2261,7 +1772,6 @@
          {
             /* During TX open duration, TX frame count is larger than threshold
              * Block TX during Sleep time */
-            hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
             netif_tx_stop_all_queues(pAdapter->dev);
             pHddCtx->tmInfo.qBlocked = VOS_TRUE;
             pHddCtx->tmInfo.lastblockTs = timestamp;
@@ -2316,10 +1826,10 @@
    v_SIZE_t size = 0;
    hdd_adapter_t* pAdapter = (hdd_adapter_t *)userData;
    
-   if (NULL == pAdapter || WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)
+   if (NULL == pAdapter)
    {
-      VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                 FL("Invalid adapter %p"), pAdapter);
+      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
+                            "%s: pAdapter is Null", __func__);
       return VOS_STATUS_E_FAILURE;
    }
 
@@ -2351,188 +1861,6 @@
    return VOS_STATUS_SUCCESS;
 }
 
-static void hdd_mon_add_rx_radiotap_hdr (struct sk_buff *skb,
-             int rtap_len,  v_PVOID_t  pRxPacket, hdd_mon_ctx_t *pMonCtx)
-{
-    u8 rtap_temp[28] = {0};
-    struct ieee80211_radiotap_header *rthdr;
-    unsigned char *pos;
-    u32 mac_time;
-    u16 rx_flags = 0;
-    u16 rateIdx;
-    u16 channel_flags = 0;
-    u8 rfBand;
-    s8 currentRSSI, currentRSSI0, currentRSSI1;
-    s8 noise;
-
-    mac_time = WDA_GET_RX_TIMESTAMP(pRxPacket);
-    rateIdx = WDA_GET_RX_MAC_RATE_IDX(pRxPacket);
-    if( rateIdx >= 210 && rateIdx <= 217)
-       rateIdx-=202;
-    if( rateIdx >= 218 && rateIdx <= 225 )
-       rateIdx-=210;
-
-    if(rateIdx >= (sizeof(gRatefromIdx)/ sizeof(int))) {
-       VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                  "%s: invalid rateIdx %d make it 0", __func__, rateIdx);
-       rateIdx = 0;
-    }
-    rfBand = WDA_GET_RX_RFBAND(pRxPacket);
-    if (IS_5G_BAND(rfBand))
-        channel_flags |= IEEE80211_CHAN_5GHZ;
-    else
-        channel_flags |= IEEE80211_CHAN_2GHZ;
-    currentRSSI0 = WDA_GETRSSI0(pRxPacket) - 100;
-    currentRSSI1 = WDA_GETRSSI1(pRxPacket) - 100;
-    currentRSSI  = (currentRSSI0 > currentRSSI1) ? currentRSSI0 : currentRSSI1;
-    noise = WDA_GET_RX_SNR(pRxPacket);
-
-    rthdr = (struct ieee80211_radiotap_header *)(&rtap_temp[0]);
-
-    /* radiotap header, set always present flags */
-    rthdr->it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) |
-                                    (1 << IEEE80211_RADIOTAP_FLAGS) |
-                                    (1 << IEEE80211_RADIOTAP_CHANNEL) |
-                                    (1 << IEEE80211_RADIOTAP_RATE) |
-                                    (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
-                                    (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) |
-                                    (1 << IEEE80211_RADIOTAP_RX_FLAGS));
-    rthdr->it_len = cpu_to_le16(rtap_len);
-
-    pos = (unsigned char *) (rthdr + 1);
-
-    /* IEEE80211_RADIOTAP_TSFT */
-    put_unaligned_le64(mac_time, pos);
-    pos += 8;
-
-    /* IEEE80211_RADIOTAP_FLAGS */
-    *pos = 0;
-    pos++;
-
-    /* IEEE80211_RADIOTAP_RATE */
-    *pos = gRatefromIdx[rateIdx]/5;
-    pos++;
-
-    /* IEEE80211_RADIOTAP_CHANNEL */
-    put_unaligned_le16(pMonCtx->ChannelNo, pos);
-    pos += 2;
-    put_unaligned_le16(channel_flags, pos);
-    pos += 2;
-
-    /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
-    *pos = currentRSSI;
-    pos++;
-
-    /* IEEE80211_RADIOTAP_DBM_ANTNOISE */
-    *pos = noise;
-    pos++;
-
-    if ((pos - (u8 *)rthdr) & 1)
-        pos++;
-    put_unaligned_le16(rx_flags, pos);
-    pos += 2;
-
-    memcpy(skb_push(skb, rtap_len), &rtap_temp[0], rtap_len);
-}
-
-
-VOS_STATUS  hdd_rx_packet_monitor_cbk(v_VOID_t *vosContext,vos_pkt_t *pVosPacket, int conversion)
-{
-  struct sk_buff *skb = NULL;
-  VOS_STATUS status = VOS_STATUS_E_FAILURE;
-  hdd_adapter_t *pAdapter = NULL;
-  hdd_context_t *pHddCtx = NULL;
-  hdd_mon_ctx_t *pMonCtx = NULL;
-  v_PVOID_t pvBDHeader = NULL;
-  int rxstat;
-  int needed_headroom = 0;
-
-
-  //Sanity check on inputs
-   if ( ( NULL == vosContext ) ||
-        ( NULL == pVosPacket ) )
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                         "%s: Null params being passed", __func__);
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   pHddCtx = (hdd_context_t *)vos_get_context( VOS_MODULE_ID_HDD, vosContext );
-
-   if (NULL == pHddCtx)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                 FL("Failed to get pHddCtx from vosContext"));
-      vos_pkt_return_packet( pVosPacket );
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   pAdapter = hdd_get_adapter(pHddCtx,WLAN_HDD_MONITOR);
-   if ((NULL == pAdapter)  || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) )
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                 FL("Invalid adapter %p for MONITOR MODE"), pAdapter);
-      vos_pkt_return_packet( pVosPacket );
-      return VOS_STATUS_E_FAILURE;
-   }
-
-    status =  WDA_DS_PeekRxPacketInfo( pVosPacket, (v_PVOID_t)&pvBDHeader, 1/*Swap BD*/ );
-    if ( NULL == pvBDHeader )
-    {
-      VOS_TRACE( VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR,
-                 "Cannot extract BD header");
-      /* Drop packet */
-      vos_pkt_return_packet(pVosPacket);
-      return VOS_STATUS_E_FAILURE;
-    }
-
-   ++pAdapter->hdd_stats.hddTxRxStats.rxChains;
-   status = vos_pkt_get_os_packet( pVosPacket, (v_VOID_t **)&skb, VOS_TRUE );
-   if(!VOS_IS_STATUS_SUCCESS( status ))
-    {
-        ++pAdapter->hdd_stats.hddTxRxStats.rxDropped;
-        VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                               "%s: Failure extracting skb from vos pkt", __func__);
-        vos_pkt_return_packet( pVosPacket );
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    if(!conversion)
-    {
-         pMonCtx = WLAN_HDD_GET_MONITOR_CTX_PTR(pAdapter);
-         needed_headroom = sizeof(struct ieee80211_radiotap_header) + 18;
-         hdd_mon_add_rx_radiotap_hdr( skb, needed_headroom, pvBDHeader, pMonCtx );
-    }
-
-    skb_reset_mac_header( skb );
-    skb->dev = pAdapter->dev;
-    skb->pkt_type = PACKET_OTHERHOST;
-    skb->protocol = htons(ETH_P_802_2);
-    skb->ip_summed = CHECKSUM_NONE;
-    ++pAdapter->hdd_stats.hddTxRxStats.rxPackets;
-    ++pAdapter->stats.rx_packets;
-    pAdapter->stats.rx_bytes += skb->len;
-
-    rxstat = netif_rx_ni(skb);
-    if (NET_RX_SUCCESS == rxstat)
-    {
-       ++pAdapter->hdd_stats.hddTxRxStats.rxDelivered;
-       ++pAdapter->hdd_stats.hddTxRxStats.pkt_rx_count;
-    }
-    else
-    {
-       ++pAdapter->hdd_stats.hddTxRxStats.rxRefused;
-    }
-
-   status = vos_pkt_return_packet( pVosPacket );
-   if(!VOS_IS_STATUS_SUCCESS( status ))
-   {
-      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,"%s: Failure returning vos pkt", __func__);
-   }
-   pAdapter->dev->last_rx = jiffies;
-
-return status;
-}
 
 /**============================================================================
   @brief hdd_rx_packet_cbk() - Receive callback registered with TL.
@@ -2580,10 +1908,11 @@
    }
 
    pAdapter = pHddCtx->sta_to_adapter[staId];
-   if ((NULL == pAdapter)  || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) )
+   if( (NULL == pAdapter)  || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) )
    {
-      VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                 FL("Invalid adapter %p for staId %u"), pAdapter, staId);
+      VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pAdapter is Null or adapter has invalid magic for staId %u",
+                 __func__, staId);
       return VOS_STATUS_E_FAILURE;
    }
 
@@ -2607,7 +1936,8 @@
       }
 
       // Extract the OS packet (skb).
-      status = vos_pkt_get_os_packet( pVosPacket, (v_VOID_t **)&skb, VOS_FALSE );
+      // Tell VOS to detach the OS packet from the VOS packet
+      status = vos_pkt_get_os_packet( pVosPacket, (v_VOID_t **)&skb, VOS_TRUE );
       if(!VOS_IS_STATUS_SUCCESS( status ))
       {
          ++pAdapter->hdd_stats.hddTxRxStats.rxDropped;
@@ -2616,11 +1946,6 @@
          return VOS_STATUS_E_FAILURE;
       }
 
-      if (TRUE == hdd_IsEAPOLPacket( pVosPacket ))
-          wlan_hdd_log_eapol(skb, WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED);
-
-      pVosPacket->pSkb = NULL;
-
       if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)
       {
          VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_FATAL,
@@ -2635,48 +1960,58 @@
         hdd_station_ctx_t *pHddStaCtx = &pAdapter->sessionCtx.station;
         u8 mac[6];
 
-        memcpy(mac, skb->data+6, 6);
+        wlan_hdd_tdls_extract_sa(skb, mac);
 
         if (vos_is_macaddr_group((v_MACADDR_t *)mac)) {
             VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO_MED,
                       "rx broadcast packet, not adding to peer list");
-        } else if ((memcmp(pHddStaCtx->conn_info.bssId,
-                            mac, 6) != 0) && (pRxMetaInfo->isStaTdls)) {
-            wlan_hdd_tdls_update_rx_pkt_cnt_n_rssi(pAdapter, mac,
-                    pRxMetaInfo->rssiAvg);
+        } else if (memcmp(pHddStaCtx->conn_info.bssId,
+                            mac, 6) != 0) {
+            hddTdlsPeer_t *curr_peer;
+            VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO_MED,
+                      "rx extract mac:" MAC_ADDRESS_STR,
+                      MAC_ADDR_ARRAY(mac) );
+            curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
+            if ((NULL != curr_peer) && (eTDLS_LINK_CONNECTED == curr_peer->link_status)
+                 && (TRUE == pRxMetaInfo->isStaTdls))
+            {
+                wlan_hdd_tdls_increment_pkt_count(pAdapter, mac, 0);
+                VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,"rssi is %d", pRxMetaInfo->rssiAvg);
+                wlan_hdd_tdls_set_rssi (pAdapter, mac, pRxMetaInfo->rssiAvg);
+            }
         } else {
             VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO_MED,
                        "rx packet sa is bssid, not adding to peer list");
         }
     }
 #endif
+
       if (pHddCtx->cfg_ini->gEnableDebugLog)
       {
          proto_type = vos_pkt_get_proto_type(skb,
                                              pHddCtx->cfg_ini->gEnableDebugLog);
          if (VOS_PKT_PROTO_TYPE_EAPOL & proto_type)
          {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
                       "STA RX EAPOL");
          }
          else if (VOS_PKT_PROTO_TYPE_DHCP & proto_type)
          {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
                       "STA RX DHCP");
          }
-         else if (VOS_PKT_PROTO_TYPE_ARP & proto_type)
-         {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                      "STA RX ARP");
-         }
       }
 
-      if (pHddCtx->cfg_ini->gEnableRoamDelayStats)
-      {
-          vos_record_roam_event(e_HDD_RX_PKT_CBK_TIME, (void *)skb, 0);
-      }
-      if (( NULL != pHddCtx ) &&
-         (pHddCtx->cfg_ini->gEnableDebugLog & VOS_PKT_PROTO_TYPE_DHCP))
+#ifdef DEBUG_ROAM_DELAY
+      vos_record_roam_event(e_HDD_RX_PKT_CBK_TIME, (void *)skb, 0);
+      //Should we check below global to avoid function call each time ??
+      /*
+         if(gRoamDelayMetaInfo.hdd_monitor_rx)
+         {
+         }
+       */
+#endif
+      if ( pHddCtx->cfg_ini->enableDhcpDebug )
       {
           hdd_dump_dhcp_pkt(skb, RX_PATH);
       }
@@ -2687,20 +2022,12 @@
       ++pAdapter->hdd_stats.hddTxRxStats.rxPackets;
       ++pAdapter->stats.rx_packets;
       pAdapter->stats.rx_bytes += skb->len;
+#ifdef WLAN_OPEN_SOURCE
 #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-       vos_wake_lock_timeout_release(&pHddCtx->rx_wake_lock,
-                          HDD_WAKE_LOCK_DURATION,
-                          WIFI_POWER_EVENT_WAKELOCK_HOLD_RX);
+      wake_lock_timeout(&pHddCtx->rx_wake_lock, msecs_to_jiffies(HDD_WAKE_LOCK_DURATION));
 #endif
-      if (pNextVosPacket)
-      {
-          rxstat = netif_rx(skb);
-      }
-      else
-      {
-          rxstat = netif_rx_ni(skb);
-      }
-
+#endif
+      rxstat = netif_rx_ni(skb);
       if (NET_RX_SUCCESS == rxstat)
       {
          ++pAdapter->hdd_stats.hddTxRxStats.rxDelivered;
@@ -2743,11 +2070,14 @@
     v_U8_t staId = 0;
     v_U8_t fconnected = 0;
 
-    ENTER();
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-    {
-        return;
-    }
+   if (NULL == phddctx)
+   {
+       VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
+              FL("phddctx is NULL"));
+       VOS_ASSERT(0);
+       return;
+   }
+
     if (!cfg_param->dynSplitscan)
     {
         VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
@@ -2761,7 +2091,7 @@
     {
         pAdapter = pAdapterNode->pAdapter;
 
-        if ((NULL != pAdapter) && (WLAN_HDD_ADAPTER_MAGIC == pAdapter->magic))
+        if ( pAdapter )
         {
             VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
                     "%s: Adapter with device mode %d exists",
@@ -2781,18 +2111,11 @@
             else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) ||
                      (WLAN_HDD_P2P_GO == pAdapter->device_mode))
             {
-                v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-                ptSapContext pSapCtx = VOS_GET_SAP_CB(pVosContext);
-                if(pSapCtx == NULL){
-                    VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
-                             FL("psapCtx is NULL"));
-                    return;
-                }
                 for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++)
                 {
-                    if ((pSapCtx->aStaInfo[staId].isUsed) &&
+                    if ((pAdapter->aStaInfo[staId].isUsed) &&
                         (WLANTL_STA_AUTHENTICATED ==
-                                          pSapCtx->aStaInfo[staId].tlSTAState))
+                                          pAdapter->aStaInfo[staId].tlSTAState))
                     {
                         fconnected = TRUE;
                     }
@@ -2851,7 +2174,7 @@
      */
     if ((pHddCtx->isTdlsScanCoexistence == FALSE) && (pHddCtx->issplitscan_enabled))
     {
-       VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
+       VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
                         "%s: Disable split scan", __func__);
        pHddCtx->issplitscan_enabled = FALSE;
        sme_enable_disable_split_scan(
@@ -2859,129 +2182,6 @@
                                   SME_DISABLE_SPLIT_SCAN,
                                   SME_DISABLE_SPLIT_SCAN);
     }
-    EXIT();
     return;
 }
 
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-/*
- * wlan_hdd_get_eapol_params() - Function to extract EAPOL params
- * @skb:                skb data
- * @eapol_params:       Pointer to hold the parsed EAPOL params
- * @event_type:         Event type to indicate Tx/Rx
- *
- * This function parses the input skb data to get the EAPOL params,if the
- * packet is EAPOL and store it in the pointer passed as input
- *
- */
-void  wlan_hdd_get_eapol_params(struct sk_buff *skb,
-                                    struct vos_event_wlan_eapol *eapol_params,
-                                    uint8_t event_type)
-{
-     uint8_t packet_type=0;
-
-     packet_type = (uint8_t)(*(uint8_t *)
-                   (skb->data + HDD_EAPOL_PACKET_TYPE_OFFSET));
-
-    /* EAPOL msg type  i.e. whether EAPOL-Start or
-     * EAPOL-Key etc. messages Present at 15 offset.
-     */
-     eapol_params->eapol_packet_type = packet_type;
-
-    /* This tells if its a M1/M2/M3/M4 packet.
-     * Present at 19th offset in EAPOL frame.
-     */
-     eapol_params->eapol_key_info = (uint16_t)(*(uint16_t *)
-                                    (skb->data + HDD_EAPOL_KEY_INFO_OFFSET));
-    /* This tells if EAPOL packet is in RX or TX
-     * direction.
-     */
-     eapol_params->event_sub_type = event_type;
-
-    /* This tells the rate at which EAPOL packet
-     * is send or received.
-     */
-     //TODO fill data rate for rx packet.
-     eapol_params->eapol_rate = 0;/* As of now, zero */
-
-     vos_mem_copy(eapol_params->dest_addr,
-                 (skb->data + HDD_EAPOL_DEST_MAC_OFFSET),
-                  sizeof(eapol_params->dest_addr));
-     vos_mem_copy(eapol_params->src_addr,
-                 (skb->data + HDD_EAPOL_SRC_MAC_OFFSET),
-                  sizeof(eapol_params->src_addr));
-     return;
-}
-/*
- * wlan_hdd_event_eapol_log() - Function to log EAPOL events
- * @eapol_params:    Structure containing EAPOL params
- *
- * This function logs the parsed EAPOL params
- *
- * Return: None
- *
- */
-
-static void wlan_hdd_event_eapol_log(struct vos_event_wlan_eapol eapol_params)
-{
-    WLAN_VOS_DIAG_EVENT_DEF(wlan_diag_event, struct vos_event_wlan_eapol);
-
-    wlan_diag_event.event_sub_type = eapol_params.event_sub_type;
-    wlan_diag_event.eapol_packet_type = eapol_params.eapol_packet_type;
-    wlan_diag_event.eapol_key_info = eapol_params.eapol_key_info;
-    wlan_diag_event.eapol_rate = eapol_params.eapol_rate;
-    vos_mem_copy(wlan_diag_event.dest_addr,
-                  eapol_params.dest_addr,
-                  sizeof (wlan_diag_event.dest_addr));
-    vos_mem_copy(wlan_diag_event.src_addr,
-                 eapol_params.src_addr,
-                 sizeof (wlan_diag_event.src_addr));
-    WLAN_VOS_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_EAPOL);
-}
-
-/*
- * wlan_hdd_log_eapol() - Function to check and extract EAPOL params
- * @skb:               skb data
- * @event_type:        One of enum wifi_connectivity_events to indicate Tx/Rx
- *
- * This function parses the input skb data to get the EAPOL params,if the
- * packet is EAPOL and store it in the pointer passed as input
- *
- * Return: None
- *
- */
-void wlan_hdd_log_eapol(struct sk_buff *skb,
-                               uint8_t event_type)
-{
-    struct vos_event_wlan_eapol eapol_params;
-
-    wlan_hdd_get_eapol_params(skb, &eapol_params, event_type);
-    wlan_hdd_event_eapol_log(eapol_params);
-
-    if ((eapol_params.eapol_key_info & EAPOL_MASK )== EAPOL_M1_BIT_MASK)
-    {
-        hddLog(LOG1, FL("%s: M1 packet"),eapol_params.event_sub_type ==
-               WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED ? "RX" : "TX");
-    }
-    else if ((eapol_params.eapol_key_info & EAPOL_MASK )== EAPOL_M2_BIT_MASK)
-    {
-        hddLog(LOG1, FL("%s: M2 packet"),eapol_params.event_sub_type ==
-               WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED ? "RX" : "TX");
-
-    }
-
-    else if ((eapol_params.eapol_key_info & EAPOL_MASK )== EAPOL_M3_BIT_MASK)
-    {
-        hddLog(LOG1, FL("%s: M3 packet"),eapol_params.event_sub_type ==
-               WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED ? "RX" : "TX");
-    }
-
-    else if ((eapol_params.eapol_key_info & EAPOL_MASK )== EAPOL_M4_BIT_MASK)
-    {
-        hddLog(LOG1, FL("%s: M4 packet"),eapol_params.event_sub_type ==
-               WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED ? "RX" : "TX");
-
-    }
-
-}
-#endif /* FEATURE_WLAN_DIAG_SUPPORT */
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_wext.c b/wlan/prima/CORE/HDD/src/wlan_hdd_wext.c
index 2bd2df2..1d3045b 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_wext.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_wext.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -50,7 +50,6 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/wireless.h>
-#include <linux/wcnss_wlan.h>
 #include <macTrace.h>
 #include <wlan_hdd_includes.h>
 #include <wlan_btc_svc.h>
@@ -103,8 +102,9 @@
 #include "vos_trace.h"
 #include "wlan_hdd_assoc.h"
 
+#ifdef DEBUG_ROAM_DELAY
 #include "vos_utils.h"
-#include "sapInternal.h"
+#endif
 
 #ifdef CONFIG_HAS_EARLYSUSPEND
 extern void hdd_suspend_wlan(struct early_suspend *wlan_suspend);
@@ -165,15 +165,6 @@
 #define WE_SET_TDLS_OFF_CHAN_MODE        16
 #endif
 #define  WE_SET_SCAN_BAND_PREFERENCE     17
-#define  WE_SET_MIRACAST_VENDOR_CONFIG     18
-#define WE_GET_FRAME_LOG                 19
-#ifdef FEATURE_WLAN_TDLS
-#define  WE_SET_TDLS_2040_BSS_COEXISTENCE 20
-#endif
-#define  WE_SET_RTS_CTS_HTVHT             21
-#define  WE_SET_MONITOR_STATE             22
-#define  WE_SET_PKT_STATS_ENABLE_DISABLE  23
-#define  WE_SET_PROXIMITY_ENABLE  24
 
 /* Private ioctls and their sub-ioctls */
 #define WLAN_PRIV_SET_NONE_GET_INT    (SIOCIWFIRSTPRIV + 1)
@@ -186,7 +177,6 @@
 #define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
 #define WE_GET_CONCURRENCY_MODE 9
 #define WE_GET_SCAN_BAND_PREFERENCE     10
-#define WE_GET_ANTENA_DIVERSITY_SELECTION 11
 /* Private ioctls and their sub-ioctls */
 #define WLAN_PRIV_SET_INT_GET_INT     (SIOCIWFIRSTPRIV + 2)
 
@@ -199,7 +189,6 @@
 #endif
 #define WE_SET_AP_WPS_IE     4  //This is called in station mode to set probe rsp ie.
 #define WE_SET_CONFIG        5
-#define WE_SET_ENCRYPT_MSG   6
 
 /* Private ioctls and their sub-ioctls */
 #define WLAN_PRIV_SET_THREE_INT_GET_NONE   (SIOCIWFIRSTPRIV + 4)
@@ -225,14 +214,7 @@
 #define WE_GET_11W_INFO      9
 #endif
 #define WE_GET_STATES        10
-#ifdef WLAN_FEATURE_RMC
-#define WE_GET_IBSS_STA_INFO 11
-#endif
-#define WE_GET_SNR           12
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-#define WE_GET_OEM_DATA_CAP  13
-#endif
+#define WE_GET_SNR           11
 
 /* Private ioctls and their sub-ioctls */
 #define WLAN_PRIV_SET_NONE_GET_NONE   (SIOCIWFIRSTPRIV + 6)
@@ -247,14 +229,12 @@
 #define WE_DISPLAY_DXE_SNAP_SHOT   7
 #define WE_SET_REASSOC_TRIGGER     8
 #define WE_DISPLAY_DATAPATH_SNAP_SHOT    9
-#ifdef WLAN_FEATURE_RMC
-#define WE_IBSS_GET_PEER_INFO_ALL 10
-#endif
 #define WE_STOP_OBSS_SCAN    11
+
+#ifdef DEBUG_ROAM_DELAY
 #define WE_DUMP_ROAM_TIMER_LOG     12
 #define WE_RESET_ROAM_TIMER_LOG    13
-#define WE_GET_FW_LOGS             14
-#define WE_GET_FW_MEMDUMP          15
+#endif
 
 /* Private ioctls and their sub-ioctls */
 #define WLAN_PRIV_SET_VAR_INT_GET_NONE   (SIOCIWFIRSTPRIV + 7)
@@ -268,14 +248,9 @@
 #ifdef FEATURE_WLAN_TDLS
 #define WE_TDLS_CONFIG_PARAMS   5
 #endif
-#ifdef WLAN_FEATURE_RMC
-#define WE_IBSS_GET_PEER_INFO   6
-#endif
 
 #define WE_MTRACE_DUMP_CMD    8
 #define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD    9
-#define WE_CONFIGURE_MONITOR_MODE  10
-#define WE_SET_MONITOR_MODE_FILTER  11
 
 #ifdef FEATURE_WLAN_TDLS
 #undef  MAX_VAR_ARGS
@@ -383,9 +358,12 @@
 #define WLAN_ADAPTER 0
 #define P2P_ADAPTER  1
 
-#define TX_PWR_MIN  6
-#define TX_PWR_MAX 22
-#define TX_PWR_DEF 50
+#define HDD_IOCTL_RATELIMIT_INTERVAL 20*HZ
+#define HDD_IOCTL_RATELIMIT_BURST 1
+
+static DEFINE_RATELIMIT_STATE(hdd_ioctl_timeout_rs, \
+        HDD_IOCTL_RATELIMIT_INTERVAL,     \
+        HDD_IOCTL_RATELIMIT_BURST);
 
 /*
  * When supplicant sends SETBAND ioctl it queries for channels from
@@ -419,9 +397,7 @@
 int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest,
                            v_U8_t sessionId);
 #endif
-static int get_fwr_memdump(struct net_device *,
-                            struct iw_request_info *,
-                            union iwreq_data *, char *);
+
 /**---------------------------------------------------------------------------
 
   \brief mem_alloc_copy_from_user_helper -
@@ -526,8 +502,6 @@
     VOS_STATUS status;
     tSirVersionString wcnss_SW_version;
     tSirVersionString wcnss_HW_version;
-    tSirVersionString iris_name;
-    char *pIRISversion;
     char *pSWversion;
     char *pHWversion;
     tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
@@ -554,208 +528,27 @@
         pHWversion = "Unknown";
     }
 
-    status = wcnss_get_iris_name(iris_name);
-
-    if (!status) {
-        pIRISversion = iris_name;
-    } else {
-        pIRISversion = "Unknown";
-    }
-
     wrqu->data.length = scnprintf(extra, WE_MAX_STR_LEN,
-                                 "Host SW:%s, FW:%s, HW:%s, IRIS_HW:%s",
+                                 "Host SW:%s, FW:%s, HW:%s",
                                  QWLAN_VERSIONSTR,
                                  pSWversion,
-                                 pHWversion, pIRISversion);
+                                 pHWversion);
 
     return;
 }
 
-#ifdef WLAN_FEATURE_RMC
-void hdd_get_ibss_peer_info_cb(v_VOID_t *pUserData, v_VOID_t *pPeerInfoRsp)
-{
-   hdd_adapter_t *pAdapter = (hdd_adapter_t *)pUserData;
-   tSirPeerInfoRspParams *pPeerInfo = (tSirPeerInfoRspParams *)pPeerInfoRsp;
-   hdd_station_ctx_t *pStaCtx =  WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   v_U8_t   i;
-
-   if (NULL != pPeerInfo && eHAL_STATUS_SUCCESS == pPeerInfo->status)
-   {
-      pStaCtx->ibss_peer_info.status = pPeerInfo->status;
-      pStaCtx->ibss_peer_info.numIBSSPeers = pPeerInfo->numPeers;
-      for (i = 0; i < pPeerInfo->numPeers; i++)
-      {
-         memcpy(&pStaCtx->ibss_peer_info.ibssPeerList[i],
-                &pPeerInfo->peerInfoParams[i], sizeof(hdd_ibss_peer_info_params_t));
-      }
-   }
-   else
-   {
-      hddLog(LOGE,
-            FL("PEER_INFO_CMD_STATUS is not SUCCESS"));
-   }
-
-   complete(&pAdapter->ibss_peer_info_comp);
-}
-
-v_MACADDR_t* hdd_wlan_get_ibss_mac_addr_from_staid(hdd_adapter_t *pAdapter, v_U8_t staIdx)
-{
-   v_U8_t idx;
-   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-
-   for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ )
-   {
-      if ( 0 != pHddStaCtx->conn_info.staId[ idx ] &&
-           staIdx == pHddStaCtx->conn_info.staId[ idx ])
-      {
-         return (&pHddStaCtx->conn_info.peerMacAddress[ idx ]);
-      }
-   }
-   return NULL;
-}
-
-eHalStatus hdd_wlan_get_ibss_peer_info(hdd_adapter_t *pAdapter, v_U8_t staIdx)
-{
-    eHalStatus status = eHAL_STATUS_FAILURE;
-    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    hdd_station_ctx_t *pStaCtx =  WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    hdd_ibss_peer_info_t *pPeerInfo = &pStaCtx->ibss_peer_info;
-
-    status = sme_RequestIBSSPeerInfo(hHal, pAdapter, hdd_get_ibss_peer_info_cb,
-                                     VOS_FALSE, staIdx);
-
-    INIT_COMPLETION(pAdapter->ibss_peer_info_comp);
-
-    if (eHAL_STATUS_SUCCESS == status)
-    {
-       long ret;
-       ret  = wait_for_completion_interruptible_timeout
-                (&pAdapter->ibss_peer_info_comp,
-                msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
-       if (ret <= 0)
-       {
-          hddLog(VOS_TRACE_LEVEL_ERROR,
-                  FL("failed wait on ibss_peer_info_comp %ld"), ret);
-          return eHAL_STATUS_FAILURE;
-       }
-
-       /** Print the peer info */
-       pr_info("pPeerInfo->numIBSSPeers = %d ", pPeerInfo->numIBSSPeers);
-       pr_info("============================================================");
-       {
-          v_MACADDR_t *macAddr = hdd_wlan_get_ibss_mac_addr_from_staid(pAdapter,
-                                 staIdx);
-          v_U32_t  txRateMbps = ((pPeerInfo->ibssPeerList[0].txRate)*500*1000)/1000000;
-
-          if (NULL != macAddr)
-          {
-             pr_info("PEER ADDR :" MAC_ADDRESS_STR " TxRate: %d Mbps  RSSI: %d",
-                     MAC_ADDR_ARRAY(macAddr->bytes),
-                      (int)txRateMbps, (int)pPeerInfo->ibssPeerList[0].rssi);
-          }
-          else
-          {
-             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                       " ERROR: PEER MAC ADDRESS NOT FOUND ");
-          }
-       }
-    }
-    else
-    {
-       hddLog(VOS_TRACE_LEVEL_WARN,
-              "%s: Warning: sme_RequestIBSSPeerInfo Request failed", __func__);
-    }
-
-    return status;
-}
-
-eHalStatus hdd_wlan_get_ibss_peer_info_all(hdd_adapter_t *pAdapter)
-{
-    eHalStatus status = eHAL_STATUS_FAILURE;
-    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    hdd_station_ctx_t *pStaCtx =  WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    hdd_ibss_peer_info_t *pPeerInfo = &pStaCtx->ibss_peer_info;
-    int i;
-
-    status = sme_RequestIBSSPeerInfo(hHal, pAdapter, hdd_get_ibss_peer_info_cb,
-                                     VOS_TRUE, 0xFF);
-    INIT_COMPLETION(pAdapter->ibss_peer_info_comp);
-
-    if (eHAL_STATUS_SUCCESS == status)
-    {
-       long ret;
-       ret  = wait_for_completion_interruptible_timeout
-                (&pAdapter->ibss_peer_info_comp,
-                 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
-       if (ret <= 0)
-       {
-          hddLog(VOS_TRACE_LEVEL_ERROR,
-                  FL("failed wait on ibss_peer_info_comp %ld"), ret);
-          return eHAL_STATUS_FAILURE;
-       }
-
-       /** Print the peer info */
-       pr_info("pPeerInfo->numIBSSPeers = %d ", (int)pPeerInfo->numIBSSPeers);
-       pr_info("============================================================");
-       for (i = 0; i < pPeerInfo->numIBSSPeers; i++)
-       {
-          v_U8_t staIdx = pPeerInfo->ibssPeerList[i].staIdx;
-          v_MACADDR_t *macAddr = hdd_wlan_get_ibss_mac_addr_from_staid(pAdapter,
-                                                                       staIdx);
-          v_U32_t  txRateMbps = ((pPeerInfo->ibssPeerList[0].txRate)*500*1000)/1000000;
-
-          pr_info("STAIDX:%d ", (int)pPeerInfo->ibssPeerList[i].staIdx);
-          if (NULL != macAddr)
-          {
-             pr_info(" PEER ADDR :" MAC_ADDRESS_STR " TxRate: %d Mbps RSSI: %d",
-                     MAC_ADDR_ARRAY(macAddr->bytes),
-                     (int)txRateMbps, (int)pPeerInfo->ibssPeerList[i].rssi);
-          }
-          else
-          {
-             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                       " ERROR: PEER MAC ADDRESS NOT FOUND ");
-          }
-       }
-    }
-    else
-    {
-       hddLog(VOS_TRACE_LEVEL_WARN,
-              "%s: Warning: sme_RequestIBSSPeerInfo Request failed", __func__);
-    }
-
-    return status;
-}
-#endif /* WLAN_FEATURE_RMC */
-
 int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu)
 {
-    tHalHandle hHal;
-    hdd_context_t *pHddCtx;
-    v_U32_t threshold = 0;
-    int ret = 0;
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    v_U32_t threshold = 0,status = 0;
 
     ENTER();
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
 
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        return ret;
-    }
-
-    hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+      return status;
     }
 
     if ( eHAL_STATUS_SUCCESS !=
@@ -777,32 +570,16 @@
 
 int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu)
 {
-    tHalHandle hHal;
-    hdd_context_t *pHddCtx;
-    v_U32_t threshold = 0, status = 0;
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    v_U32_t threshold = 0,status = 0;
 
     ENTER();
 
-    if (NULL == pAdapter)
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    status = wlan_hdd_validate_context(pHddCtx);
-    if (0 != status)
-    {
-        return status;
-    }
-
-    hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+      return status;
     }
 
     if ( ccmCfgGetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, &threshold)
@@ -951,14 +728,9 @@
    /* paranoia: invalidate the magic */
    pStatsContext->magic = 0;
 
-   /* copy over the rssi.FW will return RSSI as -100
-    * if there are no samples to calculate the average
-    * RSSI
-    */
-   if (rssi != -100)
-       pAdapter->rssi = rssi;
-   if (pAdapter->rssi > 0)
-       pAdapter->rssi = 0;
+   /* copy over the rssi */
+   pAdapter->rssi = rssi;
+
    /* notify the caller */
    complete(&pStatsContext->completion);
 
@@ -1049,22 +821,6 @@
    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
 
-   if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s:Not associated, rssi on Disconnect : %d",
-                    __func__, pAdapter->rssi_on_disconnect);
-       *rssi_value = pAdapter->rssi_on_disconnect;
-       return VOS_STATUS_SUCCESS;
-   }
-
-   if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                 "%s: Roaming in progress, hence return last cached RSSI", __func__);
-       *rssi_value = pAdapter->rssi;
-       return VOS_STATUS_SUCCESS;
-   }
-
    init_completion(&context.completion);
    context.pAdapter = pAdapter;
    context.magic = RSSI_CONTEXT_MAGIC;
@@ -1111,63 +867,6 @@
 
    return VOS_STATUS_SUCCESS;
 }
-/**---------------------------------------------------------------------------
-
-  \brief wlan_hdd_get_frame_logs() -
-
-   This function use to get Frames log.
-
-  \param  - pAdapter Pointer to the adapter.
-            flag - Specify type of request. Clear and Send request are
-                   supported.
-
-  \return - none
-
-  --------------------------------------------------------------------------*/
-VOS_STATUS wlan_hdd_get_frame_logs(hdd_adapter_t *pAdapter, v_U8_t flag)
-{
-   hdd_context_t *pHddCtx;
-   eHalStatus hstatus;
-
-   if (NULL == pAdapter)
-   {
-       hddLog(VOS_TRACE_LEVEL_WARN,
-              "%s: Invalid context, pAdapter", __func__);
-       return VOS_STATUS_E_FAULT;
-   }
-
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   if (!pHddCtx->mgmt_frame_logging)
-   {
-      hddLog(LOGW, FL("Frame Logging not init!"));
-      return VOS_STATUS_E_AGAIN;
-   }
-
-   if ((flag != WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR) &&
-                (flag != WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR) &&
-                (flag != WLAN_HDD_GET_FRAME_LOG_CMD_BMU_TRACING))
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Incorrect getFrame params!", __func__);
-      return VOS_STATUS_E_INVAL;
-   }
-
-   if ((flag == WLAN_HDD_GET_FRAME_LOG_CMD_BMU_TRACING) &&
-                               (!pHddCtx->cfg_ini->enableBMUHWtracing))
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,"%s: BMUHW Tracing not enabled!", __func__);
-      return VOS_STATUS_E_INVAL;
-   }
-
-   hstatus = sme_GetFramesLog(pHddCtx->hHal, flag);
-   if (eHAL_STATUS_SUCCESS != hstatus)
-   {
-       hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to get Frame Logs", __func__);
-       return VOS_STATUS_E_FAILURE;
-   }
-
-   return VOS_STATUS_SUCCESS;
-}
-
 
 VOS_STATUS wlan_hdd_get_snr(hdd_adapter_t *pAdapter, v_S7_t *snr)
 {
@@ -1178,8 +877,6 @@
    long lrc;
    int valid;
 
-   ENTER();
-
    if (NULL == pAdapter)
    {
        hddLog(VOS_TRACE_LEVEL_ERROR,
@@ -1192,6 +889,7 @@
    valid = wlan_hdd_validate_context(pHddCtx);
    if (0 != valid)
    {
+       hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid"));
        return VOS_STATUS_E_FAULT;
    }
 
@@ -1246,10 +944,8 @@
 
    *snr = pAdapter->snr;
 
-   EXIT();
    return VOS_STATUS_SUCCESS;
 }
-
 #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
 
 static void hdd_GetRoamRssiCB( v_S7_t rssi, tANI_U32 staId, void *pContext )
@@ -1299,15 +995,9 @@
    /* paranoia: invalidate the magic */
    pStatsContext->magic = 0;
 
-   /* copy over the rssi.FW will return RSSI as -100
-    * if there are no samples to calculate the average
-    * RSSI
-    */
-   if (rssi != -100)
-       pAdapter->rssi = rssi;
+   /* copy over the rssi */
+   pAdapter->rssi = rssi;
 
-   if (pAdapter->rssi > 0)
-       pAdapter->rssi = 0;
    /* notify the caller */
    complete(&pStatsContext->completion);
 
@@ -1524,7 +1214,7 @@
    pWextState->roamProfile.bWPSAssociation = VOS_FALSE;
    pWextState->roamProfile.bOSENAssociation = VOS_FALSE;
    pWextState->roamProfile.nAddIEScanLength = 0;
-   memset(pWextState->roamProfile.addIEScan, 0 , SIR_MAC_MAX_ADD_IE_LENGTH+2);
+   memset(pWextState->roamProfile.addIEScan, 0 , SIR_MAC_MAX_IE_LENGTH+2);
    pWextState->roamProfile.pAddIEAssoc = (tANI_U8 *)NULL;
    pWextState->roamProfile.nAddIEAssocLength = 0;
 
@@ -1563,10 +1253,10 @@
 {
     hdd_adapter_t *pAdapter = (hdd_adapter_t*)callbackContext;
 
-    if ( (pAdapter == NULL) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
+    if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Invalid pAdapter magic/ pAdapter is NULL", __func__);
+                  "%s: Invalid pAdapter magic", __func__);
     }
     else
     {
@@ -1647,85 +1337,23 @@
     return NULL;
 }
 
-static int __iw_set_commit(struct net_device *dev, struct iw_request_info *info,
-                         union iwreq_data *wrqu, char *extra)
-{
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
-
-    ENTER();
-
-    pAdapter  = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   "%s: pAdapter is NULL\n", __func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
-    /* Do nothing for now */
-
-    EXIT();
-    return ret;
-}
-
 static int iw_set_commit(struct net_device *dev, struct iw_request_info *info,
                          union iwreq_data *wrqu, char *extra)
 {
-    int ret;
-
-    vos_ssr_protect(__func__);
-    ret = __iw_set_commit(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
-}
-
-static int __iw_get_name(struct net_device *dev,
-                       struct iw_request_info *info,
-                       char *wrqu, char *extra)
-{
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
-
-    ENTER();
-    pAdapter  = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   "%s: pAdapter is NULL\n", __func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    strlcpy(wrqu, "Qcom:802.11n", IFNAMSIZ);
-    EXIT();
-    return ret;
+    hddLog( LOG1, "In %s", __func__);
+    /* Do nothing for now */
+    return 0;
 }
 
 static int iw_get_name(struct net_device *dev,
                        struct iw_request_info *info,
                        char *wrqu, char *extra)
 {
-    int ret;
 
-    vos_ssr_protect(__func__);
-    ret = __iw_get_name(dev, info, wrqu, extra);
-    vos_ssr_unprotect(__func__);
-
-    return ret;
+    ENTER();
+    strlcpy(wrqu, "Qcom:802.11n", IFNAMSIZ);
+    EXIT();
+    return 0;
 }
 
 static int __iw_set_mode(struct net_device *dev,
@@ -1733,29 +1361,26 @@
                          union iwreq_data *wrqu, char *extra)
 {
     hdd_wext_state_t         *pWextState;
-    hdd_adapter_t            *pAdapter;
-    hdd_context_t            *pHddCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     tCsrRoamProfile          *pRoamProfile;
     eCsrRoamBssType          LastBSSType;
     eMib_dot11DesiredBssType connectedBssType;
     hdd_config_t             *pConfig;
     struct wireless_dev      *wdev;
-    int                      status = 0;
 
     ENTER();
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     if (NULL == pAdapter)
     {
         hddLog(VOS_TRACE_LEVEL_WARN,
                "%s: Invalid context, pAdapter", __func__);
         return 0;
     }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    status = wlan_hdd_validate_context(pHddCtx);
-    if (0 != status)
-    {
-        return status;
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                 "%s:LOGP in Progress. Ignore!!!", __func__);
+       return 0;
     }
 
     pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
@@ -1846,13 +1471,10 @@
 {
 
     hdd_wext_state_t *pWextState;
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
 
-    ENTER();
+    hddLog(LOG1, "In %s", __func__);
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     if (NULL == pAdapter)
     {
         hddLog(VOS_TRACE_LEVEL_WARN,
@@ -1860,12 +1482,12 @@
         return 0;
     }
 
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                 "%s:LOGP in Progress. Ignore!!!", __func__);
+       return 0;
     }
+
     pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
     if (pWextState == NULL)
     {
@@ -1893,7 +1515,6 @@
         break;
     }
 
-    EXIT();
     return 0;
 }
 
@@ -1921,52 +1542,18 @@
     v_U32_t status = 0;
 
     hdd_wext_state_t *pWextState;
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    tHalHandle hHal;
-    hdd_station_ctx_t *pHddStaCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     tCsrRoamProfile * pRoamProfile;
-
     ENTER();
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s:Invalid Adapter",__func__);
-       return -EINVAL;
-    }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    status = wlan_hdd_validate_context(pHddCtx);
-    if (0 != status)
-    {
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
        return status;
     }
 
-    hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
-    }
-
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    if (NULL == pHddStaCtx)
-    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s:STA context is NULL",__func__);
-       return -EINVAL;
-    }
-
     pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-    if (NULL == pWextState)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pWextState is NULL",__func__);
-        return -EINVAL;
-    }
 
     pRoamProfile = &pWextState->roamProfile;
 
@@ -2063,50 +1650,22 @@
                          struct iw_freq *fwrq, char *extra)
 {
    v_U32_t status = FALSE, channel = 0, freq = 0;
-   hdd_adapter_t *pAdapter;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
    tHalHandle hHal;
    hdd_wext_state_t *pWextState;
    tCsrRoamProfile * pRoamProfile;
-   hdd_station_ctx_t *pHddStaCtx;
-   hdd_context_t *pHddCtx;
-   int ret = 0;
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
 
    ENTER();
 
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL", __func__);
-       return -EINVAL;
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+      return status;
    }
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-   hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-   if (NULL == hHal)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Hal Context is NULL",__func__);
-       return -EINVAL;
-   }
-   pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   if (NULL == pHddStaCtx)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: HddStaCtx is NULL", __func__);
-       return -EINVAL;
-   }
+
    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-   if (NULL == pWextState)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: pWextState is NULL",__func__);
-       return -EINVAL;
-   }
+   hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+
    pRoamProfile = &pWextState->roamProfile;
 
    if( pHddStaCtx->conn_info.connState== eConnectionState_Associated )
@@ -2138,9 +1697,7 @@
        fwrq->m = 0;
        fwrq->e = MHZ;
     }
-
-    EXIT();
-    return ret;
+   return 0;
 }
 
 static int iw_get_freq(struct net_device *dev,
@@ -2161,33 +1718,15 @@
                              union iwreq_data *wrqu, char *extra)
 {
 
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   hdd_station_ctx_t *pHddStaCtx;
-   int ret = 0;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
 
-   ENTER();
-
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
+   if (pHddCtx->isLogpInProgress)
    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-
-   pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   if (NULL == pHddStaCtx)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: STA Context is NULL",__func__);
-       return -EINVAL;
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+              "%s:LOGP in Progress. Ignore!!!",__func__);
+      return -EBUSY;
    }
 
    if(eConnectionState_Associated != pHddStaCtx->conn_info.connState)
@@ -2198,7 +1737,6 @@
    wlan_hdd_get_classAstats(pAdapter);
    wrqu->txpower.value = pAdapter->hdd_stats.ClassA_stat.max_pwr;
 
-   EXIT();
    return 0;
 }
 
@@ -2219,34 +1757,17 @@
                              struct iw_request_info *info,
                              union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    tHalHandle hHal;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+       return 0;
+    }
 
     ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
 
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
-    hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
-    }
     if ( ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, wrqu->txpower.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS )
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -2279,41 +1800,20 @@
    VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
    eHalStatus status = eHAL_STATUS_SUCCESS;
    hdd_wext_state_t *pWextState;
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   hdd_station_ctx_t *pHddStaCtx;
-   int ret = 0;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
 
    ENTER();
 
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+      return status;
    }
 
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-
-   pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   if (NULL == pHddStaCtx)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: STA Context is NULL",__func__);
-       return -EINVAL;
-   }
-
-   if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) {
+   if(eConnectionState_Associated != pHddStaCtx->conn_info.connState) {
         wrqu->bitrate.value = 0;
    }
-   else
-   {
+   else {
       status = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter), eCSR_HDD,
                                SME_SUMMARY_STATS       |
                                SME_GLOBAL_CLASSA_STATS |
@@ -2333,12 +1833,6 @@
       }
 
       pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-      if (NULL == pWextState)
-      {
-          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    "%s: pWextState is NULL",__func__);
-          return -EINVAL;
-      }
 
       vos_status = vos_wait_single_event(&pWextState->vosevent, WLAN_WAIT_TIME_STATS);
 
@@ -2379,49 +1873,23 @@
                             union iwreq_data *wrqu,
                             char *extra)
 {
-    hdd_adapter_t *pAdapter;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     hdd_wext_state_t *pWextState;
-    hdd_station_ctx_t *pHddStaCtx;
-    hdd_context_t *pHddCtx;
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     v_U8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN];
     v_U32_t a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN;
     v_U32_t b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN;
     v_U32_t i, rate;
     v_U32_t valid_rate = FALSE, active_phy_mode = 0;
-    int ret = 0;
 
     ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
 
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+       return 0;
     }
 
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    if (NULL == pHddStaCtx)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: STA Context is NULL",__func__);
-        return -EINVAL;
-    }
-
-
     pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-    if (NULL == pWextState)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pWextState is NULL",__func__);
-        return -EINVAL;
-    }
 
     if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
     {
@@ -2473,8 +1941,6 @@
                 FL("failed to set ini parameter, WNI_CFG_FIXED_RATE"));
         return -EIO;
     }
-
-    EXIT();
     return 0;
 }
 
@@ -2497,64 +1963,45 @@
                           union iwreq_data *wrqu,
                           char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   hdd_wext_state_t *pWextState;
-   u_int8_t *genie = NULL;
-   u_int8_t *base_genie = NULL;
-   v_U16_t remLen;
-   int ret = 0;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    u_int8_t *genie = NULL;
+    u_int8_t *base_genie = NULL;
+    v_U16_t remLen;
 
    ENTER();
 
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                  "%s:LOGP in Progress. Ignore!!!", __func__);
+        return 0;
+    }
 
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
+    if (!wrqu->data.length) {
+        hdd_clearRoamProfileIe(pAdapter);
+        EXIT();
+        return 0;
+    }
 
-   pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-   if (NULL == pWextState)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: pWextState is NULL",__func__);
-       return -EINVAL;
-   }
+    base_genie = mem_alloc_copy_from_user_helper(wrqu->data.pointer,
+                                                 wrqu->data.length);
+    if (NULL == base_genie)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "mem_alloc_copy_from_user_helper fail");
+        return -ENOMEM;
+    }
 
-   if (!wrqu->data.length) {
-       hdd_clearRoamProfileIe(pAdapter);
-       EXIT();
-       return 0;
-   }
+    genie = base_genie;
 
-   base_genie = mem_alloc_copy_from_user_helper(wrqu->data.pointer,
-                                                wrqu->data.length);
-   if (NULL == base_genie)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "mem_alloc_copy_from_user_helper fail");
-       return -ENOMEM;
-   }
+    remLen = wrqu->data.length;
 
-   genie = base_genie;
+    hddLog(LOG1,"iw_set_genie ioctl IE[0x%X], LEN[%d]", genie[0], genie[1]);
 
-   remLen = wrqu->data.length;
+    /* clear any previous genIE before this call */
+    memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) );
 
-   hddLog(LOG1,"iw_set_genie ioctl IE[0x%X], LEN[%d]", genie[0], genie[1]);
-
-   /* clear any previous genIE before this call */
-   memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) );
-
-   while (remLen >= 2)
+    while (remLen >= 2)
    {
         v_U16_t eLen = 0;
         v_U8_t elementId;
@@ -2570,8 +2017,8 @@
             case IE_EID_VENDOR:
                 if ((IE_LEN_SIZE+IE_EID_SIZE+IE_VENDOR_OUI_SIZE) > eLen) /* should have at least OUI */
                 {
-                    ret = -EINVAL;
-                    goto exit;
+                    kfree(base_genie);
+                    return -EINVAL;
                 }
 
                 if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4))
@@ -2585,8 +2032,8 @@
                        hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. "
                                                       "Need bigger buffer space");
                        VOS_ASSERT(0);
-                       ret = -EINVAL;
-                       goto exit;
+                       kfree(base_genie);
+                       return -ENOMEM;
                     }
                     // save to Additional IE ; it should be accumulated to handle WPS IE + other IE
                     memcpy( pWextState->genIE.addIEdata + curGenIELen, genie - 2, eLen + 2);
@@ -2595,14 +2042,6 @@
                 else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3))
                 {
                     hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2);
-                    if ((eLen + 2) > (sizeof(pWextState->WPARSNIE)))
-                    {
-                       hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. "
-                                                      "Need bigger buffer space");
-                       ret = -EINVAL;
-                       VOS_ASSERT(0);
-                       goto exit;
-                    }
                     memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN );
                     memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2));
                     pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE;
@@ -2619,8 +2058,8 @@
                        hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. "
                                                       "Need bigger buffer space");
                        VOS_ASSERT(0);
-                       ret = -ENOMEM;
-                       goto exit;
+                       kfree(base_genie);
+                       return -ENOMEM;
                     }
                     // save to Additional IE ; it should be accumulated to handle WPS IE + other IE
                     memcpy( pWextState->genIE.addIEdata + curGenIELen, genie - 2, eLen + 2);
@@ -2629,14 +2068,6 @@
               break;
          case DOT11F_EID_RSN:
                 hddLog (LOG1, "%s Set RSN IE (len %d)",__func__, eLen+2);
-                if ((eLen + 2) > (sizeof(pWextState->WPARSNIE)))
-                {
-                    hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. "
-                                                  "Need bigger buffer space");
-                    ret = -EINVAL;
-                    VOS_ASSERT(0);
-                    goto exit;
-                }
                 memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN );
                 memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2));
                 pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE;
@@ -2645,16 +2076,15 @@
 
          default:
                 hddLog (LOGE, "%s Set UNKNOWN IE %X",__func__, elementId);
-                goto exit;
+            kfree(base_genie);
+            return 0;
     }
         genie += eLen;
         remLen -= eLen;
     }
-
-exit:
     EXIT();
     kfree(base_genie);
-    return ret;
+    return 0;
 }
 
 static int iw_set_genie(struct net_device *dev,
@@ -2677,44 +2107,23 @@
                           char *extra)
 {
     hdd_wext_state_t *pWextState;
-    hdd_context_t *pHddCtx;
-    hdd_adapter_t *pAdapter;
-    hdd_station_ctx_t *pHddStaCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     eHalStatus status;
     v_U32_t length = DOT11F_IE_RSN_MAX_LEN;
     v_U8_t genIeBytes[DOT11F_IE_RSN_MAX_LEN];
 
     ENTER();
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+       return 0;
     }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    status = wlan_hdd_validate_context(pHddCtx);
-    if (0 != status)
-    {
-       return status;
-    }
+
+
+    hddLog(LOG1,"getGEN_IE ioctl");
 
     pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-    if (NULL == pWextState)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pWextState is NULL",__func__);
-        return -EINVAL;
-    }
-
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    if (NULL == pHddStaCtx)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: STA Context is NULL",__func__);
-        return -EINVAL;
-    }
 
     if( pHddStaCtx->conn_info.connState == eConnectionState_NotConnected)
     {
@@ -2768,37 +2177,20 @@
                            struct iw_request_info *info,
                            struct iw_point *dwrq, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    hdd_wext_state_t *pWextState;
-    tCsrRoamProfile *pRoamProfile;
-    int keyId, i, ret = 0;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile);
+    int keyId;
     eCsrAuthType authType = eCSR_AUTH_TYPE_NONE;
+    int i;
 
     ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+       return 0;
     }
 
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-    if (NULL == pWextState)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pWextState is NULL",__func__);
-        return -EINVAL;
-    }
-
-    pRoamProfile  = &(pWextState->roamProfile);
     keyId = pRoamProfile->Keys.defaultIndex;
 
     if(keyId < 0 || keyId >= MAX_WEP_KEYS)
@@ -2902,36 +2294,17 @@
                                   struct iw_request_info *info,
                                   union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    tHalHandle hHal;
-    int ret = 0;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
 
     ENTER();
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+            "%s:LOGP in Progress. Ignore!!!", __func__);
+        return -EAGAIN;
     }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
-    hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
-    }
-
     if ( wrqu->rts.value < WNI_CFG_RTS_THRESHOLD_STAMIN || wrqu->rts.value > WNI_CFG_RTS_THRESHOLD_STAMAX )
     {
         return -EINVAL;
@@ -2991,35 +2364,17 @@
                                    struct iw_request_info *info,
                                    union iwreq_data *wrqu, char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   tHalHandle hHal;
-   int ret = 0;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
 
    ENTER();
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
 
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
    {
-       return ret;
-   }
-
-   hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-   if (NULL == hHal)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Hal Context is NULL",__func__);
-       return -EINVAL;
-   }
-
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+       return -EBUSY;
+    }
     if ( wrqu->frag.value < WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN || wrqu->frag.value > WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX )
     {
         return -EINVAL;
@@ -3050,93 +2405,28 @@
    return ret;
 }
 
-static int __iw_get_power_mode(struct net_device *dev,
-                             struct iw_request_info *info,
-                             union iwreq_data *wrqu, char *extra)
-{
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   int ret = 0;
-
-   ENTER();
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-
-   EXIT();
-   return -EOPNOTSUPP;
-}
-
 static int iw_get_power_mode(struct net_device *dev,
                              struct iw_request_info *info,
                              union iwreq_data *wrqu, char *extra)
 {
-   int ret;
-
-   vos_ssr_protect(__func__);
-   ret = __iw_get_power_mode(dev, info, wrqu, extra);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-static int __iw_set_power_mode(struct net_device *dev,
-                             struct iw_request_info *info,
-                             union iwreq_data *wrqu, char *extra)
-{
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
-
-    ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
-    EXIT();
-    return -EOPNOTSUPP;
+   ENTER();
+   return -EOPNOTSUPP;
 }
 
 static int iw_set_power_mode(struct net_device *dev,
                              struct iw_request_info *info,
                              union iwreq_data *wrqu, char *extra)
 {
-   int ret;
-
-   vos_ssr_protect(__func__);
-   ret = __iw_set_power_mode(dev, info, wrqu, extra);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
+    ENTER();
+    return -EOPNOTSUPP;
 }
 
 static int __iw_get_range(struct net_device *dev,
                           struct iw_request_info *info,
                           union iwreq_data *wrqu, char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   tHalHandle hHal;
-   hdd_context_t *pHddCtx;
-   int ret = 0;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
    struct iw_range *range = (struct iw_range *) extra;
 
    v_U8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN];
@@ -3150,29 +2440,16 @@
 
    ENTER();
 
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                                  "%s: pAdapter is NULL", __func__);
-      return -EINVAL;
-   }
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret =  wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-   hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-   if (NULL == hHal)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                                  "%s: pAdapter is NULL", __func__);
-      return -EINVAL;
-   }
    wrqu->data.length = sizeof(struct iw_range);
    memset(range, 0, sizeof(struct iw_range));
 
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+      return -EBUSY;
+   }
+
    /*Get the phy mode*/
    if (ccmCfgGetInt(hHal,
                   WNI_CFG_DOT11_MODE, &active_phy_mode) == eHAL_STATUS_SUCCESS)
@@ -3590,8 +2867,7 @@
    hstatus = sme_GetStatistics(WLAN_HDD_GET_HAL_CTX(pAdapter),
                                eCSR_HDD,
                                SME_SUMMARY_STATS |
-                               SME_GLOBAL_CLASSA_STATS |
-                               SME_PER_PKT_STATS,
+                               SME_GLOBAL_CLASSA_STATS,
                                hdd_get_station_statisticsCB,
                                0, // not periodic
                                FALSE, //non-cached results
@@ -3647,37 +2923,25 @@
                             struct iw_request_info *info,
                             union iwreq_data *wrqu, char *extra)
 {
-   hdd_adapter_t *pAdapter;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
    hdd_context_t *pHddCtx;
    char *pLinkSpeed = (char*)extra;
    int len = sizeof(v_U32_t) + 1;
    v_U32_t link_speed;
-   hdd_station_ctx_t *pHddStaCtx;
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
    VOS_STATUS status;
-   int rc, valid = 0;
-
-   ENTER();
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
+   int rc, valid;
 
    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
    valid = wlan_hdd_validate_context(pHddCtx);
+
    if (0 != valid)
    {
+       hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid"));
        return valid;
    }
-   pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   if (NULL == pHddStaCtx)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: STA Context is NULL",__func__);
-       return -EINVAL;
-   }
+
    if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
    {
       /* we are not connected so we don't have a classAstats */
@@ -3722,7 +2986,6 @@
        return -EIO;
    }
 
-   EXIT();
   /* a value is being successfully returned */
    return rc;
 }
@@ -3846,222 +3109,11 @@
     return ret;
 }
 
-static uint8 chartohex(char c)
-{
-    uint8 val = 0;
-    if (c >= '0' && c <= '9')
-        val = c - '0';
-    else if (c >= 'a' && c <= 'f')
-        val = c - 'a' + 10;
-    else if (c >= 'A' && c <= 'F')
-        val = c - 'A' + 10;
-    else
-        hddLog(VOS_TRACE_LEVEL_ERROR, "Not a valid hex char");
-
-    return val;
-}
-
-uint8 getByte(char **buf)
-{
-    uint8 byte = 0;
-    char *temp = *buf;
-    byte = chartohex(*temp) * 16;
-    temp++;
-    byte += chartohex(*temp);
-    temp++;
-    *buf = temp;
-    return byte;
-}
-
-static void parse_Bufferforpkt(tSirpkt80211 *pkt, u8 *pBuffer, u16 len)
-{
-    tSir80211Header *macHeader;
-    int i = 0, j = 0, length = 0;
-    uint8 byte = 0;
-    char *temp = pBuffer;
-    uint16 fragNum = 0;
-    char *pHeader;
-    tSir80211Header header;
-
-    macHeader = &pkt->macHeader;
-
-    pkt->encParams.keyParams.key[0].keyId = *temp - '0';
-
-    temp++;
-
-    hddLog(VOS_TRACE_LEVEL_ERROR, "Input Message to encrypt");
-    hddLog(VOS_TRACE_LEVEL_ERROR, "Key Id : %d",
-            pkt->encParams.keyParams.key[0].keyId);
-
-    for (i = 0; i< 16; i++) {
-        pkt->encParams.keyParams.key[0].key[i]
-            = getByte(&temp);
-    }
-
-    print_hex_dump(KERN_INFO, "Key : ", DUMP_PREFIX_NONE, 16, 1,
-            &pkt->encParams.keyParams.key[0].key[0], 16, 0);
-
-    for (i = 0; i< 6; i++) {
-        pkt->encParams.pn[i]
-            = getByte(&temp);
-    }
-
-    print_hex_dump(KERN_INFO, "PN : ", DUMP_PREFIX_NONE, 16, 1,
-            &pkt->encParams.pn[0], 6, 0);
-
-    for (i = 0, j= 5; i< 3; i++, j--) {
-        byte = pkt->encParams.pn[i];
-        pkt->encParams.pn[i] = pkt->encParams.pn[j];
-        pkt->encParams.pn[j] = byte;
-    }
-
-    length = getByte(&temp);
-    if (length > sizeof(tSir80211Header))
-       length = sizeof(tSir80211Header);
-
-    pHeader = temp;
-    vos_mem_zero(&header, sizeof(tSir80211Header));
-    for (i = 0; i < length; i++) {
-        *((uint8 *)&header + i) = getByte(&pHeader);
-    }
-
-    print_hex_dump(KERN_INFO, "Header : ", DUMP_PREFIX_NONE, 16, 1,
-            (char *)&header, length, 0);
-
-    byte = getByte(&temp);
-
-    macHeader->frameCtrl.protVer  = byte & 0x3;
-    macHeader->frameCtrl.type     = (byte >> 2) & 0x3;
-    macHeader->frameCtrl.subType  = (byte >> 4) & 0xF;
-
-    byte = getByte(&temp);
-    macHeader->frameCtrl.toDS     = (byte) & 0x1;
-    macHeader->frameCtrl.fromDS   = (byte >> 1) & 0x1;
-    macHeader->frameCtrl.moreFrag = (byte >> 2) & 0x1;
-    macHeader->frameCtrl.retry    = (byte >> 3) & 0x1;
-    macHeader->frameCtrl.powerMgmt = (byte >> 4) & 0x1;
-    macHeader->frameCtrl.moreData = (byte >> 5) & 0x1;
-    macHeader->frameCtrl.wep      = (byte >> 6) & 0x1;
-    macHeader->frameCtrl.order    = (byte >> 7) & 0x1;
-
-    hddLog(VOS_TRACE_LEVEL_INFO, "macHeader->frameCtrl.protVer    : %x "
-            "macHeader->frameCtrl.type       : %x "
-            "macHeader->frameCtrl.subType    : %x "
-            "macHeader->frameCtrl.toDS       : %x "
-            "macHeader->frameCtrl.fromDS     : %x "
-            "macHeader->frameCtrl.moreFrag   : %x "
-            "macHeader->frameCtrl.retry      : %x "
-            "macHeader->frameCtrl.powerMgmt  : %x "
-            "macHeader->frameCtrl.MoreData   : %x "
-            "macHeader->frameCtrl.wep        : %x "
-            "macHeader->frameCtrl.order      : %x "
-            , macHeader->frameCtrl.protVer
-            , macHeader->frameCtrl.type
-            , macHeader->frameCtrl.subType
-            , macHeader->frameCtrl.toDS
-            , macHeader->frameCtrl.fromDS
-            , macHeader->frameCtrl.moreFrag
-            , macHeader->frameCtrl.retry
-            , macHeader->frameCtrl.powerMgmt
-            , macHeader->frameCtrl.moreData
-            , macHeader->frameCtrl.wep
-            , macHeader->frameCtrl.order);
-
-
-    macHeader->usDurationId = getByte(&temp);
-    macHeader->usDurationId += getByte(&temp) << 8;
-
-    macHeader->vA1[0]       = getByte(&temp);
-    macHeader->vA1[1]       = getByte(&temp);
-    macHeader->vA1[2]       = getByte(&temp);
-    macHeader->vA1[3]       = getByte(&temp);
-    macHeader->vA1[4]       = getByte(&temp);
-    macHeader->vA1[5]       = getByte(&temp);
-
-    macHeader->vA2[0]       = getByte(&temp);
-    macHeader->vA2[1]       = getByte(&temp);
-    macHeader->vA2[2]       = getByte(&temp);
-    macHeader->vA2[3]       = getByte(&temp);
-    macHeader->vA2[4]       = getByte(&temp);
-    macHeader->vA2[5]       = getByte(&temp);
-
-    macHeader->vA3[0]       = getByte(&temp);
-    macHeader->vA3[1]       = getByte(&temp);
-    macHeader->vA3[2]       = getByte(&temp);
-    macHeader->vA3[3]       = getByte(&temp);
-    macHeader->vA3[4]       = getByte(&temp);
-    macHeader->vA3[5]       = getByte(&temp);
-
-    macHeader->sSeqCtrl = getByte(&temp);
-    fragNum = macHeader->sSeqCtrl & 0xF;
-    macHeader->sSeqCtrl >>= 4;
-
-    macHeader->sSeqCtrl += getByte(&temp) << 4;
-
-    macHeader->sSeqCtrl |= fragNum << 12;
-
-    if (length == 30 || length == 32) {
-        macHeader->optvA4[0]       = getByte(&temp);
-        macHeader->optvA4[1]       = getByte(&temp);
-        macHeader->optvA4[2]       = getByte(&temp);
-        macHeader->optvA4[3]       = getByte(&temp);
-        macHeader->optvA4[4]       = getByte(&temp);
-        macHeader->optvA4[5]       = getByte(&temp);
-    }
-
-    if (length == 26 || length == 32) {
-        macHeader->usQosCtrl = getByte(&temp);
-        macHeader->usQosCtrl += getByte(&temp) << 8;
-    }
-
-    //parse payload
-    length = getByte(&temp);
-    length += getByte(&temp) << 8;
-    hddLog(VOS_TRACE_LEVEL_INFO,"Payload length : %d", length);
-
-    pkt->data.length = length;
-
-    for (i = 0; i< length; i++) {
-        pkt->data.data[i] = getByte(&temp);
-    }
-
-    print_hex_dump(KERN_INFO, "Data : ", DUMP_PREFIX_NONE, 16, 1,
-            &pkt->data.data[0], pkt->data.length, 0);
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief hdd_encrypt_msg_cb() - Callback function for DISA
-  encrypt message request
-  This is an asynchronous callback function from SME when the encrypted data
-  is received
-
-  \pEncInfoRsp -> Encrypted data info
-
-  \return - 0 for success non-zero for failure
-  --------------------------------------------------------------------------*/
-static void
-hdd_encrypt_msg_cb(v_VOID_t *pUserData, v_VOID_t *pEncInfoRsp)
-{
-    tpSetEncryptedDataRspParams   pEncryptedDataRsp;
-
-    pEncryptedDataRsp = (tpSetEncryptedDataRspParams)pEncInfoRsp;
-
-    hddLog(VOS_TRACE_LEVEL_ERROR, "Encrypted Message");
-    hddLog(VOS_TRACE_LEVEL_ERROR, "Length : %d",
-            pEncryptedDataRsp->encryptedPayload.length);
-    hddLog(VOS_TRACE_LEVEL_ERROR, " Encrypted Data: ");
-    print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 1,
-            pEncryptedDataRsp->encryptedPayload.data,
-            pEncryptedDataRsp->encryptedPayload.length, 0);
-}
-
 VOS_STATUS  wlan_hdd_enter_bmps(hdd_adapter_t *pAdapter, int mode)
 {
    struct statsContext context;
    eHalStatus status;
    hdd_context_t *pHddCtx;
-   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
 
    if (NULL == pAdapter)
    {
@@ -4108,23 +3160,6 @@
    }
    else if (DRIVER_POWER_MODE_AUTO == mode)
    {
-       /* If this is called by hdd_suspend_wlan or hdd_resume_wlan, driver
-        * was already in BMPS state and thus either STA or P2P-CLI is in
-        * associated state and authenticated, so even if STA connState is
-        * not associated it can be assumed that P2P-CLI is associated and
-        * authenticated. Thus driver can enter BMPS. And even if we try to enter
-        * BMPS with no adaptor in associated state, pmcRequestBmps will check
-        * if all condition are satisfied for entering BMPS.
-        */
-       if ((eConnectionState_Associated  == pHddStaCtx->conn_info.connState) &&
-           (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated))
-       {
-           hddLog(LOGE,
-              FL("Station is associated but, still not Authenticated ignore "
-               "power save mode"));
-           return VOS_STATUS_E_AGAIN;
-       }
-
        if (pHddCtx->cfg_ini->fIsBmpsEnabled)
        {
            hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering Bmps ",
@@ -4261,30 +3296,16 @@
                        struct iw_request_info *info,
                        union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     char *cmd = NULL;
     int cmd_len = wrqu->data.length;
-    int rc = 0, ret = 0;
+    int ret = 0;
+    int rc = 0;
     VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
 
-    hdd_context_t *pHddCtx;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
     ENTER();
-
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "mem_alloc_copy_from_user_helper fail");
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    rc = wlan_hdd_validate_context(pHddCtx);
-    if (0 != rc)
-    {
-        return rc;
-    }
-
     cmd = mem_alloc_copy_from_user_helper(wrqu->data.pointer,
                                           wrqu->data.length);
     if (NULL == cmd)
@@ -4302,6 +3323,18 @@
     hddLog(VOS_TRACE_LEVEL_INFO_MED,
            "%s: ***Received %s cmd from Wi-Fi GUI***", __func__, cmd);
 
+    if (pHddCtx->isLogpInProgress) {
+        if (ioctl_debug)
+        {
+            pr_info("%s: RESTART in progress\n", __func__);
+        }
+
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                 "%s:LOGP in Progress. Ignore!!!",__func__);
+        kfree(cmd);
+        return -EBUSY;
+    }
+
     if (strncmp(cmd, "CSCAN", 5) == 0 )
     {
        if (eHAL_STATUS_SUCCESS != iw_set_cscan(dev, info, wrqu, cmd)) {
@@ -4352,15 +3385,15 @@
     }
     else if (strcasecmp(cmd, "scan-active") == 0)
     {
-        hddLog(LOG1,
-                FL("making default scan to active"));
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                   FL("making default scan to active"));
         pHddCtx->scan_info.scan_mode = eSIR_ACTIVE_SCAN;
         ret = snprintf(cmd, cmd_len, "OK");
     }
     else if (strcasecmp(cmd, "scan-passive") == 0)
     {
-        hddLog(LOG1,
-               FL("making default scan to passive"));
+        hddLog(VOS_TRACE_LEVEL_ERROR,
+                   FL("making default scan to passive"));
         pHddCtx->scan_info.scan_mode = eSIR_PASSIVE_SCAN;
         ret = snprintf(cmd, cmd_len, "OK");
     }
@@ -4603,7 +3636,6 @@
                __func__, cmd, wrqu->data.length, rc);
     }
     kfree(cmd);
-    EXIT();
     return rc;
 }
 
@@ -4619,72 +3651,11 @@
    return ret;
 }
 
-static int __iw_set_nick(struct net_device *dev,
-                       struct iw_request_info *info,
-                       union iwreq_data *wrqu, char *extra)
-{
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   int ret = 0;
-
-   ENTER();
-
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-   EXIT();
-   return 0;
-}
-
 static int iw_set_nick(struct net_device *dev,
                        struct iw_request_info *info,
                        union iwreq_data *wrqu, char *extra)
 {
-   int ret;
-
-   vos_ssr_protect(__func__);
-   ret = __iw_set_nick(dev, info, wrqu, extra);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
-static int __iw_get_nick(struct net_device *dev,
-                       struct iw_request_info *info,
-                       union iwreq_data *wrqu, char *extra)
-{
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   int ret = 0;
-
    ENTER();
-
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-   EXIT();
    return 0;
 }
 
@@ -4692,85 +3663,14 @@
                        struct iw_request_info *info,
                        union iwreq_data *wrqu, char *extra)
 {
-   int ret;
-
-   vos_ssr_protect(__func__);
-   ret = __iw_get_nick(dev, info, wrqu, extra);
-   vos_ssr_unprotect(__func__);
-
-   return ret;
-}
-
-/* cat /proc/net/wireless invokes this function to get wireless stats */
-static struct iw_statistics * __get_wireless_stats(struct net_device *dev)
-{
-    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t *pHddCtx;
-    hdd_station_ctx_t *pHddStaCtx;
-    v_S7_t snr = 0, rssi = 0;
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-
-    ENTER();
-
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-        return NULL;
-    }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    status = wlan_hdd_validate_context(pHddCtx);
-    if (0 != status)
-    {
-       return NULL;
-    }
-
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    if (NULL == pHddStaCtx)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: STA Context is NULL",__func__);
-        return NULL;
-    }
-
-    if (eConnectionState_Associated == pHddStaCtx->conn_info.connState)
-    {
-        wlan_hdd_get_station_stats(pAdapter);
-        wlan_hdd_get_snr(pAdapter, &snr);
-        wlan_hdd_get_rssi(pAdapter, &rssi);
-
-        vos_mem_zero(&pAdapter->iwStats, sizeof(pAdapter->iwStats));
-        pAdapter->iwStats.status = 0;
-        pAdapter->iwStats.qual.qual = snr;
-        pAdapter->iwStats.qual.level = rssi;
-        pAdapter->iwStats.qual.noise = rssi - snr;
-        pAdapter->iwStats.discard.code = 0;
-        pAdapter->iwStats.discard.retries= 0;
-        pAdapter->iwStats.miss.beacon = 0;
-        pAdapter->iwStats.qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
-    }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
-            FL("not in associated state: %d"), pHddStaCtx->conn_info.connState);
-        return NULL;
-    }
-
-    EXIT();
-    return &(pAdapter->iwStats);
+   ENTER();
+   return 0;
 }
 
 static struct iw_statistics *get_wireless_stats(struct net_device *dev)
 {
-
-       struct iw_statistics *stats;
-
-       vos_ssr_protect(__func__);
-       stats = __get_wireless_stats(dev);
-       vos_ssr_unprotect(__func__);
-
-       return stats;
+   ENTER();
+   return NULL;
 }
 
 static int __iw_set_encode(struct net_device *dev,
@@ -4778,10 +3678,9 @@
                          union iwreq_data *wrqu,char *extra)
 
 {
-   hdd_adapter_t *pAdapter;
-   hdd_station_ctx_t *pHddStaCtx;
-   hdd_wext_state_t  *pWextState;
-   hdd_context_t *pHddCtx;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+   hdd_wext_state_t  *pWextState =  WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
    struct iw_point *encoderq = &(wrqu->encoding);
    v_U32_t keyId;
    v_U8_t key_length;
@@ -4792,34 +3691,14 @@
 
 
    ENTER();
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
+
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+        return 0;
    }
 
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   status = wlan_hdd_validate_context(pHddCtx);
-   if (0 != status)
-   {
-       return status;
-   }
-   pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-   if (NULL == pWextState)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s:  pWextState is NULL ",__func__);
-       return -EINVAL;
-   }
-   pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   if (NULL == pHddStaCtx)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: STA Context is NULL",__func__);
-       return -EINVAL;
-   }
 
    keyId = encoderq->flags & IW_ENCODE_INDEX;
 
@@ -4948,7 +3827,7 @@
           return status;
        }
    }
-   EXIT();
+
    return 0;
 }
 
@@ -4970,38 +3849,22 @@
                struct iw_point *dwrq,
                char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_wext_state_t  *pWextState;
-    tCsrRoamProfile *pRoamProfile;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_wext_state_t  *pWextState =  WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile);
     int keyId;
     eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE;
     eCsrAuthType authType = eCSR_AUTH_TYPE_NONE;
-    int i, ret = 0;
-    hdd_context_t *pHddCtx;
+    int i;
 
     ENTER();
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+              "%s:LOGP in Progress. Ignore!!!", __func__);
+        return -EBUSY;
     }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-    if (NULL == pWextState)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pWextState is NULL",__func__);
-        return -EINVAL;
-    }
-    pRoamProfile = &(pWextState->roamProfile);
 
     keyId = pRoamProfile->Keys.defaultIndex;
 
@@ -5083,13 +3946,12 @@
                         struct iw_request_info *info,
                         union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_station_ctx_t *pHddStaCtx;
-    hdd_wext_state_t  *pWextState;
-    hdd_context_t *pHddCtx;
-    eHalStatus halStatus = eHAL_STATUS_SUCCESS;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+    hdd_wext_state_t  *pWextState =  WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    eHalStatus halStatus= eHAL_STATUS_SUCCESS;
 
-    tCsrRoamProfile *pRoamProfile;
+    tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile;
     v_U32_t status = 0;
 
     struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
@@ -5103,34 +3965,14 @@
     VOS_STATUS vos_status;
 
     ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+        return 0;
     }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    status = wlan_hdd_validate_context(pHddCtx);
-    if (0 != status)
-    {
-        return status;
-    }
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    if (NULL == pHddStaCtx)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: STA Context is NULL",__func__);
-        return -EINVAL;
-    }
-    pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-    if (NULL == pWextState)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pWextState is NULL",__func__);
-        return -EINVAL;
-    }
-    pRoamProfile = &pWextState->roamProfile;
+
     key_index = encoding->flags & IW_ENCODE_INDEX;
 
     if(key_index > 0) {
@@ -5297,8 +4139,8 @@
 
        pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
     }
-    EXIT();
-    return halStatus;
+
+   return halStatus;
 }
 
 static int iw_set_encodeext(struct net_device *dev,
@@ -5318,34 +4160,16 @@
                         struct iw_request_info *info,
                         union iwreq_data *wrqu, char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   tHalHandle hHal;
-   hdd_context_t *pHddCtx;
-   int ret = 0;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
 
    ENTER();
 
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-
-   hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-   if (NULL == hHal)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Hal Context is NULL",__func__);
-       return -EINVAL;
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                   "%s:LOGP in Progress. Ignore!!!", __func__);
+      return -EBUSY;
    }
 
    if(wrqu->retry.value < WNI_CFG_LONG_RETRY_LIMIT_STAMIN ||
@@ -5407,35 +4231,17 @@
                         struct iw_request_info *info,
                         union iwreq_data *wrqu, char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
-   tHalHandle hHal;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
    v_U32_t retry = 0;
-   int ret = 0;
 
    ENTER();
 
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-
-   hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-   if (NULL == hHal)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Hal Context is NULL",__func__);
-       return -EINVAL;
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+              "%s:LOGP in Progress. Ignore!!!", __func__);
+      return -EBUSY;
    }
 
    if((wrqu->retry.flags & IW_RETRY_LONG))
@@ -5493,33 +4299,18 @@
                        union iwreq_data *wrqu,
                        char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    hdd_station_ctx_t *pHddStaCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     struct iw_mlme *mlme = (struct iw_mlme *)extra;
     eHalStatus status = eHAL_STATUS_SUCCESS;
-    int ret = 0;
 
     ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                                  "%s:Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    if (NULL == pHddStaCtx)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                                  "%s:STA context is NULL",__func__);
-        return -EINVAL;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!",__func__);
+        return 0;
     }
 
     //reason_code is unused. By default it is set to eCSR_DISCONNECT_REASON_UNSPECIFIED
@@ -5554,7 +4345,6 @@
                 /* Resetting authKeyMgmt */
                 (WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->authKeyMgmt = 0;
 
-                hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
                 netif_tx_disable(dev);
                 netif_carrier_off(dev);
 
@@ -5589,84 +4379,15 @@
     return ret;
 }
 
-int wlan_hdd_set_proximity(int set_value)
-{
-    sHwCalValues hwCalValues;
-    uint16 hwCalTxPower;
-    uint8 txPwr = TX_PWR_DEF;
-
-    hddLog(LOG1, FL("WE_SET_PROXIMITY_ENABLE: %d"), set_value);
-
-    if (TRUE == set_value) {
-        if(vos_nv_read( VNV_HW_CAL_VALUES, &hwCalValues,
-                        NULL, sizeof(sHwCalValues) )
-                            != VOS_STATUS_SUCCESS) {
-            return -EINVAL;
-        }
-        hwCalTxPower = (uint16)(hwCalValues.calData.hwParam7 >> 16);
-
-        hddLog(LOG1, FL("hwCalTxPower:%x nv_data:%x"),
-                hwCalTxPower, hwCalValues.calData.hwParam7);
-
-        txPwr = (int8)(hwCalTxPower & 0x00FF);
-        txPwr = txPwr/10;
-        if (txPwr < TX_PWR_MIN)
-            txPwr = TX_PWR_MIN;
-        if (txPwr > TX_PWR_MAX)
-            txPwr = TX_PWR_MAX;
-
-        if (sme_SetMaxTxPowerPerBand(eCSR_BAND_24, txPwr) !=
-                                eHAL_STATUS_SUCCESS) {
-            hddLog(VOS_TRACE_LEVEL_ERROR,
-              FL("Setting tx power failed for 2.4GHz band %d"), txPwr);
-            return -EIO;
-        }
-
-        txPwr = (int8)((hwCalTxPower >> 8) & 0x00FF);
-        txPwr /= 10;
-        if (txPwr < TX_PWR_MIN)
-            txPwr = TX_PWR_MIN;
-        if (txPwr > TX_PWR_MAX)
-            txPwr = TX_PWR_MAX;
-
-        if (sme_SetMaxTxPowerPerBand(eCSR_BAND_5G, txPwr) !=
-                                eHAL_STATUS_SUCCESS) {
-            hddLog(VOS_TRACE_LEVEL_ERROR,
-              FL("setting tx power failed for 5GHz band %d"), txPwr);
-            return -EIO;
-        }
-    }
-    else if(FALSE == set_value) {
-        if (sme_SetMaxTxPowerPerBand(eCSR_BAND_24, txPwr) !=
-                                eHAL_STATUS_SUCCESS) {
-            hddLog(VOS_TRACE_LEVEL_ERROR,
-              FL("Setting tx power failed for 2.4GHz band %d"), txPwr);
-            return -EIO;
-        }
-
-        if (sme_SetMaxTxPowerPerBand(eCSR_BAND_5G, txPwr) !=
-                                eHAL_STATUS_SUCCESS) {
-            hddLog(VOS_TRACE_LEVEL_ERROR,
-              FL("setting tx power failed for 5GHz band %d"), txPwr);
-            return -EIO;
-        }
-    }
-    else {
-        return -EINVAL;
-    }
-
-    return eHAL_STATUS_SUCCESS;
-}
 /* set param sub-ioctls */
 static int __iw_setint_getnone(struct net_device *dev,
                                struct iw_request_info *info,
                                union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    tHalHandle hHal = NULL;
-    hdd_wext_state_t  *pWextState;
-    hdd_context_t *pHddCtx;
-    hdd_mon_ctx_t *pMonCtx = NULL;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    hdd_wext_state_t  *pWextState =  WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     int *value = (int *)extra;
     int sub_cmd = value[0];
     int set_value = value[1];
@@ -5676,41 +4397,14 @@
     v_U8_t nEnableSuspendOld;
 #endif
 
-    ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
+    if (0 != wlan_hdd_validate_context(pHddCtx))
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
+        hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid"));
+        return -EBUSY;
     }
 
-    if ( VOS_MONITOR_MODE != hdd_get_conparam())
-    {
-      /* In monitor mode hHal is NULL */
-      hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-      if (NULL == hHal)
-      {
-          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Hal Context is NULL",__func__);
-          return -EINVAL;
-      }
-      pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-      if (NULL == pWextState)
-      {
-          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    "%s: pWextState is NULL",__func__);
-          return -EINVAL;
-      }
+    INIT_COMPLETION(pWextState->completion_var);
 
-      INIT_COMPLETION(pWextState->completion_var);
-    }
     switch(sub_cmd)
     {
         case WE_SET_11D_STATE:
@@ -5718,8 +4412,8 @@
             tSmeConfigParams smeConfig;
             memset(&smeConfig, 0x00, sizeof(smeConfig));
 
-            if(((ENABLE_11D == set_value) || (DISABLE_11D == set_value)) &&
-              (hHal)) {
+            if((ENABLE_11D == set_value) || (DISABLE_11D == set_value)) {
+
                 sme_GetConfigParam(hHal,&smeConfig);
                 smeConfig.csrConfig.Is11dSupportEnabled = (v_BOOL_t)set_value;
 
@@ -5764,20 +4458,16 @@
               case  0: //Full Power
               {
                  struct statsContext context;
-                 eHalStatus status = eHAL_STATUS_FAILURE;
+                 eHalStatus status;
 
                  init_completion(&context.completion);
 
                  context.pAdapter = pAdapter;
                  context.magic = POWER_CONTEXT_MAGIC;
 
-                 if (NULL == hHal)
-                    return -EINVAL;
-
                  status = sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter),
                               iw_power_callback_fn, &context,
                               eSME_FULL_PWR_NEEDED_BY_HDD);
-
                  if (eHAL_STATUS_PMC_PENDING == status)
                  {
                     int lrc = wait_for_completion_interruptible_timeout(
@@ -5809,32 +4499,23 @@
                  break;
               }
               case  1: //Enable BMPS
-                 if (hHal)
-                     sme_EnablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE);
-                 else
-                     ret = -EINVAL;
+                 sme_EnablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE);
                  break;
               case  2: //Disable BMPS
-                 if (hHal)
-                     sme_DisablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE);
-                 else
-                     ret = -EINVAL;
+                 sme_DisablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE);
                  break;
               case  3: //Request Bmps
               {
                  struct statsContext context;
-                 eHalStatus status = eHAL_STATUS_FAILURE;
+                 eHalStatus status;
 
                  init_completion(&context.completion);
 
                  context.pAdapter = pAdapter;
                  context.magic = POWER_CONTEXT_MAGIC;
 
-                 if (NULL == hHal)
-                    return -EINVAL;
-
                  status = sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                              iw_power_callback_fn, &context);
+                           iw_power_callback_fn, &context);
                  if (eHAL_STATUS_PMC_PENDING == status)
                  {
                     int lrc = wait_for_completion_interruptible_timeout(
@@ -5866,44 +4547,26 @@
                  break;
               }
               case  4: //Enable IMPS
-                 if (hHal)
-                     sme_EnablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE);
-                 else
-                     ret = -EINVAL;
+                 sme_EnablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE);
                  break;
               case  5: //Disable IMPS
-                 if (hHal)
-                     sme_DisablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE);
-                 else
-                     ret = -EINVAL;
+                 sme_DisablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE);
                  break;
               case  6: //Enable Standby
-                 if (hHal)
-                     sme_EnablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE);
-                 else
-                     ret = -EINVAL;
+                 sme_EnablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE);
                  break;
               case  7: //Disable Standby
-                 if (hHal)
-                     sme_DisablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE);
-                 else
-                     ret = -EINVAL;
+                 sme_DisablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE);
                  break;
               case  8: //Request Standby
 #ifdef CONFIG_HAS_EARLYSUSPEND
 #endif
                  break;
               case  9: //Start Auto Bmps Timer
-                 if (hHal)
-                     sme_StartAutoBmpsTimer(hHal);
-                 else
-                     ret = -EINVAL;
+                 sme_StartAutoBmpsTimer(hHal);
                  break;
               case  10://Stop Auto BMPS Timer
-                 if (hHal)
-                     sme_StopAutoBmpsTimer(hHal);
-                 else
-                     ret = -EINVAL;
+                 sme_StopAutoBmpsTimer(hHal);
                  break;
 #ifdef CONFIG_HAS_EARLYSUSPEND
               case  11://suspend to standby
@@ -5936,8 +4599,7 @@
         case WE_SET_MAX_ASSOC:
         {
             if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) ||
-                (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value) ||
-                (NULL == hHal))
+                (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value))
             {
                 ret = -EINVAL;
             }
@@ -5972,9 +4634,6 @@
 
         case  WE_SET_DATA_INACTIVITY_TO:
         {
-           if (NULL == hHal)
-               return -EINVAL;
-
            if  ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) ||
                 (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) ||
                 (ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal,
@@ -5994,9 +4653,6 @@
            tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
            tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
 
-           if (NULL == hHal)
-               return -EINVAL;
-
            hddLog(VOS_TRACE_LEVEL_INFO, "%s: Setting maximum tx power %d dBm",
                   __func__, set_value);
            if( sme_SetMaxTxPower(hHal, bssid, selfMac, set_value) !=
@@ -6111,10 +4767,7 @@
         {
            hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
            pHddCtx->cfg_ini->gEnableDebugLog = set_value;
-           if (hHal)
-               sme_UpdateConnectDebug(pHddCtx->hHal, set_value);
-           else
-               ret = -1;
+           sme_UpdateConnectDebug(pHddCtx->hHal, set_value);
            break;
         }
 #ifdef FEATURE_WLAN_TDLS
@@ -6152,9 +4805,8 @@
             }
             hddLog(LOG1, "WE_SET_BAND_PREFERRENCE val %d ", set_value);
 
-            if ((eCSR_BAND_ALL == set_value ||
-                    eCSR_BAND_24 == set_value || eCSR_BAND_5G == set_value) &&
-                    (hHal)) {
+            if (eCSR_BAND_ALL == set_value ||
+                    eCSR_BAND_24 == set_value || eCSR_BAND_5G == set_value) {
                 sme_GetConfigParam(hHal, &smeConfig);
                 smeConfig.csrConfig.scanBandPreference = set_value;
 
@@ -6169,174 +4821,7 @@
             }
             break;
         }
-        /* The WE_SET_MIRACAST_VENDOR_CONFIG IOCTL should be set before the
-         * connection happens so that the params can take effect during
-         * association. Also this should not be used in STA+p2p concurrency
-         * as the param will also effect the STA mode.
-         */
-        case WE_SET_MIRACAST_VENDOR_CONFIG:
-        {
-            hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 
-            hddLog(LOG1, FL(
-             "Set Miracast vendor tuning %d"), set_value);
-
-           if (NULL == hHal)
-               return -EINVAL;
-
-            if (1 == set_value || 0 == set_value)
-            {
-                if (eHAL_STATUS_SUCCESS != sme_SetMiracastVendorConfig(pHddCtx->hHal,
-                                  pHddCtx->cfg_ini->numBuffAdvert, set_value))
-                {
-                    hddLog( LOGE, FL("set vendor miracast config failed"));
-                    ret = -EIO;
-                }
-            }
-            else
-            {
-                hddLog(LOGE,
-                 FL("Invalid value %d in WE_SET_MIRACAST_VENDOR_CONFIG IOCTL"), set_value);
-                ret = -EINVAL;
-            }
-            break;
-        }
-
-        case WE_GET_FRAME_LOG:
-        {
-            if (wlan_hdd_get_frame_logs(pAdapter, set_value)
-                         != VOS_STATUS_SUCCESS)
-            {
-                ret = -EINVAL;
-            }
-            break;
-        }
-
-        case WE_SET_TDLS_2040_BSS_COEXISTENCE:
-        {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                      "%s: TDLS_2040_BSS_COEXISTENCE %d", __func__, set_value);
-            if ((set_value == 0 || set_value == 1) && (hHal))
-            {
-                sme_SetTdls2040BSSCoexistence(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                              set_value);
-            }
-            else
-                ret = -EINVAL;
-
-            break;
-        }
-        /* Bit mask value to enable RTS/CTS for different modes
-         * for 2.4 GHz, HT20 - 0x0001, for 2.4 GHz, HT40 - 0x0002
-         * for 2.4 GHz, VHT20 - 0x0004, for 2.4 GHz, VHT40 - 0x0008
-         * for 5 GHz, HT20 - 0x0100, for 5 GHz, HT40 - 0x0200
-         * for 5 GHz, VHT20 - 0x0400, for 5 GHz, VHT40 - 0x0800
-         * for 5 GHz, VHT80 - 0x1000
-         */
-        case WE_SET_RTS_CTS_HTVHT:
-        {
-
-           hddLog( LOG1, FL("WE_SET_RTS_CTS_HTVHT set value %d"), set_value);
-
-           if (NULL == hHal)
-               return -EINVAL;
-
-           if (eHAL_STATUS_SUCCESS !=
-                        sme_SetRtsCtsHtVht( pHddCtx->hHal, set_value))
-           {
-                hddLog( LOGE, FL("set WE_SET_RTS_CTS_HTVHT failed"));
-                ret = -EINVAL;
-           }
-           break;
-        }
-        case WE_SET_MONITOR_STATE:
-        {
-           v_U32_t magic = 0;
-           struct completion cmpVar;
-           long waitRet = 0;
-           tVOS_CON_MODE mode = hdd_get_conparam();
-
-           if( VOS_MONITOR_MODE != mode)
-           {
-               hddLog(LOGE, "invalid mode %d", mode);
-               ret = -EIO;
-               break;
-           }
-
-           pMonCtx =  WLAN_HDD_GET_MONITOR_CTX_PTR(pAdapter);
-           if( pMonCtx == NULL )
-           {
-             hddLog(LOGE, "Monitor Context NULL");
-             ret = -EIO;
-             break;
-           }
-           if (pMonCtx->state == set_value)
-           {
-               VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                         FL("already in same mode curr_mode:%d req_mode: %d"),
-                             pMonCtx->state, set_value);
-               break;
-           }
-           pMonCtx->state = set_value;
-           magic = MON_MODE_MSG_MAGIC;
-           init_completion(&cmpVar);
-           if (VOS_STATUS_SUCCESS !=
-                         wlan_hdd_mon_postMsg(&magic, &cmpVar,
-                                               pMonCtx, hdd_monPostMsgCb)) {
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                          FL("failed to post MON MODE REQ"));
-                pMonCtx->state = (pMonCtx->state==MON_MODE_START)?
-                                   MON_MODE_STOP : MON_MODE_START;
-                magic = 0;
-                ret = -EIO;
-                break;
-           }
-           waitRet = wait_for_completion_timeout(&cmpVar, MON_MODE_MSG_TIMEOUT);
-           magic = 0;
-           if (waitRet <= 0 ){
-               VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    FL("failed to wait on monitor mode completion %ld"),
-                        waitRet);
-           }
-           break;
-        }
-        case WE_SET_PKT_STATS_ENABLE_DISABLE:
-        {
-            hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-            tAniWifiStartLog start_log;
-            if (!pHddCtx->cfg_ini->wlanPerPktStatsLogEnable ||
-                 !vos_isPktStatsEnabled())
-            {
-                hddLog(LOGE, FL("per pkt stats not enabled"));
-                return -EINVAL;
-            }
-            hddLog(LOG1, FL("Set Pkt Stats %d"), set_value);
-
-            if (1 == set_value || 0 == set_value)
-            {
-                start_log.ringId = RING_ID_PER_PACKET_STATS;
-                start_log.flag = 0;
-                if (set_value)
-                   start_log.verboseLevel = WLAN_LOG_LEVEL_ACTIVE;
-                else
-                   start_log.verboseLevel = WLAN_LOG_LEVEL_OFF;
-
-                vos_set_ring_log_level(start_log.ringId, start_log.verboseLevel);
-            }
-            else
-            {
-                hddLog(LOGE,
-                FL("Invalid value %d in WE_SET_PKT_STATS_ENABLE_DISABLE IOCTL"),
-                    set_value);
-                ret = -EINVAL;
-            }
-            break;
-        }
-        case WE_SET_PROXIMITY_ENABLE:
-        {
-            ret = wlan_hdd_set_proximity(set_value);
-            break;
-        }
         default:
         {
             hddLog(LOGE, "Invalid IOCTL setvalue command %d value %d",
@@ -6344,7 +4829,7 @@
             break;
         }
     }
-    EXIT();
+
     return ret;
 }
 
@@ -6369,40 +4854,20 @@
     int sub_cmd;
     int ret = 0; /* success */
     char *pBuffer = NULL;
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 #ifdef WLAN_FEATURE_VOWIFI
-    hdd_config_t  *pConfig;
+    hdd_config_t  *pConfig = pHddCtx->cfg_ini;
 #endif /* WLAN_FEATURE_VOWIFI */
     struct iw_point s_priv_data;
-    tSirpkt80211 *pkt;
 
-    ENTER();
-
-    if (!capable(CAP_NET_ADMIN))
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("permission check failed"));
-        return -EPERM;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+        return -EBUSY;
     }
 
-    pAdapter = (netdev_priv(dev));
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-#ifdef WLAN_FEATURE_VOWIFI
-    pConfig = pHddCtx->cfg_ini;
-#endif
     /* helper function to get iwreq_data with compat handling. */
     if (hdd_priv_get_data(&s_priv_data, wrqu))
     {
@@ -6482,39 +4947,6 @@
              ret = -EINVAL;
           }
           break;
-       case WE_SET_ENCRYPT_MSG:
-          pkt = vos_mem_malloc(sizeof(tSirpkt80211));
-          if (NULL == pkt)
-          {
-              hddLog(VOS_TRACE_LEVEL_ERROR,
-                      "%s: vos_mem_alloc failed", __func__);
-              ret = -ENOMEM;
-              break;
-          }
-
-          memset(pkt, 0, sizeof(tSirpkt80211));
-
-          if (FALSE == sme_IsFeatureSupportedByFW(DISA)) {
-              hddLog(VOS_TRACE_LEVEL_ERROR,
-                      FL("Firmware is not DISA capable"));
-              ret = -EINVAL;
-              vos_mem_free(pkt);
-              break;
-          }
-
-          parse_Bufferforpkt(pkt, pBuffer, wrqu->data.length);
-
-          ret = sme_Encryptmsgsend(pHddCtx->hHal, (u8 *)pkt,
-                  sizeof(tSirpkt80211), hdd_encrypt_msg_cb);
-          if (eHAL_STATUS_SUCCESS != ret) {
-              hddLog(VOS_TRACE_LEVEL_ERROR,
-                      FL("SENDEncryptMSG: fail to post WDA cmd"));
-              ret = -EINVAL;
-          }
-          vos_mem_free(pkt);
-
-          break;
-
        default:
        {
            hddLog(LOGE, "%s: Invalid sub command %d",__func__, sub_cmd);
@@ -6523,8 +4955,6 @@
        }
     }
     kfree(pBuffer);
-
-    EXIT();
     return ret;
 }
 
@@ -6541,145 +4971,25 @@
     return ret;
 }
 
-static void hdd_GetCurrentAntennaIndex(int antennaId, void *pContext)
-{
-   struct statsContext *context;
-   hdd_adapter_t *pAdapter;
-
-   if (NULL == pContext)
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,
-             "%s: Bad param, pContext [%p]",
-             __func__, pContext);
-      return;
-   }
-
-   context = pContext;
-   pAdapter      = context->pAdapter;
-
-   spin_lock(&hdd_context_lock);
-
-   if ((NULL == pAdapter) || (ANTENNA_CONTEXT_MAGIC != context->magic))
-   {
-      /* the caller presumably timed out so there is nothing we can do */
-      spin_unlock(&hdd_context_lock);
-      hddLog(VOS_TRACE_LEVEL_WARN,
-             "%s: Invalid context, pAdapter [%p] magic [%08x]",
-              __func__, pAdapter, context->magic);
-      return;
-   }
-
-   context->magic = 0;
-   pAdapter->antennaIndex = antennaId;
-
-   complete(&context->completion);
-   spin_unlock(&hdd_context_lock);
-}
-
-static VOS_STATUS wlan_hdd_get_current_antenna_index(hdd_adapter_t *pAdapter,
-                                                     int *antennaIndex)
-{
-   hdd_context_t *pHddCtx;
-   eHalStatus halStatus;
-   struct statsContext context;
-   long lrc;
-
-   ENTER();
-   if (NULL == pAdapter)
-   {
-       hddLog(VOS_TRACE_LEVEL_WARN,
-              "%s: Invalid context, pAdapter", __func__);
-       return VOS_STATUS_E_FAULT;
-   }
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   if (0 != (wlan_hdd_validate_context(pHddCtx)))
-   {
-       return VOS_STATUS_E_FAULT;
-   }
-   if (TRUE != sme_IsFeatureSupportedByFW(ANTENNA_DIVERSITY_SELECTION))
-   {
-       hddLog(VOS_TRACE_LEVEL_ERROR,
-              "%s: ANTENNA_DIVERSITY_SELECTION is not supported by Firwmare",
-               __func__);
-       return VOS_STATUS_E_NOSUPPORT;
-   }
-   init_completion(&context.completion);
-   context.pAdapter = pAdapter;
-   context.magic = ANTENNA_CONTEXT_MAGIC;
-
-   halStatus = sme_GetCurrentAntennaIndex(pHddCtx->hHal,
-                                         hdd_GetCurrentAntennaIndex,
-                                         &context, pAdapter->sessionId);
-   if (eHAL_STATUS_SUCCESS != halStatus)
-   {
-       spin_lock(&hdd_context_lock);
-       context.magic = 0;
-       spin_unlock(&hdd_context_lock);
-       hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve Antenna Index",
-              __func__);
-       /* we'll returned a cached value below */
-       *antennaIndex = -1;
-       return VOS_STATUS_E_FAILURE;
-   }
-   else
-   {
-       /* request was sent -- wait for the response */
-       lrc = wait_for_completion_interruptible_timeout(&context.completion,
-                                    msecs_to_jiffies(WLAN_WAIT_TIME_STATS));
-       if (lrc <= 0)
-       {
-           spin_lock(&hdd_context_lock);
-           context.magic = 0;
-           spin_unlock(&hdd_context_lock);
-           hddLog(VOS_TRACE_LEVEL_ERROR, "%s:SME %s while retrieving Antenna"
-                                         " Index",
-                  __func__, (0 == lrc) ? "timeout" : "interrupt");
-           *antennaIndex = -1;
-           return VOS_STATUS_E_FAILURE;
-       }
-   }
-   spin_lock(&hdd_context_lock);
-   context.magic = 0;
-   spin_unlock(&hdd_context_lock);
-
-   *antennaIndex = pAdapter->antennaIndex;
-
-   EXIT();
-   return VOS_STATUS_SUCCESS;
-}
-
 /* get param sub-ioctls */
 static int __iw_setnone_getint(struct net_device *dev,
                                struct iw_request_info *info,
                                union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    tHalHandle hHal;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     int *value = (int *)extra;
     int ret = 0; /* success */
+    tSmeConfigParams smeConfig;
 
-    ENTER();
-
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
+        if (__ratelimit(&hdd_ioctl_timeout_rs)) {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+        }
+        return -EBUSY;
     }
 
     switch (value[0])
@@ -6775,7 +5085,6 @@
 
         case WE_GET_SCAN_BAND_PREFERENCE:
         {
-            tSmeConfigParams smeConfig;
             sme_GetConfigParam(hHal, &smeConfig);
             *value = smeConfig.csrConfig.scanBandPreference;
 
@@ -6783,18 +5092,14 @@
                       "scanBandPreference = %d\n", *value);
             break;
         }
-        case WE_GET_ANTENA_DIVERSITY_SELECTION:
-        {
-             wlan_hdd_get_current_antenna_index(pAdapter, value);
-             break;
-        }
+
         default:
         {
             hddLog(LOGE, "Invalid IOCTL get_value command %d ",value[0]);
             break;
         }
     }
-    EXIT();
+
     return ret;
 }
 
@@ -6816,34 +5121,18 @@
                                 struct iw_request_info *info,
                                 union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     int *value = (int *)extra;
     int sub_cmd = value[0];
     int ret = 0;
 
-    ENTER();
-
-    if (!capable(CAP_NET_ADMIN))
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("permission check failed"));
-        return -EPERM;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+        return -EBUSY;
     }
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
     switch(sub_cmd)
     {
         case WE_SET_WLAN_DBG:
@@ -6868,7 +5157,6 @@
             break;
         }
     }
-    EXIT();
     return ret;
 }
 
@@ -6889,37 +5177,36 @@
                                  struct iw_request_info *info,
                                  union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     int sub_cmd = wrqu->data.flags;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
 #ifdef WLAN_FEATURE_11W
     hdd_wext_state_t *pWextState;
 #endif
 
-    ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     if (pAdapter == NULL)
     {
          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                    "%s: pAdapter is NULL!", __func__);
          return -EINVAL;
     }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
 #ifdef WLAN_FEATURE_11W
     pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-    if (NULL == pWextState)
+#endif
+
+    if (NULL == WLAN_HDD_GET_CTX(pAdapter))
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pWextState is NULL",__func__);
+                                        "%s: HDD Context is NULL!", __func__);
+
         return -EINVAL;
     }
-#endif
+
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+        return -EBUSY;
+    }
 
     switch(sub_cmd)
     {
@@ -7179,7 +5466,7 @@
                 len += buf;
 
                 /*printing the PE Sme and Mlm states for valid lim sessions*/
-                while ( check < 3 && count < pMac->lim.maxBssId)
+                while ( check < 3 && count < 255)
                 {
                     if ( pMac->lim.gpSession[count].valid )
                     {
@@ -7214,7 +5501,6 @@
         case WE_GET_RSSI:
         {
             v_S7_t s7Rssi = 0;
-            wlan_hdd_get_station_stats(pAdapter);
             wlan_hdd_get_rssi(pAdapter, &s7Rssi);
             snprintf(extra, WE_MAX_STR_LEN, "rssi=%d",s7Rssi);
             wrqu->data.length = strlen(extra)+1;
@@ -7338,37 +5624,6 @@
            break;
        }
 #endif
-#ifdef WLAN_FEATURE_RMC
-        case WE_GET_IBSS_STA_INFO:
-        {
-            hdd_station_ctx_t *pHddStaCtx =
-                WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-            int idx = 0;
-            int length = 0, buf = 0;
-
-            for (idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++)
-            {
-               if (0 != pHddStaCtx->conn_info.staId[ idx ])
-               {
-                   buf = snprintf
-                             (
-                             (extra + length), WE_MAX_STR_LEN - length,
-                             "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n",
-                             pHddStaCtx->conn_info.staId[ idx ],
-                             pHddStaCtx->conn_info.peerMacAddress[idx].bytes[0],
-                             pHddStaCtx->conn_info.peerMacAddress[idx].bytes[1],
-                             pHddStaCtx->conn_info.peerMacAddress[idx].bytes[2],
-                             pHddStaCtx->conn_info.peerMacAddress[idx].bytes[3],
-                             pHddStaCtx->conn_info.peerMacAddress[idx].bytes[4],
-                             pHddStaCtx->conn_info.peerMacAddress[idx].bytes[5]
-                             );
-                   length += buf;
-               }
-            }
-            wrqu->data.length = strlen(extra)+1;
-            break;
-        }
-#endif
         case WE_GET_SNR:
         {
             v_S7_t s7snr = 0;
@@ -7380,6 +5635,7 @@
             status = wlan_hdd_validate_context(pHddCtx);
             if (0 != status)
             {
+                hddLog(LOGE, "%s: getSNR: HDD context is not valid", __func__);
                 return status;
             }
 
@@ -7403,20 +5659,13 @@
             break;
         }
 
-#ifdef FEATURE_OEM_DATA_SUPPORT
-        case WE_GET_OEM_DATA_CAP:
-        {
-            return iw_get_oem_data_cap(dev, info, wrqu, extra);
-        }
-#endif /* FEATURE_OEM_DATA_SUPPORT */
-
         default:
         {
             hddLog(LOGE, "%s: Invalid IOCTL command %d", __func__, sub_cmd );
             break;
         }
     }
-    EXIT();
+
     return 0;
 }
 
@@ -7438,27 +5687,18 @@
                                 struct iw_request_info *info,
                                 union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     int sub_cmd;
     int ret = 0; /* success */
     struct iw_point s_priv_data;
 
-    ENTER();
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+        return -EBUSY;
+    }
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
     /* helper function to get iwreq_data with compat handling. */
     if (hdd_priv_get_data(&s_priv_data, wrqu))
     {
@@ -7498,13 +5738,6 @@
                  wlan_hdd_get_intf_addr( WLAN_HDD_GET_CTX(pAdapter) ),TRUE);
           break;
         }
-#ifdef WLAN_FEATURE_RMC
-        case WE_IBSS_GET_PEER_INFO_ALL:
-        {
-            hdd_wlan_get_ibss_peer_info_all(pAdapter);
-            break;
-        }
-#endif
         case WE_STOP_AP:
         {
            /*FIX ME: Need to be revisited if multiple SAPs to be supported */
@@ -7526,7 +5759,7 @@
 
                /*Make sure that pAdapter cleaned properly*/
                hdd_stop_adapter( pHddCtx, pAdapter_to_stop, VOS_TRUE );
-               hdd_deinit_adapter( pHddCtx, pAdapter_to_stop, TRUE);
+               hdd_deinit_adapter( pHddCtx, pAdapter_to_stop );
                memset(&pAdapter_to_stop->sessionCtx, 0, sizeof(pAdapter_to_stop->sessionCtx));
 
                wlan_hdd_release_intf_addr(WLAN_HDD_GET_CTX(pAdapter),
@@ -7635,6 +5868,7 @@
             sme_HT40StopOBSSScan(pMac, pAdapter->sessionId);
         }
         break;
+#ifdef DEBUG_ROAM_DELAY
         case WE_DUMP_ROAM_TIMER_LOG:
         {
             vos_dump_roam_time_log_service();
@@ -7646,28 +5880,14 @@
             vos_reset_roam_timer_log();
             break;
         }
-        case WE_GET_FW_LOGS:
-        {
-            vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL,
-                     WLAN_LOG_INDICATOR_IOCTL,
-                     WLAN_LOG_REASON_IOCTL,
-                     TRUE, TRUE);
-            break;
-        }
-        case WE_GET_FW_MEMDUMP:
-        {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                     "FW_MEM_DUMP requested ");
-            get_fwr_memdump(dev,info,wrqu,extra);
-            break;
-        }
+#endif
         default:
         {
             hddLog(LOGE, "%s: unknown ioctl %d", __func__, sub_cmd);
             break;
         }
     }
-    EXIT();
+
     return ret;
 }
 
@@ -7693,138 +5913,67 @@
      * whether the clients are registered or not.
      */
     int i = 0, j = 0;
-    v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-    ptSapContext pSapCtx = VOS_GET_SAP_CB(pVosContext);
-    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    hdd_ibss_peer_info_t *pPeerInfo;
-    v_SIZE_t tx_queue_count[NUM_TX_QUEUES];
-
     for ( i=0; i< NUM_TX_QUEUES; i++)
     {
         spin_lock_bh(&pAdapter->wmm_tx_queue[i].lock);
-        tx_queue_count[i] = pAdapter->wmm_tx_queue[i].count;
+        hddLog(LOGE, "HDD WMM TxQueue Info For AC: %d Count: %d PrevAdress:%p, NextAddress:%p",
+               i, pAdapter->wmm_tx_queue[i].count,
+               pAdapter->wmm_tx_queue[i].anchor.prev, pAdapter->wmm_tx_queue[i].anchor.next);
         spin_unlock_bh(&pAdapter->wmm_tx_queue[i].lock);
     }
 
-    for ( i=0; i< NUM_TX_QUEUES; i++) {
-        if (tx_queue_count[i]) {
-            hddLog(LOGE, "HDD WMM TxQueue Info For AC: %d Count: %d",
-               i, tx_queue_count[i]);
-        }
-    }
-
-    if(pSapCtx == NULL){
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("psapCtx is NULL"));
-        return;
-    }
-
-    spin_lock_bh(&pSapCtx->staInfo_lock);
     for(i =0; i<WLAN_MAX_STA_COUNT; i++)
     {
-        if(pSapCtx->aStaInfo[i].isUsed)
+        if(pAdapter->aStaInfo[i].isUsed)
         {
              hddLog(LOGE, "******STAIndex: %d*********", i);
              for ( j=0; j< NUM_TX_QUEUES; j++)
              {
-                if( pSapCtx->aStaInfo[i].wmm_tx_queue[j].count )
-                {
-                   spin_lock_bh(&pSapCtx->aStaInfo[i].wmm_tx_queue[j].lock);
-                   hddLog(LOGE, "HDD TxQueue Info For AC: %d Count: %d",
-                         j, pSapCtx->aStaInfo[i].wmm_tx_queue[j].count);
-                  spin_unlock_bh(&pSapCtx->aStaInfo[i].wmm_tx_queue[j].lock);
-                }
+                spin_lock_bh(&pAdapter->aStaInfo[i].wmm_tx_queue[j].lock);
+                hddLog(LOGE, "HDD TxQueue Info For AC: %d Count: %d PrevAdress:%p, NextAddress:%p",
+                       j, pAdapter->aStaInfo[i].wmm_tx_queue[j].count,
+                       pAdapter->aStaInfo[i].wmm_tx_queue[j].anchor.prev,
+                       pAdapter->aStaInfo[i].wmm_tx_queue[j].anchor.next);
+                spin_unlock_bh(&pAdapter->aStaInfo[i].wmm_tx_queue[j].lock);
              }
         }
     }
-    spin_unlock_bh(&pSapCtx->staInfo_lock);
-
-    if(pHddStaCtx == NULL){
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("pHddStaCtx is NULL"));
-        return;
-    }
-
-    pPeerInfo = &pHddStaCtx->ibss_peer_info;
-    if(pPeerInfo == NULL){
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("ppeerinfo is NULL"));
-        return;
-    }
-
-    for (i = 0; i < HDD_MAX_NUM_IBSS_STA; i++) {
-        if (pPeerInfo->ibssStaInfo[i].isUsed) {
-            hddLog(LOGE, "******IBSS STAIndex: %d*********", i);
-            for (j = 0; j < NUM_TX_QUEUES; j++) {
-                if (pPeerInfo->ibssStaInfo[i].wmm_tx_queue[j].count) {
-                    spin_lock_bh(
-                        &pPeerInfo->ibssStaInfo[i].wmm_tx_queue[j].lock);
-                    hddLog(LOGE,
-                        "HDD TxQueue Info For AC: %d Count: %d PrevAdress:%p, NextAddress:%p",
-                        j, pPeerInfo->ibssStaInfo[i].wmm_tx_queue[j].count,
-                        pPeerInfo->ibssStaInfo[i].wmm_tx_queue[j].anchor.prev,
-                        pPeerInfo->ibssStaInfo[i].wmm_tx_queue[j].anchor.next);
-                    spin_unlock_bh(
-                        &pPeerInfo->ibssStaInfo[i].wmm_tx_queue[j].lock);
-                }
-            }
-        }
-    }
 
 }
-
 static int __iw_set_var_ints_getnone(struct net_device *dev,
                                      struct iw_request_info *info,
                                      union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    tHalHandle hHal = NULL;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
     int sub_cmd;
     int *apps_args = (int *) extra;
     hdd_station_ctx_t *pStaCtx = NULL ;
-    hdd_mon_ctx_t *pMonCtx = NULL;
     hdd_context_t *pHddCtx = NULL;
     hdd_ap_ctx_t  *pAPCtx = NULL;
-    v_CONTEXT_t pVosContext;
     int cmd = 0;
     int staId = 0;
     int ret = 0;
 
-    ENTER();
     if (extra == NULL)
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "%s: NULL extra buffer pointer", __func__);
         return -EINVAL;
     }
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    if( VOS_MONITOR_MODE != hdd_get_conparam())
-    {
-      hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-      if (NULL == hHal)
-      {
-          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Hal Context is NULL",__func__);
-          return -EINVAL;
-      }
-    }
+
     sub_cmd = wrqu->data.flags;
 
     hddLog(LOG1, "%s: Received length %d", __func__, wrqu->data.length);
 
+    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+    ret = wlan_hdd_validate_context(pHddCtx);
+    if (0 != ret)
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "%s: HDD context is Null", __func__);
+        return ret;
+    }
 
     if(( sub_cmd == WE_MCC_CONFIG_CREDENTIAL ) ||
         (sub_cmd == WE_MCC_CONFIG_PARAMS ))
@@ -7852,41 +6001,20 @@
     {
         case WE_LOG_DUMP_CMD:
             {
-               if(apps_args[0] == 26) {
-                if (!pHddCtx->cfg_ini->crash_inject_enabled) {
-                 hddLog(LOGE, "Crash Inject ini disabled, Ignore Crash Inject");
-                    return 0;
-                }
-             }
                 hddLog(LOG1, "%s: LOG_DUMP %d arg1 %d arg2 %d arg3 %d arg4 %d",
                         __func__, apps_args[0], apps_args[1], apps_args[2],
                         apps_args[3], apps_args[4]);
-                if (hHal)
-                  logPrintf(hHal, apps_args[0], apps_args[1], apps_args[2],
-                          apps_args[3], apps_args[4]);
+
+                logPrintf(hHal, apps_args[0], apps_args[1], apps_args[2],
+                        apps_args[3], apps_args[4]);
 
             }
             break;
-#ifdef WLAN_FEATURE_RMC
-        case WE_IBSS_GET_PEER_INFO:
-             {
-                pr_info ( "Station ID = %d\n",apps_args[0]);
-                hdd_wlan_get_ibss_peer_info(pAdapter, apps_args[0]);
-             }
-              break;
-#endif
 
         case WE_P2P_NOA_CMD:
             {
                 p2p_app_setP2pPs_t p2pNoA;
 
-                if (pAdapter->device_mode != WLAN_HDD_P2P_GO) {
-                    hddLog(LOGE,
-                        FL("Setting NoA is not allowed in Device mode:%d"),
-                        pAdapter->device_mode);
-                    return -EINVAL;
-                }
-
                 p2pNoA.opp_ps = apps_args[0];
                 p2pNoA.ctWindow = apps_args[1];
                 p2pNoA.duration = apps_args[2];
@@ -7919,9 +6047,8 @@
                        "bitmask_of_module %d ",
                         __func__, apps_args[0], apps_args[1], apps_args[2],
                         apps_args[3]);
-                if (hHal)
-                  vosTraceDumpAll((void*)hHal , apps_args[0], apps_args[1],
-                                  apps_args[2], apps_args[3]);
+                vosTraceDumpAll((void*)hHal , apps_args[0], apps_args[1],
+                                apps_args[2], apps_args[3]);
 
             }
             break;
@@ -7932,9 +6059,7 @@
                            // in the Riva dump command
                 if((apps_args[0] >= 40 ) && (apps_args[0] <= 160 ))
                 {
-                    if (hHal)
-                      logPrintf(hHal, cmd, staId, apps_args[0], apps_args[1],
-                                apps_args[2]);
+                    logPrintf(hHal, cmd, staId, apps_args[0], apps_args[1], apps_args[2]);
                 }
                 else
                 {
@@ -7972,122 +6097,6 @@
             }
         break;
 #endif
-        case WE_CONFIGURE_MONITOR_MODE:
-           {
-               v_U32_t magic = 0;
-               struct completion cmpVar;
-               long waitRet = 0;
-               tVOS_CON_MODE mode = hdd_get_conparam();
-
-               if (VOS_MONITOR_MODE != mode) {
-                  hddLog(LOGE, FL("invalid mode %d"), mode);
-                  return -EIO;
-               }
-
-               pMonCtx =  WLAN_HDD_GET_MONITOR_CTX_PTR(pAdapter);
-               if( pMonCtx == NULL )
-               {
-                 hddLog(LOGE, "Monitor Context NULL");
-                 return -EIO;
-               }
-               hddLog(LOG1, "%s: Monitor MOde Configuration: ChNo=%d ChBW=%d CRCCheck=%d type=%d ConversionBit=%d",
-                        __func__, apps_args[0], apps_args[1], apps_args[2],
-                        apps_args[3], apps_args[4]);
-               /* Input Validation part of FW */
-               pMonCtx->ChannelNo = apps_args[0];
-               pMonCtx->ChannelBW = apps_args[1];
-               pMonCtx->crcCheckEnabled = apps_args[2];
-               wlan_hdd_mon_set_typesubtype( pMonCtx,apps_args[3]);
-               pMonCtx->is80211to803ConReq = apps_args[4];
-               WLANTL_SetIsConversionReq(pVosContext,apps_args[4]);
-               if( pMonCtx->is80211to803ConReq )
-                    pAdapter->dev->type = ARPHRD_ETHER;
-               else
-                    pAdapter->dev->type = ARPHRD_IEEE80211_RADIOTAP;
-               if( (apps_args[3]!= 100 && apps_args[3]!= 0) && apps_args[4] )
-               {
-                  hddLog(LOGE, "%s: Filtering data packets as management and control"
-                         " cannot be converted to 802.3 ",__func__);
-                  pMonCtx->typeSubtypeBitmap = 0xFFFF00000000;
-               }
-               if (MON_MODE_START == pMonCtx->state) {
-                    magic = MON_MODE_MSG_MAGIC;
-                    init_completion(&cmpVar);
-                    if (VOS_STATUS_SUCCESS !=
-                            wlan_hdd_mon_postMsg(&magic, &cmpVar,
-                                                  pMonCtx, hdd_monPostMsgCb)) {
-                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                                    FL("failed to post MON MODE REQ"));
-                        magic = 0;
-                        return -EIO;
-                    }
-                    waitRet = wait_for_completion_timeout(&cmpVar,
-                                                       MON_MODE_MSG_TIMEOUT);
-                    magic = 0;
-                    if (waitRet <= 0 ) {
-                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                            FL("failed to wait on monitor mode completion %ld"),
-                                waitRet);
-                    }
-               }
-           }
-         break;
-
-        case WE_SET_MONITOR_MODE_FILTER:
-           {
-               v_U32_t magic = 0;
-               struct completion cmpVar;
-               long waitRet = 0;
-               tVOS_CON_MODE mode = hdd_get_conparam();
-
-               if (VOS_MONITOR_MODE != mode) {
-                  hddLog(LOGE, FL("invalid mode %d"), mode);
-                  return -EIO;
-               }
-
-               pMonCtx =  WLAN_HDD_GET_MONITOR_CTX_PTR(pAdapter);
-               if( pMonCtx == NULL )
-               {
-                  hddLog(LOGE, "Monitor Context NULL");
-                  return -EIO;
-               }
-               /* Input Validation Part of FW */
-               pMonCtx->numOfMacFilters=1;
-               pMonCtx->mmFilters[0].macAddr.bytes[0]=apps_args[0];
-               pMonCtx->mmFilters[0].macAddr.bytes[1]=apps_args[1];
-               pMonCtx->mmFilters[0].macAddr.bytes[2]=apps_args[2];
-               pMonCtx->mmFilters[0].macAddr.bytes[3]=apps_args[3];
-               pMonCtx->mmFilters[0].macAddr.bytes[4]=apps_args[4];
-               pMonCtx->mmFilters[0].macAddr.bytes[5]=apps_args[5];
-               pMonCtx->mmFilters[0].isA1filter = apps_args[6];
-               pMonCtx->mmFilters[0].isA2filter = apps_args[7];
-               pMonCtx->mmFilters[0].isA3filter = apps_args[8];
-               hddLog(LOG1, "%s: Monitor Filter: %pM A1=%d A2=%d A3=%d ",
-                        __func__, pMonCtx->mmFilters[0].macAddr.bytes,
-                       apps_args[6], apps_args[7], apps_args[8]);
-               if (MON_MODE_START == pMonCtx->state) {
-                    magic = MON_MODE_MSG_MAGIC;
-                    init_completion(&cmpVar);
-                    if (VOS_STATUS_SUCCESS !=
-                            wlan_hdd_mon_postMsg(&magic, &cmpVar,
-                                                  pMonCtx, hdd_monPostMsgCb)) {
-                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                                    FL("failed to post MON MODE REQ"));
-                        magic = 0;
-                        return -EIO;
-                    }
-                    waitRet = wait_for_completion_timeout(&cmpVar,
-                                                       MON_MODE_MSG_TIMEOUT);
-                    magic = 0;
-                    if (waitRet <= 0 ) {
-                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                            FL("failed to wait on monitor mode completion %ld"),
-                                waitRet);
-                    }
-               }
-           }
-         break;
-
         default:
             {
                 hddLog(LOGE, "%s: Invalid IOCTL command %d",
@@ -8095,7 +6104,7 @@
             }
             break;
     }
-    EXIT();
+
     return 0;
 }
 
@@ -8108,13 +6117,6 @@
     int apps_args[MAX_VAR_ARGS] = {0};
     int num_args;
 
-    if (!capable(CAP_NET_ADMIN))
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("permission check failed"));
-        return -EPERM;
-    }
-
     /* helper function to get iwreq_data with compat handling. */
     if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
     {
@@ -8166,37 +6168,14 @@
                           struct iw_request_info *info,
                           union iwreq_data *wrqu, char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_station_ctx_t *pHddStaCtx;
-   hdd_context_t *pHddCtx;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
    hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra;
    int params[HDD_WLAN_WMM_PARAM_COUNT];
    sme_QosWmmTspecInfo tSpec;
    v_U32_t handle;
    struct iw_point s_priv_data;
-   int ret = 0;
 
-   ENTER();
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
-   pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   if (NULL == pHddStaCtx)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: STA Context is NULL",__func__);
-       return -EINVAL;
-   }
    // make sure the application is sufficiently priviledged
    // note that the kernel will do this for "set" ioctls, but since
    // this ioctl wants to return status to user space it must be
@@ -8205,6 +6184,14 @@
    {
       return -EPERM;
    }
+
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+      return -EBUSY;
+   }
+
    // we must be associated in order to add a tspec
    if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
    {
@@ -8338,8 +6325,6 @@
    }
 
    *pStatus = hdd_wmm_addts(pAdapter, handle, &tSpec);
-
-   EXIT();
    return 0;
 }
 
@@ -8361,29 +6346,11 @@
                           struct iw_request_info *info,
                           union iwreq_data *wrqu, char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
    int *params = (int *)extra;
    hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra;
    v_U32_t handle;
-   int ret = 0;
 
-   ENTER();
-
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
-
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
    // make sure the application is sufficiently priviledged
    // note that the kernel will do this for "set" ioctls, but since
    // this ioctl wants to return status to user space it must be
@@ -8392,6 +6359,14 @@
    {
       return -EPERM;
    }
+
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+      return -EBUSY;
+   }
+
    // although we are defined to be a "get" ioctl, the params we require
    // will fit in the iwreq_data, therefore unlike iw_add_tspec() there
    // is no need to copy the params from user space
@@ -8406,8 +6381,6 @@
    }
 
    *pStatus = hdd_wmm_delts(pAdapter, handle);
-
-   EXIT();
    return 0;
 }
 
@@ -8429,32 +6402,15 @@
                           struct iw_request_info *info,
                           union iwreq_data *wrqu, char *extra)
 {
-   hdd_adapter_t *pAdapter;
-   hdd_context_t *pHddCtx;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
    int *params = (int *)extra;
    hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra;
    v_U32_t handle;
-   int ret = 0;
-
-   ENTER();
 
    // although we are defined to be a "get" ioctl, the params we require
    // will fit in the iwreq_data, therefore unlike iw_add_tspec() there
    // is no need to copy the params from user space
-   pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-   if (NULL == pAdapter)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Adapter is NULL",__func__);
-       return -EINVAL;
-   }
 
-   pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       return ret;
-   }
    // validate the handle
    handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
    if (HDD_WMM_HANDLE_IMPLICIT == handle)
@@ -8464,8 +6420,14 @@
       return 0;
    }
 
+   if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+      return -EBUSY;
+   }
+
    *pStatus = hdd_wmm_checkts(pAdapter, handle);
-   EXIT();
    return 0;
 }
 
@@ -8493,32 +6455,15 @@
                           struct iw_request_info *info,
                           union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_station_ctx_t *pHddStaCtx;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     //v_CONTEXT_t pVosContext;
 
-    ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-    pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    if (NULL == pHddStaCtx)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: STA Context is NULL",__func__);
-        return -EINVAL;
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+       return -EBUSY;
     }
     if (!wrqu->data.length)
     {
@@ -8547,7 +6492,6 @@
     sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, extra,
         wrqu->data.length);
 
-    EXIT();
     return 0;
 }
 
@@ -8569,37 +6513,22 @@
         struct iw_request_info *info,
         union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     tpRcvFltMcAddrList pRequest = (tpRcvFltMcAddrList)extra;
-    hdd_context_t *pHddCtx;
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     tpSirWlanSetRxpFilters wlanRxpFilterParam;
-    tHalHandle hHal;
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
     tpSirRcvFltMcAddrList mc_addr_list_ptr;
     int idx;
     eHalStatus ret_val;
 
-    ENTER();
+    if (pHddCtx->isLogpInProgress)
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+       return -EBUSY;
+    }
 
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret_val = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret_val)
-    {
-        return ret_val;
-    }
-    hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
-    }
     if (HDD_MULTICAST_FILTER_LIST == pRequest->mcastBcastFilterSetting)
     {
 #ifdef WLAN_FEATURE_PACKET_FILTERING
@@ -8692,7 +6621,6 @@
         }
     }
 
-    EXIT();
     return 0;
 }
 
@@ -8713,34 +6641,11 @@
                                           struct iw_request_info *info,
                                           union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     tpSirWlanSetRxpFilters wlanRxpFilterParam;
-    int ret = 0;
+    hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: ", __func__);
 
-    ENTER();
-
-    if (!capable(CAP_NET_ADMIN))
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("permission check failed"));
-        return -EPERM;
-    }
-
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
     //Reset the filter to INI value as we have to clear the dynamic filter
     pHddCtx->configuredMcastBcastFilter = pHddCtx->cfg_ini->mcastBcastFilterSetting;
 
@@ -8781,7 +6686,6 @@
         }
 
     }
-    EXIT();
     return 0;
 }
 
@@ -8803,28 +6707,16 @@
                                  struct iw_request_info *info,
                                  union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     tpHostOffloadRequest pRequest = (tpHostOffloadRequest) extra;
     tSirHostOffloadReq offloadRequest;
-    int ret = 0;
 
-    ENTER();
-
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+       return -EBUSY;
     }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
     /* Debug display of request components. */
     switch (pRequest->offloadType)
     {
@@ -8880,7 +6772,6 @@
         return -EINVAL;
     }
 
-    EXIT();
     return 0;
 }
 
@@ -8901,26 +6792,17 @@
                                      struct iw_request_info *info,
                                      union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     tpKeepAliveRequest pRequest = (tpKeepAliveRequest) extra;
     tSirKeepAliveReq keepaliveRequest;
-    int ret = 0;
 
-    ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+        return 0;
     }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
+
     /* Debug display of request components. */
     hddLog(VOS_TRACE_LEVEL_INFO,
            "%s: Set Keep Alive Request : TimePeriod %d size %zu",
@@ -8959,8 +6841,7 @@
        copied individually. */
        memcpy(&keepaliveRequest, pRequest, wrqu->data.length);
 
-       hddLog(VOS_TRACE_LEVEL_INFO, "set Keep: TP before SME %d",
-                                     keepaliveRequest.timePeriod);
+       hddLog(VOS_TRACE_LEVEL_ERROR, "set Keep: TP before SME %d", keepaliveRequest.timePeriod);
 
     if (eHAL_STATUS_SUCCESS != sme_SetKeepAlive(WLAN_HDD_GET_HAL_CTX(pAdapter),
                                         pAdapter->sessionId, &keepaliveRequest))
@@ -8969,7 +6850,7 @@
                __func__);
         return -EINVAL;
     }
-    EXIT();
+
     return 0;
 }
 
@@ -8999,6 +6880,12 @@
                 __func__ );
         return 0;
     }
+    if (pHddCtx->isLogpInProgress)
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+       return -EBUSY;
+    }
     /* Debug display of request components. */
     hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Packet Filter Request : FA %d params %d",
             __func__, pRequest->filterAction, pRequest->numParams);
@@ -9354,34 +7241,11 @@
                                          struct iw_request_info *info,
                                          union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     tpPacketFilterCfg pRequest = NULL;
-    int ret = 0;
+    int ret;
     struct iw_point s_priv_data;
 
-    ENTER();
-
-    if (!capable(CAP_NET_ADMIN))
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("permission check failed"));
-        return -EPERM;
-    }
-
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
     if (hdd_priv_get_data(&s_priv_data, wrqu))
     {
        return -EINVAL;
@@ -9405,7 +7269,6 @@
     ret = wlan_hdd_set_filter(WLAN_HDD_GET_CTX(pAdapter), pRequest, pAdapter->sessionId);
     kfree(pRequest);
 
-    EXIT();
     return ret;
 }
 
@@ -9430,33 +7293,22 @@
   VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
   eHalStatus status = eHAL_STATUS_SUCCESS;
   hdd_wext_state_t *pWextState;
-  hdd_adapter_t *pAdapter;
-  hdd_context_t *pHddCtx;
+  hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+  hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
   char *p = extra;
-  int tlen = 0, ret = 0;
-  tCsrSummaryStatsInfo *pStats;
+  int tlen = 0;
+  tCsrSummaryStatsInfo *pStats = &(pAdapter->hdd_stats.summary_stat);
 
-  tCsrGlobalClassAStatsInfo *aStats;
-  tCsrGlobalClassDStatsInfo *dStats;
+  tCsrGlobalClassAStatsInfo *aStats = &(pAdapter->hdd_stats.ClassA_stat);
+  tCsrGlobalClassDStatsInfo *dStats = &(pAdapter->hdd_stats.ClassD_stat);
 
   ENTER();
 
-  pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-  if (NULL == pAdapter)
-  {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: Adapter is NULL",__func__);
-      return -EINVAL;
+  if (pHddCtx->isLogpInProgress) {
+     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
+     return -EINVAL;
   }
-  pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-  ret = wlan_hdd_validate_context(pHddCtx);
-  if (0 != ret)
-  {
-      return ret;
-  }
-  pStats = &(pAdapter->hdd_stats.summary_stat);
-  aStats =  &(pAdapter->hdd_stats.ClassA_stat);
-  dStats = &(pAdapter->hdd_stats.ClassD_stat);
+
   if (eConnectionState_Associated != (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) {
 
      wrqu->txpower.value = 0;
@@ -9481,12 +7333,6 @@
     }
 
     pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-    if (NULL == pWextState)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pWextState is NULL",__func__);
-        return -EINVAL;
-    }
 
     vos_status = vos_wait_single_event(&pWextState->vosevent, WLAN_WAIT_TIME_STATS);
     if (!VOS_IS_STATUS_SUCCESS(vos_status))
@@ -9671,7 +7517,7 @@
      overflow.  This API is only invoked via ioctl, so it is
      serialized by the kernel rtnl_lock and hence does not need to be
      reentrant */
-  tSirPNOScanReq pnoRequest = {0};
+  static tSirPNOScanReq pnoRequest;
   char *ptr;
   v_U8_t i,j, ucParams, ucMode;
   eHalStatus status = eHAL_STATUS_FAILURE;
@@ -9779,18 +7625,6 @@
 
   ptr += nOffset;
 
-  pnoRequest.aNetworks =
-           vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount);
-  if (pnoRequest.aNetworks == NULL)
-  {
-       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-           FL("failed to allocate memory aNetworks %u"),
-               (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount);
-       goto error;
-  }
-  vos_mem_zero(pnoRequest.aNetworks,
-               sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount);
-
   for ( i = 0; i < pnoRequest.ucNetworksCount; i++ )
   {
 
@@ -9803,7 +7637,7 @@
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "PNO ssid length input is not valid %s",ptr);
-        goto error;
+        return VOS_STATUS_E_FAILURE;
     }
 
     if (( 0 == pnoRequest.aNetworks[i].ssId.length ) ||
@@ -9859,7 +7693,7 @@
     {
       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
                 "Incorrect number of channels");
-      goto error;
+      return VOS_STATUS_E_FAILURE;
     }
 
     if ( 0 !=  pnoRequest.aNetworks[i].ucChannelCount)
@@ -9871,7 +7705,7 @@
                            &nOffset))
             {    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                            "PNO network channel input is not valid %s",ptr);
-                  goto error;
+                  return VOS_STATUS_E_FAILURE;
             }
             /*Advance to next channel number*/
             ptr += nOffset;
@@ -9977,24 +7811,6 @@
   {
      pnoRequest.modePNO = SIR_PNO_MODE_ON_SUSPEND;
   }
-  pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE);
-  if (pnoRequest.p24GProbeTemplate == NULL){
-      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-          FL("failed to allocate memory p24GProbeTemplate %u"),
-              SIR_PNO_MAX_PB_REQ_SIZE);
-      goto error;
-  }
-
-  pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE);
-  if (pnoRequest.p5GProbeTemplate == NULL){
-      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-          FL("failed to allocate memory p5GProbeTemplate %u"),
-              SIR_PNO_MAX_PB_REQ_SIZE);
-      goto error;
-  }
-
-  vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE);
-  vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE);
 
   status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), &pnoRequest,
                                 pAdapter->sessionId,
@@ -10009,12 +7825,6 @@
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                 "%s: Failed to enable PNO", __func__);
     pHddCtx->isPnoEnable = FALSE;
-    if (pnoRequest.aNetworks)
-        vos_mem_free(pnoRequest.aNetworks);
-    if (pnoRequest.p24GProbeTemplate)
-        vos_mem_free(pnoRequest.p24GProbeTemplate);
-    if (pnoRequest.p5GProbeTemplate)
-        vos_mem_free(pnoRequest.p5GProbeTemplate);
     return VOS_STATUS_E_FAILURE;
 }/*iw_set_pno*/
 
@@ -10044,35 +7854,18 @@
                            struct iw_request_info *info,
                            union iwreq_data *wrqu, char *extra)
 {
-    hdd_adapter_t *pAdapter;
-    hdd_context_t *pHddCtx;
-    int ret = 0;
-    VOS_STATUS status;
-
-    ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    ret = wlan_hdd_validate_context(pHddCtx);
-    if (0 != ret)
-    {
-        return ret;
-    }
-
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
 
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                 "Set PNO Private");
 
-    status = iw_set_pno(dev,info,wrqu,extra,0);
-
-    EXIT();
-    return status;
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+    {
+       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+       return -EBUSY;
+    }
+    return iw_set_pno(dev,info,wrqu,extra,0);
 }
 
 static int iw_set_pno_priv(struct net_device *dev,
@@ -10092,39 +7885,15 @@
 //Common function to SetBand
 int hdd_setBand(struct net_device *dev, u8 ui_band)
 {
-    hdd_adapter_t *pAdapter;
-    tHalHandle hHal;
-    hdd_context_t *pHddCtx;
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     hdd_scaninfo_t *pScanInfo = NULL;
     eCsrBand band;
-    int wait_result;
     eCsrBand currBand = eCSR_BAND_MAX;
     eCsrBand connectedBand;
-    tpAniSirGlobal pMac;
-    int retval = SEND_CHANNEL_CHANGE_EVENT;
-
-    ENTER();
-    pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    if (NULL == pAdapter)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Adapter is NULL",__func__);
-        return -EINVAL;
-    }
-    pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    retval = wlan_hdd_validate_context(pHddCtx);
-    if (0 != retval)
-    {
-        return retval;
-    }
-    hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Hal Context is NULL",__func__);
-        return -EINVAL;
-    }
-    pMac = PMAC_STRUCT(hHal);
+    v_U8_t ret = SEND_CHANNEL_CHANGE_EVENT;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
 
     switch(ui_band)
     {
@@ -10155,7 +7924,8 @@
     }
 
     if ( (band == eCSR_BAND_24 && pHddCtx->cfg_ini->nBandCapability==2) ||
-         (band == eCSR_BAND_5G && pHddCtx->cfg_ini->nBandCapability==1) )
+         (band == eCSR_BAND_5G && pHddCtx->cfg_ini->nBandCapability==1) ||
+         (band == eCSR_BAND_ALL && pHddCtx->cfg_ini->nBandCapability!=0))
     {
          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
              "%s: band value %u violate INI settings %u", __func__,
@@ -10163,14 +7933,6 @@
          return -EIO;
     }
 
-    if (band == eCSR_BAND_ALL)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, FL("Auto Band "
-                            "received. Setting band same as ini value %d"),
-                                        pHddCtx->cfg_ini->nBandCapability);
-        band = pHddCtx->cfg_ini->nBandCapability;
-    }
-
     if (eHAL_STATUS_SUCCESS != sme_GetFreqBand(hHal, &currBand))
     {
          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
@@ -10181,17 +7943,14 @@
 
     if (currBand != band)
     {
-        if ( band == eCSR_BAND_5G )
-        {
-            /* Return failure if current country code is world regulatory domain*/
-            if( (pMac->scan.countryCodeCurrent[0] == '0' &&
+        /* Return failure if current country code is world regulatory domain*/
+        if( (pMac->scan.countryCodeCurrent[0] == '0' &&
                         pMac->scan.countryCodeCurrent[1] == '0') )
-            {
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                        "%s: failed to set the band value to %u as country code is 00",
+        {
+          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+             "%s: failed to set the band value to %u as country code is 00",
                         __func__, band);
-                return -EAGAIN;
-            }
+             return -EAGAIN;
         }
 
         /* Change band request received.
@@ -10215,74 +7974,30 @@
         }
         if(currBand == eCSR_BAND_24 || currBand == eCSR_BAND_5G)
         {
-             tANI_U8 curr_country[WNI_CFG_COUNTRY_CODE_LEN];
+             v_COUNTRYCODE_t curr_country;
              curr_country[0]=pMac->scan.countryCodeCurrent[0];
              curr_country[1]=pMac->scan.countryCodeCurrent[1];
-             INIT_COMPLETION(pHddCtx->linux_reg_req);
+
              /* As currunt band is already set to 2.4Ghz/5Ghz we dont have all channel
               * information available in NV so to get the channel information from kernel
               * we need to send regulatory hint for the currunt country
               * And to set the same country again we need to set the dummy country
               * first and then the actual country.
               */
+
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
              regulatory_hint_user("00", NL80211_USER_REG_HINT_USER);
 #else
              regulatory_hint_user("00");
 #endif
-             wait_result = wait_for_completion_interruptible_timeout(
-                               &pHddCtx->linux_reg_req,
-                               msecs_to_jiffies(LINUX_REG_WAIT_TIME));
-
-             /* if the country information does not exist with the kernel,
-               then the driver callback would not be called */
-
-             if (wait_result >= 0)
-             {
-                 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-                           "runtime country code is found in kernel db");
-             }
-             else
-             {
-                 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
-                           "runtime country code is not found"
-                           " in kernel db");
-             }
 
              pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_TRUE;
-
-             /*
-              * Update 11dcountry and current country here as the hint
-              * with 00 results in 11d and current country with 00
-              */
-             vos_mem_copy(pMac->scan.countryCode11d, curr_country,
-                      WNI_CFG_COUNTRY_CODE_LEN);
-             vos_mem_copy(pMac->scan.countryCodeCurrent, curr_country,
-                      WNI_CFG_COUNTRY_CODE_LEN);
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
              regulatory_hint_user(curr_country, NL80211_USER_REG_HINT_USER);
 #else
              regulatory_hint_user(curr_country);
 #endif
-             wait_result = wait_for_completion_interruptible_timeout(
-                               &pHddCtx->linux_reg_req,
-                               msecs_to_jiffies(LINUX_REG_WAIT_TIME));
-
-             /* if the country information does not exist with the kernel,
-               then the driver callback would not be called */
-             if (wait_result >= 0)
-             {
-                 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-                           "runtime country code is found in kernel db");
-             }
-             else
-             {
-                 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
-                           "runtime country code is not found"
-                           " in kernel db");
-             }
-
-             retval = DO_NOT_SEND_CHANNEL_CHANGE_EVENT;
+             ret = DO_NOT_SEND_CHANNEL_CHANGE_EVENT;
         }
         else
         {
@@ -10342,11 +8057,7 @@
              }
         }
     }
-    EXIT();
-    if (TRUE == pHddCtx->isSetBandByNL)
-        return 0;
-    else
-        return retval;
+    return ret;
 }
 
 int hdd_setBand_helper(struct net_device *dev, const char *command)
@@ -10364,15 +8075,16 @@
                                 struct iw_request_info *info,
                                 union iwreq_data *wrqu, char *extra)
 {
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     int *value = (int *)extra;
 
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: ", __func__);
 
-    if (!capable(CAP_NET_ADMIN))
+    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
     {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("permission check failed"));
-        return -EPERM;
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+        return -EBUSY;
     }
 
     return hdd_setBand(dev, value[0]);
@@ -10391,49 +8103,14 @@
     return ret;
 }
 
-static int get_fwr_memdump(struct net_device *dev,
-                            struct iw_request_info *info,
-                            union iwreq_data *wrqu, char *extra)
-{
-    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    int ret;
-    ENTER();
-   // HddCtx sanity
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-      return ret;
-   }
-   if( !pHddCtx->cfg_ini->enableFwrMemDump ||
-      (FALSE == sme_IsFeatureSupportedByFW(MEMORY_DUMP_SUPPORTED)))
-   {
-      hddLog(VOS_TRACE_LEVEL_INFO, FL("FW dump Logging not supported"));
-      return -EINVAL;
-   }
-   ret = wlan_hdd_fw_mem_dump_req(pHddCtx);
-
-   EXIT();
-   return ret;
-}
-
 static int __iw_set_power_params_priv(struct net_device *dev,
                                       struct iw_request_info *info,
                                       union iwreq_data *wrqu, char *extra)
 {
   int ret;
   char *ptr;
-
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                 "Set power params Private");
-
-  if (!capable(CAP_NET_ADMIN))
-  {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                FL("permission check failed"));
-      return -EPERM;
-  }
-
   /* ODD number is used for set, copy data using copy_from_user */
   ptr = mem_alloc_copy_from_user_helper(wrqu->data.pointer,
                                           wrqu->data.length);
@@ -10466,34 +8143,25 @@
 VOS_STATUS iw_set_power_params(struct net_device *dev, struct iw_request_info *info,
                       union iwreq_data *wrqu, char *extra, int nOffset)
 {
-  hdd_adapter_t *pAdapter;
-  hdd_context_t *pHddCtx;
+  hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
   tSirSetPowerParamsReq powerRequest;
   char *ptr;
   v_U8_t  ucType;
   v_U32_t  uTotalSize, uValue;
-  int ret = 0;
+  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
-  ENTER();
-  pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-  if (NULL == pAdapter)
-  {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: Adapter is NULL",__func__);
-      return -EINVAL;
-  }
-
-  pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-  ret = wlan_hdd_validate_context(pHddCtx);
-  if (0 != ret)
-  {
-      return ret;
-  }
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
             "Power Params data len %d data %s",
             wrqu->data.length,
             extra);
 
+  if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+  {
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                                  "%s:LOGP in Progress. Ignore!!!", __func__);
+    return -EBUSY;
+  }
+
   if (wrqu->data.length <= nOffset )
   {
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "set power param input is not correct");
@@ -10608,7 +8276,6 @@
   /* put the device back to power save*/
   wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO);
 
-  EXIT();
   return VOS_STATUS_SUCCESS;
 }/*iw_set_power_params*/
 
@@ -10636,7 +8303,7 @@
 {
     if (offchanoffset ==  0)
     {
-       tdlsOffChBwOffset = 1;
+       tdlsOffChBwOffset = 0;
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls secondary off channel offset to %u",
                  __func__, tdlsOffChBwOffset);
 
@@ -10646,7 +8313,7 @@
 
     if ( offchanoffset == 40 )
     {
-       tdlsOffChBwOffset = 2;
+       tdlsOffChBwOffset = 1;
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls secondary off channel offset to %u",
                  __func__, tdlsOffChBwOffset);
 
@@ -10662,18 +8329,6 @@
        return 0;
 
     }
-
-    if ((offchanoffset == 80) &&
-        (TRUE == sme_IsFeatureSupportedByFW(DOT11AC)) &&
-        (TRUE == sme_IsFeatureSupportedByDriver(DOT11AC)))
-    {
-       tdlsOffChBwOffset = 4;
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                 "%s: change tdls secondary off channel offset to %u",
-                 __func__, tdlsOffChBwOffset);
-
-       return 0;
-    }
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Invalid tdls secondary off channel offset %d",
               __func__, offchanoffset);
     return -1;
@@ -10684,7 +8339,7 @@
     hddTdlsPeer_t *connPeer = NULL;
     hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    tSirMacAddr peerMac;
+
     if (offchanmode < 0 || offchanmode > 4)
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -10705,16 +8360,12 @@
         eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == pHddCtx->tdls_mode)
     {
        /* Send TDLS Channel Switch Request to connected peer */
-       mutex_lock(&pHddCtx->tdls_lock);
-       connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter);
+       connPeer = wlan_hdd_tdls_get_first_connected_peer(pAdapter);
        if (NULL == connPeer) {
-           mutex_unlock(&pHddCtx->tdls_lock);
            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
                      "%s: No TDLS Connected Peer", __func__);
            return -1;
        }
-       vos_mem_copy(peerMac, connPeer->peerMac, sizeof(tSirMacAddr));
-       mutex_unlock(&pHddCtx->tdls_lock);
     }
     else
     {
@@ -10739,7 +8390,7 @@
            {
 
                sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                       pAdapter->sessionId, peerMac,
+                                       pAdapter->sessionId, connPeer->peerMac,
                                        tdlsOffCh, tdlsOffChBwOffset,
                                        offchanmode);
            }
@@ -10887,10 +8538,6 @@
 /*Maximum command length can be only 15 */
 static const struct iw_priv_args we_private_args[] = {
 
-    {   WE_SET_MONITOR_STATE,
-        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-        0, "monitor" },
-
     /* handlers for main ioctl */
     {   WLAN_PRIV_SET_INT_GET_NONE,
         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
@@ -10993,32 +8640,7 @@
     {   WE_SET_SCAN_BAND_PREFERENCE,
         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
         0, "set_scan_pref" },
-    {
-        WE_GET_FRAME_LOG,
-        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-        0,
-        "getFrameLogs" },
 
-    {   WE_SET_MIRACAST_VENDOR_CONFIG,
-        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-        0, "setMiracstConf" },
-
-#ifdef FEATURE_WLAN_TDLS
-    {
-        WE_SET_TDLS_2040_BSS_COEXISTENCE,
-        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-        0,
-        "tdls_2040bsscox" },
-#endif
-    {   WE_SET_RTS_CTS_HTVHT,
-        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-        0, "setRtsCtsHtVht" },
-    {   WE_SET_PKT_STATS_ENABLE_DISABLE,
-        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-        0, "setPktStats" },
-    {   WE_SET_PROXIMITY_ENABLE,
-        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-        0, "setProximity" },
     /* handlers for main ioctl */
     {   WLAN_PRIV_SET_NONE_GET_INT,
         0,
@@ -11071,11 +8693,6 @@
         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
         "get_scan_pref"},
 
-    {   WE_GET_ANTENA_DIVERSITY_SELECTION,
-        0,
-        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-        "getCurAnt"},
-
     /* handlers for main ioctl */
     {   WLAN_PRIV_SET_CHAR_GET_NONE,
         IW_PRIV_TYPE_CHAR| 512,
@@ -11110,12 +8727,6 @@
         0,
         "setConfig" },
 
-    {   WE_SET_ENCRYPT_MSG,
-        IW_PRIV_TYPE_CHAR| 512,
-        0,
-        "encryptMsg" },
-
-
     /* handlers for main ioctl */
     {   WLAN_PRIV_SET_THREE_INT_GET_NONE,
         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
@@ -11196,24 +8807,11 @@
         IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
         "getPMFInfo" },
 #endif
-#ifdef WLAN_FEATURE_RMC
-    {
-        WE_GET_IBSS_STA_INFO,
-        0,
-        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
-        "getIbssSTAs" },
-#endif
     {   WE_GET_SNR,
         0,
         IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
         "getSNR" },
-#ifdef FEATURE_OEM_DATA_SUPPORT
-   {
-        WE_GET_OEM_DATA_CAP,
-        0,
-        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
-        "getOemDataCap" },
-#endif /* FEATURE_OEM_DATA_SUPPORT */
+
     /* handlers for main ioctl */
     {   WLAN_PRIV_SET_NONE_GET_NONE,
         0,
@@ -11229,13 +8827,6 @@
         0,
         0,
         "initAP" },
-#ifdef WLAN_FEATURE_RMC
-    {
-        WE_IBSS_GET_PEER_INFO_ALL,
-        0,
-        0,
-       "ibssPeerInfoAll" },
-#endif
     {   WE_STOP_AP,
         0,
         0,
@@ -11272,6 +8863,7 @@
         0,
         0,
         "stopOBSSScan" },
+#ifdef DEBUG_ROAM_DELAY
     {
         WE_DUMP_ROAM_TIMER_LOG,
         0,
@@ -11282,35 +8874,18 @@
         0,
         0,
         "resetRoamDelay" },
-    {
-        WE_GET_FW_LOGS,
-        0,
-        0,
-        "getFwLogs" },
-    {
-        WE_GET_FW_MEMDUMP,
-        0,
-        0,
-        "getFwMemDump" },
+#endif
     /* handlers for main ioctl */
     {   WLAN_PRIV_SET_VAR_INT_GET_NONE,
         IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
         0,
         "" },
 
-
-
     /* handlers for sub-ioctl */
     {   WE_LOG_DUMP_CMD,
         IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
         0,
         "dump" },
-#ifdef WLAN_FEATURE_RMC
-    {   WE_IBSS_GET_PEER_INFO,
-        IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
-        0,
-        "ibssPeerInfo" },
-#endif
 
     /* handlers for sub-ioctl */
     {   WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
@@ -11346,18 +8921,6 @@
        "setTdlsConfig" },
 #endif
 
-   {
-       WE_CONFIGURE_MONITOR_MODE,
-       IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
-       0,
-       "MonitorModeConf" },
-
-   {
-       WE_SET_MONITOR_MODE_FILTER,
-       IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
-       0,
-       "MonitorFilter" },
-
     /* handlers for main ioctl */
     {   WLAN_PRIV_ADD_TSPEC,
         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
@@ -11407,8 +8970,7 @@
 
     {
         WLAN_SET_KEEPALIVE_PARAMS,
-        IW_PRIV_TYPE_BYTE  | sizeof(tKeepAliveRequest) |
-        IW_PRIV_SIZE_FIXED,
+        IW_PRIV_TYPE_BYTE  | sizeof(tKeepAliveRequest),
         0,
         "setKeepAlive" },
 #ifdef WLAN_FEATURE_PACKET_FILTERING
@@ -11727,13 +9289,27 @@
 
 int hdd_UnregisterWext(struct net_device *dev)
 {
-   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"In %s %p", __func__, dev);
-   if (dev != NULL)
-   {
-       rtnl_lock();
-       dev->wireless_handlers = NULL;
-       rtnl_unlock();
-   }
+#if 0
+   hdd_wext_state_t *wextBuf;
+   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+
+   ENTER();
+   // Set up the pointer to the Wireless Extensions state structure
+   wextBuf = pAdapter->pWextState;
+
+   // De-allocate the Wireless Extensions state structure
+   kfree(wextBuf);
+
+   // Clear out the pointer to the Wireless Extensions state structure
+   pAdapter->pWextState = NULL;
+
+   EXIT();
+#endif
+
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"In %s", __func__);
+   rtnl_lock();
+   dev->wireless_handlers = NULL;
+   rtnl_unlock();
 
    return 0;
 }
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_wmm.c b/wlan/prima/CORE/HDD/src/wlan_hdd_wmm.c
index b6d5c21..dea56c0 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_wmm.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_wmm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -47,6 +47,9 @@
   The remaining functions are utility functions for information hiding.
 
 
+               Copyright (c) 2008-9 QUALCOMM Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary
 ============================================================================*/
 
 /*---------------------------------------------------------------------------
@@ -66,7 +69,7 @@
 #include <wlan_hdd_softap_tx_rx.h>
 #include <vos_sched.h>
 #include "sme_Api.h"
-#include "sapInternal.h"
+
 // change logging behavior based upon debug flag
 #ifdef HDD_WMM_DEBUG
 #define WMM_TRACE_LEVEL_FATAL      VOS_TRACE_LEVEL_FATAL
@@ -130,21 +133,13 @@
 {
    hdd_adapter_t* pAdapter = pQosContext->pAdapter;
    WLANTL_ACEnumType acType = pQosContext->acType;
-   hdd_wmm_ac_status_t *pAc = NULL;
+   hdd_wmm_ac_status_t *pAc = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
    VOS_STATUS status;
    v_U32_t service_interval;
    v_U32_t suspension_interval;
    sme_QosWmmDirType direction;
    v_BOOL_t psb;
 
-   if (acType >= WLANTL_MAX_AC)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                "%s: Invalid AC: %d", __func__, acType);
-      return;
-   }
-
-   pAc = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
 
    // The TSPEC must be valid
    if (pAc->wmmAcTspecValid == VOS_FALSE)
@@ -258,22 +253,13 @@
 {
    hdd_adapter_t* pAdapter = pQosContext->pAdapter;
    WLANTL_ACEnumType acType = pQosContext->acType;
-   hdd_wmm_ac_status_t *pAc = NULL;
+   hdd_wmm_ac_status_t *pAc = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
    VOS_STATUS status;
    v_U32_t service_interval;
    v_U32_t suspension_interval;
    v_U8_t uapsd_mask;
    v_U8_t ActiveTspec = INVALID_TSPEC;
 
-   if (acType >= WLANTL_MAX_AC)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                "%s: Invalid AC: %d", __func__, acType);
-      return;
-   }
-
-   pAc = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
-
    // have we previously enabled UAPSD?
    if (pAc->wmmAcUapsdInfoValid == VOS_TRUE)
    {
@@ -310,10 +296,6 @@
             service_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBkSrvIntv;
             suspension_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBkSuspIntv;
             break;
-         default:
-            VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                    "%s: Invalid AC %d", __func__, acType );
-            return;
          }
 
          status = WLANTL_EnableUAPSDForAC((WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
@@ -356,39 +338,25 @@
 */
 static void hdd_wmm_free_context (hdd_wmm_qos_context_t* pQosContext)
 {
-   v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
-   hdd_context_t *pHddCtx = NULL;
-
-   if (NULL == pVosContext)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                FL("pVosContext is NULL"));
-      return;
-   }
-
-   pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
-   if (NULL == pHddCtx)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                FL("HddCtx is NULL"));
-      return;
-   }
+   hdd_adapter_t* pAdapter;
 
    VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
              "%s: Entered, context %p",
              __func__, pQosContext);
 
-   // take the wmmLock since we're manipulating the context list
-   mutex_lock(&pHddCtx->wmmLock);
-
    if (unlikely((NULL == pQosContext) ||
                 (HDD_WMM_CTX_MAGIC != pQosContext->magic)))
    {
       // must have been freed in another thread
-      mutex_unlock(&pHddCtx->wmmLock);
       return;
    }
 
+   // get pointer to the adapter context
+   pAdapter = pQosContext->pAdapter;
+
+   // take the wmmLock since we're manipulating the context list
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
+
    // make sure nobody thinks this is a valid context
    pQosContext->magic = 0;
 
@@ -396,7 +364,7 @@
    list_del(&pQosContext->node);
 
    // done manipulating the list
-   mutex_unlock(&pHddCtx->wmmLock);
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
 
    // reclaim memory
    kfree(pQosContext);
@@ -419,41 +387,20 @@
    hdd_adapter_t* pAdapter;
    union iwreq_data wrqu;
    char buf[MAX_NOTIFY_LEN+1];
-   v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
-   hdd_context_t *pHddCtx = NULL;
-
-   if (NULL == pVosContext)
-   {
-         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("pVosContext is NULL"));
-         return;
-   }
-
-   pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
-   if (NULL == pHddCtx)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("HddCtx is NULL"));
-      return;
-   }
 
    VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
              "%s: Entered, context %p",
              __func__, pQosContext);
 
-   mutex_lock(&pHddCtx->wmmLock);
    if (unlikely((NULL == pQosContext) ||
                 (HDD_WMM_CTX_MAGIC != pQosContext->magic)))
    {
-      mutex_unlock(&pHddCtx->wmmLock);
       VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
                 "%s: Invalid QoS Context",
                 __func__);
       return;
    }
-   // get pointer to the adapter
-   pAdapter = pQosContext->pAdapter;
-   mutex_unlock(&pHddCtx->wmmLock);
+
 
    // create the event
    memset(&wrqu, 0, sizeof(wrqu));
@@ -466,7 +413,8 @@
    wrqu.data.pointer = buf;
    wrqu.data.length = strlen(buf);
 
-
+   // get pointer to the adapter
+   pAdapter = pQosContext->pAdapter;
 
    // send the event
    VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
@@ -548,45 +496,9 @@
     hdd_wlan_wmm_status_e status;
     VOS_STATUS vos_status;
     v_U32_t currentTrafficCnt = 0;
-    WLANTL_ACEnumType acType = 0;
-    v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
-    hdd_context_t *pHddCtx = NULL;
+    WLANTL_ACEnumType acType = pQosContext->acType;
 
-    ENTER();
-    if (NULL == pVosContext)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                  "%s: Invalid VOS Context", __func__);
-        return;
-    }
-
-    pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext);
-    if (0 != (wlan_hdd_validate_context(pHddCtx)))
-    {
-        return;
-    }
-
-    mutex_lock(&pHddCtx->wmmLock);
-    if (unlikely((NULL == pQosContext) ||
-                (HDD_WMM_CTX_MAGIC != pQosContext->magic)))
-    {
-        mutex_unlock(&pHddCtx->wmmLock);
-        VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                  "%s: Invalid QoS Context",
-                  __func__);
-        return;
-    }
-    mutex_unlock(&pHddCtx->wmmLock);
-
-    acType = pQosContext->acType;
     pAdapter = pQosContext->pAdapter;
-    if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  FL("invalid pAdapter: %p"), pAdapter);
-        return;
-    }
-
     pAc = &pAdapter->hddWmmStatus.wmmAcStatus[acType];
 
     // Get the Tx stats for this AC.
@@ -623,7 +535,6 @@
         }
     }
 
-    EXIT();
     return;
 }
 
@@ -733,40 +644,19 @@
    WLANTL_ACEnumType acType;
    hdd_wmm_ac_status_t *pAc;
    VOS_STATUS status;
-   v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
-   hdd_context_t *pHddCtx = NULL;
-
-   if (NULL == pVosContext)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("pVosContext is NULL"));
-      return eHAL_STATUS_FAILURE;
-   }
-
-   pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
-   if (NULL == pHddCtx)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("HddCtx is NULL"));
-      return eHAL_STATUS_FAILURE;
-   }
-
 
    VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
              "%s: Entered, context %p",
              __func__, pQosContext);
 
-   mutex_lock(&pHddCtx->wmmLock);
    if (unlikely((NULL == pQosContext) ||
                 (HDD_WMM_CTX_MAGIC != pQosContext->magic)))
    {
-      mutex_unlock(&pHddCtx->wmmLock);
       VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
                 "%s: Invalid QoS Context",
                 __func__);
       return eHAL_STATUS_FAILURE;
    }
-   mutex_unlock(&pHddCtx->wmmLock);
 
    pAdapter = pQosContext->pAdapter;
    acType = pQosContext->acType;
@@ -986,7 +876,7 @@
       VOS_TRACE( VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
                  "%s: Setup failed, not a QoS AP",
                  __func__);
-      if (HDD_WMM_HANDLE_IMPLICIT != pQosContext->handle)
+      if (!HDD_WMM_HANDLE_IMPLICIT == pQosContext->handle)
       {
          VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
                    "%s: Explicit Qos, notifying userspace",
@@ -1416,7 +1306,7 @@
 
   @return         : void
   ===========================================================================*/
-static void __hdd_wmm_do_implicit_qos(struct work_struct *work)
+static void hdd_wmm_do_implicit_qos(struct work_struct *work)
 {
    hdd_wmm_qos_context_t* pQosContext =
       container_of(work, hdd_wmm_qos_context_t, wmmAcSetupImplicitQos);
@@ -1428,40 +1318,18 @@
    sme_QosStatusType smeStatus;
 #endif
    sme_QosWmmTspecInfo qosInfo;
-   v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
-   hdd_context_t *pHddCtx = NULL;
-   int ret = 0;
-
-   if (NULL == pVosContext)
-   {
-         VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("pVosContext is NULL"));
-         return;
-   }
-
-   pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
-
-   ret = wlan_hdd_validate_context(pHddCtx);
-   if (0 != ret)
-   {
-       hddLog(LOGE, FL("HDD context is invalid"));
-       return;
-   }
 
    VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
              "%s: Entered, context %p",
              __func__, pQosContext);
 
-   mutex_lock(&pHddCtx->wmmLock);
    if (unlikely(HDD_WMM_CTX_MAGIC != pQosContext->magic))
    {
-      mutex_unlock(&pHddCtx->wmmLock);
       VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
                 "%s: Invalid QoS Context",
                 __func__);
       return;
    }
-   mutex_unlock(&pHddCtx->wmmLock);
 
    pAdapter = pQosContext->pAdapter;
    acType = pQosContext->acType;
@@ -1524,6 +1392,7 @@
       qosInfo.surplus_bw_allowance = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraSbaAcVi;
       qosInfo.suspension_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdViSuspIntv;
       break;
+   default:
    case WLANTL_AC_BE:
       qosInfo.ts_info.up = SME_QOS_WMM_UP_BE;
       /* Check if there is any valid configuration from framework */
@@ -1558,10 +1427,6 @@
       qosInfo.surplus_bw_allowance = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraSbaAcBk;
       qosInfo.suspension_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraUapsdBkSuspIntv;
       break;
-   default:
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                "%s: Invalid AC %d", __func__, acType );
-      return;
    }
 #ifdef FEATURE_WLAN_ESE
    qosInfo.inactivity_interval = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->InfraInactivityInterval;
@@ -1591,9 +1456,9 @@
      }
    }
 
-   mutex_lock(&pHddCtx->wmmLock);
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
    list_add(&pQosContext->node, &pAdapter->hddWmmStatus.wmmContextList);
-   mutex_unlock(&pHddCtx->wmmLock);
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
 
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
    smeStatus = sme_QosSetupReq(WLAN_HDD_GET_HAL_CTX(pAdapter),
@@ -1670,13 +1535,6 @@
 
 }
 
-static void hdd_wmm_do_implicit_qos(struct work_struct *work)
-{
-    vos_ssr_protect(__func__);
-    __hdd_wmm_do_implicit_qos( work );
-    vos_ssr_unprotect(__func__);
-}
-
 /**============================================================================
   @brief hdd_wmm_init() - Function which will initialize the WMM configuation
   and status to an initial state.  The configuration can later be overwritten
@@ -1732,6 +1590,7 @@
 
    pAdapter->hddWmmStatus.wmmQap = VOS_FALSE;
    INIT_LIST_HEAD(&pAdapter->hddWmmStatus.wmmContextList);
+   mutex_init(&pAdapter->hddWmmStatus.wmmLock);
 
    for (acType = 0; acType < WLANTL_MAX_AC; acType++)
    {
@@ -1795,23 +1654,6 @@
 VOS_STATUS hdd_wmm_adapter_close ( hdd_adapter_t* pAdapter )
 {
    hdd_wmm_qos_context_t* pQosContext;
-   v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
-   hdd_context_t *pHddCtx = NULL;
-
-   if (NULL == pVosContext)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("pVosContext is NULL"));
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
-   if (NULL == pHddCtx)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("HddCtx is NULL"));
-      return VOS_STATUS_E_FAILURE;
-   }
 
    VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
              "%s: Entered", __func__);
@@ -1824,15 +1666,14 @@
 #ifdef FEATURE_WLAN_ESE
       hdd_wmm_disable_inactivity_timer(pQosContext);
 #endif
-   mutex_lock(&pHddCtx->wmmLock);
+#ifdef WLAN_OPEN_SOURCE
    if (pQosContext->handle == HDD_WMM_HANDLE_IMPLICIT
        && pQosContext->magic == HDD_WMM_CTX_MAGIC)
    {
 
-      vos_flush_work(&pQosContext->wmmAcSetupImplicitQos);
+      cancel_work_sync(&pQosContext->wmmAcSetupImplicitQos);
    }
-   mutex_unlock(&pHddCtx->wmmLock);
-
+#endif
       hdd_wmm_free_context(pQosContext);
    }
 
@@ -1840,14 +1681,14 @@
 }
 
 /**============================================================================
-  @brief hdd_is_dhcp_packet() - Function which will check OS packet for
+  @brief is_dhcp_packet() - Function which will check OS packet for
   DHCP packet
 
   @param skb      : [in]  pointer to OS packet (sk_buff)
   @return         : VOS_TRUE if the OS packet is DHCP packet
                   : otherwise VOS_FALSE
   ===========================================================================*/
-v_BOOL_t hdd_is_dhcp_packet(struct sk_buff *skb)
+v_BOOL_t is_dhcp_packet(struct sk_buff *skb)
 {
    if (*((u16*)((u8*)skb->data+34)) == DHCP_SOURCE_PORT ||
        *((u16*)((u8*)skb->data+34)) == DHCP_DESTINATION_PORT)
@@ -1857,28 +1698,6 @@
 }
 
 /**============================================================================
-  @brief hdd_skb_is_eapol_or_wai_packet() - Function which will check OS packet
-  for Eapol/Wapi packet
-
-  @param skb      : [in]  pointer to OS packet (sk_buff)
-  @return         : VOS_TRUE if the OS packet is an Eapol or a Wapi packet
-                  : otherwise VOS_FALSE
-  ===========================================================================*/
-v_BOOL_t hdd_skb_is_eapol_or_wai_packet(struct sk_buff *skb)
-{
-    if ((*((u16*)((u8*)skb->data+HDD_ETHERTYPE_802_1_X_FRAME_OFFSET))
-         == vos_cpu_to_be16(HDD_ETHERTYPE_802_1_X))
-#ifdef FEATURE_WLAN_WAPI
-         || (*((u16*)((u8*)skb->data+HDD_ETHERTYPE_802_1_X_FRAME_OFFSET))
-         == vos_cpu_to_be16(HDD_ETHERTYPE_WAI))
-#endif
-       )
-       return VOS_TRUE;
-
-    return VOS_FALSE;
-}
-
-/**============================================================================
   @brief hdd_wmm_classify_pkt() - Function which will classify an OS packet
   into a WMM AC based on either 802.1Q or DSCP
 
@@ -1990,8 +1809,6 @@
       }
       else
       {
-          v_BOOL_t toggleArpBDRates =
-                        (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->toggleArpBDRates;
           // default
 #ifdef HDD_WMM_DEBUG
           VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_WARN,
@@ -2001,11 +1818,6 @@
           //Give the highest priority to 802.1x packet
           if (pHdr->eth_II.h_proto == htons(HDD_ETHERTYPE_802_1_X))
               tos = 0xC0;
-          else if (toggleArpBDRates &&
-                   pHdr->eth_II.h_proto == htons(HDD_ETHERTYPE_ARP))
-          {
-              tos = TID3;
-          }
           else
               tos = 0;
       }
@@ -2082,14 +1894,7 @@
 
   @return         : Qdisc queue index
   ===========================================================================*/
-v_U16_t hdd_hostapd_select_queue(struct net_device * dev, struct sk_buff *skb
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0))
-                                 , void *accel_priv
-#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-                                 , select_queue_fallback_t fallbac
-#endif
-)
+v_U16_t hdd_hostapd_select_queue(struct net_device * dev, struct sk_buff *skb)
 {
    WLANTL_ACEnumType ac;
    sme_QosWmmUpType up = SME_QOS_WMM_UP_BE;
@@ -2098,49 +1903,32 @@
    hdd_adapter_t *pAdapter = (hdd_adapter_t *)netdev_priv(dev);
    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
    v_U8_t STAId;
-   v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
-   ptSapContext pSapCtx = NULL;
-   int status = 0;
+   v_U8_t *pSTAId = (v_U8_t *)(((v_U8_t *)(skb->data)) - 1);
 
-   status = wlan_hdd_validate_context(pHddCtx);
-   if (status !=0 )
-   {
-       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                  FL("called during WDReset/unload"));
-       skb->priority = SME_QOS_WMM_UP_BE;
-       return HDD_LINUX_AC_BE;
-   }
-
-   pSapCtx = VOS_GET_SAP_CB(pVosContext);
-   if(pSapCtx == NULL){
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                 FL("psapCtx is NULL"));
-       STAId = HDD_WLAN_INVALID_STA_ID;
-       goto done;
-   }
    /*Get the Station ID*/
-   STAId = hdd_sta_id_find_from_mac_addr(pAdapter, pDestMacAddress);
-   if (STAId == HDD_WLAN_INVALID_STA_ID) {
-       VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
-                 "%s: Failed to find right station", __func__);
-       goto done;
+   if (VOS_STATUS_SUCCESS != hdd_softap_GetStaId(pAdapter, pDestMacAddress, &STAId))
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
+            "%s: Failed to find right station", __func__);
+      *pSTAId = HDD_WLAN_INVALID_STA_ID;
+      goto done;
    }
 
-   spin_lock_bh( &pSapCtx->staInfo_lock );
-   if (FALSE == vos_is_macaddr_equal(&pSapCtx->aStaInfo[STAId].macAddrSTA, pDestMacAddress))
+   spin_lock_bh( &pAdapter->staInfo_lock );
+   if (FALSE == vos_is_macaddr_equal(&pAdapter->aStaInfo[STAId].macAddrSTA, pDestMacAddress))
    {
       VOS_TRACE( VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_INFO,
                    "%s: Station MAC address does not matching", __func__);
 
-      STAId = HDD_WLAN_INVALID_STA_ID;
+      *pSTAId = HDD_WLAN_INVALID_STA_ID;
       goto release_lock;
    }
-   if (pSapCtx->aStaInfo[STAId].isUsed && pSapCtx->aStaInfo[STAId].isQosEnabled && (HDD_WMM_USER_MODE_NO_QOS != pHddCtx->cfg_ini->WmmMode))
+   if (pAdapter->aStaInfo[STAId].isUsed && pAdapter->aStaInfo[STAId].isQosEnabled && (HDD_WMM_USER_MODE_NO_QOS != pHddCtx->cfg_ini->WmmMode))
    {
       /* Get the user priority from IP header & corresponding AC */
       hdd_wmm_classify_pkt (pAdapter, skb, &ac, &up);
       //If 3/4th of Tx queue is used then place the DHCP packet in VOICE AC queue
-      if (pSapCtx->aStaInfo[STAId].vosLowResource && hdd_is_dhcp_packet(skb))
+      if (pAdapter->aStaInfo[STAId].vosLowResource && is_dhcp_packet(skb))
       {
          VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_WARN,
                     "%s: Making priority of DHCP packet as VOICE", __func__);
@@ -2148,9 +1936,10 @@
          ac = hddWmmUpToAcMap[up];
       }
    }
+   *pSTAId = STAId;
 
 release_lock:
-    spin_unlock_bh( &pSapCtx->staInfo_lock );
+    spin_unlock_bh( &pAdapter->staInfo_lock );
 done:
    skb->priority = up;
    if(skb->priority < SME_QOS_WMM_UP_MAX)
@@ -2181,11 +1970,10 @@
    sme_QosWmmUpType up = SME_QOS_WMM_UP_BE;
    v_USHORT_t queueIndex;
    hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
-   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-   int status = 0;
 
-   status = wlan_hdd_validate_context(pHddCtx);
-   if (status !=0) {
+   if (isWDresetInProgress()) {
+       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+                  FL("called during WDReset"));
        skb->priority = SME_QOS_WMM_UP_BE;
        return HDD_LINUX_AC_BE;
    }
@@ -2193,32 +1981,32 @@
    /*Get the Station ID*/
    if (WLAN_HDD_IBSS == pAdapter->device_mode)
    {
+       v_U8_t *pSTAId = (v_U8_t *)(((v_U8_t *)(skb->data)) - 1);
        v_MACADDR_t *pDestMacAddress = (v_MACADDR_t*)skb->data;
-       v_U8_t STAId;
 
-       STAId = hdd_sta_id_find_from_mac_addr(pAdapter, pDestMacAddress);
-       if ((STAId == HDD_WLAN_INVALID_STA_ID) &&
-            !vos_is_macaddr_broadcast( pDestMacAddress ) &&
-            !vos_is_macaddr_group(pDestMacAddress))
+       if ( VOS_STATUS_SUCCESS !=
+            hdd_Ibss_GetStaId(&pAdapter->sessionCtx.station,
+                               pDestMacAddress, pSTAId))
        {
-           VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+          *pSTAId = HDD_WLAN_INVALID_STA_ID;
+          if ( !vos_is_macaddr_broadcast( pDestMacAddress ) &&
+                             !vos_is_macaddr_group(pDestMacAddress))
+          {
+              VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                      "%s: Failed to find right station pDestMacAddress: "
                      MAC_ADDRESS_STR , __func__,
                      MAC_ADDR_ARRAY(pDestMacAddress->bytes));
-           goto done;
+              goto done;
+          }
        }
    }
    /* All traffic will get equal opportuniy to transmit data frames. */
    /* Get the user priority from IP header & corresponding AC */
    hdd_wmm_classify_pkt (pAdapter, skb, &ac, &up);
-
    /* If 3/4th of BE AC Tx queue is full,
-    * then place the DHCP packet in VOICE AC queue.
-    * Doing this for IBSS alone, since for STA interface
-    * types, these packets will be queued to the new queue.
+    * then place the DHCP packet in VOICE AC queue
     */
-   if ((WLAN_HDD_IBSS == pAdapter->device_mode) &&
-       pAdapter->isVosLowResource && hdd_is_dhcp_packet(skb))
+   if (pAdapter->isVosLowResource && is_dhcp_packet(skb))
    {
       VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_WARN,
                 "%s: BestEffort Tx Queue is 3/4th full"
@@ -2226,7 +2014,6 @@
       up = SME_QOS_WMM_UP_VO;
       ac = hddWmmUpToAcMap[up];
    }
-
 done:
    skb->priority = up;
    if(skb->priority < SME_QOS_WMM_UP_MAX)
@@ -2238,19 +2025,6 @@
       queueIndex = hddLinuxUpToAcMap[SME_QOS_WMM_UP_BE];
    }
 
-   if ((WLAN_HDD_IBSS != pAdapter->device_mode) &&
-       (hdd_is_dhcp_packet(skb) ||
-        hdd_skb_is_eapol_or_wai_packet(skb)))
-   {
-       /* If the packet is a DHCP packet or a Eapol packet or
-        * a Wapi packet, then queue it to the new queue for
-        * STA interfaces alone.
-        */
-       queueIndex = WLANTL_AC_HIGH_PRIO;
-       VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
-                 "%s: up=%d QIndex:%d", __func__, up, queueIndex);
-   }
-
    return queueIndex;
 }
 
@@ -2377,7 +2151,7 @@
    pQosContext->qosFlowId = 0;
    pQosContext->handle = HDD_WMM_HANDLE_IMPLICIT;
    pQosContext->magic = HDD_WMM_CTX_MAGIC;
-   vos_init_work(&pQosContext->wmmAcSetupImplicitQos,
+   INIT_WORK(&pQosContext->wmmAcSetupImplicitQos,
              hdd_wmm_do_implicit_qos);
 
    VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
@@ -2577,14 +2351,7 @@
 
          // admission is required
          pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessRequired = VOS_TRUE;
-         //Mark wmmAcAccessAllowed as True if implicit Qos is disabled as there
-         //is no need to hold packets in queue during hdd_tx_fetch_packet_cbk
-         if (!(WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->bImplicitQosEnabled)
-              pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessAllowed =
-                                                                     VOS_TRUE;
-         else
-              pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessAllowed =
-                                                                    VOS_FALSE;
+         pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessAllowed = VOS_FALSE;
          pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessGranted = VOS_FALSE;
 
          /* Making TSPEC invalid here so downgrading can be happen while roaming
@@ -2737,29 +2504,12 @@
    sme_QosStatusType smeStatus;
 #endif
    v_BOOL_t found = VOS_FALSE;
-   v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
-   hdd_context_t *pHddCtx = NULL;
-
-   if (NULL == pVosContext)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("pVosContext is NULL"));
-      return HDD_WLAN_WMM_STATUS_SETUP_FAILED;
-   }
-
-   pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
-   if (NULL == pHddCtx)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("HddCtx is NULL"));
-      return HDD_WLAN_WMM_STATUS_SETUP_FAILED;
-   }
 
    VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
              "%s: Entered with handle 0x%x", __func__, handle);
 
    // see if a context already exists with the given handle
-   mutex_lock(&pHddCtx->wmmLock);
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
    list_for_each_entry(pQosContext,
                        &pAdapter->hddWmmStatus.wmmContextList,
                        node)
@@ -2770,7 +2520,7 @@
          break;
       }
    }
-   mutex_unlock(&pHddCtx->wmmLock);
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
    if (found)
    {
       // record with that handle already exists
@@ -2812,12 +2562,12 @@
           return HDD_WLAN_WMM_STATUS_MODIFY_FAILED;
       }
 
-      mutex_lock(&pHddCtx->wmmLock);
+      mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
       if (pQosContext->magic == HDD_WMM_CTX_MAGIC)
       {
           pQosContext->lastStatus = status;
       }
-      mutex_unlock(&pHddCtx->wmmLock);
+      mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
       return status;
    }
 
@@ -2843,18 +2593,17 @@
                 HDD_WMM_UP_TO_AC_MAP_SIZE - 1, hddWmmUpToAcMap[0]);
       pQosContext->acType = hddWmmUpToAcMap[0];
    }
-
    pQosContext->pAdapter = pAdapter;
    pQosContext->qosFlowId = 0;
+   pQosContext->magic = HDD_WMM_CTX_MAGIC;
 
    VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
              "%s: Setting up QoS, context %p",
              __func__, pQosContext);
 
-   mutex_lock(&pHddCtx->wmmLock);
-   pQosContext->magic = HDD_WMM_CTX_MAGIC;
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
    list_add(&pQosContext->node, &pAdapter->hddWmmStatus.wmmContextList);
-   mutex_unlock(&pHddCtx->wmmLock);
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
 
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
    smeStatus = sme_QosSetupReq(WLAN_HDD_GET_HAL_CTX(pAdapter),
@@ -2906,12 +2655,12 @@
 #endif
 
    // we were successful, save the status
-   mutex_lock(&pHddCtx->wmmLock);
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
    if (pQosContext->magic == HDD_WMM_CTX_MAGIC)
    {
          pQosContext->lastStatus = status;
    }
-   mutex_unlock(&pHddCtx->wmmLock);
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
 
    return status;
 }
@@ -2936,29 +2685,12 @@
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
    sme_QosStatusType smeStatus;
 #endif
-   v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
-   hdd_context_t *pHddCtx = NULL;
-
-   if (NULL == pVosContext)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("pVosContext is NULL"));
-      return HDD_WLAN_WMM_STATUS_RELEASE_FAILED;
-   }
-
-   pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
-   if (NULL == pHddCtx)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("HddCtx is NULL"));
-      return HDD_WLAN_WMM_STATUS_RELEASE_FAILED;
-   }
 
    VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
              "%s: Entered with handle 0x%x", __func__, handle);
 
    // locate the context with the given handle
-   mutex_lock(&pHddCtx->wmmLock);
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
    list_for_each_entry(pQosContext,
                        &pAdapter->hddWmmStatus.wmmContextList,
                        node)
@@ -2971,7 +2703,7 @@
          break;
       }
    }
-   mutex_unlock(&pHddCtx->wmmLock);
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
 
    if (VOS_FALSE == found)
    {
@@ -3038,12 +2770,12 @@
    }
 
 #endif
-   mutex_lock(&pHddCtx->wmmLock);
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
    if (pQosContext->magic == HDD_WMM_CTX_MAGIC)
    {
          pQosContext->lastStatus = status;
    }
-   mutex_unlock(&pHddCtx->wmmLock);
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
    return status;
 }
 
@@ -3061,29 +2793,12 @@
 {
    hdd_wmm_qos_context_t *pQosContext;
    hdd_wlan_wmm_status_e status = HDD_WLAN_WMM_STATUS_LOST;
-   v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
-   hdd_context_t *pHddCtx = NULL;
-
-   if (NULL == pVosContext)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("pVosContext is NULL"));
-      return HDD_WLAN_WMM_STATUS_LOST;
-   }
-
-   pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
-   if (NULL == pHddCtx)
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_ERROR,
-                   FL("HddCtx is NULL"));
-      return HDD_WLAN_WMM_STATUS_LOST;
-   }
 
    VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO_LOW,
              "%s: Entered with handle 0x%x", __func__, handle);
 
    // locate the context with the given handle
-   mutex_lock(&pHddCtx->wmmLock);
+   mutex_lock(&pAdapter->hddWmmStatus.wmmLock);
    list_for_each_entry(pQosContext,
                        &pAdapter->hddWmmStatus.wmmContextList,
                        node)
@@ -3098,6 +2813,6 @@
          break;
       }
    }
-   mutex_unlock(&pHddCtx->wmmLock);
+   mutex_unlock(&pAdapter->hddWmmStatus.wmmLock);
    return status;
 }
diff --git a/wlan/prima/CORE/HDD/src/wlan_hdd_wowl.c b/wlan/prima/CORE/HDD/src/wlan_hdd_wowl.c
index ad3f5fa..4b82ba8 100644
--- a/wlan/prima/CORE/HDD/src/wlan_hdd_wowl.c
+++ b/wlan/prima/CORE/HDD/src/wlan_hdd_wowl.c
@@ -28,6 +28,9 @@
 /*============================================================================
  * @file wlan_hdd_wowl.c
  *
+ * Copyright (c) 2009 QUALCOMM Incorporated.
+ * All Rights Reserved.
+ * Qualcomm Confidential and Proprietary
  *
  * ==========================================================================*/
 
diff --git a/wlan/prima/CORE/MAC/inc/aniGlobal.h b/wlan/prima/CORE/MAC/inc/aniGlobal.h
index 1d50dbf..468620b 100644
--- a/wlan/prima/CORE/MAC/inc/aniGlobal.h
+++ b/wlan/prima/CORE/MAC/inc/aniGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -92,8 +92,6 @@
 #endif
 #include "p2p_Api.h"
 
-#include "limRMC.h"
-
 #if defined WLAN_FEATURE_VOWIFI_11R
 #include <limFTDefs.h>
 #endif
@@ -233,10 +231,15 @@
 #ifdef FEATURE_WLAN_ESE
     TX_TIMER           gLimEseTsmTimer;
 #endif
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+    TX_TIMER           gLimTdlsDisRspWaitTimer;
+    TX_TIMER           gLimTdlsLinkSetupRspTimeouTimer;
+    TX_TIMER           gLimTdlsLinkSetupCnfTimeoutTimer;
+#endif
+
     TX_TIMER           gLimPeriodicJoinProbeReqTimer;
     TX_TIMER           gLimDisassocAckTimer;
     TX_TIMER           gLimDeauthAckTimer;
-    TX_TIMER           gLimPeriodicAuthRetryTimer;
     // This timer is started when single shot NOA insert msg is sent to FW for scan in P2P GO mode
     TX_TIMER           gLimP2pSingleShotNoaInsertTimer;
     /* This timer is used to convert active channel to
@@ -255,11 +258,6 @@
     void *pMlmDeauthReq;
 }tLimDisassocDeauthCnfReq;
 
-typedef struct {
-    tANI_U32 failed_count[MAX_TIDS];
-    v_TIME_t failed_timestamp[MAX_TIDS];
-} tLimStaBAInfo;
-
 typedef struct sAniSirLim
 {
     //////////////////////////////////////     TIMER RELATED START ///////////////////////////////////////////
@@ -376,8 +374,6 @@
 
     //////////////////////////////////////     SCAN/LEARN RELATED START ///////////////////////////////////////////
     tSirMacAddr         gSelfMacAddr;   //added for BT-AMP Support 
-    tSirMacAddr         spoofMacAddr;   //added for Mac Addr Spoofing support
-    tANI_U8             isSpoofingEnabled;
 
     //////////////////////////////////////////     BSS RELATED END ///////////////////////////////////////////
     // Place holder for StartBssReq message
@@ -427,7 +423,6 @@
     /// Definition for storing IBSS peers BSS description
     tLimIbssPeerNode      *gLimIbssPeerList;
     tANI_U32               gLimNumIbssPeers;
-    tANI_U32               gLimIbssRetryCnt;
 
     // ibss info - params for which ibss to join while coalescing
     tAniSirLimIbss      ibssInfo;
@@ -865,6 +860,22 @@
 
     ////////////////////////////////  HT RELATED           //////////////////////////////////////////
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+    ////////////////////////////////  TDLS RELATED         //////////////////////////////////////////
+    
+    tSirTdlsDisReq gLimTdlsDisReq ; 
+    //tLimDisResultList *gTdlsDisResultList ;
+    tLimDisResultList *gLimTdlsDisResultList ;
+    tANI_U8 gLimTdlsDisStaCount ;
+    tANI_U8 gAddStaDisRspWait ;
+
+    tLimTdlsLinkSetupInfo  gLimTdlsLinkSetupInfo;
+    
+    /* to track if direct link is b/g/n, this can be independent of AP link */
+#ifdef FEATURE_WLAN_TDLS_NEGATIVE
+    tANI_U32 gLimTdlsNegativeBehavior;  
+#endif
+#endif
 #ifdef FEATURE_WLAN_TDLS
     tANI_U8 gLimAddStaTdls ;
     tANI_U8 gLimTdlsLinkMode ;
@@ -911,9 +922,6 @@
      * debug marker frame.
      */
     tANI_U32 remOnChnSeqNum;
-    tANI_U32 txBdToken;
-    tANI_U32 EnableTdls2040BSSCoexIE;
-    tLimStaBAInfo staBaInfo[WLAN_MAX_STA_COUNT];
 } tAniSirLim, *tpAniSirLim;
 
 typedef struct sLimMgmtFrameRegistration
@@ -984,13 +992,6 @@
 
 } tHalMacStartParameters;
 
-typedef enum
-{
-    LIM_AUTH_ACK_NOT_RCD,
-    LIM_AUTH_ACK_RCD_SUCCESS,
-    LIM_AUTH_ACK_RCD_FAILURE,
-} tAuthAckStatus;
-
 // -------------------------------------------------------------------
 /// MAC Sirius parameter structure
 typedef struct sAniSirGlobal
@@ -1028,6 +1029,9 @@
 #ifdef FEATURE_OEM_DATA_SUPPORT
     tOemDataStruct oemData;
 #endif
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+    tCsrTdlsCtxStruct tdlsCtx ;
+#endif
     tPmcInfo     pmc;
     tSmeBtcInfo  btc;
 
@@ -1057,9 +1061,6 @@
     v_BOOL_t isTdlsPowerSaveProhibited;
 #endif
     tANI_U8 fScanOffload;
-#ifdef WLAN_FEATURE_RMC
-    tLimRmcContext  rmcContext;
-#endif /* WLAN_FEATURE_RMC */
     tANI_U8 isCoalesingInIBSSAllowed;
     tANI_U32 fEnableDebugLog;
     tANI_U32 fDeferIMPSTime;
@@ -1074,18 +1075,6 @@
     v_BOOL_t isCoexScoIndSet;
     v_U8_t miracast_mode;
     v_U8_t fBtcEnableIndTimerVal;
-    v_U8_t roamDelayStatsEnabled;
-    tANI_BOOLEAN miracastVendorConfig;
-    v_BOOL_t fActiveScanOnDFSChannels;
-    tAuthAckStatus  authAckStatus;
-    sir_mgmt_frame_ind_callback mgmt_frame_ind_cb;
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-    v_U8_t PERroamCandidatesCnt;
-    tSirCandidateChanInfo candidateChannelInfo[SIR_PER_ROAM_MAX_CANDIDATE_CNT];
-    tSirRoamAPInfo previousRoamApInfo[SIR_PER_ROAM_MAX_CANDIDATE_CNT];
-    v_U32_t PERroamTimeout;
-    v_U32_t currentBssScore;
-#endif
 } tAniSirGlobal;
 
 #ifdef FEATURE_WLAN_TDLS
diff --git a/wlan/prima/CORE/MAC/inc/aniSystemDefs.h b/wlan/prima/CORE/MAC/inc/aniSystemDefs.h
index 0eb1cce..7c0aded 100644
--- a/wlan/prima/CORE/MAC/inc/aniSystemDefs.h
+++ b/wlan/prima/CORE/MAC/inc/aniSystemDefs.h
@@ -159,7 +159,7 @@
 typedef struct sSirAddie
 {
     tANI_U16       length;
-    tANI_U8        addIEdata[SIR_MAC_MAX_ADD_IE_LENGTH+2];
+    tANI_U8        addIEdata[SIR_MAC_MAX_IE_LENGTH+2];
 } tSirAddie, *tpSirAddie;
 
 #ifdef FEATURE_WLAN_ESE
@@ -222,18 +222,6 @@
 
 } tSirMicFailureInfo, *tpSirMicFailureInfo;
 
-typedef struct sSirLostLinkParamsInfo
-{
-    tANI_U8 bssIdx;
-    tANI_U8  rssi;
-    tSirMacAddr  selfMacAddr;
-    tANI_U32 linkFlCnt;
-    tANI_U32 linkFlTx;
-    tANI_U32 lastDataRate;
-    tANI_U32 rsvd1;
-    tANI_U32 rsvd2;
-}tSirLostLinkParamsInfo, *tpSirLostLinkParamsInfo;
-
 // Boa command. Used mainly for radar info persistance
 typedef struct sBoaCommand
 {
diff --git a/wlan/prima/CORE/MAC/inc/macTrace.h b/wlan/prima/CORE/MAC/inc/macTrace.h
index 2ee4c7f..70e2936 100644
--- a/wlan/prima/CORE/MAC/inc/macTrace.h
+++ b/wlan/prima/CORE/MAC/inc/macTrace.h
@@ -33,6 +33,9 @@
 
   \author Sunit Bhatia
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/MAC/inc/qwlan_version.h b/wlan/prima/CORE/MAC/inc/qwlan_version.h
index 937076b..1458f8b 100644
--- a/wlan/prima/CORE/MAC/inc/qwlan_version.h
+++ b/wlan/prima/CORE/MAC/inc/qwlan_version.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -37,15 +37,18 @@
    Build number automaticly updated by build scripts.
 
 
+                Copyright (c) 2008-2011 QUALCOMM Incorporated.
+                All Right Reserved.
+                Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 #define QWLAN_VERSION_MAJOR            3
-#define QWLAN_VERSION_MINOR            0
-#define QWLAN_VERSION_PATCH            11
+#define QWLAN_VERSION_MINOR            8
+#define QWLAN_VERSION_PATCH            20
 #define QWLAN_VERSION_EXTRA            ""
 
-#define QWLAN_VERSION_BUILD            40
+#define QWLAN_VERSION_BUILD            23
 
-#define QWLAN_VERSIONSTR               "3.0.11.40"
+#define QWLAN_VERSIONSTR               "3.8.20.23"
 
 #endif /* QWLAN_VERSION_H */
diff --git a/wlan/prima/CORE/MAC/inc/sirApi.h b/wlan/prima/CORE/MAC/inc/sirApi.h
index 8994dc3..42b2efe 100644
--- a/wlan/prima/CORE/MAC/inc/sirApi.h
+++ b/wlan/prima/CORE/MAC/inc/sirApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -142,12 +142,10 @@
 #define WLAN_EXTSCAN_MAX_CHANNELS                 16
 #define WLAN_EXTSCAN_MAX_BUCKETS                  16
 #define WLAN_EXTSCAN_MAX_HOTLIST_APS              128
+#define WLAN_EXTSCAN_MAX_SIGNIFICANT_CHANGE_APS   64
 #define WLAN_EXTSCAN_MAX_RSSI_SAMPLE_SIZE     8
-#define WLAN_EXTSCAN_MAX_HOTLIST_SSIDS            8
 #endif /* WLAN_FEATURE_EXTSCAN */
 
-#define WLAN_DISA_MAX_PAYLOAD_SIZE                1600
-
 enum eSirHostMsgTypes
 {
     SIR_HAL_APP_SETUP_NTF = SIR_HAL_HOST_MSG_START,
@@ -176,7 +174,6 @@
 enum {
     SIR_BOOT_MODULE_ID = 1,
     SIR_HAL_MODULE_ID  = 0x10,
-    SIR_HAL_EXT_MODULE_ID  = 0x11,
     SIR_CFG_MODULE_ID = 0x12,
     SIR_LIM_MODULE_ID,
     SIR_ARQ_MODULE_ID,
@@ -341,7 +338,6 @@
     eSIR_SME_BMPS_REQ_FAILED,
     eSIR_SME_BMPS_REQ_REJECT,
     eSIR_SME_UAPSD_REQ_FAILED,
-    eSIR_SME_UAPSD_REQ_INVALID,
     eSIR_SME_WOWL_ENTER_REQ_FAILED,
     eSIR_SME_WOWL_EXIT_REQ_FAILED,
 #if defined WLAN_FEATURE_VOWIFI_11R
@@ -681,9 +677,6 @@
     tANI_BOOLEAN            pmfRequired;
 #endif
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    tANI_BOOLEAN            apHT40_24GEnabled;
-#endif
 } tSirSmeStartBssReq, *tpSirSmeStartBssReq;
 
 #define GET_IE_LEN_IN_BSS(lenInBss) ( lenInBss + sizeof(lenInBss) - \
@@ -710,7 +703,7 @@
     //used only in scan case.
     tANI_U8              channelIdSelf;
     tANI_U8              sSirBssDescriptionRsvd[3];
-    v_TIME_t nReceivedTime;     //base on a tick count. It is a time stamp, not a relative time.
+    tANI_TIMESTAMP nReceivedTime;     //base on a tick count. It is a time stamp, not a relative time.
 #if defined WLAN_FEATURE_VOWIFI
     tANI_U32       parentTSF;
     tANI_U32       startTSF[2];
@@ -719,11 +712,11 @@
     tANI_U8              mdiePresent;
     tANI_U8              mdie[SIR_MDIE_SIZE];                // MDIE for 11r, picked from the beacons
 #endif
-#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_ROAM_SCAN_OFFLOAD)
-    tANI_U8              QBSSLoad_present;
-    tANI_U8              QBSS_ChanLoad;
-    tANI_U16             QBSSLoad_avail;
+#ifdef FEATURE_WLAN_ESE
+    tANI_U16             QBSSLoad_present;
+    tANI_U16             QBSSLoad_avail; 
 #endif
+    // Please keep the structure 4 bytes aligned above the ieFields
 
     tANI_U8              fProbeRsp; //whether it is from a probe rsp
     tANI_U8              reservedPadding1;
@@ -731,14 +724,9 @@
     tANI_U8              reservedPadding3;
     tANI_U32             WscIeLen;
     tANI_U8              WscIeProbeRsp[WSCIE_PROBE_RSP_LEN];
-    tANI_U8              HTCapsPresent;
-    tANI_U8              vhtCapsPresent;
-    tANI_U8              wmeInfoPresent;
-    tANI_U8              beacomformingCapable;
-    tANI_U8              chanWidth;
-    /* Please keep the structure 4 bytes aligned above the ieFields */
+    tANI_U8              reservedPadding4;
+    
     tANI_U32             ieFields[1];
-
 } tSirBssDescription, *tpSirBssDescription;
 
 /// Definition for response message to previously
@@ -1045,8 +1033,6 @@
     tSirBssType         bsstype;                // add new type for BT -AMP STA and AP Modules
     tANI_U8             dot11mode;              // to support BT-AMP     
     tVOS_CON_MODE       staPersona;             //Persona
-    tANI_BOOLEAN        bOSENAssociation;       //HS2.0
-    tANI_BOOLEAN        bWPSAssociation;       //WPS
     ePhyChanBondState   cbMode;                 // Pass CB mode value in Join.
 
     /*This contains the UAPSD Flag for all 4 AC
@@ -1059,7 +1045,6 @@
 
     tSirMacRateSet      operationalRateSet;// Has 11a or 11b rates
     tSirMacRateSet      extendedRateSet;    // Has 11g rates
-    tANI_U16            rateBitMap;
     tSirRSNie           rsnIE;                  // RSN IE to be sent in
                                                 // (Re) Association Request
 #ifdef FEATURE_WLAN_ESE
@@ -1198,16 +1183,12 @@
     tSirMacPowerCapInfo     powerCap;
     tSirSupChnl             supportedChannels;
     tAniBool             wmmEnabledSta; /* if present - STA is WMM enabled */
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    tAniBool             HT40MHzIntoEnabledSta; /* if present - STA Enable 40 MHz Intolerant */
-#endif
     tAniBool             reassocReq;
     // Required for indicating the frames to upper layer
     tANI_U32             beaconLength;
     tANI_U8*             beaconPtr;
     tANI_U32             assocReqLength;
     tANI_U8*             assocReqPtr;
-    uint32_t             rate_flags;
 } tSirSmeAssocInd, *tpSirSmeAssocInd;
 
 
@@ -1624,7 +1605,6 @@
     tSirMacAddr         peerMacAddr;
     tAniStaStatStruct  perStaStats; // STA stats
     tANI_U16            staId;
-    tANI_U16            assocId;
     tANI_U32            reasonCode;
 } tSirSmeDisassocInd, *tpSirSmeDisassocInd;
 
@@ -1637,7 +1617,6 @@
     tSirResultCodes     statusCode;
     tSirMacAddr         bssId;            
     tSirMacAddr         peerMacAddr;
-    tANI_U16            assocId;
 } tSirSmeDisassocCnf, *tpSirSmeDisassocCnf;
 
 /// Definition for Deauthetication request
@@ -1675,7 +1654,6 @@
     tSirMacAddr         peerMacAddr;
 
     tANI_U16            staId;
-    tANI_U16            assocId;
     tANI_U32            reasonCode;
 } tSirSmeDeauthInd, *tpSirSmeDeauthInd;
 
@@ -1688,18 +1666,8 @@
     tSirResultCodes     statusCode;
     tSirMacAddr         bssId;             // AP BSSID
     tSirMacAddr        peerMacAddr;
-    tANI_U16            assocId;
 } tSirSmeDeauthCnf, *tpSirSmeDeauthCnf;
 
-typedef struct sSirSmeDisConDoneInd
-{
-    tANI_U16           messageType;
-    tANI_U16           length;
-    tANI_U8            sessionId;
-    tSirResultCodes    reasonCode;
-    tSirMacAddr        peerMacAddr;
-}tSirSmeDisConDoneInd, *tpSirSmeDisConDoneInd;
-
 /// Definition for stop BSS request message
 typedef struct sSirSmeStopBssReq
 {
@@ -1775,15 +1743,6 @@
     tSirMicFailureInfo     info;
 } tSirSmeMicFailureInd, *tpSirSmeMicFailureInd;
 
-typedef struct sSirSmeLostLinkParamsInd
-{
-    tANI_U16  messageType;
-    tANI_U16  length;
-    tANI_U8 sessionId;
-    tSirLostLinkParamsInfo info;
-} tSirSmeLostLinkParamsInd, *tpSirSmeLostLinkParamsInd;
-
-
 typedef struct sSirSmeMissedBeaconInd
 {
     tANI_U16                    messageType; // eWNI_SME_MISSED_BEACON_IND
@@ -2134,8 +2093,7 @@
     PE_GLOBAL_CLASS_B_STATS_INFO    = 0x00000004,
     PE_GLOBAL_CLASS_C_STATS_INFO    = 0x00000008,
     PE_GLOBAL_CLASS_D_STATS_INFO    = 0x00000010,
-    PE_PER_STA_STATS_INFO           = 0x00000020,
-    PE_PER_TX_PKT_STATS_INFO        = 0x00000040,
+    PE_PER_STA_STATS_INFO           = 0x00000020
 }ePEStatsMask;
 
 /*
@@ -2317,16 +2275,6 @@
 
 } tAniDHCPInd, *tpAniDHCPInd;
 
-#ifdef WLAN_FEATURE_RMC
-typedef struct sAniTXFailMonitorInd
-{
-    tANI_U16                msgType; // message type is same as the request type
-    tANI_U16                msgLen;  // length of the entire request
-    tANI_U8                 tx_fail_count;
-    void                    *txFailIndCallback;
-} tAniTXFailMonitorInd, *tpAniTXFailMonitorInd;
-#endif /* WLAN_FEATURE_RMC */
-
 typedef struct sAniSummaryStatsInfo
 {
     tANI_U32 retry_cnt[4];         //Total number of packets(per AC) that were successfully transmitted with retries
@@ -2458,13 +2406,6 @@
 
 }tAniPerStaStatsInfo, *tpAniPerStaStatsInfo;
 
-typedef struct sAniPerTxPktStatsInfo
-{
-    tANI_U32 lastTxRate;       // 802.11 data rate at which the last data frame is transmitted.
-    tANI_U32  txAvgRetry;      // Average number of retries per 10 packets.
-}tAniPerTxPktStatsInfo, *tpAniPerTxPktStatsInfo;
-
-
 /**********************PE Statistics end*************************/
 
 
@@ -3475,28 +3416,6 @@
     tANI_U8        sessionId;      // Session ID
 } tSirChangeBIParams, *tpSirChangeBIParams;
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-typedef struct sSirSetHT2040Mode
-{
-    tANI_U16       messageType;
-    tANI_U16       length;
-    tANI_U8        cbMode;
-    tSirMacAddr    bssId;
-    tANI_U8        sessionId;      // Session ID
-} tSirSetHT2040Mode, *tpSirSetHT2040Mode;
-
-typedef struct sSirHT2040CoexInfoInd
-{
-    tANI_U16       messageType; //  eWNI_SME_2040_COEX_IND
-    tANI_U16       length;
-    tANI_U8        sessionId;
-    tANI_U8        HT40MHzIntolerant;
-    tANI_U8        HT20MHzBssWidthReq;
-    tANI_U8        channel_num;
-    tANI_U8        HT2040BssIntoChanReport [1]; //variable
-}tSirHT2040CoexInfoInd, *tpSirHT2040CoexInfoInd;
-#endif
-
 typedef struct sSirOBSSHT40Param
 {
    tANI_U16 OBSSScanPassiveDwellTime;
@@ -3680,13 +3599,6 @@
     tSirMacAddr     selfMacAddr;
 }tSirSmeDelStaSelfRsp, *tpSirSmeDelStaSelfRsp;
 
-typedef enum DFSChanScanType
-{
-    DFS_CHNL_SCAN_DISABLED,
-    DFS_CHNL_SCAN_ENABLED_NORMAL,
-    DFS_CHNL_SCAN_ENABLED_ACTIVE
-}eDFSChanScanType;
-
 /* Coex Indication defines - 
    should match WLAN_COEX_IND_DATA_SIZE 
    should match WLAN_COEX_IND_TYPE_DISABLE_HB_MONITOR 
@@ -3714,7 +3626,8 @@
 
 typedef struct sSirSmeMgmtFrameInd
 {
-    tANI_U16        frameLen;
+    tANI_U16        mesgType;
+    tANI_U16        mesgLen;
     tANI_U32        rxChan;
     tANI_U8        sessionId;
     tANI_U8         frameType;
@@ -3767,107 +3680,6 @@
     tANI_U8 setMcstBcstFilter;
 }tSirWlanSetRxpFilters,*tpSirWlanSetRxpFilters;
 
-typedef struct
-{
-  //FW mail box address
-  uint64 logMailBoxAddr;
-  tANI_U32 status;
-  //Logging mail box version
-  tANI_U8 logMailBoxVer;
-  //Qshrink is enabled
-  tANI_U8 logCompressEnabled;
-  /* used to tell fwr mem dump size */
-  tANI_U32 fw_mem_dump_max_size;
-  //Reserved for future purpose
-  tANI_U32 reserved1;
-  tANI_U32 reserved2;
-}tAniLoggingInitRsp, *tpAniLoggingInitRsp;
-
-typedef void(*FWLoggingInitReqCb)(void *fwlogInitCbContext, tAniLoggingInitRsp *pRsp);
-typedef void ( *tGetFrameLogCallback) (void *pContext);
-typedef void(*RssiMonitorReqCb)(void *rssiMonitorCbContext, VOS_STATUS status);
-
-typedef struct sAniGetFrameLogReq
-{
-    tANI_U16               msgType;
-    tANI_U16               msgLen;
-    tANI_U8                getFrameLogCmdFlag;
-} tAniGetFrameLogReq,      *tpAniGetFrameLogReq;
-
-/**
- * struct s_ani_set_tx_max_pwr - Req params to set max tx power
- * @bssid: bssid to set the power cap for
- * @self_mac_addr:self mac address
- * @power: power to set in dB
- */
-struct s_ani_set_tx_max_pwr
-{
-    tSirMacAddr   bssid;
-    tSirMacAddr   self_sta_mac_addr;
-    tPowerdBm     power;
-};
-
-
-
-typedef struct sSirFWLoggingInitParam
-{
-    tANI_U8                enableFlag;
-    tANI_U8                frameType;
-    tANI_U8                frameSize;
-    tANI_U8                bufferMode;
-    tANI_U8                continuousFrameLogging;
-    tANI_U8                minLogBufferSize;
-    tANI_U8                maxLogBufferSize;
-    FWLoggingInitReqCb     fwlogInitCallback;
-    void                   *fwlogInitCbContext;
-}tSirFWLoggingInitParam,*tpSirFWLoggingInitParam;
-
-/**
- * struct sir_allowed_action_frames - Parameters to set Allowed action frames
- * @bitmask: Bits to convey the allowed action frames
- * @reserved: For future use
- */
-struct sir_allowed_action_frames {
-    uint32_t bitmask;
-    uint32_t reserved;
-};
-
-/*
- * struct rssi_monitor_req - rssi monitoring
- * @request_id: request id
- * @session_id: session id
- * @min_rssi: minimum rssi
- * @max_rssi: maximum rssi
- * @control: flag to indicate start or stop
- */
-typedef struct sSirRssiMonitorReq
-{
-    tANI_U32               requestId;
-    tANI_U32               sessionId;
-    tANI_S8                minRssi;
-    tANI_S8                maxRssi;
-    tANI_U8                currentBssId[6];
-    RssiMonitorReqCb       rssiMonitorCallback;
-    void                   *rssiMonitorCbContext;
-}tSirRssiMonitorReq, *tpSirRssiMonitorReq;
-
-
-/**
- * struct rssi_breach_event - rssi breached event structure
- * @request_id: request id
- * @curr_rssi: current rssi
- * @curr_bssid: current bssid
- */
-struct rssi_breach_event {
-        tANI_U32     request_id;
-        v_MACADDR_t  curr_bssid;
-        tANI_S8      curr_rssi;
-};
-
-typedef struct sSirFatalEventLogsReqParam
-{
-    tANI_U32 reason_code;
-}tSirFatalEventLogsReqParam, *tpSirFatalEventLogsReqParam;
 
 #ifdef FEATURE_WLAN_SCAN_PNO
 //
@@ -3928,14 +3740,14 @@
   void                *callbackContext;
   eSirPNOMode         modePNO;
   tANI_U8             ucNetworksCount; 
-  tSirNetworkType     *aNetworks;
+  tSirNetworkType     aNetworks[SIR_PNO_MAX_SUPP_NETWORKS];
   tSirScanTimersType  scanTimers;
   
   /*added by SME*/
   tANI_U16  us24GProbeTemplateLen; 
-  tANI_U8   *p24GProbeTemplate;
+  tANI_U8   p24GProbeTemplate[SIR_PNO_MAX_PB_REQ_SIZE];
   tANI_U16  us5GProbeTemplateLen; 
-  tANI_U8   *p5GProbeTemplate;
+  tANI_U8   p5GProbeTemplate[SIR_PNO_MAX_PB_REQ_SIZE]; 
 } tSirPNOScanReq, *tpSirPNOScanReq;
 
 typedef struct sSirSetRSSIFilterReq
@@ -3976,35 +3788,6 @@
 #endif //FEATURE_WLAN_SCAN_PNO
 
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-#define SIR_PER_ROAM_MAX_AP_CNT 20
-#define SIR_PER_ROAM_MAX_CANDIDATE_CNT 10
-typedef struct __attribute__((packed))
-{
-    tANI_U8    channelNumber;
-    tANI_U8    channelCCA;
-    tANI_U8    otherApCount;
-    tANI_S8    otherApRssi[SIR_PER_ROAM_MAX_AP_CNT];
-} tSirCandidateChanInfo, * tpSirCandidateChanInfo;
-
-typedef struct sPERRoamScanStart
-{
-    tANI_U16                msgType;
-    tANI_U16                msgLen;
-    tANI_U8                 start;
-} tPERRoamScanStart, *tpPERRoamScanStart;
-
-typedef struct sSirRoamAPInfo
-{
-    tSirMacAddr bssAddr;
-    unsigned int timeStamp;
-} tSirRoamAPInfo, *tpSirRoamAPInfo;
-
-typedef struct __attribute__((packed))
-{
-    tANI_U32    candidateCount;
-    tSirCandidateChanInfo  channelInfo[SIR_PER_ROAM_MAX_CANDIDATE_CNT];
-} tSirPerRoamScanResult, * tpSirPerRoamScanResult;
-
 typedef struct
 {
   tSirMacSSid ssId;
@@ -4050,35 +3833,6 @@
   tSirRoamNetworkType ConnectedNetwork;
   tSirMobilityDomainInfo MDID;
 } tSirRoamOffloadScanReq, *tpSirRoamOffloadScanReq;
-
-/**
- * struct sSirPERRoamOffloadScanReq - Offload PER config params
- * @sessionId: session id
- * @rateUpThreshold: rate at which to stop monitoring the rate
- * @rateDownThreshold: rate at which to start monitoring
- * @isPERRoamCCAEnabled: CCA sensing is enabled or disabled
- * @waitPeriodForNextPERScan: time to wait before start monitoring again once a
- * scan has been triggered
- * @PERtimerThreshold: time to collect stats to trigger roam scan
- * @PERroamTriggerPercent: minimum percentage of packets needs to be below
- * rateDownThreshold to trigger a roam scan
- */
-typedef struct sSirPERRoamOffloadScanReq
-{
-  tANI_U16  sessionId;
-  tANI_U16  rateUpThreshold;
-  tANI_U16  rateDownThreshold;
-  tANI_U16  isPERRoamCCAEnabled;
-  tANI_U32  waitPeriodForNextPERScan;
-  tANI_U32  PERtimerThreshold;
-  tANI_U32  PERroamTriggerPercent;
-} tSirPERRoamOffloadScanReq, *tpSirPERRoamOffloadScanReq;
-
-typedef struct sSirPERRoamTriggerScanReq
-{
-  tANI_BOOLEAN roamScanReq;
-} tSirPERRoamTriggerScanReq, *tpSirPERRoamTriggerScanReq;
-
 #endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
 
 #define SIR_NOCHANGE_POWER_VALUE  0xFFFFFFFF
@@ -4410,7 +4164,6 @@
     tANI_U16            transactionId; // Transaction ID for cmd
     tSirResultCodes        statusCode;
     tSirMacAddr            peerMac;
-    tANI_U16            sta_idx;
 }tSirTdlsLinkEstablishReqRsp, *tpSirTdlsLinkEstablishReqRsp;
 
 /* TDLS Request struct SME-->PE */
@@ -4481,16 +4234,175 @@
     tANI_U16            transactionId; // Transaction ID for cmd
     tSirResultCodes        statusCode;
     tSirMacAddr            peerMac;
-    tANI_U16            sta_idx;
 }tSirTdlsChanSwitchReqRsp, *tpSirTdlsChanSwitchReqRsp;
 #endif /* FEATURE_WLAN_TDLS */
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+typedef enum tdlsListType
+{
+    TDLS_DIS_LIST,
+    TDLS_SETUP_LIST
+}eTdlsListType ;
+
+typedef enum tdlsStates
+{
+    TDLS_LINK_IDLE_STATE,
+    TDLS_LINK_DIS_INIT_STATE,
+    TDLS_LINK_DIS_RSP_WAIT_STATE,
+    TDLS_DIS_REQ_PROCESS_STATE,
+    TDLS_DIS_RSP_SENT_WAIT_STATE,
+    TDLS_DIS_RSP_SENT_DONE_STATE,
+    TDLS_LINK_DIS_DONE_STATE,
+    TDLS_LINK_SETUP_START_STATE,
+    TDLS_LINK_SETUP_WAIT_STATE,
+    TDLS_LINK_SETUP_RSP_WAIT_STATE,
+    TDLS_LINK_SETUP_DONE_STATE,
+    TDLS_LINK_TEARDOWN_START_STATE,
+    TDLS_LINK_TEARDOWN_DONE_STATE,
+    TDLS_LINK_SETUP_STATE
+}eSirTdlsStates ;
+
+typedef struct sSirTdlsPeerInfo
+{
+    tSirMacAddr peerMac;
+    tANI_U8     sessionId;
+    tANI_U8     dialog ;
+    tSirMacCapabilityInfo capabilityInfo ;
+    tSirMacRateSet  tdlsPeerSuppRates ;
+    tSirMacRateSet  tdlsPeerExtRates ;
+    //tDot11fIEHTCaps tdlsPeerHtCaps ;
+    tSirMacHTCapabilityInfo tdlsPeerHtCaps ;
+    tSirMacHTParametersInfo tdlsPeerHtParams ;
+    tSirMacExtendedHTCapabilityInfo tdlsPeerHtExtCaps ;
+    tANI_U8  supportedMCSSet[SIZE_OF_SUPPORTED_MCS_SET];
+
+    //tDot11fIEExtCapability tdlsPeerExtenCaps ;
+    tSirMacRsnInfo tdlsPeerRsn ;
+    tANI_U16 tdlsPeerFtIe ;
+    tANI_U16 tdlsPeerTimeoutIntvl ;
+    tANI_U16 tdlsPeerSuppChan ;
+    tANI_U16 tdlsPeerSuppReguClass ;
+    tANI_S8  tdlsPeerRssi ;
+    tANI_U16 tdlsPeerState ;
+    /* flags to indicate optional IE's are in */
+    tANI_U8  ExtRatesPresent ;
+    tANI_U8  rsnIePresent ;
+    tANI_U8  htCapPresent ;
+    tANI_U8  delStaNeeded ;
+
+} tSirTdlsPeerInfo, *tpSirSmeTdlsPeerInfo ;
+
+/* TDLS Request struct SME-->PE */
+typedef struct sSirTdlsDiscoveryReq
+{
+    tANI_U16            messageType;   // eWNI_SME_TDLS_DISCOVERY_START_REQ
+    tANI_U16            length;
+    tANI_U8             sessionId;     // Session ID
+    tANI_U16            transactionId; // Transaction ID for cmd
+    tANI_U8             reqType;
+    tANI_U8             dialog;
+    tSirMacAddr         bssid;         // For multi-session, for PE to locate peSession ID
+    tSirMacAddr         peerMac;
+} tSirTdlsDisReq, *tpSirSmeTdlsDisReq ;
+
+typedef struct sSirTdlsLinkSetupReq
+{
+    tANI_U16            messageType;   // eWNI_SME_TDLS_LINK_START_REQ
+    tANI_U16            length;
+    tANI_U8             sessionId;     // Session ID
+    tANI_U16            transactionId; // Transaction ID for cmd
+    tANI_U8             dialog;
+    tSirMacAddr         bssid;         // For multi-session, for PE to locate peSession ID
+    tSirMacAddr         peerMac;
+} tSirTdlsSetupReq, *tpSirSmeTdlsSetupReq ;
+
+typedef struct sSirTdlsTeardownReq
+{
+    tANI_U16            messageType;   // eWNI_SME_TDLS_TEARDOWN_REQ
+    tANI_U16            length;
+    tANI_U8             sessionId;     // Session ID
+    tANI_U16            transactionId; // Transaction ID for cmd
+    tSirMacAddr         bssid;         // For multi-session, for PE to locate peSession ID
+    tSirMacAddr         peerMac;
+} tSirTdlsTeardownReq, *tpSirSmeTdlsTeardownReq ;
+
+
+/* TDLS response struct  PE-->SME */
+typedef struct sSirTdlsDiscoveryRsp
+{
+    tANI_U16               messageType;
+    tANI_U16               length;
+    tSirResultCodes        statusCode;
+    tANI_U16               numDisSta ;
+    tSirTdlsPeerInfo       tdlsDisPeerInfo[0];
+} tSirTdlsDisRsp, *tpSirSmeTdlsDiscoveryRsp;
+
+typedef struct sSirTdlsLinkSetupRsp
+{
+    tANI_U16               messageType;
+    tANI_U16               length;
+    tSirResultCodes        statusCode;
+    tSirMacAddr            peerMac;
+} tSirTdlsLinksetupRsp ;
+
+typedef struct sSirTdlsLinkSetupInd
+{
+    tANI_U16               messageType;
+    tANI_U16               length;
+    tSirResultCodes        statusCode;
+    tSirMacAddr            peerMac;
+} tSirTdlsLinkSetupInd ;
+
+
+typedef struct sSirTdlsTeardownRsp
+{
+    tANI_U16               messageType;
+    tANI_U16               length;
+    tSirResultCodes        statusCode;
+    tSirMacAddr            peerMac;
+} tSirTdlsTeardownRsp ;
+
+typedef struct sSirTdlsPeerInd
+{
+    tANI_U16               messageType;
+    tANI_U16               length;
+    tSirMacAddr            peerMac;
+    tANI_U8                sessionId;     // Session ID
+    tANI_U16               staId ;
+    tANI_U16               staType ;
+    tANI_U8                ucastSig;
+    tANI_U8                bcastSig;
+} tSirTdlsPeerInd ;
+
+typedef struct sSirTdlsLinkEstablishInd
+{
+    tANI_U16               messageType;
+    tANI_U16               length;
+    tANI_U8                bIsResponder;  /* if this is 1, self is initiator and peer is reponder */
+    tANI_U8                linkIdenOffset;  /* offset of LinkIdentifierIE.bssid[0] from ptiTemplateBuf */
+    tANI_U8                ptiBufStatusOffset; /* offset of BufferStatus from ptiTemplateBuf */
+    tANI_U8                ptiTemplateLen;
+    tANI_U8                ptiTemplateBuf[64];
+    tANI_U8                extCapability[8];
+/*  This will be part of PTI template when sent by PE  
+    tANI_U8                linkIdentifier[20];
+*/    
+} tSirTdlsLinkEstablishInd, *tpSirTdlsLinkEstablishInd;
+
+typedef struct sSirTdlsLinkTeardownInd
+{
+   tANI_U16               messageType;
+   tANI_U16               length;
+   tANI_U16               staId;
+} tSirTdlsLinkTeardownInd, *tpSirTdlsLinkTeardownInd;
+
+#endif  /* FEATURE_WLAN_TDLS_INTERNAL */
+
 typedef struct sSirActiveModeSetBcnFilterReq
 {
    tANI_U16               messageType;
    tANI_U16               length;
    tANI_U8                seesionId;
-   tSirMacAddr            bssid;
 } tSirSetActiveModeSetBncFilterReq, *tpSirSetActiveModeSetBncFilterReq;
 
 typedef enum
@@ -4504,7 +4416,6 @@
    tANI_U16               messageType;
    tANI_U16               length;
    tANI_U8                seesionId;
-   tSirMacAddr            bssid;
 } tSirSmeHT40OBSSStopScanInd, *tpSirSmeHT40OBSSStopScanInd;
 
 typedef struct sSirSmeHT40OBSSScanInd
@@ -4567,9 +4478,6 @@
     tANI_U8   sessionId;
     tANI_U8   bssid[WNI_CFG_BSSID_LEN];
     tANI_U8   channel;
-#ifndef QCA_WIFI_ISOC
-    tANI_U8   handoff_src;
-#endif
 } tAniHandoffReq, *tpAniHandoffReq;
 
 typedef struct sSirScanOffloadReq {
@@ -4636,7 +4544,6 @@
 
 typedef struct sSirUpdateChan
 {
-    tANI_U8 regId;
     tANI_U8 numChan;
     tSirUpdateChanParam chanParam[1];
 } tSirUpdateChanList, *tpSirUpdateChanList;
@@ -4761,10 +4668,10 @@
      * 0 implies MCAST RA, positive value implies fixed rate,
      * -1 implies ignore this param
      */
-    tANI_S32 rmcDataRate;//unit Mbpsx10
+    tANI_S32 reliableMcastDataRate;//unit Mbpsx10
 
     /* TX flag to differentiate between HT20, HT40 etc */
-    tTxrateinfoflags rmcDataRateTxFlag;
+    tTxrateinfoflags reliableMcastDataRateTxFlag;
 
     /*
      * MCAST(or BCAST) fixed data rate in 2.4 GHz, unit Mbpsx10,
@@ -4786,102 +4693,6 @@
 
 } tSirRateUpdateInd, *tpSirRateUpdateInd;
 
-#ifdef WLAN_FEATURE_RMC
-
-#define SIR_RMC_NUM_MAX_RULERS  8  /* HAL_NUM_MAX_RULERS */
-typedef struct sSirSetRMCReq
-{
-    tANI_U16       msgType;
-    tANI_U16       msgLen;
-    tSirMacAddr    mcastTransmitter;
-} tSirSetRMCReq, *tpSirSetRMCReq;
-
-typedef struct sSirRMCInfo
-{
-    tANI_U32      dialogToken;
-    tANI_U8       action;
-    tSirMacAddr   mcastRuler;
-} tSirRMCInfo, *tpSirRMCInfo;
-
-typedef struct sSirRmcRulerSelectInd
-{
-    tANI_U16      status;
-    tSirMacAddr   mcastTransmitter;
-    tSirMacAddr   mcastGroup;
-    tSirMacAddr   ruler[SIR_RMC_NUM_MAX_RULERS];
-} tSirRmcRulerSelectInd, *tpSirRmcRulerSelectInd;
-
-typedef struct sSirRmcBecomeRulerInd
-{
-    tANI_U16      status;
-    tSirMacAddr   mcastTransmitter;
-    tSirMacAddr   mcastGroup;
-} tSirRmcBecomeRulerInd, *tpSirRmcBecomeRulerInd;
-
-typedef struct sSirRmcRulerReq
-{
-    // Common for all types are requests
-    tANI_U16      msgType; // message type is same as the request type
-    tANI_U16      msgLen;  // length of the entire request
-    tANI_U8       cmd;     // tRulerReqCmdType
-    tSirMacAddr   mcastTransmitter;
-    tSirMacAddr   mcastGroup;
-    tSirMacAddr   blacklist[SIR_RMC_NUM_MAX_RULERS];
-} tSirRmcRulerReq, *tpSirRmcRulerReq;
-
-typedef struct sSirRmcUpdateInd
-{
-    // Common for all types are requests
-    tANI_U16      msgType;    // message type is same as the request type
-    tANI_U16      msgLen;     // length of the entire request
-    tANI_U8       indication; // trulerUpdateIndType
-    tANI_U8       role;       // tRoleType
-    tSirMacAddr   mcastTransmitter;
-    tSirMacAddr   mcastGroup;
-    tSirMacAddr   mcastRuler;
-    tSirMacAddr   ruler[SIR_RMC_NUM_MAX_RULERS];
-} tSirRmcUpdateInd, *tpSirRmcUpdateInd;
-
-/*---------------------------------------------------------------------------
-* tSirIbssGetPeerInfoReqParams
-*--------------------------------------------------------------------------*/
-typedef struct
-{
-    tANI_BOOLEAN    allPeerInfoReqd; // If set, all IBSS peers stats are reported
-    tANI_U8         staIdx;          // If allPeerInfoReqd is not set, only stats
-                                     // of peer with staIdx is reported
-}tSirIbssGetPeerInfoReqParams, *tpSirIbssGetPeerInfoReqParams;
-
-/*---------------------------------------------------------------------------
-* tSirIbssGetPeerInfoParams
-*--------------------------------------------------------------------------*/
-typedef struct
-{
-   tANI_U8  staIdx;      //StaIdx
-   tANI_U32 txRate;       //Tx Rate
-   tANI_U32 mcsIndex;    //MCS Index
-   tANI_U32 txRateFlags; //TxRate Flags
-   tANI_S8  rssi;        //RSSI
-}tSirIbssPeerInfoParams;
-
-typedef struct
-{
-   tANI_U32   status;
-   tANI_U8    numPeers;
-   tSirIbssPeerInfoParams  peerInfoParams[32];
-}tSirPeerInfoRspParams, *tpSirIbssPeerInfoRspParams;
-
-/*---------------------------------------------------------------------------
-* tSirIbssGetPeerInfoRspParams
-*--------------------------------------------------------------------------*/
-typedef struct
-{
-   tANI_U16   mesgType;
-   tANI_U16   mesgLen;
-   tSirPeerInfoRspParams ibssPeerInfoRspParams;
-} tSirIbssGetPeerInfoRspParams, *tpSirIbssGetPeerInfoRspParams;
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
 // Set batch scan resposne from FW
 typedef struct
@@ -4953,7 +4764,7 @@
 #endif // FEATURE_WLAN_BATCH_SCAN
 
 #ifdef FEATURE_WLAN_CH_AVOID
-#define SIR_CH_AVOID_MAX_RANGE   15
+#define SIR_CH_AVOID_MAX_RANGE   4
 
 typedef struct sSirChAvoidFreqType
 {
@@ -4970,25 +4781,6 @@
 
 typedef void (*pGetBcnMissRateCB)( tANI_S32 bcnMissRate,
                                    VOS_STATUS status, void *data);
-typedef void (*tSirFWStatsCallback)(VOS_STATUS status,
-                    tSirFwStatsResult *fwStatsRsp, void *pContext);
-typedef void (*sir_mgmt_frame_ind_callback)(tSirSmeMgmtFrameInd *frame_ind);
-
-typedef void (*tAntennaDivSelCB)(int antennaId, void *pContext);
-
-/**
- * struct sir_sme_mgmt_frame_cb_req - Register a
- * management frame callback req
- * @message_type: message id
- * @length: msg length
- * @callback: callback for management frame indication
- */
-struct sir_sme_mgmt_frame_cb_req
-{
-  tANI_U16 message_type;
-  tANI_U16 length;
-  sir_mgmt_frame_ind_callback callback;
-};
 
 typedef PACKED_PRE struct PACKED_POST
 {
@@ -5029,39 +4821,6 @@
   u8   stopReq;
 }tSirLLStatsClearReq, *tpSirLLStatsClearReq;
 
-typedef PACKED_PRE struct PACKED_POST
-{
-  u32 stats;
-  tSirFWStatsCallback callback;
-  void *data;
-}tSirFWStatsGetReq;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-  tSirFWStatsCallback callback;
-  void *data;
-}tSirFWStatsInfo;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-  tANI_U16 status;
-  tANI_U32 selectedAntennaId;
-  tANI_U32 reserved;
-} tSirAntennaDivSelRsp, *tpSirntennaDivSelRsp;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tAntennaDivSelCB callback;
-   void *data;
-   tANI_U32 reserved;
-}tSirAntennaDiversitySelectionReq;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tAntennaDivSelCB callback;
-   void *data;
-}tSirAntennaDiversitySelectionInfo;
-
 /*---------------------------------------------------------------------------
   WLAN_HAL_LL_NOTIFY_STATS
 ---------------------------------------------------------------------------*/
@@ -5332,32 +5091,6 @@
     tANI_U32 contentionNumSamples;
 } tSirWifiWmmAcStat, *tpSirWifiWmmAcStat;
 
-#ifdef FEATURE_EXT_LL_STAT
-typedef PACKED_PRE struct PACKED_POST
-{
-    /* Average Beacon spread offset is the averaged
-     * time delay between TBTT and beacon TSF
-     */
-    tANI_U64 avg_bcn_spread;
-    /* Average number of frames received from AP after
-     * receiving the ACK for a frame with PM=1
-     */
-    tANI_U32 avg_rx_frms_leaked;
-    /* Rx leak watch window currently in force to minimize data loss
-     * because of leaky AP. Rx leak window is the time driver waits
-     * before shutting down the radio or switching the channel and
-     * after receiving an ACK for a data frame with PM bit set)
-     */
-    tANI_U32 rx_leak_window;
-
-    /* Takes value of 1 if AP leaks packets after sending
-     * an ACK for PM=1 otherwise 0
-     */
-    tANI_U32 is_leaky_ap;
-
-} tSirWifiIfaceLeakyApStat, *tpSirWifiIfaceLeakyApStat;
-#endif
-
 /* Interface statistics - corresponding to 2nd most
  * LSB in wifi statistics bitmap  for getting statistics
  */
@@ -5382,10 +5115,6 @@
     tANI_S32            rssiAck;
     // per ac data packet statistics
     tSirWifiWmmAcStat    AccessclassStats[WIFI_AC_MAX];
-#ifdef FEATURE_EXT_LL_STAT
-    //Leaky Ap Stats
-    tSirWifiIfaceLeakyApStat leakyApStat;
-#endif
 } tSirWifiIfaceStat, *tpSirWifiIfaceStat;
 
 /* Peer statistics - corresponding to 3rd most LSB in
@@ -5434,8 +5163,6 @@
 
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
 
-
-
 #ifdef WLAN_FEATURE_EXTSCAN
 
 typedef enum
@@ -5465,6 +5192,7 @@
    tSirMacAddr  bssid;   // AP BSSID
    tANI_S32     low;     // low threshold
    tANI_S32     high;    // high threshold
+   tANI_U32     channel; // channel hint
 } tSirAPThresholdParam, *tpSirAPThresholdParam;
 
 typedef struct
@@ -5485,10 +5213,9 @@
     tANI_U32      maxScanReportingThreshold;
 
     tANI_U32      maxHotlistAPs;
-    tANI_U32      maxHotlistSSIDs;
+    tANI_U32      maxSignificantWifiChangeAPs;
 
     tANI_U32      maxBsidHistoryEntries;
-
 } tSirEXTScanCapabilitiesEvent, *tpSirEXTScanCapabilitiesEvent;
 
 /* WLAN_HAL_EXT_SCAN_RESULT_IND */
@@ -5523,72 +5250,21 @@
     tANI_U16      capability;          // capabilities advertised in the beacon
 } tSirWifiScanResult, *tpSirWifiScanResult;
 
-/**
- * struct tExtscanCachedScanResult - extscan cached scan result
- * @scan_id: a unique identifier for the scan unit
- * @flags: a bitmask with additional information about scan
- * @num_results: number of bssids retrieved by the scan
- * @ap: wifi scan bssid results info
- */
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U16            scan_id;
-    tANI_U8             flags;
-    tANI_U8             num_results;
-
-    tSirWifiScanResult   ap[32];
-} tExtscanCachedScanResult, *tpExtscanCachedScanResult;
-
 /* WLAN_HAL_BSSID_HOTLIST_RESULT_IND */
 
 typedef PACKED_PRE struct PACKED_POST
 {
     tANI_U32             requestId;
-    tANI_BOOLEAN         bss_found;
-    tANI_U32             numHotlistBss;     // numbers of APs
+    tANI_U32             numOfAps;     // numbers of APs
 
     /*
      * 0 for last fragment
      * 1 still more fragment(s) coming
      */
     tANI_BOOLEAN         moreData;
-    tSirWifiScanResult   bssHotlist[1];
-} tSirEXTScanHotlistMatch, *tpSirEXTScanHotlistMatch;
-
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U32             requestId;
-    /*
-     * It gives number of scan ids
-     */
-    tANI_U32             scanResultSize;
-
-    /*
-     * 0 for last fragment
-     * 1 still more fragment(s) coming
-     */
-    tANI_BOOLEAN         moreData;
-    tANI_U8 result[1];
+    tSirWifiScanResult    ap[1];
 } tSirWifiScanResultEvent, *tpSirWifiScanResultEvent;
 
-/* WLAN_HAL_SSID_HOTLIST_RESULT_IND */
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U32             requestId;
-    tANI_BOOLEAN         ssid_found;
-    tANI_U32             numHotlistSsid;     // numbers of SSIDs
-
-    /*
-     * 0 for last fragment
-     * 1 still more fragment(s) coming
-     */
-    tANI_BOOLEAN         moreData;
-    tSirWifiScanResult   ssidHotlist[1];
-} tSirEXTScanSsidHotlistMatch, *tpSirEXTScanSsidHotlistMatch;
-
 typedef PACKED_PRE struct PACKED_POST
 {
     tANI_U8       elemId;       // Element Identifier
@@ -5644,10 +5320,6 @@
      */
     tANI_U8      reportEvents;
 
-    tANI_U32        max_period;
-    tANI_U32        exponent;
-    tANI_U32        step_count;
-
     tANI_U8      numChannels;
 
     /*
@@ -5664,12 +5336,9 @@
     tANI_U32                maxAPperScan;
 
     /* in %, when buffer is this much full, wake up host */
-    tANI_U32                reportThresholdPercent;
-    tANI_U32                reportThresholdNumScans;
+    tANI_U32                reportThreshold;
 
-    tANI_U32                homeAwayTime;       //in units of milliseconds
-
-    tANI_U8                 numBuckets;
+    tANI_U8               numBuckets;
     tSirWifiScanBucketSpec  buckets[WLAN_EXTSCAN_MAX_BUCKETS];
 } tSirEXTScanStartReqParams, *tpSirEXTScanStartReqParams;
 
@@ -5695,8 +5364,8 @@
 {
     tANI_U32               requestId;
     tANI_U8                sessionId;    // session Id mapped to vdev_id
-    tANI_U32               lostBssidSampleSize;
-    tANI_U32               numBssid;        // number of hotlist APs
+
+    tANI_U32               numAp;        // number of hotlist APs
     tSirAPThresholdParam   ap[WLAN_EXTSCAN_MAX_HOTLIST_APS];    // hotlist APs
 } tSirEXTScanSetBssidHotListReqParams, *tpSirEXTScanSetBssidHotListReqParams;
 
@@ -5720,46 +5389,65 @@
 
 typedef struct
 {
+    tANI_U32              requestId;
+    tANI_U8               sessionId;
+
+    /* number of samples for averaging RSSI */
+    tANI_U32              rssiSampleSize;
+
+    /* number of missed samples to confirm AP loss */
+    tANI_U32              lostApSampleSize;
+
+    /* number of APs breaching threshold required for firmware
+     * to generate event
+     */
+    tANI_U32              minBreaching;
+
+    tANI_U32              numAp;
+    tSirAPThresholdParam  ap[WLAN_EXTSCAN_MAX_SIGNIFICANT_CHANGE_APS];
+} tSirEXTScanSetSignificantChangeReqParams,
+ *tpSirEXTScanSetSignificantChangeReqParams;
+
+typedef PACKED_PRE struct PACKED_POST
+{
+    tANI_U32        requestId;
+    tANI_U32        status;
+} tSirEXTScanSetSignificantChangeRspParams,
+  *tpSirEXTScanSetSignificantChangeRspParams;
+
+/*---------------------------------------------------------------------------
+ * WLAN_HAL_SIG_RSSI_RESULT_IND
+ *-------------------------------------------------------------------------*/
+
+typedef PACKED_PRE struct PACKED_POST
+{
+   tSirMacAddr bssid;                  // BSSID
+   tANI_U32  channel;                   // channel frequency in MHz
+   tANI_U8   numRssi;                    // number of rssi samples
+   tANI_S32   rssi[WLAN_EXTSCAN_MAX_RSSI_SAMPLE_SIZE]; // RSSI history in db
+} tSirSigRssiResultParams, *tpSirSigRssiResultParams;
+
+typedef PACKED_PRE struct PACKED_POST
+{
+    tANI_U32     requestId;
+    tANI_U32     numSigRssiBss;
+    tANI_BOOLEAN moreData;
+    tSirSigRssiResultParams sigRssiResult[1];
+} tSirWifiSignificantChangeEvent, *tpSirWifiSignificantChangeEvent;
+
+typedef struct
+{
     tANI_U32      requestId;
     tANI_U8       sessionId;
-} tSirEXTScanResetSsidHotlistReqParams, *tpSirEXTScanResetSsidHotlistReqParams;
+} tSirEXTScanResetSignificantChangeReqParams,
+  *tpSirEXTScanResetSignificantChangeReqParams;
 
 typedef PACKED_PRE struct PACKED_POST
 {
     tANI_U32      requestId;
     tANI_U32      status;
-} tSirEXTScanResetSsidHotlistRspParams, *tpSirEXTScanResetSsidHotlistRspParams;
-
-
-/**
- * struct sir_ssid_hotlist_param - param for SSID Hotlist
- * @ssid: SSID which is being hotlisted
- * @band: Band in which the given SSID should be scanned
- * @rssi_low: Low bound on RSSI
- * @rssi_high: High bound on RSSI
- */
-typedef struct
-{
-    tSirMacSSid ssid;
-    tANI_U8 band;
-    tANI_S32 rssi_low;
-    tANI_S32 rssi_high;
-}tSirSsidThresholdParam, *tpSirSsidThresholdParam;
-
-typedef struct
-{
-    tANI_U32 request_id;
-    tANI_U8 session_id;
-    tANI_U32 lost_ssid_sample_size;
-    tANI_U32 ssid_count;
-    tSirSsidThresholdParam ssid[WLAN_EXTSCAN_MAX_HOTLIST_SSIDS];
-}tSirEXTScanSetSsidHotListReqParams, *tpSirEXTScanSetSsidHotListReqParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U32      requestId;
-    tANI_U32      status;
-} tSirEXTScanSetSsidHotListRspParams, *tpSirEXTScanSetSsidHotListRspParams;
+} tSirEXTScanResetSignificantChangeRspParams,
+  *tpSirEXTScanResetSignificantChangeRspParams;
 
 /*---------------------------------------------------------------------------
  *  * WLAN_HAL_EXTSCAN_RESULT_AVAILABLE_IND
@@ -5796,11 +5484,7 @@
 }tSirEXTScanProgressIndParams,
  *tpSirEXTScanProgressIndParams;
 
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_BOOLEAN  pause; // 1 -> pause, 0 -> unpause
-    tANI_U32      reserved; //reserved for future use
-}tSirHighPriorityDataInfoInd, *tpSirHighPriorityDataInfoInd;
+
 
 #endif /* WLAN_FEATURE_EXTSCAN */
 
@@ -5811,247 +5495,4 @@
     tSirMacAddr    macAddr;
 } tSirSpoofMacAddrReq, *tpSirSpoofMacAddrReq;
 
-typedef struct
-{
-   //BIT order is most likely little endian.
-   //This structure is for netowkr-order byte array (or big-endian byte order)
-#ifndef WLAN_PAL_BIG_ENDIAN_BIT
-   tANI_U8 protVer :2;
-   tANI_U8 type :2;
-   tANI_U8 subType :4;
-
-   tANI_U8 toDS :1;
-   tANI_U8 fromDS :1;
-   tANI_U8 moreFrag :1;
-   tANI_U8 retry :1;
-   tANI_U8 powerMgmt :1;
-   tANI_U8 moreData :1;
-   tANI_U8 wep :1;
-   tANI_U8 order :1;
-
-#else
-
-   tANI_U8 subType :4;
-   tANI_U8 type :2;
-   tANI_U8 protVer :2;
-
-   tANI_U8 order :1;
-   tANI_U8 wep :1;
-   tANI_U8 moreData :1;
-   tANI_U8 powerMgmt :1;
-   tANI_U8 retry :1;
-   tANI_U8 moreFrag :1;
-   tANI_U8 fromDS :1;
-   tANI_U8 toDS :1;
-
-#endif
-
-} tSirFC;
-
-typedef struct
-{
-   /* Frame control field */
-   tSirFC   frameCtrl;
-   /* Duration ID */
-   tANI_U16 usDurationId;
-   /* Address 1 field  */
-   tSirMacAddr vA1;
-   /* Address 2 field */
-   tSirMacAddr vA2;
-   /* Address 3 field */
-   tSirMacAddr vA3;
-   /* Sequence control field */
-   tANI_U16 sSeqCtrl;
-   /* Optional A4 address */
-   tSirMacAddr optvA4;
-   /* Optional QOS control field */
-   tANI_U16  usQosCtrl;
-}tSir80211Header;
-// Definition for Encryption Keys
-//typedef struct sSirKeys
-typedef struct
-{
-    tANI_U8                  keyId;
-    tANI_U8                  unicast;     // 0 for multicast
-    tAniKeyDirection    keyDirection;
-    tANI_U8                  keyRsc[WLAN_MAX_KEY_RSC_LEN];   // Usage is unknown
-    tANI_U8                  paeRole;     // =1 for authenticator,
-                                     // =0 for supplicant
-    tANI_U16                 keyLength;
-    tANI_U8                  key[SIR_MAC_MAX_KEY_LENGTH];
-} tMacKeys, *tpMacKeys;
-
-typedef enum
-{
-    eMAC_WEP_STATIC,
-    eMAC_WEP_DYNAMIC,
-} tMacWepType;
-
-/*
- * This is used by PE to configure the key information on a given station.
- * When the secType is WEP40 or WEP104, the defWEPIdx is used to locate
- * a preconfigured key from a BSS the station assoicated with; otherwise
- * a new key descriptor is created based on the key field.
- */
-//typedef struct
-typedef struct
-{
-    tANI_U16          staIdx;
-    tAniEdType        encType;        // Encryption/Decryption type
-    tMacWepType       wepType;        // valid only for WEP
-    tANI_U8           defWEPIdx;      // Default WEP key, valid only for static WEP, must between 0 and 3
-    tMacKeys         key[SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS];            // valid only for non-static WEP encyrptions
-    tANI_U8          singleTidRc;    // 1=Single TID based Replay Count, 0=Per TID based RC
-    tANI_U8          sessionId; // PE session id for PE<->HAL interface
-} tSirSetStaKeyParams, *tpSirSetStaKeyParams;
-
-//typedef struct
-typedef struct
-{
-    tSirSetStaKeyParams keyParams;
-    tANI_U8 pn[6];
-}tSirencConfigParams;
-
-typedef struct
-{
-    tANI_U16 length;
-    tANI_U8 data[WLAN_DISA_MAX_PAYLOAD_SIZE];
-}tSirpayload;
-
-typedef struct
-{
-    tSir80211Header macHeader;
-    tSirencConfigParams encParams;
-    tSirpayload data;
-}tSirpkt80211;
-
-typedef struct
-{
-   tANI_U32 status;
-   tSirpayload  encryptedPayload;
-} tSetEncryptedDataRspParams, *tpSetEncryptedDataRspParams;
-
-typedef struct
-{
-   tANI_U16   mesgType;
-   tANI_U16   mesgLen;
-   tSetEncryptedDataRspParams   encryptedDataRsp;
-} tSirEncryptedDataRspParams, *tpSirEncryptedDataRspParams;
-
-typedef enum eSirAbortScanStatus
-{
-    eSIR_ABORT_ACTIVE_SCAN_LIST_EMPTY,
-    eSIR_ABORT_ACTIVE_SCAN_LIST_NOT_EMPTY,
-    eSIR_ABORT_SCAN_FAILURE
-}tSirAbortScanStatus;
-
-/* Max number of rates allowed in Supported Rates IE */
-#define MAX_NUM_SUPPORTED_RATES (8)
-
-typedef struct sSirSmeUpdateMaxRateParams
-{
-    tANI_U32        maxRateFlag;
-    tANI_U8         smeSessionId;
-}tSirSmeUpdateMaxRateParams, *tpSirSmeUpdateMaxRateParams;
-
-typedef struct
-{
-    tANI_U32 event_data_len;
-    tANI_U8  event_data[1];
-} tSirNanEvent, *tpSirNanEvent;
-
-typedef struct
-{
-    tANI_U32 txCompleteStatus;
-    tANI_U32 txBdToken;
-}tSirTxBdStatus, *tpSirTxBdStatus;
-
-/* enable or disable 20_40 BSS Coexistence IE in TDLS frames*/
-typedef struct
-{
-    // Common for all types are requests
-    tANI_U16    msgType;    // message type is same as the request type
-    tANI_U16    msgLen;     // length of the entire request
-    tANI_U8     SetTdls2040BSSCoex; //enabled or disabled
-} tAniSetTdls2040BSSCoex, *tpAniSetTdls2040BSSCoex;
-
-/**
- * struct sir_wifi_start_log - Structure to store the params sent to start/
- * stop logging
- * @ringId:        Attribute which indicates the type of logging like per packet
- *                 statistics, connectivity etc.
- * @verboseLevel: Verbose level which can be 0,1,2,3
- * @flag:          Flag field for future use
- */
-typedef struct sir_wifi_start_log {
-    tANI_U32 ringId;
-    tANI_U32 verboseLevel;
-    tANI_U32 flag;
-}tAniWifiStartLog, *tpAniWifiStartLog;
-
-typedef struct
-{
-    tANI_U16   mesgType;
-    tANI_U16   mesgLen;
-    tSirMacAddr bssid;
-}tSirDelAllTdlsPeers, *ptSirDelAllTdlsPeers;
-
-typedef void (*tSirMonModeCb)(tANI_U32 *magic, struct completion *cmpVar);
-typedef struct
-{
-    tANI_U32 *magic;
-    struct completion *cmpVar;
-    void *data;
-    tSirMonModeCb callback;
-}tSirMonModeReq, *ptSirMonModeReq;
-
-/**
- * struct tAniFwrDumpRsp - firmware dump response details.
- *
- * This structure is used to store the firmware dump
- * response from the firmware.
- */
-typedef struct
-{
-    tANI_U32 dump_status;
-}tAniFwrDumpRsp, *tpAniFwrDumpRsp;
-
-typedef void (*FWMemDumpReqCb)(void *fwMemDumpReqContext, tAniFwrDumpRsp *dump_rsp);
-
-/**
- * struct tAniFwrDumpReq - firmware memory dump request details.
-.*.@FWMemDumpReqCb - Associated Callback
- *.@fwMemDumpReqContext - Callback context
- * @reserved - reserved field 1.
- *
- * This structure carries information about the firmware
- * memory dump request.
- */
-typedef struct
-{
-    FWMemDumpReqCb  fwMemDumpReqCallback;
-    void *          fwMemDumpReqContext;
-    tANI_U32        reserved1;
-}tAniFwrDumpReq, *tpAniFwrDumpReq;
-
-/**
-* struct tSetWifiConfigParams - Structure to store the wificonfig related params
-* @paramType: 1. Average Stats factor 2. Guard type
-* @paramvalue: Value to be set in the firmware.
-* @bssId: macaddr of the connected BssId
-*/
-typedef struct
-{
-   tANI_U8  paramType;
-   tANI_U8  sessionId;
-   tANI_U32 paramValue;
-   tSirMacAddr  bssId;
-} tSetWifiConfigParams, *tpSetWifiConfigParams;
-
-typedef struct {
-   tANI_U8   param;
-   tANI_U32  value;
-} tModifyRoamParamsReqParams, * tpModifyRoamParamsReqParams;
-
-
 #endif /* __SIR_API_H */
diff --git a/wlan/prima/CORE/MAC/inc/sirMacPropExts.h b/wlan/prima/CORE/MAC/inc/sirMacPropExts.h
index f362575..6c06f12 100644
--- a/wlan/prima/CORE/MAC/inc/sirMacPropExts.h
+++ b/wlan/prima/CORE/MAC/inc/sirMacPropExts.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -158,11 +158,6 @@
 #define IS_DOT11_MODE_11B(dot11Mode)  \
             ((dot11Mode == WNI_CFG_DOT11_MODE_11B) ? TRUE : FALSE)
 
-#define IS_BSS_VHT_CAPABLE(vhtCaps) \
-            ((vhtCaps).present && \
-             ((vhtCaps).rxMCSMap != 0xFFFF) && \
-             ((vhtCaps).txMCSMap != 0xFFFF))
-
 /// ANI proprietary Status Codes enum
 /// (present in Management response frames)
 typedef enum eSirMacPropStatusCodes
diff --git a/wlan/prima/CORE/MAC/inc/sirMacProtDef.h b/wlan/prima/CORE/MAC/inc/sirMacProtDef.h
index b635693..4d94072 100644
--- a/wlan/prima/CORE/MAC/inc/sirMacProtDef.h
+++ b/wlan/prima/CORE/MAC/inc/sirMacProtDef.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -43,7 +43,7 @@
 
 #include "palTypes.h"
 #include "sirTypes.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "aniCompiler.h"
 
 
@@ -173,14 +173,12 @@
 #define SIR_MAC_ACTION_UNPROT_WNM     11
 #define SIR_MAC_ACTION_TDLS           12
 #define SIR_MAC_ACITON_MESH           13
-#define SIR_MAC_ACTION_MHF            14
+#define SIR_MAC_ACTION_MULTIHOP       14
 #define SIR_MAC_SELF_PROTECTED        15
 #define SIR_MAC_ACTION_WME            17
-#define SIR_MAC_ACTION_FST            18
 #define SIR_MAC_ACTION_VHT            21
 
-#define SIR_MAC_ACTION_TX             1
-#define SIR_MAC_ACTION_RX             2
+
 // QoS management action codes
 
 #define SIR_MAC_QOS_ADD_TS_REQ      0
@@ -254,12 +252,6 @@
 #define SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY     0x7F
 #define SIR_MAC_ACTION_P2P_SUBTYPE_PRESENCE_RSP     2
 
-// Public Action for 20/40 BSS Coexistence
-#ifdef WLAN_FEATURE_AP_HT40_24G
-#define SIR_MAC_ACTION_2040_BSS_COEXISTENCE     0
-#endif
-
-
 #ifdef WLAN_FEATURE_11W
 //11w SA query request/response action frame category code
 #define SIR_MAC_SA_QUERY_REQ             0
@@ -419,7 +411,6 @@
 #define SIR_MAC_HT_INFO_EID_MIN    0
 #define SIR_MAC_HT_INFO_EID_MAX    255
 #define SIR_MAC_OBSS_SCAN_PARAMETERS_EID 74
-#define SIR_MAC_EXTENDED_CAPABILITIES_EID 127
 
 #ifdef WLAN_FEATURE_11AC
 #define SIR_MAC_VHT_CAPABILITIES_EID   191
@@ -434,7 +425,6 @@
 #define SIR_MAC_ANI_WORKAROUND_EID_MIN     0
 #define SIR_MAC_ANI_WORKAROUND_EID_MAX     255
 
-#define SIR_MAC_MAX_ADD_IE_LENGTH   500
 /// Maximum length of each IE
 #define SIR_MAC_MAX_IE_LENGTH       255
 
@@ -1301,6 +1291,7 @@
     tSirMacEdcaParamRecord acvo; // voice
 } __ani_attr_packed tSirMacEdcaParamSetIE;
 
+#if 1
 typedef __ani_attr_pre_packed struct sSirMacQoSParams
 {
     tANI_U8        count;
@@ -1308,6 +1299,7 @@
     tANI_U8        CWmin[8];
     tANI_U8        AIFS[8];
 } __ani_attr_packed tSirMacQoSParams;
+#endif
 
 typedef __ani_attr_pre_packed struct sSirMacQbssLoadIE
 {
@@ -2448,18 +2440,6 @@
 } __ani_attr_packed tSirMacVendorSpecificFrameHdr, *tpSirMacVendorSpecificFrameHdr;
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-typedef __ani_attr_pre_packed struct sSirMacIbssExtNetworkFrameHdr
-{
-    tANI_U8    category;
-    tANI_U8    Oui[3];
-    tANI_U8    MagicCode[6];
-    tANI_U8    version;
-    tANI_U8    actionID;
-    tANI_U32   dialogToken;
-} __ani_attr_packed tSirMacIbssExtNetworkFrameHdr, *tpSirMacIbssExtNetworkFrameHdr;
-#endif /* WLAN_FEATURE_RMC */
-
 typedef __ani_attr_pre_packed struct sSirMacVendorSpecificPublicActionFrameHdr
 {
     tANI_U8    category;
@@ -2793,18 +2773,6 @@
 #define SIR_MAC_RATE_216 1006
 #define SIR_MAC_RATE_240 1007
 
-#define SIR_MAC_RATE_1_BITMAP    (1<<0)
-#define SIR_MAC_RATE_2_BITMAP    (1<<1)
-#define SIR_MAC_RATE_5_5_BITMAP  (1<<2)
-#define SIR_MAC_RATE_11_BITMAP   (1<<3)
-#define SIR_MAC_RATE_6_BITMAP    (1<<4)
-#define SIR_MAC_RATE_9_BITMAP    (1<<5)
-#define SIR_MAC_RATE_12_BITMAP   (1<<6)
-#define SIR_MAC_RATE_18_BITMAP   (1<<7)
-#define SIR_MAC_RATE_24_BITMAP   (1<<8)
-#define SIR_MAC_RATE_36_BITMAP   (1<<9)
-#define SIR_MAC_RATE_48_BITMAP   (1<<10)
-#define SIR_MAC_RATE_54_BITMAP   (1<<11)
 
 #define sirIsArate(x) ((((tANI_U8)x)==SIR_MAC_RATE_6) || \
                        (((tANI_U8)x)==SIR_MAC_RATE_9) || \
@@ -2891,24 +2859,6 @@
 
 #define SIR_MAC_MIN_IE_LEN 2 // Minimum IE length for IE validation
 
-#ifdef WLAN_FEATURE_RMC
-
-// RMC action codes
-#define SIR_MAC_RMC_ENABLE_REQ                  0
-#define SIR_MAC_RMC_DISABLE_REQ                 1
-#define SIR_MAC_RMC_RULER_INFORM_SELECTED      2
-#define SIR_MAC_RMC_RULER_INFORM_CANCELLED     3
-
-// RMC protocol version
-#define SIR_MAC_RMC_VER 0x01
-
-// Organization Identifier
-#define SIR_MAC_RMC_OUI             "\x00\x16\x32"
-#define SIR_MAC_RMC_OUI_SIZE        3
-
-#define SIR_MAC_RMC_MCAST_ADDRESS  "\x01\x00\x5E\x00\x02\x0A"
-
-#endif /* WLAN_FEATURE_RMC */
 
 #define SIR_MAC_TI_TYPE_REASSOC_DEADLINE        1
 #define SIR_MAC_TI_TYPE_KEY_LIFETIME            2
diff --git a/wlan/prima/CORE/MAC/inc/sirTypes.h b/wlan/prima/CORE/MAC/inc/sirTypes.h
index 6854cba..a6cc129 100644
--- a/wlan/prima/CORE/MAC/inc/sirTypes.h
+++ b/wlan/prima/CORE/MAC/inc/sirTypes.h
@@ -166,7 +166,6 @@
     eSIR_PMM_STA_NOT_ASSOCIATED,
     eSIR_PMM_HEART_BEAT_TMOUT,
     eSIR_PMM_NTH_BEACON_DELIVERY,
-    eSIR_PMM_INVALID_REQ,
 
     // ARQ Return Codes
     eSIR_ARQ_ERROR_BASE=0x2500,
@@ -185,26 +184,4 @@
 
 } tSirRetStatus;
 
-typedef enum
-{
-   FW_UBSP_STATS = 1,
-   FW_STATS_MAX,
-}tSirFwStatsType;
-
-
-typedef struct
-{
-   v_U32_t ubsp_enter_cnt;
-   v_U32_t ubsp_jump_ddr_cnt;
-}tSirUbspFwStats;
-
-typedef struct
-{
-   tSirFwStatsType type;
-   /*data*/
-   union{
-     tSirUbspFwStats ubspStats;
-   }fwStatsData;
-}tSirFwStatsResult;
-
 # endif // __SIR_TYPES_H
diff --git a/wlan/prima/CORE/MAC/inc/wniApi.h b/wlan/prima/CORE/MAC/inc/wniApi.h
index ff69d7f..d90c8a9 100644
--- a/wlan/prima/CORE/MAC/inc/wniApi.h
+++ b/wlan/prima/CORE/MAC/inc/wniApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -94,7 +94,8 @@
 #define AGN1223AR_02      8
 #define AGN_EEP_PRODUCT_ID_MAX   8
 
-#define SIR_SME_MODULE_ID 0x16
+
+
 
 /// Start of Sirius/Host message types
 #define WNI_HOST_MSG_START             0x1500
@@ -132,7 +133,6 @@
     eWNI_SME_DEAUTH_REQ,
     eWNI_SME_DEAUTH_RSP,
     eWNI_SME_DEAUTH_IND,
-    eWNI_SME_DISCONNECT_DONE_IND,
     eWNI_SME_WM_STATUS_CHANGE_NTF,
     eWNI_SME_IBSS_NEW_PEER_IND,
     eWNI_SME_IBSS_PEER_DEPARTED_IND,
@@ -226,6 +226,7 @@
     eWNI_SME_REMAIN_ON_CHANNEL_REQ,
     eWNI_SME_REMAIN_ON_CHN_IND,
     eWNI_SME_REMAIN_ON_CHN_RSP,
+    eWNI_SME_MGMT_FRM_IND,
     eWNI_SME_REMAIN_ON_CHN_RDY_IND,
     eWNI_SME_SEND_ACTION_FRAME_IND,
     eWNI_SME_ACTION_FRAME_SEND_CNF,
@@ -234,7 +235,6 @@
     eWNI_SME_CLEAR_DFS_CHANNEL_LIST,
     eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER,
     eWNI_SME_GET_SNR_REQ,
-    eWNI_SME_LOST_LINK_PARAMS_IND,
     //General Power Save Messages
     eWNI_PMC_MSG_TYPES_BEGIN,
     eWNI_PMC_PWR_SAVE_CFG,
@@ -345,6 +345,20 @@
     //SIR_LIM_MSG_TYPES_BEGIN+0xB0 = 12B0 (which means max of 176 messages and
     //eWNI_SME_TDLS_DEL_STA_RSP = 175.
     //Should fix above issue to enable TDLS_INTERNAL
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+#error ERROR_TDLS_INTERNAL
+    eWNI_SME_TDLS_DISCOVERY_START_REQ,    
+    eWNI_SME_TDLS_DISCOVERY_START_RSP,    
+    eWNI_SME_TDLS_DISCOVERY_START_IND,    
+    eWNI_SME_TDLS_LINK_START_REQ,    
+    eWNI_SME_TDLS_LINK_START_RSP,    
+    eWNI_SME_TDLS_LINK_START_IND,    
+    eWNI_SME_TDLS_TEARDOWN_REQ,    
+    eWNI_SME_TDLS_TEARDOWN_RSP,    
+    eWNI_SME_TDLS_TEARDOWN_IND,    
+    eWNI_SME_ADD_TDLS_PEER_IND,    
+    eWNI_SME_DELETE_TDLS_PEER_IND,    
+#endif
     eWNI_SME_SET_BCN_FILTER_REQ,
     eWNI_SME_RESET_AP_CAPS_CHANGED,
 #ifdef WLAN_FEATURE_11W
@@ -356,17 +370,10 @@
     eWNI_SME_CANDIDATE_FOUND_IND, /*ROAM candidate indication from FW*/
     eWNI_SME_HANDOFF_REQ,/*upper layer requested handoff to driver in STA mode*/
     eWNI_SME_ROAM_SCAN_OFFLOAD_RSP,/*Fwd the LFR scan offload rsp from FW to SME*/
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-    eWNI_SME_ROAM_SCAN_TRIGGER_RSP,
-#endif
 #ifdef FEATURE_WLAN_LPHB
     eWNI_SME_LPHB_IND,
 #endif /* FEATURE_WLAN_LPHB */
-#ifdef WLAN_FEATURE_RMC
-    eWNI_SME_ENABLE_RMC_REQ,
-    eWNI_SME_DISABLE_RMC_REQ,
-    eWNI_SME_IBSS_PEER_INFO_RSP,
-#endif /* WLAN_FEATURE_RMC */
+
     eWNI_SME_GET_TSM_STATS_REQ,
     eWNI_SME_GET_TSM_STATS_RSP,
     eWNI_SME_TSM_IE_IND,
@@ -376,17 +383,7 @@
 #endif /* FEATURE_WLAN_CH_AVOID */
     eWNI_SME_HT40_OBSS_SCAN_IND, /* START and UPDATE OBSS SCAN Indication*/
     eWNI_SME_HT40_STOP_OBSS_SCAN_IND, /* STOP OBSS SCAN indication */
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    eWNI_SME_SET_HT_2040_MODE, /* HT 20/40 indication in SAP case for 2.4GHz*/
-    eWNI_SME_2040_COEX_IND, /* HT20/40 Coex indication in SAP case for 2.4GHz*/
-#endif
     eWNI_SME_MAC_SPOOF_ADDR_IND,
-    eWNI_SME_ENCRYPT_MSG_RSP,
-    eWNI_SME_UPDATE_MAX_RATE_IND,
-    eWNI_SME_NAN_EVENT,
-    eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ,
-    eWNI_SME_DEL_ALL_TDLS_PEERS,
-    eWNI_SME_REGISTER_MGMT_FRAME_CB,
     eWNI_SME_MSG_TYPES_END
 };
 
diff --git a/wlan/prima/CORE/MAC/inc/wniCfgAp.h b/wlan/prima/CORE/MAC/inc/wniCfgAp.h
new file mode 100644
index 0000000..791165a
--- /dev/null
+++ b/wlan/prima/CORE/MAC/inc/wniCfgAp.h
@@ -0,0 +1,2920 @@
+/*
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file was originally distributed by Qualcomm Atheros, Inc.
+ * under proprietary terms before Copyright ownership was assigned
+ * to the Linux Foundation.
+ */
+
+/*
+ * DO NOT EDIT - This file is generated automatically
+ */
+
+/*
+ * IMPORTANT:  This file is for system that supports both STA and AP mode.
+ */
+
+
+#ifndef __WNICFGAP_H
+#define __WNICFGAP_H
+
+/*
+ * Configuration Parameter ID for STA and AP
+ */
+
+#define WNI_CFG_STA_ID    0
+#define WNI_CFG_CF_POLLABLE    1
+#define WNI_CFG_CFP_PERIOD    2
+#define WNI_CFG_CFP_MAX_DURATION    3
+#define WNI_CFG_SSID    4
+#define WNI_CFG_BEACON_INTERVAL    5
+#define WNI_CFG_DTIM_PERIOD    6
+#define WNI_CFG_WEP_KEY_LENGTH    7
+#define WNI_CFG_WEP_DEFAULT_KEY_TABLE    8
+#define WNI_CFG_WEP_DEFAULT_KEY_TABLE_ROW    4
+#define WNI_CFG_WEP_DEFAULT_KEY_TABLE_COL    1
+#define WNI_CFG_WEP_DEFAULT_KEY_1    8
+#define WNI_CFG_WEP_DEFAULT_KEY_2    9
+#define WNI_CFG_WEP_DEFAULT_KEY_3    10
+#define WNI_CFG_WEP_DEFAULT_KEY_4    11
+#define WNI_CFG_WEP_DEFAULT_KEYID    12
+#define WNI_CFG_EXCLUDE_UNENCRYPTED    13
+#define WNI_CFG_RTS_THRESHOLD    14
+#define WNI_CFG_SHORT_RETRY_LIMIT    15
+#define WNI_CFG_LONG_RETRY_LIMIT    16
+#define WNI_CFG_FRAGMENTATION_THRESHOLD    17
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME    18
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME    19
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME    20
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME    21
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT    22
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT    23
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT    24
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT    25
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT    26
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS    27
+#define WNI_CFG_PS_ENABLE_BCN_FILTER    28
+#define WNI_CFG_PS_ENABLE_HEART_BEAT    29
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR    30
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT    31
+#define WNI_CFG_RF_SETTLING_TIME_CLK    32
+#define WNI_CFG_SUPPORTED_RATES_11B    33
+#define WNI_CFG_SUPPORTED_RATES_11A    34
+#define WNI_CFG_PHY_MODE    35
+#define WNI_CFG_DOT11_MODE    36
+#define WNI_CFG_OPERATIONAL_RATE_SET    37
+#define WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET    38
+#define WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET    39
+#define WNI_CFG_BSSID    40
+#define WNI_CFG_LISTEN_INTERVAL    41
+#define WNI_CFG_VALID_CHANNEL_LIST    42
+#define WNI_CFG_CURRENT_CHANNEL    43
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ    44
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ    45
+#define WNI_CFG_RATE_ADAPTATION_TYPE    46
+#define WNI_CFG_FIXED_RATE    47
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ    48
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ    49
+#define WNI_CFG_RETRYRATE_POLICY    50
+#define WNI_CFG_RETRYRATE_SECONDARY    51
+#define WNI_CFG_RETRYRATE_TERTIARY    52
+#define WNI_CFG_APSD_ENABLED    53
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE    54
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE    55
+#define WNI_CFG_AUTHENTICATION_TYPE    56
+#define WNI_CFG_CF_POLL_REQUEST    57
+#define WNI_CFG_PRIVACY_ENABLED    58
+#define WNI_CFG_SHORT_PREAMBLE    59
+#define WNI_CFG_SHORT_SLOT_TIME    60
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY    61
+#define WNI_CFG_QOS_ENABLED    62
+#define WNI_CFG_HCF_ENABLED    63
+#define WNI_CFG_RSN_ENABLED    64
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD    65
+#define WNI_CFG_MAX_NUM_PRE_AUTH    66
+#define WNI_CFG_PREAUTH_CLNUP_TIMEOUT    67
+#define WNI_CFG_RELEASE_AID_TIMEOUT    68
+#define WNI_CFG_HEART_BEAT_THRESHOLD    69
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT    70
+#define WNI_CFG_MANUFACTURER_OUI    71
+#define WNI_CFG_MANUFACTURER_NAME    72
+#define WNI_CFG_MODEL_NUMBER    73
+#define WNI_CFG_MODEL_NAME    74
+#define WNI_CFG_MANUFACTURER_PRODUCT_NAME    75
+#define WNI_CFG_MANUFACTURER_PRODUCT_VERSION    76
+#define WNI_CFG_11D_ENABLED    77
+#define WNI_CFG_MAX_TX_POWER_2_4    78
+#define WNI_CFG_MAX_TX_POWER_5    79
+#define WNI_CFG_NETWORK_DENSITY    80
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM    81
+#define WNI_CFG_CURRENT_TX_ANTENNA    82
+#define WNI_CFG_CURRENT_RX_ANTENNA    83
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL    84
+#define WNI_CFG_POWER_STATE_PER_CHAIN    85
+#define WNI_CFG_NEW_BSS_FOUND_IND    86
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED    87
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED    88
+#define WNI_CFG_AP_NODE_NAME    89
+#define WNI_CFG_COUNTRY_CODE    90
+#define WNI_CFG_11H_ENABLED    91
+#define WNI_CFG_WT_CNF_TIMEOUT    92
+#define WNI_CFG_KEEPALIVE_TIMEOUT    93
+#define WNI_CFG_PROXIMITY    94
+#define WNI_CFG_LOG_LEVEL    95
+#define WNI_CFG_OLBC_DETECT_TIMEOUT    96
+#define WNI_CFG_PROTECTION_ENABLED    97
+#define WNI_CFG_11G_PROTECTION_ALWAYS    98
+#define WNI_CFG_FORCE_POLICY_PROTECTION    99
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED    100
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED    101
+#define WNI_CFG_CAL_PERIOD    102
+#define WNI_CFG_STATS_PERIOD    103
+#define WNI_CFG_CAL_CONTROL    104
+#define WNI_CFG_11G_ONLY_POLICY    105
+#define WNI_CFG_PACKET_CLASSIFICATION    106
+#define WNI_CFG_WME_ENABLED    107
+#define WNI_CFG_ADDTS_RSP_TIMEOUT    108
+#define WNI_CFG_MAX_SP_LENGTH    109
+#define WNI_CFG_KEEP_ALIVE_STA_LIMIT_THRESHOLD    110
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS    111
+#define WNI_CFG_WSM_ENABLED    112
+#define WNI_CFG_PROP_CAPABILITY    113
+#define WNI_CFG_EDCA_PROFILE    114
+#define WNI_CFG_EDCA_ANI_ACBK_LOCAL    115
+#define WNI_CFG_EDCA_ANI_ACBE_LOCAL    116
+#define WNI_CFG_EDCA_ANI_ACVI_LOCAL    117
+#define WNI_CFG_EDCA_ANI_ACVO_LOCAL    118
+#define WNI_CFG_EDCA_ANI_ACBK    119
+#define WNI_CFG_EDCA_ANI_ACBE    120
+#define WNI_CFG_EDCA_ANI_ACVI    121
+#define WNI_CFG_EDCA_ANI_ACVO    122
+#define WNI_CFG_EDCA_WME_ACBK_LOCAL    123
+#define WNI_CFG_EDCA_WME_ACBE_LOCAL    124
+#define WNI_CFG_EDCA_WME_ACVI_LOCAL    125
+#define WNI_CFG_EDCA_WME_ACVO_LOCAL    126
+#define WNI_CFG_EDCA_WME_ACBK    127
+#define WNI_CFG_EDCA_WME_ACBE    128
+#define WNI_CFG_EDCA_WME_ACVI    129
+#define WNI_CFG_EDCA_WME_ACVO    130
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK_LOCAL    131
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE_LOCAL    132
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI_LOCAL    133
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO_LOCAL    134
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK    135
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE    136
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI    137
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO    138
+#define WNI_CFG_RDET_FLAG    139
+#define WNI_CFG_RADAR_CHANNEL_LIST    140
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT    141
+#define WNI_CFG_ADMIT_POLICY    142
+#define WNI_CFG_ADMIT_BWFACTOR    143
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE    144
+#define WNI_CFG_CHANNEL_BONDING_MODE    145
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE    146
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO    147
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE    148
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO    149
+#define WNI_CFG_TRIG_STA_BK_SCAN    150
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING    151
+#define WNI_CFG_SCAN_CONTROL_LIST    152
+#define WNI_CFG_MIMO_ENABLED    153
+#define WNI_CFG_BLOCK_ACK_ENABLED    154
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT    155
+#define WNI_CFG_HT_RX_STBC    156
+#define WNI_CFG_HT_CAP_INFO    157
+#define WNI_CFG_HT_AMPDU_PARAMS    158
+#define WNI_CFG_SUPPORTED_MCS_SET    159
+#define WNI_CFG_EXT_HT_CAP_INFO    160
+#define WNI_CFG_TX_BF_CAP    161
+#define WNI_CFG_AS_CAP    162
+#define WNI_CFG_HT_INFO_FIELD1    163
+#define WNI_CFG_HT_INFO_FIELD2    164
+#define WNI_CFG_HT_INFO_FIELD3    165
+#define WNI_CFG_BASIC_MCS_SET    166
+#define WNI_CFG_CURRENT_MCS_SET    167
+#define WNI_CFG_GREENFIELD_CAPABILITY    168
+#define WNI_CFG_VHT_MAX_MPDU_LENGTH    169
+#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET    170
+#define WNI_CFG_VHT_LDPC_CODING_CAP    171
+#define WNI_CFG_VHT_SHORT_GI_80MHZ    172
+#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ    173
+#define WNI_CFG_VHT_TXSTBC    174
+#define WNI_CFG_VHT_RXSTBC    175
+#define WNI_CFG_VHT_SU_BEAMFORMER_CAP    176
+#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP    177
+#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED    178
+#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS    179
+#define WNI_CFG_VHT_MU_BEAMFORMER_CAP    180
+#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP    181
+#define WNI_CFG_VHT_TXOP_PS    182
+#define WNI_CFG_VHT_HTC_VHTC_CAP    183
+#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT    184
+#define WNI_CFG_VHT_LINK_ADAPTATION_CAP    185
+#define WNI_CFG_VHT_RX_ANT_PATTERN    186
+#define WNI_CFG_VHT_TX_ANT_PATTERN    187
+#define WNI_CFG_VHT_RX_MCS_MAP    188
+#define WNI_CFG_VHT_TX_MCS_MAP    189
+#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE    190
+#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE    191
+#define WNI_CFG_VHT_CHANNEL_WIDTH    192
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1    193
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2    194
+#define WNI_CFG_VHT_BASIC_MCS_SET    195
+#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT    196
+#define WNI_CFG_VHT_SS_UNDER_UTIL    197
+#define WNI_CFG_VHT_40MHZ_UTILIZATION    198
+#define WNI_CFG_VHT_80MHZ_UTILIZATION    199
+#define WNI_CFG_VHT_160MHZ_UTILIZATION    200
+#define WNI_CFG_MAX_AMSDU_LENGTH    201
+#define WNI_CFG_MPDU_DENSITY    202
+#define WNI_CFG_NUM_BUFF_ADVERT    203
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR    204
+#define WNI_CFG_SHORT_GI_20MHZ    205
+#define WNI_CFG_SHORT_GI_40MHZ    206
+#define WNI_CFG_RIFS_ENABLED    207
+#define WNI_CFG_MAX_PS_POLL    208
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE    209
+#define WNI_CFG_RSSI_FILTER_PERIOD    210
+#define WNI_CFG_MIN_RSSI_THRESHOLD    211
+#define WNI_CFG_NTH_BEACON_FILTER    212
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE    213
+#define WNI_CFG_SCAN_IN_POWERSAVE    214
+#define WNI_CFG_IGNORE_DTIM    215
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE    216
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE    217
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE    218
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE    219
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON    220
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD    221
+#define WNI_CFG_BA_TIMEOUT    222
+#define WNI_CFG_BA_THRESHOLD_HIGH    223
+#define WNI_CFG_MAX_BA_BUFFERS    224
+#define WNI_CFG_MAX_BA_SESSIONS    225
+#define WNI_CFG_BA_AUTO_SETUP    226
+#define WNI_CFG_ADDBA_REQ_DECLINE    227
+#define WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC    228
+#define WNI_CFG_BG_SCAN_CHANNEL_LIST    229
+#define WNI_CFG_MAX_MEDIUM_TIME    230
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU    231
+#define WNI_CFG_IBSS_AUTO_BSSID    232
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG    233
+#define WNI_CFG_PROBE_REQ_ADDNIE_DATA    234
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG    235
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA1    236
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA2    237
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA3    238
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG    239
+#define WNI_CFG_ASSOC_RSP_ADDNIE_DATA    240
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG    241
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA    242
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG    243
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA    244
+#define WNI_CFG_WPS_ENABLE    245
+#define WNI_CFG_WPS_STATE    246
+#define WNI_CFG_WPS_PROBE_REQ_FLAG    247
+#define WNI_CFG_WPS_VERSION    248
+#define WNI_CFG_WPS_REQUEST_TYPE    249
+#define WNI_CFG_WPS_CFG_METHOD    250
+#define WNI_CFG_WPS_UUID    251
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY    252
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI    253
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY    254
+#define WNI_CFG_WPS_ASSOCIATION_STATE    255
+#define WNI_CFG_WPS_CONFIGURATION_ERROR    256
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID    257
+#define WNI_CFG_WPS_ASSOC_METHOD    258
+#define WNI_CFG_LOW_GAIN_OVERRIDE    259
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE    260
+#define WNI_CFG_RPE_POLLING_THRESHOLD    261
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG    262
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG    263
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG    264
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG    265
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS    266
+#define WNI_CFG_SINGLE_TID_RC    267
+#define WNI_CFG_RRM_ENABLED    268
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX    269
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX    270
+#define WNI_CFG_TX_PWR_CTRL_ENABLE    271
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING    272
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK    273
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE    274
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT    275
+#define WNI_CFG_TELE_BCN_WAKEUP_EN    276
+#define WNI_CFG_TELE_BCN_TRANS_LI    277
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS    278
+#define WNI_CFG_TELE_BCN_MAX_LI    279
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS    280
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS    281
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD    282
+#define WNI_CFG_ASSOC_STA_LIMIT    283
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL    284
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL    285
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND    286
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD    287
+#define WNI_CFG_ENABLE_CLOSE_LOOP    288
+#define WNI_CFG_ENABLE_LTE_COEX    289
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT    290
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT    291
+#define WNI_CFG_ENABLE_MC_ADDR_LIST    292
+#define WNI_CFG_ENABLE_UC_FILTER    293
+#define WNI_CFG_ENABLE_LPWR_IMG_TRANSITION    294
+#define WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED    295
+#define WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP    296
+#define WNI_CFG_AP_LINK_MONITOR_TIMEOUT    297
+#define WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK    298
+#define WNI_CFG_TDLS_BUF_STA_ENABLED    299
+#define WNI_CFG_TDLS_PUAPSD_INACT_TIME    300
+#define WNI_CFG_TDLS_RX_FRAME_THRESHOLD    301
+#define WNI_CFG_ENABLE_ADAPT_RX_DRAIN    302
+#define WNI_CFG_FLEX_CONNECT_POWER_FACTOR    303
+#define WNI_CFG_ANTENNA_DIVESITY    304
+#define WNI_CFG_GO_LINK_MONITOR_TIMEOUT    305
+#define WNI_CFG_ATH_DISABLE    306
+#define WNI_CFG_BTC_ACTIVE_WLAN_LEN    307
+#define WNI_CFG_BTC_ACTIVE_BT_LEN    308
+#define WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN    309
+#define WNI_CFG_BTC_SAP_ACTIVE_BT_LEN    310
+#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY    311
+#define WNI_CFG_ASD_PROBE_INTERVAL    312
+#define WNI_CFG_ASD_TRIGGER_THRESHOLD    313
+#define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD    314
+#define WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL    315
+#define WNI_CFG_BTC_CTS2S_DURING_SCO    316
+#define WNI_CFG_CHANNEL_BONDING_24G    317
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME    318
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME    319
+#define WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL    320
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL    321
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL    322
+#define WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR    323
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD    324
+#define WNI_CFG_TDLS_OFF_CHANNEL_ENABLED    325
+#define WNI_CFG_PMF_SA_QUERY_MAX_RETRIES    326
+#define WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL    327
+#define WNI_CFG_RA_FILTER_ENABLE    328
+#define WNI_CFG_RA_RATE_LIMIT_INTERVAL    329
+#define WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE    330
+#define WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE    331
+#define WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD    332
+#define WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD    333
+#define WNI_CFG_TDLS_WMM_MODE_ENABLED    334
+#define WNI_CFG_MAX_UAPSD_CONSEC_SP    335
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT    336
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT    337
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW    338
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW    339
+#define WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE    340
+#define WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS    341
+#define WNI_CFG_ENABLE_DYNAMIC_WMMPS    342
+#define WNI_CFG_BURST_MODE_BE_TXOP_VALUE    343
+#define WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE    344
+#define WNI_CFG_BTC_FAST_WLAN_CONN_PREF    345
+
+/*
+ * String parameter lengths 
+ */
+
+#define WNI_CFG_STA_ID_LEN    6
+#define WNI_CFG_SSID_LEN    32
+#define WNI_CFG_WEP_DEFAULT_KEY_1_LEN    13
+#define WNI_CFG_WEP_DEFAULT_KEY_2_LEN    13
+#define WNI_CFG_WEP_DEFAULT_KEY_3_LEN    13
+#define WNI_CFG_WEP_DEFAULT_KEY_4_LEN    13
+#define WNI_CFG_SUPPORTED_RATES_11B_LEN    4
+#define WNI_CFG_SUPPORTED_RATES_11A_LEN    8
+#define WNI_CFG_OPERATIONAL_RATE_SET_LEN    12
+#define WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN    8
+#define WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET_LEN    4
+#define WNI_CFG_BSSID_LEN    6
+#define WNI_CFG_VALID_CHANNEL_LIST_LEN    100
+#define WNI_CFG_MANUFACTURER_OUI_LEN    3
+#define WNI_CFG_MANUFACTURER_NAME_LEN    65
+#define WNI_CFG_MODEL_NUMBER_LEN    33
+#define WNI_CFG_MODEL_NAME_LEN    33
+#define WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN    33
+#define WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN    33
+#define WNI_CFG_MAX_TX_POWER_2_4_LEN    128
+#define WNI_CFG_MAX_TX_POWER_5_LEN    128
+#define WNI_CFG_AP_NODE_NAME_LEN    32
+#define WNI_CFG_COUNTRY_CODE_LEN    3
+#define WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN    20
+#define WNI_CFG_EDCA_ANI_ACBE_LOCAL_LEN    20
+#define WNI_CFG_EDCA_ANI_ACVI_LOCAL_LEN    20
+#define WNI_CFG_EDCA_ANI_ACVO_LOCAL_LEN    20
+#define WNI_CFG_EDCA_ANI_ACBK_LEN    20
+#define WNI_CFG_EDCA_ANI_ACBE_LEN    20
+#define WNI_CFG_EDCA_ANI_ACVI_LEN    20
+#define WNI_CFG_EDCA_ANI_ACVO_LEN    20
+#define WNI_CFG_EDCA_WME_ACBK_LOCAL_LEN    20
+#define WNI_CFG_EDCA_WME_ACBE_LOCAL_LEN    20
+#define WNI_CFG_EDCA_WME_ACVI_LOCAL_LEN    20
+#define WNI_CFG_EDCA_WME_ACVO_LOCAL_LEN    20
+#define WNI_CFG_EDCA_WME_ACBK_LEN    20
+#define WNI_CFG_EDCA_WME_ACBE_LEN    20
+#define WNI_CFG_EDCA_WME_ACVI_LEN    20
+#define WNI_CFG_EDCA_WME_ACVO_LEN    20
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK_LOCAL_LEN    20
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE_LOCAL_LEN    20
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI_LOCAL_LEN    20
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO_LOCAL_LEN    20
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK_LEN    20
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE_LEN    20
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI_LEN    20
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO_LEN    20
+#define WNI_CFG_RADAR_CHANNEL_LIST_LEN    20
+#define WNI_CFG_SCAN_CONTROL_LIST_LEN    128
+#define WNI_CFG_SUPPORTED_MCS_SET_LEN    16
+#define WNI_CFG_BASIC_MCS_SET_LEN    16
+#define WNI_CFG_CURRENT_MCS_SET_LEN    16
+#define WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN    100
+#define WNI_CFG_PROBE_REQ_ADDNIE_DATA_LEN    255
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN    255
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN    255
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN    255
+#define WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN    255
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA_LEN    255
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN    255
+#define WNI_CFG_WPS_UUID_LEN    16
+
+/*
+ * Integer parameter min/max/default values 
+ */
+
+#define WNI_CFG_CF_POLLABLE_APMIN    0
+#define WNI_CFG_CF_POLLABLE_APMAX    1
+#define WNI_CFG_CF_POLLABLE_APDEF    0
+
+#define WNI_CFG_CFP_PERIOD_STAMIN    0
+#define WNI_CFG_CFP_PERIOD_STAMAX    255
+#define WNI_CFG_CFP_PERIOD_STADEF    1
+
+#define WNI_CFG_CFP_PERIOD_APMIN    0
+#define WNI_CFG_CFP_PERIOD_APMAX    255
+#define WNI_CFG_CFP_PERIOD_APDEF    1
+
+#define WNI_CFG_CFP_MAX_DURATION_STAMIN    0
+#define WNI_CFG_CFP_MAX_DURATION_STAMAX    65535
+#define WNI_CFG_CFP_MAX_DURATION_STADEF    30000
+
+#define WNI_CFG_CFP_MAX_DURATION_APMIN    0
+#define WNI_CFG_CFP_MAX_DURATION_APMAX    65535
+#define WNI_CFG_CFP_MAX_DURATION_APDEF    30000
+
+#define WNI_CFG_BEACON_INTERVAL_STAMIN    0
+#define WNI_CFG_BEACON_INTERVAL_STAMAX    65535
+#define WNI_CFG_BEACON_INTERVAL_STADEF    100
+
+#define WNI_CFG_BEACON_INTERVAL_APMIN    0
+#define WNI_CFG_BEACON_INTERVAL_APMAX    65535
+#define WNI_CFG_BEACON_INTERVAL_APDEF    100
+
+#define WNI_CFG_DTIM_PERIOD_STAMIN    0
+#define WNI_CFG_DTIM_PERIOD_STAMAX    65535
+#define WNI_CFG_DTIM_PERIOD_STADEF    1
+
+#define WNI_CFG_DTIM_PERIOD_APMIN    0
+#define WNI_CFG_DTIM_PERIOD_APMAX    65535
+#define WNI_CFG_DTIM_PERIOD_APDEF    1
+
+#define WNI_CFG_WEP_KEY_LENGTH_STAMIN    5
+#define WNI_CFG_WEP_KEY_LENGTH_STAMAX    13
+#define WNI_CFG_WEP_KEY_LENGTH_STADEF    5
+
+#define WNI_CFG_WEP_KEY_LENGTH_APMIN    5
+#define WNI_CFG_WEP_KEY_LENGTH_APMAX    13
+#define WNI_CFG_WEP_KEY_LENGTH_APDEF    5
+
+#define WNI_CFG_WEP_KEY_LENGTH_5    5
+#define WNI_CFG_WEP_KEY_LENGTH_13    13
+
+#define WNI_CFG_WEP_DEFAULT_KEYID_STAMIN    0
+#define WNI_CFG_WEP_DEFAULT_KEYID_STAMAX    3
+#define WNI_CFG_WEP_DEFAULT_KEYID_STADEF    0
+
+#define WNI_CFG_WEP_DEFAULT_KEYID_APMIN    0
+#define WNI_CFG_WEP_DEFAULT_KEYID_APMAX    3
+#define WNI_CFG_WEP_DEFAULT_KEYID_APDEF    0
+
+#define WNI_CFG_WEP_DEFAULT_KEYID_0    0
+#define WNI_CFG_WEP_DEFAULT_KEYID_1    1
+#define WNI_CFG_WEP_DEFAULT_KEYID_2    2
+#define WNI_CFG_WEP_DEFAULT_KEYID_3    3
+
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_STAMIN    0
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_STAMAX    1
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_STADEF    0
+
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_APMIN    0
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_APMAX    1
+#define WNI_CFG_EXCLUDE_UNENCRYPTED_APDEF    0
+
+#define WNI_CFG_RTS_THRESHOLD_STAMIN    0
+#define WNI_CFG_RTS_THRESHOLD_STAMAX    2347
+#define WNI_CFG_RTS_THRESHOLD_STADEF    2347
+
+#define WNI_CFG_RTS_THRESHOLD_APMIN    0
+#define WNI_CFG_RTS_THRESHOLD_APMAX    2347
+#define WNI_CFG_RTS_THRESHOLD_APDEF    2347
+
+#define WNI_CFG_SHORT_RETRY_LIMIT_STAMIN    0
+#define WNI_CFG_SHORT_RETRY_LIMIT_STAMAX    255
+#define WNI_CFG_SHORT_RETRY_LIMIT_STADEF    6
+
+#define WNI_CFG_SHORT_RETRY_LIMIT_APMIN    0
+#define WNI_CFG_SHORT_RETRY_LIMIT_APMAX    255
+#define WNI_CFG_SHORT_RETRY_LIMIT_APDEF    6
+
+#define WNI_CFG_LONG_RETRY_LIMIT_STAMIN    0
+#define WNI_CFG_LONG_RETRY_LIMIT_STAMAX    255
+#define WNI_CFG_LONG_RETRY_LIMIT_STADEF    6
+
+#define WNI_CFG_LONG_RETRY_LIMIT_APMIN    0
+#define WNI_CFG_LONG_RETRY_LIMIT_APMAX    255
+#define WNI_CFG_LONG_RETRY_LIMIT_APDEF    6
+
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN    256
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX    8000
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_STADEF    8000
+
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_APMIN    256
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_APMAX    8000
+#define WNI_CFG_FRAGMENTATION_THRESHOLD_APDEF    8000
+
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_STAMIN    0
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_STAMAX    65535
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_STADEF    20
+
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_APMIN    0
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_APMAX    65535
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_APDEF    20
+
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STAMIN    0
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STAMAX    65535
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STADEF    40
+
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_APMIN    0
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_APMAX    65535
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_APDEF    40
+
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_STAMIN    0
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_STAMAX    65535
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_STADEF    60
+
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_APMIN    0
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_APMAX    65535
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_APDEF    60
+
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STAMIN    0
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STAMAX    65535
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STADEF    110
+
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_APMIN    0
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_APMAX    65535
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_APDEF    110
+
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_STAMIN    0
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_STAMAX    65535
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_STADEF    3000
+
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_APMIN    0
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_APMAX    65535
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT_APDEF    3000
+
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STAMIN    0
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STAMAX    65535
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STADEF    1000
+
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_APMIN    0
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_APMAX    65535
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_APDEF    1000
+
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_STAMIN    0
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_STAMAX    65535
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_STADEF    1000
+
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_APMIN    0
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_APMAX    65535
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_APDEF    1000
+
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STAMIN    0
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STAMAX    65535
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STADEF    2000
+
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_APMIN    0
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_APMAX    65535
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_APDEF    3000
+
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_STAMIN    0
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_STAMAX    65535
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_STADEF    1000
+
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_APMIN    0
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_APMAX    65535
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_APDEF    3000
+
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS_STAMIN    0
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS_STAMAX    65535
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS_STADEF    1000
+
+#define WNI_CFG_PS_ENABLE_BCN_FILTER_STAMIN    0
+#define WNI_CFG_PS_ENABLE_BCN_FILTER_STAMAX    1
+#define WNI_CFG_PS_ENABLE_BCN_FILTER_STADEF    1
+
+#define WNI_CFG_PS_ENABLE_HEART_BEAT_STAMIN    0
+#define WNI_CFG_PS_ENABLE_HEART_BEAT_STAMAX    1
+#define WNI_CFG_PS_ENABLE_HEART_BEAT_STADEF    1
+
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR_STAMIN    0
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR_STAMAX    1
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR_STADEF    0
+
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STAMIN    1
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STAMAX    255
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STADEF    20
+
+#define WNI_CFG_RF_SETTLING_TIME_CLK_STAMIN    0
+#define WNI_CFG_RF_SETTLING_TIME_CLK_STAMAX    60000
+#define WNI_CFG_RF_SETTLING_TIME_CLK_STADEF    1500
+
+#define WNI_CFG_PHY_MODE_STAMIN    0
+#define WNI_CFG_PHY_MODE_STAMAX    3
+#define WNI_CFG_PHY_MODE_STADEF    0
+
+#define WNI_CFG_PHY_MODE_APMIN    0
+#define WNI_CFG_PHY_MODE_APMAX    3
+#define WNI_CFG_PHY_MODE_APDEF    0
+
+#define WNI_CFG_PHY_MODE_11A    0
+#define WNI_CFG_PHY_MODE_11B    1
+#define WNI_CFG_PHY_MODE_11G    2
+#define WNI_CFG_PHY_MODE_NONE    3
+
+#define WNI_CFG_DOT11_MODE_STAMIN    0
+#define WNI_CFG_DOT11_MODE_STAMAX    11
+#define WNI_CFG_DOT11_MODE_STADEF    0
+
+#define WNI_CFG_DOT11_MODE_APMIN    0
+#define WNI_CFG_DOT11_MODE_APMAX    11
+#define WNI_CFG_DOT11_MODE_APDEF    0
+
+#define WNI_CFG_DOT11_MODE_ALL    0
+#define WNI_CFG_DOT11_MODE_11A    1
+#define WNI_CFG_DOT11_MODE_11B    2
+#define WNI_CFG_DOT11_MODE_11G    3
+#define WNI_CFG_DOT11_MODE_11N    4
+#define WNI_CFG_DOT11_MODE_POLARIS    5
+#define WNI_CFG_DOT11_MODE_TITAN    6
+#define WNI_CFG_DOT11_MODE_TAURUS    7
+#define WNI_CFG_DOT11_MODE_11G_ONLY    8
+#define WNI_CFG_DOT11_MODE_11N_ONLY    9
+#define WNI_CFG_DOT11_MODE_11AC    10
+#define WNI_CFG_DOT11_MODE_11AC_ONLY    11
+
+#define WNI_CFG_LISTEN_INTERVAL_STAMIN    0
+#define WNI_CFG_LISTEN_INTERVAL_STAMAX    65535
+#define WNI_CFG_LISTEN_INTERVAL_STADEF    1
+
+#define WNI_CFG_LISTEN_INTERVAL_APMIN    0
+#define WNI_CFG_LISTEN_INTERVAL_APMAX    65535
+#define WNI_CFG_LISTEN_INTERVAL_APDEF    1
+
+#define WNI_CFG_CURRENT_CHANNEL_STAMIN    0
+#define WNI_CFG_CURRENT_CHANNEL_STAMAX    165
+#define WNI_CFG_CURRENT_CHANNEL_STADEF    1
+
+#define WNI_CFG_CURRENT_CHANNEL_APMIN    0
+#define WNI_CFG_CURRENT_CHANNEL_APMAX    165
+#define WNI_CFG_CURRENT_CHANNEL_APDEF    1
+
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_STAMIN    0
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_STAMAX    11
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_STADEF    5
+
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_APMIN    0
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_APMAX    11
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_APDEF    5
+
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_STAMIN    0
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_STAMAX    31
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_STADEF    1
+
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_APMIN    0
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_APMAX    31
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_APDEF    1
+
+#define WNI_CFG_RATE_ADAPTATION_TYPE_STAMIN    0
+#define WNI_CFG_RATE_ADAPTATION_TYPE_STAMAX    2
+#define WNI_CFG_RATE_ADAPTATION_TYPE_STADEF    1
+
+#define WNI_CFG_RATE_ADAPTATION_TYPE_APMIN    0
+#define WNI_CFG_RATE_ADAPTATION_TYPE_APMAX    2
+#define WNI_CFG_RATE_ADAPTATION_TYPE_APDEF    1
+
+#define WNI_CFG_RATE_ADAPTATION_TYPE_FIXED    0
+#define WNI_CFG_RATE_ADAPTATION_TYPE_AUTO    1
+#define WNI_CFG_RATE_ADAPTATION_TYPE_SNR_BASED    2
+
+#define WNI_CFG_FIXED_RATE_STAMIN    0
+#define WNI_CFG_FIXED_RATE_STAMAX    44
+#define WNI_CFG_FIXED_RATE_STADEF    0
+
+#define WNI_CFG_FIXED_RATE_APMIN    0
+#define WNI_CFG_FIXED_RATE_APMAX    44
+#define WNI_CFG_FIXED_RATE_APDEF    0
+
+#define WNI_CFG_FIXED_RATE_AUTO    0
+#define WNI_CFG_FIXED_RATE_1MBPS    1
+#define WNI_CFG_FIXED_RATE_2MBPS    2
+#define WNI_CFG_FIXED_RATE_5_5MBPS    3
+#define WNI_CFG_FIXED_RATE_11MBPS    4
+#define WNI_CFG_FIXED_RATE_6MBPS    5
+#define WNI_CFG_FIXED_RATE_9MBPS    6
+#define WNI_CFG_FIXED_RATE_12MBPS    7
+#define WNI_CFG_FIXED_RATE_18MBPS    8
+#define WNI_CFG_FIXED_RATE_24MBPS    9
+#define WNI_CFG_FIXED_RATE_36MBPS    10
+#define WNI_CFG_FIXED_RATE_48MBPS    11
+#define WNI_CFG_FIXED_RATE_54MBPS    12
+#define WNI_CFG_FIXED_RATE_6_5MBPS_MCS0_20MHZ_SIMO    13
+#define WNI_CFG_FIXED_RATE_13MBPS_MCS1_20MHZ_SIMO    14
+#define WNI_CFG_FIXED_RATE_19_5MBPS_MCS2_20MHZ_SIMO    15
+#define WNI_CFG_FIXED_RATE_26MBPS_MCS3_20MHZ_SIMO    16
+#define WNI_CFG_FIXED_RATE_39MBPS_MCS4_20MHZ_SIMO    17
+#define WNI_CFG_FIXED_RATE_52MBPS_MCS5_20MHZ_SIMO    18
+#define WNI_CFG_FIXED_RATE_58_5MBPS_MCS6_20MHZ_SIMO    19
+#define WNI_CFG_FIXED_RATE_65MBPS_MCS7_20MHZ_SIMO    20
+#define WNI_CFG_FIXED_RATE_7_2MBPS_MCS0_20MHZ_SIMO_SGI    21
+#define WNI_CFG_FIXED_RATE_14_4MBPS_MCS1_20MHZ_SIMO_SGI    22
+#define WNI_CFG_FIXED_RATE_21_7MBPS_MCS2_20MHZ_SIMO_SGI    23
+#define WNI_CFG_FIXED_RATE_28_9MBPS_MCS3_20MHZ_SIMO_SGI    24
+#define WNI_CFG_FIXED_RATE_43_3MBPS_MCS4_20MHZ_SIMO_SGI    25
+#define WNI_CFG_FIXED_RATE_57_8MBPS_MCS5_20MHZ_SIMO_SGI    26
+#define WNI_CFG_FIXED_RATE_65MBPS_MCS6_20MHZ_SIMO_SGI    27
+#define WNI_CFG_FIXED_RATE_72_2MBPS_MCS7_20MHZ_SIMO_SGI    28
+#define WNI_CFG_FIXED_RATE_0_25MBPS_SLR_20MHZ_SIMO    29
+#define WNI_CFG_FIXED_RATE_0_5MBPS_SLR_20MHZ_SIMO    30
+#define WNI_CFG_FIXED_RATE_68_25MBPS_QC_PROP_20MHZ_SIMO    31
+#define WNI_CFG_FIXED_RATE_54MBPS_MCS3_40MHZ_SIMO    32
+#define WNI_CFG_FIXED_RATE_81MBPS_MCS4_40MHZ_SIMO    33
+#define WNI_CFG_FIXED_RATE_108MBPS_MCS5_40MHZ_SIMO    34
+#define WNI_CFG_FIXED_RATE_121_5MBPS_MCS6_40MHZ_SIMO    35
+#define WNI_CFG_FIXED_RATE_135MBPS_MCS7_40MHZ_SIMO    36
+#define WNI_CFG_FIXED_RATE_15MBPS_MCS0_40MHZ_SIMO_SGI    37
+#define WNI_CFG_FIXED_RATE_30MBPS_MCS1_40MHZ_SIMO_SGI    38
+#define WNI_CFG_FIXED_RATE_45MBPS_MCS2_40MHZ_SIMO_SGI    39
+#define WNI_CFG_FIXED_RATE_60MBPS_MCS3_40MHZ_SIMO_SGI    40
+#define WNI_CFG_FIXED_RATE_90MBPS_MCS4_40MHZ_SIMO_SGI    41
+#define WNI_CFG_FIXED_RATE_120MBPS_MCS5_40MHZ_SIMO_SGI    42
+#define WNI_CFG_FIXED_RATE_135MBPS_MCS6_40MHZ_SIMO_SGI    43
+#define WNI_CFG_FIXED_RATE_150MBPS_MCS7_40MHZ_SIMO_SGI    44
+
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_STAMIN    0
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_STAMAX    31
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_STADEF    1
+
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_APMIN    0
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_APMAX    31
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_APDEF    1
+
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_STAMIN    0
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_STAMAX    31
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_STADEF    5
+
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_APMIN    0
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_APMAX    31
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_APDEF    5
+
+#define WNI_CFG_RETRYRATE_POLICY_STAMIN    0
+#define WNI_CFG_RETRYRATE_POLICY_STAMAX    255
+#define WNI_CFG_RETRYRATE_POLICY_STADEF    4
+
+#define WNI_CFG_RETRYRATE_POLICY_APMIN    0
+#define WNI_CFG_RETRYRATE_POLICY_APMAX    255
+#define WNI_CFG_RETRYRATE_POLICY_APDEF    4
+
+#define WNI_CFG_RETRYRATE_POLICY_MIN_SUPPORTED    0
+#define WNI_CFG_RETRYRATE_POLICY_PRIMARY    1
+#define WNI_CFG_RETRYRATE_POLICY_RESERVED    2
+#define WNI_CFG_RETRYRATE_POLICY_CLOSEST    3
+#define WNI_CFG_RETRYRATE_POLICY_AUTOSELECT    4
+#define WNI_CFG_RETRYRATE_POLICY_MAX    5
+
+#define WNI_CFG_RETRYRATE_SECONDARY_STAMIN    0
+#define WNI_CFG_RETRYRATE_SECONDARY_STAMAX    255
+#define WNI_CFG_RETRYRATE_SECONDARY_STADEF    0
+
+#define WNI_CFG_RETRYRATE_SECONDARY_APMIN    0
+#define WNI_CFG_RETRYRATE_SECONDARY_APMAX    255
+#define WNI_CFG_RETRYRATE_SECONDARY_APDEF    0
+
+#define WNI_CFG_RETRYRATE_TERTIARY_STAMIN    0
+#define WNI_CFG_RETRYRATE_TERTIARY_STAMAX    255
+#define WNI_CFG_RETRYRATE_TERTIARY_STADEF    0
+
+#define WNI_CFG_RETRYRATE_TERTIARY_APMIN    0
+#define WNI_CFG_RETRYRATE_TERTIARY_APMAX    255
+#define WNI_CFG_RETRYRATE_TERTIARY_APDEF    0
+
+#define WNI_CFG_APSD_ENABLED_STAMIN    0
+#define WNI_CFG_APSD_ENABLED_STAMAX    1
+#define WNI_CFG_APSD_ENABLED_STADEF    0
+
+#define WNI_CFG_APSD_ENABLED_APMIN    0
+#define WNI_CFG_APSD_ENABLED_APMAX    1
+#define WNI_CFG_APSD_ENABLED_APDEF    0
+
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_STAMIN    0
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_STAMAX    1
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_STADEF    1
+
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_APMIN    0
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_APMAX    1
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE_APDEF    1
+
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STAMIN    0
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STAMAX    1
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STADEF    1
+
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_APMIN    0
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_APMAX    1
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_APDEF    1
+
+#define WNI_CFG_AUTHENTICATION_TYPE_STAMIN    0
+#define WNI_CFG_AUTHENTICATION_TYPE_STAMAX    65535
+#define WNI_CFG_AUTHENTICATION_TYPE_STADEF    0
+
+#define WNI_CFG_AUTHENTICATION_TYPE_APMIN    0
+#define WNI_CFG_AUTHENTICATION_TYPE_APMAX    65535
+#define WNI_CFG_AUTHENTICATION_TYPE_APDEF    0
+
+#define WNI_CFG_CF_POLL_REQUEST_APMIN    0
+#define WNI_CFG_CF_POLL_REQUEST_APMAX    1
+#define WNI_CFG_CF_POLL_REQUEST_APDEF    0
+
+#define WNI_CFG_PRIVACY_ENABLED_STAMIN    0
+#define WNI_CFG_PRIVACY_ENABLED_STAMAX    1
+#define WNI_CFG_PRIVACY_ENABLED_STADEF    0
+
+#define WNI_CFG_PRIVACY_ENABLED_APMIN    0
+#define WNI_CFG_PRIVACY_ENABLED_APMAX    1
+#define WNI_CFG_PRIVACY_ENABLED_APDEF    0
+
+#define WNI_CFG_SHORT_PREAMBLE_STAMIN    0
+#define WNI_CFG_SHORT_PREAMBLE_STAMAX    1
+#define WNI_CFG_SHORT_PREAMBLE_STADEF    1
+
+#define WNI_CFG_SHORT_PREAMBLE_APMIN    0
+#define WNI_CFG_SHORT_PREAMBLE_APMAX    1
+#define WNI_CFG_SHORT_PREAMBLE_APDEF    1
+
+#define WNI_CFG_SHORT_SLOT_TIME_STAMIN    0
+#define WNI_CFG_SHORT_SLOT_TIME_STAMAX    1
+#define WNI_CFG_SHORT_SLOT_TIME_STADEF    1
+
+#define WNI_CFG_SHORT_SLOT_TIME_APMIN    0
+#define WNI_CFG_SHORT_SLOT_TIME_APMAX    1
+#define WNI_CFG_SHORT_SLOT_TIME_APDEF    0
+
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_STAMIN    0
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_STAMAX    1
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_STADEF    0
+
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_APMIN    0
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_APMAX    1
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_APDEF    0
+
+#define WNI_CFG_QOS_ENABLED_STAMIN    0
+#define WNI_CFG_QOS_ENABLED_STAMAX    1
+#define WNI_CFG_QOS_ENABLED_STADEF    0
+
+#define WNI_CFG_QOS_ENABLED_APMIN    0
+#define WNI_CFG_QOS_ENABLED_APMAX    1
+#define WNI_CFG_QOS_ENABLED_APDEF    0
+
+#define WNI_CFG_HCF_ENABLED_STAMIN    0
+#define WNI_CFG_HCF_ENABLED_STAMAX    1
+#define WNI_CFG_HCF_ENABLED_STADEF    0
+
+#define WNI_CFG_HCF_ENABLED_APMIN    0
+#define WNI_CFG_HCF_ENABLED_APMAX    1
+#define WNI_CFG_HCF_ENABLED_APDEF    0
+
+#define WNI_CFG_RSN_ENABLED_STAMIN    0
+#define WNI_CFG_RSN_ENABLED_STAMAX    1
+#define WNI_CFG_RSN_ENABLED_STADEF    0
+
+#define WNI_CFG_RSN_ENABLED_APMIN    0
+#define WNI_CFG_RSN_ENABLED_APMAX    1
+#define WNI_CFG_RSN_ENABLED_APDEF    0
+
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_STAMIN    0
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_STAMAX    180000
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_STADEF    5000
+
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_APMIN    0
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_APMAX    18000
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD_APDEF    5000
+
+#define WNI_CFG_MAX_NUM_PRE_AUTH_STAMIN    0
+#define WNI_CFG_MAX_NUM_PRE_AUTH_STAMAX    256
+#define WNI_CFG_MAX_NUM_PRE_AUTH_STADEF    64
+
+#define WNI_CFG_MAX_NUM_PRE_AUTH_APMIN    0
+#define WNI_CFG_MAX_NUM_PRE_AUTH_APMAX    256
+#define WNI_CFG_MAX_NUM_PRE_AUTH_APDEF    64
+
+#define WNI_CFG_PREAUTH_CLNUP_TIMEOUT_APMIN    0
+#define WNI_CFG_PREAUTH_CLNUP_TIMEOUT_APMAX    120000
+#define WNI_CFG_PREAUTH_CLNUP_TIMEOUT_APDEF    30000
+
+#define WNI_CFG_RELEASE_AID_TIMEOUT_APMIN    0
+#define WNI_CFG_RELEASE_AID_TIMEOUT_APMAX    100000
+#define WNI_CFG_RELEASE_AID_TIMEOUT_APDEF    1000
+
+#define WNI_CFG_HEART_BEAT_THRESHOLD_STAMIN    0
+#define WNI_CFG_HEART_BEAT_THRESHOLD_STAMAX    65535
+#define WNI_CFG_HEART_BEAT_THRESHOLD_STADEF    40
+
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_STAMIN    10
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_STAMAX    10000
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_STADEF    40
+
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_APMIN    10
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_APMAX    10000
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_APDEF    40
+
+#define WNI_CFG_11D_ENABLED_STAMIN    0
+#define WNI_CFG_11D_ENABLED_STAMAX    1
+#define WNI_CFG_11D_ENABLED_STADEF    1
+
+#define WNI_CFG_11D_ENABLED_APMIN    0
+#define WNI_CFG_11D_ENABLED_APMAX    1
+#define WNI_CFG_11D_ENABLED_APDEF    0
+
+#define WNI_CFG_NETWORK_DENSITY_STAMIN    0
+#define WNI_CFG_NETWORK_DENSITY_STAMAX    3
+#define WNI_CFG_NETWORK_DENSITY_STADEF    3
+
+#define WNI_CFG_NETWORK_DENSITY_APMIN    0
+#define WNI_CFG_NETWORK_DENSITY_APMAX    3
+#define WNI_CFG_NETWORK_DENSITY_APDEF    0
+
+#define WNI_CFG_NETWORK_DENSITY_LOW    0
+#define WNI_CFG_NETWORK_DENSITY_MEDIUM    1
+#define WNI_CFG_NETWORK_DENSITY_HIGH    2
+#define WNI_CFG_NETWORK_DENSITY_ADAPTIVE    3
+
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_STAMIN    1
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_STAMAX    2
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_STADEF    2
+
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_APMIN    1
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_APMAX    2
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_APDEF    2
+
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_CARRIER    1
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_CORRELATION    2
+
+#define WNI_CFG_CURRENT_TX_ANTENNA_STAMIN    1
+#define WNI_CFG_CURRENT_TX_ANTENNA_STAMAX    1
+#define WNI_CFG_CURRENT_TX_ANTENNA_STADEF    1
+
+#define WNI_CFG_CURRENT_TX_ANTENNA_APMIN    1
+#define WNI_CFG_CURRENT_TX_ANTENNA_APMAX    2
+#define WNI_CFG_CURRENT_TX_ANTENNA_APDEF    2
+
+#define WNI_CFG_CURRENT_RX_ANTENNA_STAMIN    1
+#define WNI_CFG_CURRENT_RX_ANTENNA_STAMAX    2
+#define WNI_CFG_CURRENT_RX_ANTENNA_STADEF    2
+
+#define WNI_CFG_CURRENT_RX_ANTENNA_APMIN    1
+#define WNI_CFG_CURRENT_RX_ANTENNA_APMAX    3
+#define WNI_CFG_CURRENT_RX_ANTENNA_APDEF    3
+
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMIN    0
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMAX    128
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_STADEF    27
+
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_APMIN    0
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_APMAX    128
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL_APDEF    27
+
+#define WNI_CFG_POWER_STATE_PER_CHAIN_STAMIN    0
+#define WNI_CFG_POWER_STATE_PER_CHAIN_STAMAX    65535
+#define WNI_CFG_POWER_STATE_PER_CHAIN_STADEF    785
+
+#define WNI_CFG_POWER_STATE_PER_CHAIN_APMIN    0
+#define WNI_CFG_POWER_STATE_PER_CHAIN_APMAX    65535
+#define WNI_CFG_POWER_STATE_PER_CHAIN_APDEF    785
+
+#define WNI_CFG_POWER_STATE_PER_CHAIN_OFF    0
+#define WNI_CFG_POWER_STATE_PER_CHAIN_ON    1
+#define WNI_CFG_POWER_STATE_PER_CHAIN_TX    2
+#define WNI_CFG_POWER_STATE_PER_CHAIN_RX    3
+#define WNI_CFG_POWER_STATE_PER_CHAIN_MASK    15
+#define WNI_CFG_POWER_STATE_PER_CHAIN_CHAIN_0_OFFSET    0
+#define WNI_CFG_POWER_STATE_PER_CHAIN_CHAIN_1_OFFSET    4
+#define WNI_CFG_POWER_STATE_PER_CHAIN_CHAIN_2_OFFSET    8
+
+#define WNI_CFG_NEW_BSS_FOUND_IND_STAMIN    0
+#define WNI_CFG_NEW_BSS_FOUND_IND_STAMAX    1
+#define WNI_CFG_NEW_BSS_FOUND_IND_STADEF    0
+
+#define WNI_CFG_NEW_BSS_FOUND_IND_APMIN    0
+#define WNI_CFG_NEW_BSS_FOUND_IND_APMAX    1
+#define WNI_CFG_NEW_BSS_FOUND_IND_APDEF    0
+
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_STAMIN    0
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_STAMAX    1
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_STADEF    0
+
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_APMIN    0
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_APMAX    1
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_APDEF    0
+
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_STAMIN    0
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_STAMAX    1
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_STADEF    0
+
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_APMIN    0
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_APMAX    1
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED_APDEF    0
+
+#define WNI_CFG_11H_ENABLED_STAMIN    0
+#define WNI_CFG_11H_ENABLED_STAMAX    1
+#define WNI_CFG_11H_ENABLED_STADEF    1
+
+#define WNI_CFG_11H_ENABLED_APMIN    0
+#define WNI_CFG_11H_ENABLED_APMAX    1
+#define WNI_CFG_11H_ENABLED_APDEF    1
+
+#define WNI_CFG_WT_CNF_TIMEOUT_STAMIN    10
+#define WNI_CFG_WT_CNF_TIMEOUT_STAMAX    3000
+#define WNI_CFG_WT_CNF_TIMEOUT_STADEF    1000
+
+#define WNI_CFG_WT_CNF_TIMEOUT_APMIN    10
+#define WNI_CFG_WT_CNF_TIMEOUT_APMAX    3000
+#define WNI_CFG_WT_CNF_TIMEOUT_APDEF    1000
+
+#define WNI_CFG_KEEPALIVE_TIMEOUT_STAMIN    0
+#define WNI_CFG_KEEPALIVE_TIMEOUT_STAMAX    3600000
+#define WNI_CFG_KEEPALIVE_TIMEOUT_STADEF    0
+
+#define WNI_CFG_KEEPALIVE_TIMEOUT_APMIN    0
+#define WNI_CFG_KEEPALIVE_TIMEOUT_APMAX    3600000
+#define WNI_CFG_KEEPALIVE_TIMEOUT_APDEF    3000
+
+#define WNI_CFG_PROXIMITY_STAMIN    0
+#define WNI_CFG_PROXIMITY_STAMAX    1
+#define WNI_CFG_PROXIMITY_STADEF    0
+
+#define WNI_CFG_PROXIMITY_APMIN    0
+#define WNI_CFG_PROXIMITY_APMAX    1
+#define WNI_CFG_PROXIMITY_APDEF    0
+
+#define WNI_CFG_PROXIMITY_OFF    0
+#define WNI_CFG_PROXIMITY_ON    1
+
+#define WNI_CFG_LOG_LEVEL_STAMIN    0
+#define WNI_CFG_LOG_LEVEL_STAMAX    7
+#define WNI_CFG_LOG_LEVEL_STADEF    4
+
+#define WNI_CFG_LOG_LEVEL_APMIN    0
+#define WNI_CFG_LOG_LEVEL_APMAX    7
+#define WNI_CFG_LOG_LEVEL_APDEF    4
+
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_STAMIN    1000
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_STAMAX    30000
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_STADEF    10000
+
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_APMIN    1000
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_APMAX    30000
+#define WNI_CFG_OLBC_DETECT_TIMEOUT_APDEF    10000
+
+#define WNI_CFG_PROTECTION_ENABLED_STAMIN    0
+#define WNI_CFG_PROTECTION_ENABLED_STAMAX    65535
+#define WNI_CFG_PROTECTION_ENABLED_STADEF    65535
+
+#define WNI_CFG_PROTECTION_ENABLED_APMIN    0
+#define WNI_CFG_PROTECTION_ENABLED_APMAX    65535
+#define WNI_CFG_PROTECTION_ENABLED_APDEF    65535
+
+#define WNI_CFG_PROTECTION_ENABLED_FROM_llA    0
+#define WNI_CFG_PROTECTION_ENABLED_FROM_llB    1
+#define WNI_CFG_PROTECTION_ENABLED_FROM_llG    2
+#define WNI_CFG_PROTECTION_ENABLED_HT_20    3
+#define WNI_CFG_PROTECTION_ENABLED_NON_GF    4
+#define WNI_CFG_PROTECTION_ENABLED_LSIG_TXOP    5
+#define WNI_CFG_PROTECTION_ENABLED_RIFS    6
+#define WNI_CFG_PROTECTION_ENABLED_OBSS    7
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llA    8
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llB    9
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llG    10
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_HT20    11
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_NON_GF    12
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_LSIG_TXOP    13
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_RIFS    14
+#define WNI_CFG_PROTECTION_ENABLED_OLBC_OBSS    15
+
+#define WNI_CFG_11G_PROTECTION_ALWAYS_STAMIN    0
+#define WNI_CFG_11G_PROTECTION_ALWAYS_STAMAX    1
+#define WNI_CFG_11G_PROTECTION_ALWAYS_STADEF    0
+
+#define WNI_CFG_11G_PROTECTION_ALWAYS_APMIN    0
+#define WNI_CFG_11G_PROTECTION_ALWAYS_APMAX    1
+#define WNI_CFG_11G_PROTECTION_ALWAYS_APDEF    0
+
+#define WNI_CFG_FORCE_POLICY_PROTECTION_STAMIN    0
+#define WNI_CFG_FORCE_POLICY_PROTECTION_STAMAX    5
+#define WNI_CFG_FORCE_POLICY_PROTECTION_STADEF    5
+
+#define WNI_CFG_FORCE_POLICY_PROTECTION_APMIN    0
+#define WNI_CFG_FORCE_POLICY_PROTECTION_APMAX    5
+#define WNI_CFG_FORCE_POLICY_PROTECTION_APDEF    5
+
+#define WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE    0
+#define WNI_CFG_FORCE_POLICY_PROTECTION_CTS    1
+#define WNI_CFG_FORCE_POLICY_PROTECTION_RTS    2
+#define WNI_CFG_FORCE_POLICY_PROTECTION_DUAL_CTS    3
+#define WNI_CFG_FORCE_POLICY_PROTECTION_RTS_ALWAYS    4
+#define WNI_CFG_FORCE_POLICY_PROTECTION_AUTO    5
+
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_STAMIN    0
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_STAMAX    1
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_STADEF    0
+
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_APMIN    0
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_APMAX    1
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_APDEF    0
+
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_STAMIN    0
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_STAMAX    1
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_STADEF    1
+
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_APMIN    0
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_APMAX    1
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_APDEF    1
+
+#define WNI_CFG_CAL_PERIOD_STAMIN    2
+#define WNI_CFG_CAL_PERIOD_STAMAX    10
+#define WNI_CFG_CAL_PERIOD_STADEF    5
+
+#define WNI_CFG_CAL_PERIOD_APMIN    2
+#define WNI_CFG_CAL_PERIOD_APMAX    10
+#define WNI_CFG_CAL_PERIOD_APDEF    5
+
+#define WNI_CFG_STATS_PERIOD_STAMIN    1
+#define WNI_CFG_STATS_PERIOD_STAMAX    10
+#define WNI_CFG_STATS_PERIOD_STADEF    10
+
+#define WNI_CFG_STATS_PERIOD_APMIN    1
+#define WNI_CFG_STATS_PERIOD_APMAX    10
+#define WNI_CFG_STATS_PERIOD_APDEF    10
+
+#define WNI_CFG_CAL_CONTROL_STAMIN    0
+#define WNI_CFG_CAL_CONTROL_STAMAX    1
+#define WNI_CFG_CAL_CONTROL_STADEF    0
+
+#define WNI_CFG_CAL_CONTROL_APMIN    0
+#define WNI_CFG_CAL_CONTROL_APMAX    1
+#define WNI_CFG_CAL_CONTROL_APDEF    0
+
+#define WNI_CFG_CAL_CONTROL_CAL_ON    0
+#define WNI_CFG_CAL_CONTROL_CAL_OFF    1
+
+#define WNI_CFG_11G_ONLY_POLICY_STAMIN    0
+#define WNI_CFG_11G_ONLY_POLICY_STAMAX    1
+#define WNI_CFG_11G_ONLY_POLICY_STADEF    0
+
+#define WNI_CFG_11G_ONLY_POLICY_APMIN    0
+#define WNI_CFG_11G_ONLY_POLICY_APMAX    1
+#define WNI_CFG_11G_ONLY_POLICY_APDEF    0
+
+#define WNI_CFG_PACKET_CLASSIFICATION_STAMIN    0
+#define WNI_CFG_PACKET_CLASSIFICATION_STAMAX    3
+#define WNI_CFG_PACKET_CLASSIFICATION_STADEF    0
+
+#define WNI_CFG_PACKET_CLASSIFICATION_APMIN    0
+#define WNI_CFG_PACKET_CLASSIFICATION_APMAX    3
+#define WNI_CFG_PACKET_CLASSIFICATION_APDEF    0
+
+#define WNI_CFG_PACKET_CLASSIFICATION_DISABLED    0
+#define WNI_CFG_PACKET_CLASSIFICATION_DSCP    1
+#define WNI_CFG_PACKET_CLASSIFICATION_8021P    2
+#define WNI_CFG_PACKET_CLASSIFICATION_ALL    3
+
+#define WNI_CFG_WME_ENABLED_STAMIN    0
+#define WNI_CFG_WME_ENABLED_STAMAX    1
+#define WNI_CFG_WME_ENABLED_STADEF    1
+
+#define WNI_CFG_WME_ENABLED_APMIN    0
+#define WNI_CFG_WME_ENABLED_APMAX    1
+#define WNI_CFG_WME_ENABLED_APDEF    1
+
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_STAMIN    0
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_STAMAX    65535
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_STADEF    1000
+
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_APMIN    0
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_APMAX    65535
+#define WNI_CFG_ADDTS_RSP_TIMEOUT_APDEF    1000
+
+#define WNI_CFG_MAX_SP_LENGTH_STAMIN    0
+#define WNI_CFG_MAX_SP_LENGTH_STAMAX    3
+#define WNI_CFG_MAX_SP_LENGTH_STADEF    0
+
+#define WNI_CFG_MAX_SP_LENGTH_APMIN    0
+#define WNI_CFG_MAX_SP_LENGTH_APMAX    3
+#define WNI_CFG_MAX_SP_LENGTH_APDEF    0
+
+#define WNI_CFG_KEEP_ALIVE_STA_LIMIT_THRESHOLD_APMIN    0
+#define WNI_CFG_KEEP_ALIVE_STA_LIMIT_THRESHOLD_APMAX    32
+#define WNI_CFG_KEEP_ALIVE_STA_LIMIT_THRESHOLD_APDEF    0
+
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_STAMIN    0
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_STAMAX    1
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_STADEF    0
+
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_APMIN    0
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_APMAX    1
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS_APDEF    0
+
+#define WNI_CFG_WSM_ENABLED_STAMIN    0
+#define WNI_CFG_WSM_ENABLED_STAMAX    1
+#define WNI_CFG_WSM_ENABLED_STADEF    0
+
+#define WNI_CFG_WSM_ENABLED_APMIN    0
+#define WNI_CFG_WSM_ENABLED_APMAX    1
+#define WNI_CFG_WSM_ENABLED_APDEF    0
+
+#define WNI_CFG_PROP_CAPABILITY_STAMIN    0
+#define WNI_CFG_PROP_CAPABILITY_STAMAX    65535
+#define WNI_CFG_PROP_CAPABILITY_STADEF    57535
+
+#define WNI_CFG_PROP_CAPABILITY_APMIN    0
+#define WNI_CFG_PROP_CAPABILITY_APMAX    65535
+#define WNI_CFG_PROP_CAPABILITY_APDEF    49321
+
+#define WNI_CFG_PROP_CAPABILITY_HCF    0
+#define WNI_CFG_PROP_CAPABILITY_11EQOS    1
+#define WNI_CFG_PROP_CAPABILITY_WME    2
+#define WNI_CFG_PROP_CAPABILITY_WSM    3
+#define WNI_CFG_PROP_CAPABILITY_EXTRATES    4
+#define WNI_CFG_PROP_CAPABILITY_EXTRATE_STOP    5
+#define WNI_CFG_PROP_CAPABILITY_TITAN    6
+#define WNI_CFG_PROP_CAPABILITY_TAURUS    7
+#define WNI_CFG_PROP_CAPABILITY_EDCAPARAMS    13
+#define WNI_CFG_PROP_CAPABILITY_LOADINFO    14
+#define WNI_CFG_PROP_CAPABILITY_VERSION    15
+#define WNI_CFG_PROP_CAPABILITY_MAXBITOFFSET    15
+
+#define WNI_CFG_EDCA_PROFILE_STAMIN    0
+#define WNI_CFG_EDCA_PROFILE_STAMAX    255
+#define WNI_CFG_EDCA_PROFILE_STADEF    1
+
+#define WNI_CFG_EDCA_PROFILE_APMIN    0
+#define WNI_CFG_EDCA_PROFILE_APMAX    255
+#define WNI_CFG_EDCA_PROFILE_APDEF    1
+
+#define WNI_CFG_EDCA_PROFILE_ANI    0
+#define WNI_CFG_EDCA_PROFILE_WMM    1
+#define WNI_CFG_EDCA_PROFILE_TIT_DEMO    2
+#define WNI_CFG_EDCA_PROFILE_MAX    3
+#define WNI_CFG_EDCA_PROFILE_ACM_IDX    0
+#define WNI_CFG_EDCA_PROFILE_AIFSN_IDX    1
+#define WNI_CFG_EDCA_PROFILE_CWMINA_IDX    2
+#define WNI_CFG_EDCA_PROFILE_CWMAXA_IDX    4
+#define WNI_CFG_EDCA_PROFILE_TXOPA_IDX    6
+#define WNI_CFG_EDCA_PROFILE_CWMINB_IDX    7
+#define WNI_CFG_EDCA_PROFILE_CWMAXB_IDX    9
+#define WNI_CFG_EDCA_PROFILE_TXOPB_IDX    11
+#define WNI_CFG_EDCA_PROFILE_CWMING_IDX    12
+#define WNI_CFG_EDCA_PROFILE_CWMAXG_IDX    14
+#define WNI_CFG_EDCA_PROFILE_TXOPG_IDX    16
+
+#define WNI_CFG_RDET_FLAG_STAMIN    0
+#define WNI_CFG_RDET_FLAG_STAMAX    1
+#define WNI_CFG_RDET_FLAG_STADEF    0
+
+#define WNI_CFG_RDET_FLAG_APMIN    0
+#define WNI_CFG_RDET_FLAG_APMAX    1
+#define WNI_CFG_RDET_FLAG_APDEF    0
+
+#define WNI_CFG_RDET_FLAG_ENABLE    1
+#define WNI_CFG_RDET_FLAG_DISABLE    0
+
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_STAMIN    0
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_STAMAX    255
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_STADEF    0
+
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_APMIN    0
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_APMAX    255
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT_APDEF    0
+
+#define WNI_CFG_ADMIT_POLICY_STAMIN    0
+#define WNI_CFG_ADMIT_POLICY_STAMAX    2
+#define WNI_CFG_ADMIT_POLICY_STADEF    0
+
+#define WNI_CFG_ADMIT_POLICY_APMIN    0
+#define WNI_CFG_ADMIT_POLICY_APMAX    2
+#define WNI_CFG_ADMIT_POLICY_APDEF    0
+
+#define WNI_CFG_ADMIT_POLICY_ADMIT_ALL    0
+#define WNI_CFG_ADMIT_POLICY_REJECT_ALL    1
+#define WNI_CFG_ADMIT_POLICY_BW_FACTOR    2
+
+#define WNI_CFG_ADMIT_BWFACTOR_STAMIN    0
+#define WNI_CFG_ADMIT_BWFACTOR_STAMAX    100
+#define WNI_CFG_ADMIT_BWFACTOR_STADEF    20
+
+#define WNI_CFG_ADMIT_BWFACTOR_APMIN    0
+#define WNI_CFG_ADMIT_BWFACTOR_APMAX    100
+#define WNI_CFG_ADMIT_BWFACTOR_APDEF    20
+
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STAMIN    0
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STAMAX    256
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STADEF    60
+
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_APMIN    0
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_APMAX    256
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_APDEF    60
+
+#define WNI_CFG_CHANNEL_BONDING_MODE_STAMIN    0
+#define WNI_CFG_CHANNEL_BONDING_MODE_STAMAX    10
+#define WNI_CFG_CHANNEL_BONDING_MODE_STADEF    0
+
+#define WNI_CFG_CHANNEL_BONDING_MODE_APMIN    0
+#define WNI_CFG_CHANNEL_BONDING_MODE_APMAX    10
+#define WNI_CFG_CHANNEL_BONDING_MODE_APDEF    0
+
+#define WNI_CFG_CHANNEL_BONDING_MODE_DISABLE    0
+#define WNI_CFG_CHANNEL_BONDING_MODE_ENABLE    1
+#define WNI_CFG_CHANNEL_BONDING_MODE_IF_NO_LEGACY_BSS    2
+#define WNI_CFG_CHANNEL_BONDING_MODE_IF_NO_LEGACY_ALL    3
+#define WNI_CFG_CHANNEL_BONDING_MODE_INTELLIGENT    4
+
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMIN    0
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMAX    10
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STADEF    0
+
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_APMIN    0
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_APMAX    10
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_APDEF    0
+
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_NONE    0
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_LOWER    1
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_HIGHER    2
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_LOW_40MHZ_CENTERED    3
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_CENTERED_40MHZ_CENTERED    4
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_HIGH_40MHZ_CENTERED    5
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_LOW_40MHZ_LOW    6
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_HIGH_40MHZ_LOW    7
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_LOW_40MHZ_HIGH    8
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_HIGH_40MHZ_HIGH    9
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMIN    0
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMAX    255
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STADEF    2
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_APMIN    0
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_APMAX    255
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_APDEF    2
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_STAMIN    0
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_STAMAX    255
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_STADEF    4
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_APMIN    0
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_APMAX    255
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE_APDEF    4
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_STAMIN    0
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_STAMAX    255
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_STADEF    6
+
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_APMIN    0
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_APMAX    255
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO_APDEF    6
+
+#define WNI_CFG_TRIG_STA_BK_SCAN_STAMIN    0
+#define WNI_CFG_TRIG_STA_BK_SCAN_STAMAX    1
+#define WNI_CFG_TRIG_STA_BK_SCAN_STADEF    0
+
+#define WNI_CFG_TRIG_STA_BK_SCAN_APMIN    0
+#define WNI_CFG_TRIG_STA_BK_SCAN_APMAX    1
+#define WNI_CFG_TRIG_STA_BK_SCAN_APDEF    1
+
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_STAMIN    0
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_STAMAX    255
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_STADEF    255
+
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_APMIN    0
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_APMAX    255
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_APDEF    1
+
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING_UNUSED    255
+
+#define WNI_CFG_MIMO_ENABLED_STAMIN    0
+#define WNI_CFG_MIMO_ENABLED_STAMAX    1
+#define WNI_CFG_MIMO_ENABLED_STADEF    1
+
+#define WNI_CFG_MIMO_ENABLED_APMIN    0
+#define WNI_CFG_MIMO_ENABLED_APMAX    1
+#define WNI_CFG_MIMO_ENABLED_APDEF    1
+
+#define WNI_CFG_MIMO_ENABLED_ENABLE    1
+#define WNI_CFG_MIMO_ENABLED_DISABLE    0
+
+#define WNI_CFG_BLOCK_ACK_ENABLED_STAMIN    0
+#define WNI_CFG_BLOCK_ACK_ENABLED_STAMAX    3
+#define WNI_CFG_BLOCK_ACK_ENABLED_STADEF    2
+
+#define WNI_CFG_BLOCK_ACK_ENABLED_APMIN    0
+#define WNI_CFG_BLOCK_ACK_ENABLED_APMAX    3
+#define WNI_CFG_BLOCK_ACK_ENABLED_APDEF    2
+
+#define WNI_CFG_BLOCK_ACK_ENABLED_DELAYED    0
+#define WNI_CFG_BLOCK_ACK_ENABLED_IMMEDIATE    1
+
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_STAMIN    0
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_STAMAX    65535
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_STADEF    1000
+
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_APMIN    0
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_APMAX    65535
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_APDEF    1000
+
+#define WNI_CFG_HT_RX_STBC_STAMIN    0
+#define WNI_CFG_HT_RX_STBC_STAMAX    3
+#define WNI_CFG_HT_RX_STBC_STADEF    1
+
+#define WNI_CFG_HT_RX_STBC_APMIN    0
+#define WNI_CFG_HT_RX_STBC_APMAX    3
+#define WNI_CFG_HT_RX_STBC_APDEF    1
+
+#define WNI_CFG_HT_CAP_INFO_STAMIN    0
+#define WNI_CFG_HT_CAP_INFO_STAMAX    65535
+#define WNI_CFG_HT_CAP_INFO_STADEF    364
+
+#define WNI_CFG_HT_CAP_INFO_APMIN    0
+#define WNI_CFG_HT_CAP_INFO_APMAX    65535
+#define WNI_CFG_HT_CAP_INFO_APDEF    4206
+
+#define WNI_CFG_HT_CAP_INFO_ADVANCE_CODING    0
+#define WNI_CFG_HT_CAP_INFO_SUPPORTED_CHAN_WIDTH_SET    1
+#define WNI_CFG_HT_CAP_INFO_SM_POWER_SAVE    2
+#define WNI_CFG_HT_CAP_INFO_GREEN_FIELD    4
+#define WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ    5
+#define WNI_CFG_HT_CAP_INFO_SHORT_GI_40MHZ    6
+#define WNI_CFG_HT_CAP_INFO_TX_STBC    7
+#define WNI_CFG_HT_CAP_INFO_RX_STBC    8
+#define WNI_CFG_HT_CAP_INFO_DELAYED_BA    10
+#define WNI_CFG_HT_CAP_INFO_MAX_AMSDU_SIZE    11
+#define WNI_CFG_HT_CAP_INFO_DSSS_CCK_MODE_40MHZ    12
+#define WNI_CFG_HT_CAP_INFO_PSMP    13
+#define WNI_CFG_HT_CAP_INFO_STBC_CONTROL_FRAME    14
+#define WNI_CFG_HT_CAP_INFO_LSIG_TXOP_PROTECTION    15
+
+#define WNI_CFG_HT_AMPDU_PARAMS_STAMIN    0
+#define WNI_CFG_HT_AMPDU_PARAMS_STAMAX    255
+#define WNI_CFG_HT_AMPDU_PARAMS_STADEF    0
+
+#define WNI_CFG_HT_AMPDU_PARAMS_APMIN    0
+#define WNI_CFG_HT_AMPDU_PARAMS_APMAX    255
+#define WNI_CFG_HT_AMPDU_PARAMS_APDEF    2
+
+#define WNI_CFG_HT_AMPDU_PARAMS_MAX_RX_AMPDU_FACTOR    0
+#define WNI_CFG_HT_AMPDU_PARAMS_MPDU_DENSITY    2
+#define WNI_CFG_HT_AMPDU_PARAMS_RESERVED    5
+
+#define WNI_CFG_EXT_HT_CAP_INFO_STAMIN    0
+#define WNI_CFG_EXT_HT_CAP_INFO_STAMAX    65535
+#define WNI_CFG_EXT_HT_CAP_INFO_STADEF    1024
+
+#define WNI_CFG_EXT_HT_CAP_INFO_APMIN    0
+#define WNI_CFG_EXT_HT_CAP_INFO_APMAX    65535
+#define WNI_CFG_EXT_HT_CAP_INFO_APDEF    1024
+
+#define WNI_CFG_EXT_HT_CAP_INFO_PCO    0
+#define WNI_CFG_EXT_HT_CAP_INFO_TRANSITION_TIME    1
+#define WNI_CFG_EXT_HT_CAP_INFO_RESERVED1    3
+#define WNI_CFG_EXT_HT_CAP_INFO_MCS_FEEDBACK    8
+#define WNI_CFG_EXT_HT_CAP_INFO_HTC_SUPPORT    10
+#define WNI_CFG_EXT_HT_CAP_INFO_RD_RESPONDER    11
+#define WNI_CFG_EXT_HT_CAP_INFO_RESERVED2    12
+
+#define WNI_CFG_TX_BF_CAP_STAMIN    0
+#define WNI_CFG_TX_BF_CAP_STAMAX    4294967295
+#define WNI_CFG_TX_BF_CAP_STADEF    0
+
+#define WNI_CFG_TX_BF_CAP_APMIN    0
+#define WNI_CFG_TX_BF_CAP_APMAX    4294967295
+#define WNI_CFG_TX_BF_CAP_APDEF    0
+
+#define WNI_CFG_AS_CAP_STAMIN    0
+#define WNI_CFG_AS_CAP_STAMAX    255
+#define WNI_CFG_AS_CAP_STADEF    0
+
+#define WNI_CFG_AS_CAP_APMIN    0
+#define WNI_CFG_AS_CAP_APMAX    255
+#define WNI_CFG_AS_CAP_APDEF    0
+
+#define WNI_CFG_AS_CAP_ANTENNA_SELECTION    0
+#define WNI_CFG_AS_CAP_EXPLICIT_CSI_FEEDBACK_TX    1
+#define WNI_CFG_AS_CAP_ANTENNA_INDICES_FEEDBACK_TX    2
+#define WNI_CFG_AS_CAP_EXPLICIT_CSI_FEEDBACK    3
+#define WNI_CFG_AS_CAP_ANTENNA_INDICES_FEEDBACK    4
+#define WNI_CFG_AS_CAP_RX_AS    5
+#define WNI_CFG_AS_CAP_TX_SOUNDING_PPDUS    6
+#define WNI_CFG_AS_CAP_RESERVED    7
+
+#define WNI_CFG_HT_INFO_FIELD1_STAMIN    0
+#define WNI_CFG_HT_INFO_FIELD1_STAMAX    255
+#define WNI_CFG_HT_INFO_FIELD1_STADEF    15
+
+#define WNI_CFG_HT_INFO_FIELD1_APMIN    0
+#define WNI_CFG_HT_INFO_FIELD1_APMAX    255
+#define WNI_CFG_HT_INFO_FIELD1_APDEF    15
+
+#define WNI_CFG_HT_INFO_FIELD1_SECONDARY_CHANNEL_OFFSET    0
+#define WNI_CFG_HT_INFO_FIELD1_RECOMMENDED_CHANNEL_WIDTH    2
+#define WNI_CFG_HT_INFO_FIELD1_RIFS_MODE    3
+#define WNI_CFG_HT_INFO_FIELD1_PSMP_ACCESS_ONLY    4
+#define WNI_CFG_HT_INFO_FIELD1_SERVICE_INTERVAL_GRANULARITY    5
+
+#define WNI_CFG_HT_INFO_FIELD2_STAMIN    0
+#define WNI_CFG_HT_INFO_FIELD2_STAMAX    65535
+#define WNI_CFG_HT_INFO_FIELD2_STADEF    0
+
+#define WNI_CFG_HT_INFO_FIELD2_APMIN    0
+#define WNI_CFG_HT_INFO_FIELD2_APMAX    65535
+#define WNI_CFG_HT_INFO_FIELD2_APDEF    0
+
+#define WNI_CFG_HT_INFO_FIELD2_OP_MODE    0
+#define WNI_CFG_HT_INFO_FIELD2_NON_GF_DEVICES_PRESENT    2
+#define WNI_CFG_HT_INFO_FIELD2_RESERVED    3
+
+#define WNI_CFG_HT_INFO_FIELD3_STAMIN    0
+#define WNI_CFG_HT_INFO_FIELD3_STAMAX    65535
+#define WNI_CFG_HT_INFO_FIELD3_STADEF    0
+
+#define WNI_CFG_HT_INFO_FIELD3_APMIN    0
+#define WNI_CFG_HT_INFO_FIELD3_APMAX    65535
+#define WNI_CFG_HT_INFO_FIELD3_APDEF    0
+
+#define WNI_CFG_HT_INFO_FIELD3_BASIC_STBC_MCS    0
+#define WNI_CFG_HT_INFO_FIELD3_DUAL_STBC_PROTECTION    7
+#define WNI_CFG_HT_INFO_FIELD3_SECONDARY_BEACON    8
+#define WNI_CFG_HT_INFO_FIELD3_LSIG_TXOP_PROTECTION_FULL_SUPPORT    9
+#define WNI_CFG_HT_INFO_FIELD3_PCO_ACTIVE    10
+#define WNI_CFG_HT_INFO_FIELD3_PCO_PHASE    11
+#define WNI_CFG_HT_INFO_FIELD3_RESERVED    12
+
+#define WNI_CFG_GREENFIELD_CAPABILITY_STAMIN    0
+#define WNI_CFG_GREENFIELD_CAPABILITY_STAMAX    1
+#define WNI_CFG_GREENFIELD_CAPABILITY_STADEF    0
+
+#define WNI_CFG_GREENFIELD_CAPABILITY_APMIN    0
+#define WNI_CFG_GREENFIELD_CAPABILITY_APMAX    1
+#define WNI_CFG_GREENFIELD_CAPABILITY_APDEF    0
+
+#define WNI_CFG_GREENFIELD_CAPABILITY_ENABLE    1
+#define WNI_CFG_GREENFIELD_CAPABILITY_DISABLE    0
+
+#define WNI_CFG_VHT_MAX_MPDU_LENGTH_STAMIN    0
+#define WNI_CFG_VHT_MAX_MPDU_LENGTH_STAMAX    2
+#define WNI_CFG_VHT_MAX_MPDU_LENGTH_STADEF    0
+
+#define WNI_CFG_VHT_MAX_MPDU_LENGTH_APMIN    0
+#define WNI_CFG_VHT_MAX_MPDU_LENGTH_APMAX    2
+#define WNI_CFG_VHT_MAX_MPDU_LENGTH_APDEF    0
+
+#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_STAMIN    0
+#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_STAMAX    0
+#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_STADEF    0
+
+#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_APMIN    0
+#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_APMAX    0
+#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_APDEF    0
+
+#define WNI_CFG_VHT_LDPC_CODING_CAP_STAMIN    0
+#define WNI_CFG_VHT_LDPC_CODING_CAP_STAMAX    1
+#define WNI_CFG_VHT_LDPC_CODING_CAP_STADEF    0
+
+#define WNI_CFG_VHT_LDPC_CODING_CAP_APMIN    0
+#define WNI_CFG_VHT_LDPC_CODING_CAP_APMAX    1
+#define WNI_CFG_VHT_LDPC_CODING_CAP_APDEF    0
+
+#define WNI_CFG_VHT_SHORT_GI_80MHZ_STAMIN    0
+#define WNI_CFG_VHT_SHORT_GI_80MHZ_STAMAX    1
+#define WNI_CFG_VHT_SHORT_GI_80MHZ_STADEF    1
+
+#define WNI_CFG_VHT_SHORT_GI_80MHZ_APMIN    0
+#define WNI_CFG_VHT_SHORT_GI_80MHZ_APMAX    1
+#define WNI_CFG_VHT_SHORT_GI_80MHZ_APDEF    1
+
+#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_STAMIN    0
+#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_STAMAX    1
+#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_STADEF    0
+
+#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_APMIN    0
+#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_APMAX    1
+#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_APDEF    0
+
+#define WNI_CFG_VHT_TXSTBC_STAMIN    0
+#define WNI_CFG_VHT_TXSTBC_STAMAX    1
+#define WNI_CFG_VHT_TXSTBC_STADEF    0
+
+#define WNI_CFG_VHT_TXSTBC_APMIN    0
+#define WNI_CFG_VHT_TXSTBC_APMAX    1
+#define WNI_CFG_VHT_TXSTBC_APDEF    0
+
+#define WNI_CFG_VHT_RXSTBC_STAMIN    0
+#define WNI_CFG_VHT_RXSTBC_STAMAX    1
+#define WNI_CFG_VHT_RXSTBC_STADEF    1
+
+#define WNI_CFG_VHT_RXSTBC_APMIN    0
+#define WNI_CFG_VHT_RXSTBC_APMAX    1
+#define WNI_CFG_VHT_RXSTBC_APDEF    1
+
+#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_STAMIN    0
+#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_STAMAX    1
+#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_STADEF    0
+
+#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_APMIN    0
+#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_APMAX    1
+#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_APDEF    0
+
+#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STAMIN    0
+#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STAMAX    1
+#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STADEF    0
+
+#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_APMIN    0
+#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_APMAX    1
+#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_APDEF    0
+
+#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STAMIN    0
+#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STAMAX    4
+#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STADEF    0
+
+#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_APMIN    0
+#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_APMAX    4
+#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_APDEF    0
+
+#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_STAMIN    0
+#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_STAMAX    3
+#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_STADEF    0
+
+#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_APMIN    0
+#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_APMAX    3
+#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_APDEF    0
+
+#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_STAMIN    0
+#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_STAMAX    1
+#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_STADEF    0
+
+#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_APMIN    0
+#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_APMAX    1
+#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_APDEF    0
+
+#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_STAMIN    0
+#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_STAMAX    1
+#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_STADEF    0
+
+#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_APMIN    0
+#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_APMAX    1
+#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_APDEF    0
+
+#define WNI_CFG_VHT_TXOP_PS_STAMIN    0
+#define WNI_CFG_VHT_TXOP_PS_STAMAX    1
+#define WNI_CFG_VHT_TXOP_PS_STADEF    0
+
+#define WNI_CFG_VHT_TXOP_PS_APMIN    0
+#define WNI_CFG_VHT_TXOP_PS_APMAX    1
+#define WNI_CFG_VHT_TXOP_PS_APDEF    0
+
+#define WNI_CFG_VHT_HTC_VHTC_CAP_STAMIN    0
+#define WNI_CFG_VHT_HTC_VHTC_CAP_STAMAX    1
+#define WNI_CFG_VHT_HTC_VHTC_CAP_STADEF    0
+
+#define WNI_CFG_VHT_HTC_VHTC_CAP_APMIN    0
+#define WNI_CFG_VHT_HTC_VHTC_CAP_APMAX    1
+#define WNI_CFG_VHT_HTC_VHTC_CAP_APDEF    0
+
+#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_STAMIN    0
+#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_STAMAX    7
+#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_STADEF    3
+
+#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_APMIN    0
+#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_APMAX    7
+#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_APDEF    3
+
+#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_STAMIN    0
+#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_STAMAX    3
+#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_STADEF    0
+
+#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_APMIN    0
+#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_APMAX    3
+#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_APDEF    0
+
+#define WNI_CFG_VHT_RX_ANT_PATTERN_STAMIN    0
+#define WNI_CFG_VHT_RX_ANT_PATTERN_STAMAX    1
+#define WNI_CFG_VHT_RX_ANT_PATTERN_STADEF    1
+
+#define WNI_CFG_VHT_RX_ANT_PATTERN_APMIN    0
+#define WNI_CFG_VHT_RX_ANT_PATTERN_APMAX    1
+#define WNI_CFG_VHT_RX_ANT_PATTERN_APDEF    1
+
+#define WNI_CFG_VHT_TX_ANT_PATTERN_STAMIN    0
+#define WNI_CFG_VHT_TX_ANT_PATTERN_STAMAX    1
+#define WNI_CFG_VHT_TX_ANT_PATTERN_STADEF    1
+
+#define WNI_CFG_VHT_TX_ANT_PATTERN_APMIN    0
+#define WNI_CFG_VHT_TX_ANT_PATTERN_APMAX    1
+#define WNI_CFG_VHT_TX_ANT_PATTERN_APDEF    1
+
+#define WNI_CFG_VHT_RX_MCS_MAP_STAMIN    0
+#define WNI_CFG_VHT_RX_MCS_MAP_STAMAX    65535
+#define WNI_CFG_VHT_RX_MCS_MAP_STADEF    65534
+
+#define WNI_CFG_VHT_RX_MCS_MAP_APMIN    0
+#define WNI_CFG_VHT_RX_MCS_MAP_APMAX    65535
+#define WNI_CFG_VHT_RX_MCS_MAP_APDEF    65534
+
+#define WNI_CFG_VHT_TX_MCS_MAP_STAMIN    0
+#define WNI_CFG_VHT_TX_MCS_MAP_STAMAX    65535
+#define WNI_CFG_VHT_TX_MCS_MAP_STADEF    65534
+
+#define WNI_CFG_VHT_TX_MCS_MAP_APMIN    0
+#define WNI_CFG_VHT_TX_MCS_MAP_APMAX    65535
+#define WNI_CFG_VHT_TX_MCS_MAP_APDEF    65534
+
+#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_STAMIN    0
+#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_STAMAX    390
+#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_STADEF    0
+
+#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_APMIN    0
+#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_APMAX    390
+#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_APDEF    0
+
+#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_STAMIN    0
+#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_STAMAX    390
+#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_STADEF    0
+
+#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_APMIN    0
+#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_APMAX    390
+#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_APDEF    0
+
+#define WNI_CFG_VHT_CHANNEL_WIDTH_STAMIN    0
+#define WNI_CFG_VHT_CHANNEL_WIDTH_STAMAX    3
+#define WNI_CFG_VHT_CHANNEL_WIDTH_STADEF    0
+
+#define WNI_CFG_VHT_CHANNEL_WIDTH_APMIN    0
+#define WNI_CFG_VHT_CHANNEL_WIDTH_APMAX    3
+#define WNI_CFG_VHT_CHANNEL_WIDTH_APDEF    0
+
+#define WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ    0
+#define WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ    1
+#define WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ    2
+#define WNI_CFG_VHT_CHANNEL_WIDTH_80_PLUS_80MHZ    3
+
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_STAMIN    0
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_STAMAX    256
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_STADEF    0
+
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_APMIN    0
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_APMAX    256
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_APDEF    0
+
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_STAMIN    0
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_STAMAX    0
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_STADEF    0
+
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_APMIN    0
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_APMAX    0
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_APDEF    0
+
+#define WNI_CFG_VHT_BASIC_MCS_SET_STAMIN    0
+#define WNI_CFG_VHT_BASIC_MCS_SET_STAMAX    65535
+#define WNI_CFG_VHT_BASIC_MCS_SET_STADEF    65534
+
+#define WNI_CFG_VHT_BASIC_MCS_SET_APMIN    0
+#define WNI_CFG_VHT_BASIC_MCS_SET_APMAX    65535
+#define WNI_CFG_VHT_BASIC_MCS_SET_APDEF    65534
+
+#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_STAMIN    0
+#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_STAMAX    4
+#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_STADEF    0
+
+#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_APMIN    0
+#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_APMAX    4
+#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_APDEF    0
+
+#define WNI_CFG_VHT_SS_UNDER_UTIL_STAMIN    0
+#define WNI_CFG_VHT_SS_UNDER_UTIL_STAMAX    0
+#define WNI_CFG_VHT_SS_UNDER_UTIL_STADEF    0
+
+#define WNI_CFG_VHT_SS_UNDER_UTIL_APMIN    0
+#define WNI_CFG_VHT_SS_UNDER_UTIL_APMAX    0
+#define WNI_CFG_VHT_SS_UNDER_UTIL_APDEF    0
+
+#define WNI_CFG_VHT_40MHZ_UTILIZATION_STAMIN    0
+#define WNI_CFG_VHT_40MHZ_UTILIZATION_STAMAX    0
+#define WNI_CFG_VHT_40MHZ_UTILIZATION_STADEF    0
+
+#define WNI_CFG_VHT_40MHZ_UTILIZATION_APMIN    0
+#define WNI_CFG_VHT_40MHZ_UTILIZATION_APMAX    0
+#define WNI_CFG_VHT_40MHZ_UTILIZATION_APDEF    0
+
+#define WNI_CFG_VHT_80MHZ_UTILIZATION_STAMIN    0
+#define WNI_CFG_VHT_80MHZ_UTILIZATION_STAMAX    0
+#define WNI_CFG_VHT_80MHZ_UTILIZATION_STADEF    0
+
+#define WNI_CFG_VHT_80MHZ_UTILIZATION_APMIN    0
+#define WNI_CFG_VHT_80MHZ_UTILIZATION_APMAX    0
+#define WNI_CFG_VHT_80MHZ_UTILIZATION_APDEF    0
+
+#define WNI_CFG_VHT_160MHZ_UTILIZATION_STAMIN    0
+#define WNI_CFG_VHT_160MHZ_UTILIZATION_STAMAX    0
+#define WNI_CFG_VHT_160MHZ_UTILIZATION_STADEF    0
+
+#define WNI_CFG_VHT_160MHZ_UTILIZATION_APMIN    0
+#define WNI_CFG_VHT_160MHZ_UTILIZATION_APMAX    0
+#define WNI_CFG_VHT_160MHZ_UTILIZATION_APDEF    0
+
+#define WNI_CFG_MAX_AMSDU_LENGTH_STAMIN    0
+#define WNI_CFG_MAX_AMSDU_LENGTH_STAMAX    1
+#define WNI_CFG_MAX_AMSDU_LENGTH_STADEF    0
+
+#define WNI_CFG_MAX_AMSDU_LENGTH_APMIN    0
+#define WNI_CFG_MAX_AMSDU_LENGTH_APMAX    1
+#define WNI_CFG_MAX_AMSDU_LENGTH_APDEF    0
+
+#define WNI_CFG_MAX_AMSDU_LENGTH_SHORT_3839_BYTES    0
+#define WNI_CFG_MAX_AMSDU_LENGTH_LONG_7935__BYTES    1
+
+#define WNI_CFG_MPDU_DENSITY_STAMIN    0
+#define WNI_CFG_MPDU_DENSITY_STAMAX    7
+#define WNI_CFG_MPDU_DENSITY_STADEF    0
+
+#define WNI_CFG_MPDU_DENSITY_APMIN    0
+#define WNI_CFG_MPDU_DENSITY_APMAX    7
+#define WNI_CFG_MPDU_DENSITY_APDEF    0
+
+#define WNI_CFG_NUM_BUFF_ADVERT_STAMIN    0
+#define WNI_CFG_NUM_BUFF_ADVERT_STAMAX    128
+#define WNI_CFG_NUM_BUFF_ADVERT_STADEF    64
+
+#define WNI_CFG_NUM_BUFF_ADVERT_APMIN    0
+#define WNI_CFG_NUM_BUFF_ADVERT_APMAX    128
+#define WNI_CFG_NUM_BUFF_ADVERT_APDEF    64
+
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_STAMIN    0
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_STAMAX    3
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_STADEF    3
+
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_APMIN    0
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_APMAX    3
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR_APDEF    3
+
+#define WNI_CFG_SHORT_GI_20MHZ_STAMIN    0
+#define WNI_CFG_SHORT_GI_20MHZ_STAMAX    1
+#define WNI_CFG_SHORT_GI_20MHZ_STADEF    1
+
+#define WNI_CFG_SHORT_GI_20MHZ_APMIN    0
+#define WNI_CFG_SHORT_GI_20MHZ_APMAX    1
+#define WNI_CFG_SHORT_GI_20MHZ_APDEF    1
+
+#define WNI_CFG_SHORT_GI_20MHZ_ENABLE    1
+#define WNI_CFG_SHORT_GI_20MHZ_DISABLE    0
+
+#define WNI_CFG_SHORT_GI_40MHZ_STAMIN    0
+#define WNI_CFG_SHORT_GI_40MHZ_STAMAX    1
+#define WNI_CFG_SHORT_GI_40MHZ_STADEF    0
+
+#define WNI_CFG_SHORT_GI_40MHZ_APMIN    0
+#define WNI_CFG_SHORT_GI_40MHZ_APMAX    1
+#define WNI_CFG_SHORT_GI_40MHZ_APDEF    1
+
+#define WNI_CFG_SHORT_GI_40MHZ_ENABLE    1
+#define WNI_CFG_SHORT_GI_40MHZ_DISABLE    0
+
+#define WNI_CFG_RIFS_ENABLED_STAMIN    0
+#define WNI_CFG_RIFS_ENABLED_STAMAX    1
+#define WNI_CFG_RIFS_ENABLED_STADEF    1
+
+#define WNI_CFG_RIFS_ENABLED_APMIN    0
+#define WNI_CFG_RIFS_ENABLED_APMAX    1
+#define WNI_CFG_RIFS_ENABLED_APDEF    1
+
+#define WNI_CFG_RIFS_ENABLED_ENABLE    1
+#define WNI_CFG_RIFS_ENABLED_DISABLE    0
+
+#define WNI_CFG_MAX_PS_POLL_STAMIN    0
+#define WNI_CFG_MAX_PS_POLL_STAMAX    255
+#define WNI_CFG_MAX_PS_POLL_STADEF    0
+
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMIN    1
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMAX    20
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STADEF    20
+
+#define WNI_CFG_RSSI_FILTER_PERIOD_STAMIN    0
+#define WNI_CFG_RSSI_FILTER_PERIOD_STAMAX    255
+#define WNI_CFG_RSSI_FILTER_PERIOD_STADEF    5
+
+#define WNI_CFG_MIN_RSSI_THRESHOLD_STAMIN    0
+#define WNI_CFG_MIN_RSSI_THRESHOLD_STAMAX    10
+#define WNI_CFG_MIN_RSSI_THRESHOLD_STADEF    10
+
+#define WNI_CFG_NTH_BEACON_FILTER_STAMIN    0
+#define WNI_CFG_NTH_BEACON_FILTER_STAMAX    255
+#define WNI_CFG_NTH_BEACON_FILTER_STADEF    10
+
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE_STAMIN    0
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE_STAMAX    1
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE_STADEF    0
+
+#define WNI_CFG_SCAN_IN_POWERSAVE_STAMIN    0
+#define WNI_CFG_SCAN_IN_POWERSAVE_STAMAX    1
+#define WNI_CFG_SCAN_IN_POWERSAVE_STADEF    1
+
+#define WNI_CFG_SCAN_IN_POWERSAVE_APMIN    0
+#define WNI_CFG_SCAN_IN_POWERSAVE_APMAX    1
+#define WNI_CFG_SCAN_IN_POWERSAVE_APDEF    1
+
+#define WNI_CFG_IGNORE_DTIM_STAMIN    0
+#define WNI_CFG_IGNORE_DTIM_STAMAX    1
+#define WNI_CFG_IGNORE_DTIM_STADEF    0
+
+#define WNI_CFG_IGNORE_DTIM_APMIN    0
+#define WNI_CFG_IGNORE_DTIM_APMAX    1
+#define WNI_CFG_IGNORE_DTIM_APDEF    0
+
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE_STAMIN    0
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE_STAMAX    1
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE_STADEF    1
+
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE_STAMIN    0
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE_STAMAX    1
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE_STADEF    1
+
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE_STAMIN    0
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE_STAMAX    1
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE_STADEF    1
+
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE_STAMIN    0
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE_STAMAX    1
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE_STADEF    1
+
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON_STAMIN    0
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON_STAMAX    65535
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON_STADEF    40
+
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD_STAMIN    0
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD_STAMAX    65535
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD_STADEF    65535
+
+#define WNI_CFG_BA_TIMEOUT_STAMIN    0
+#define WNI_CFG_BA_TIMEOUT_STAMAX    65535
+#define WNI_CFG_BA_TIMEOUT_STADEF    0
+
+#define WNI_CFG_BA_TIMEOUT_APMIN    0
+#define WNI_CFG_BA_TIMEOUT_APMAX    65535
+#define WNI_CFG_BA_TIMEOUT_APDEF    0
+
+#define WNI_CFG_BA_THRESHOLD_HIGH_STAMIN    0
+#define WNI_CFG_BA_THRESHOLD_HIGH_STAMAX    65535
+#define WNI_CFG_BA_THRESHOLD_HIGH_STADEF    128
+
+#define WNI_CFG_BA_THRESHOLD_HIGH_APMIN    0
+#define WNI_CFG_BA_THRESHOLD_HIGH_APMAX    65535
+#define WNI_CFG_BA_THRESHOLD_HIGH_APDEF    128
+
+#define WNI_CFG_MAX_BA_BUFFERS_STAMIN    0
+#define WNI_CFG_MAX_BA_BUFFERS_STAMAX    2560
+#define WNI_CFG_MAX_BA_BUFFERS_STADEF    2560
+
+#define WNI_CFG_MAX_BA_BUFFERS_APMIN    0
+#define WNI_CFG_MAX_BA_BUFFERS_APMAX    2560
+#define WNI_CFG_MAX_BA_BUFFERS_APDEF    2560
+
+#define WNI_CFG_MAX_BA_SESSIONS_STAMIN    0
+#define WNI_CFG_MAX_BA_SESSIONS_STAMAX    64
+#define WNI_CFG_MAX_BA_SESSIONS_STADEF    40
+
+#define WNI_CFG_MAX_BA_SESSIONS_APMIN    0
+#define WNI_CFG_MAX_BA_SESSIONS_APMAX    64
+#define WNI_CFG_MAX_BA_SESSIONS_APDEF    40
+
+#define WNI_CFG_BA_AUTO_SETUP_STAMIN    0
+#define WNI_CFG_BA_AUTO_SETUP_STAMAX    1
+#define WNI_CFG_BA_AUTO_SETUP_STADEF    1
+
+#define WNI_CFG_BA_AUTO_SETUP_APMIN    0
+#define WNI_CFG_BA_AUTO_SETUP_APMAX    1
+#define WNI_CFG_BA_AUTO_SETUP_APDEF    1
+
+#define WNI_CFG_BA_AUTO_SETUP_ENABLE    1
+#define WNI_CFG_BA_AUTO_SETUP_DISABLE    0
+
+#define WNI_CFG_ADDBA_REQ_DECLINE_STAMIN    0
+#define WNI_CFG_ADDBA_REQ_DECLINE_STAMAX    255
+#define WNI_CFG_ADDBA_REQ_DECLINE_STADEF    0
+
+#define WNI_CFG_ADDBA_REQ_DECLINE_APMIN    0
+#define WNI_CFG_ADDBA_REQ_DECLINE_APMAX    255
+#define WNI_CFG_ADDBA_REQ_DECLINE_APDEF    0
+
+#define WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC_STAMIN    0
+#define WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC_STAMAX    1
+#define WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC_STADEF    0
+
+#define WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC_APMIN    0
+#define WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC_APMAX    1
+#define WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC_APDEF    0
+
+#define WNI_CFG_MAX_MEDIUM_TIME_STAMIN    0
+#define WNI_CFG_MAX_MEDIUM_TIME_STAMAX    65535
+#define WNI_CFG_MAX_MEDIUM_TIME_STADEF    2048
+
+#define WNI_CFG_MAX_MEDIUM_TIME_APMIN    0
+#define WNI_CFG_MAX_MEDIUM_TIME_APMAX    65535
+#define WNI_CFG_MAX_MEDIUM_TIME_APDEF    2048
+
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_STAMIN    0
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_STAMAX    65535
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_STADEF    64
+
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_APMIN    0
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_APMAX    65535
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU_APDEF    64
+
+#define WNI_CFG_IBSS_AUTO_BSSID_STAMIN    0
+#define WNI_CFG_IBSS_AUTO_BSSID_STAMAX    1
+#define WNI_CFG_IBSS_AUTO_BSSID_STADEF    1
+
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_STAMIN    0
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_STAMAX    1
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_STADEF    0
+
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_APMIN    0
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_APMAX    1
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG_APDEF    0
+
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_STAMIN    0
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_STAMAX    1
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_STADEF    0
+
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_APMIN    0
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_APMAX    1
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG_APDEF    0
+
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_STAMIN    0
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_STAMAX    1
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_STADEF    0
+
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_APMIN    0
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_APMAX    1
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_APDEF    0
+
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_STAMIN    0
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_STAMAX    1
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_STADEF    0
+
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_APMIN    0
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_APMAX    1
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_APDEF    0
+
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_STAMIN    0
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_STAMAX    1
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_STADEF    0
+
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_APMIN    0
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_APMAX    1
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_APDEF    0
+
+#define WNI_CFG_WPS_ENABLE_STAMIN    0
+#define WNI_CFG_WPS_ENABLE_STAMAX    255
+#define WNI_CFG_WPS_ENABLE_STADEF    0
+
+#define WNI_CFG_WPS_ENABLE_APMIN    0
+#define WNI_CFG_WPS_ENABLE_APMAX    255
+#define WNI_CFG_WPS_ENABLE_APDEF    0
+
+#define WNI_CFG_WPS_ENABLE_AP    1
+#define WNI_CFG_WPS_ENABLE_STA    2
+
+#define WNI_CFG_WPS_STATE_STAMIN    0
+#define WNI_CFG_WPS_STATE_STAMAX    255
+#define WNI_CFG_WPS_STATE_STADEF    1
+
+#define WNI_CFG_WPS_STATE_APMIN    0
+#define WNI_CFG_WPS_STATE_APMAX    255
+#define WNI_CFG_WPS_STATE_APDEF    1
+
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_STAMIN    0
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_STAMAX    1
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_STADEF    0
+
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_APMIN    0
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_APMAX    1
+#define WNI_CFG_WPS_PROBE_REQ_FLAG_APDEF    0
+
+#define WNI_CFG_WPS_VERSION_STAMIN    0
+#define WNI_CFG_WPS_VERSION_STAMAX    255
+#define WNI_CFG_WPS_VERSION_STADEF    16
+
+#define WNI_CFG_WPS_VERSION_APMIN    0
+#define WNI_CFG_WPS_VERSION_APMAX    255
+#define WNI_CFG_WPS_VERSION_APDEF    16
+
+#define WNI_CFG_WPS_REQUEST_TYPE_STAMIN    0
+#define WNI_CFG_WPS_REQUEST_TYPE_STAMAX    255
+#define WNI_CFG_WPS_REQUEST_TYPE_STADEF    0
+
+#define WNI_CFG_WPS_REQUEST_TYPE_APMIN    0
+#define WNI_CFG_WPS_REQUEST_TYPE_APMAX    255
+#define WNI_CFG_WPS_REQUEST_TYPE_APDEF    3
+
+#define WNI_CFG_WPS_CFG_METHOD_STAMIN    0
+#define WNI_CFG_WPS_CFG_METHOD_STAMAX    4294967295
+#define WNI_CFG_WPS_CFG_METHOD_STADEF    8
+
+#define WNI_CFG_WPS_CFG_METHOD_APMIN    0
+#define WNI_CFG_WPS_CFG_METHOD_APMAX    4294967295
+#define WNI_CFG_WPS_CFG_METHOD_APDEF    25952654
+
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_STAMIN    0
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_STAMAX    65535
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_STADEF    1
+
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_APMIN    0
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_APMAX    65535
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_APDEF    6
+
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_STAMIN    0
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_STAMAX    4294967295
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_STADEF    5304836
+
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_APMIN    0
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_APMAX    4294967295
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI_APDEF    5304836
+
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_STAMIN    0
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_STAMAX    65535
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_STADEF    1
+
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_APMIN    0
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_APMAX    65535
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY_APDEF    1
+
+#define WNI_CFG_WPS_ASSOCIATION_STATE_STAMIN    0
+#define WNI_CFG_WPS_ASSOCIATION_STATE_STAMAX    65535
+#define WNI_CFG_WPS_ASSOCIATION_STATE_STADEF    0
+
+#define WNI_CFG_WPS_ASSOCIATION_STATE_APMIN    0
+#define WNI_CFG_WPS_ASSOCIATION_STATE_APMAX    65535
+#define WNI_CFG_WPS_ASSOCIATION_STATE_APDEF    0
+
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_STAMIN    0
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_STAMAX    65535
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_STADEF    0
+
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_APMIN    0
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_APMAX    65535
+#define WNI_CFG_WPS_CONFIGURATION_ERROR_APDEF    0
+
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_STAMIN    0
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_STAMAX    4294967295
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_STADEF    0
+
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_APMIN    0
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_APMAX    4294967295
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID_APDEF    0
+
+#define WNI_CFG_WPS_ASSOC_METHOD_STAMIN    0
+#define WNI_CFG_WPS_ASSOC_METHOD_STAMAX    65535
+#define WNI_CFG_WPS_ASSOC_METHOD_STADEF    0
+
+#define WNI_CFG_WPS_ASSOC_METHOD_APMIN    0
+#define WNI_CFG_WPS_ASSOC_METHOD_APMAX    65535
+#define WNI_CFG_WPS_ASSOC_METHOD_APDEF    0
+
+#define WNI_CFG_LOW_GAIN_OVERRIDE_STAMIN    0
+#define WNI_CFG_LOW_GAIN_OVERRIDE_STAMAX    1
+#define WNI_CFG_LOW_GAIN_OVERRIDE_STADEF    0
+
+#define WNI_CFG_LOW_GAIN_OVERRIDE_APMIN    0
+#define WNI_CFG_LOW_GAIN_OVERRIDE_APMAX    1
+#define WNI_CFG_LOW_GAIN_OVERRIDE_APDEF    0
+
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_STAMIN    0
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_STAMAX    128
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_STADEF    128
+
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_APMIN    0
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_APMAX    128
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_APDEF    128
+
+#define WNI_CFG_RPE_POLLING_THRESHOLD_STAMIN    0
+#define WNI_CFG_RPE_POLLING_THRESHOLD_STAMAX    65535
+#define WNI_CFG_RPE_POLLING_THRESHOLD_STADEF    10
+
+#define WNI_CFG_RPE_POLLING_THRESHOLD_APMIN    0
+#define WNI_CFG_RPE_POLLING_THRESHOLD_APMAX    65535
+#define WNI_CFG_RPE_POLLING_THRESHOLD_APDEF    10
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_STAMIN    0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_STAMAX    65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_STADEF    30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_APMIN    0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_APMAX    65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_APDEF    30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_STAMIN    0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_STAMAX    65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_STADEF    30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_APMIN    0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_APMAX    65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_APDEF    30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_STAMIN    0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_STAMAX    65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_STADEF    30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_APMIN    0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_APMAX    65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_APDEF    30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_STAMIN    0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_STAMAX    65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_STADEF    30
+
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_APMIN    0
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_APMAX    65535
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_APDEF    30
+
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_STAMIN    0
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_STAMAX    2
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_STADEF    1
+
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_APMIN    0
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_APMAX    2
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_APDEF    1
+
+#define WNI_CFG_SINGLE_TID_RC_STAMIN    0
+#define WNI_CFG_SINGLE_TID_RC_STAMAX    1
+#define WNI_CFG_SINGLE_TID_RC_STADEF    1
+
+#define WNI_CFG_SINGLE_TID_RC_APMIN    0
+#define WNI_CFG_SINGLE_TID_RC_APMAX    1
+#define WNI_CFG_SINGLE_TID_RC_APDEF    1
+
+#define WNI_CFG_RRM_ENABLED_STAMIN    0
+#define WNI_CFG_RRM_ENABLED_STAMAX    1
+#define WNI_CFG_RRM_ENABLED_STADEF    0
+
+#define WNI_CFG_RRM_ENABLED_APMIN    0
+#define WNI_CFG_RRM_ENABLED_APMAX    1
+#define WNI_CFG_RRM_ENABLED_APDEF    0
+
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_STAMIN    0
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_STAMAX    8
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_STADEF    0
+
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_APMIN    0
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_APMAX    8
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX_APDEF    0
+
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_STAMIN    0
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_STAMAX    8
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_STADEF    0
+
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_APMIN    0
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_APMAX    8
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_APDEF    0
+
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_STAMIN    0
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_STAMAX    1
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_STADEF    1
+
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_APMIN    0
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_APMAX    1
+#define WNI_CFG_TX_PWR_CTRL_ENABLE_APDEF    1
+
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_STAMIN    0
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_STAMAX    3
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_STADEF    0
+
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_APMIN    0
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_APMAX    3
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING_APDEF    0
+
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_STAMIN    0
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_STAMAX    255
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_STADEF    0
+
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_APMIN    0
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_APMAX    255
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_APDEF    0
+
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_STAMIN    0
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_STAMAX    255
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_STADEF    0
+
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_APMIN    0
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_APMAX    255
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE_APDEF    0
+
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STAMIN    0
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STAMAX    80
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STADEF    0
+
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_STAMIN    0
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_STAMAX    1
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_STADEF    0
+
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_APMIN    0
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_APMAX    1
+#define WNI_CFG_TELE_BCN_WAKEUP_EN_APDEF    0
+
+#define WNI_CFG_TELE_BCN_TRANS_LI_STAMIN    0
+#define WNI_CFG_TELE_BCN_TRANS_LI_STAMAX    7
+#define WNI_CFG_TELE_BCN_TRANS_LI_STADEF    3
+
+#define WNI_CFG_TELE_BCN_TRANS_LI_APMIN    0
+#define WNI_CFG_TELE_BCN_TRANS_LI_APMAX    7
+#define WNI_CFG_TELE_BCN_TRANS_LI_APDEF    3
+
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_STAMIN    5
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_STAMAX    255
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_STADEF    10
+
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_APMIN    5
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_APMAX    255
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_APDEF    10
+
+#define WNI_CFG_TELE_BCN_MAX_LI_STAMIN    0
+#define WNI_CFG_TELE_BCN_MAX_LI_STAMAX    7
+#define WNI_CFG_TELE_BCN_MAX_LI_STADEF    5
+
+#define WNI_CFG_TELE_BCN_MAX_LI_APMIN    0
+#define WNI_CFG_TELE_BCN_MAX_LI_APMAX    7
+#define WNI_CFG_TELE_BCN_MAX_LI_APDEF    5
+
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_STAMIN    5
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_STAMAX    255
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_STADEF    15
+
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_APMIN    5
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_APMAX    255
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_APDEF    15
+
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_STAMIN    0
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_STAMAX    255
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_STADEF    7
+
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_APMIN    0
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_APMAX    255
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_APDEF    7
+
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMIN    0
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX    65535
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STADEF    0
+
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_APMIN    0
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_APMAX    65535
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_APDEF    0
+
+#define WNI_CFG_ASSOC_STA_LIMIT_STAMIN    1
+#define WNI_CFG_ASSOC_STA_LIMIT_STAMAX    32
+#define WNI_CFG_ASSOC_STA_LIMIT_STADEF    10
+
+#define WNI_CFG_ASSOC_STA_LIMIT_APMIN    1
+#define WNI_CFG_ASSOC_STA_LIMIT_APMAX    32
+#define WNI_CFG_ASSOC_STA_LIMIT_APDEF    10
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMIN    1
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMAX    252
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STADEF    1
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_APMIN    1
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_APMAX    252
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_APDEF    1
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMIN    1
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMAX    252
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STADEF    11
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_APMIN    1
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_APMAX    252
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_APDEF    11
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMIN    0
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMAX    5
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STADEF    0
+
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_APMIN    0
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_APMAX    5
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_APDEF    0
+
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STAMIN    0
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STAMAX    65535
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STADEF    5
+
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_APMIN    0
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_APMAX    65535
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_APDEF    5
+
+#define WNI_CFG_ENABLE_CLOSE_LOOP_STAMIN    0
+#define WNI_CFG_ENABLE_CLOSE_LOOP_STAMAX    1
+#define WNI_CFG_ENABLE_CLOSE_LOOP_STADEF    0
+
+#define WNI_CFG_ENABLE_CLOSE_LOOP_APMIN    0
+#define WNI_CFG_ENABLE_CLOSE_LOOP_APMAX    1
+#define WNI_CFG_ENABLE_CLOSE_LOOP_APDEF    0
+
+#define WNI_CFG_ENABLE_LTE_COEX_STAMIN    0
+#define WNI_CFG_ENABLE_LTE_COEX_STAMAX    1
+#define WNI_CFG_ENABLE_LTE_COEX_STADEF    0
+
+#define WNI_CFG_ENABLE_LTE_COEX_APMIN    0
+#define WNI_CFG_ENABLE_LTE_COEX_APMAX    1
+#define WNI_CFG_ENABLE_LTE_COEX_APDEF    0
+
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_STAMIN    1
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_STAMAX    255
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_STADEF    20
+
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_APMIN    1
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_APMAX    255
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_APDEF    20
+
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STAMIN    1
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STAMAX    255
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STADEF    20
+
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_APMIN    1
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_APMAX    255
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_APDEF    20
+
+#define WNI_CFG_ENABLE_MC_ADDR_LIST_STAMIN    0
+#define WNI_CFG_ENABLE_MC_ADDR_LIST_STAMAX    1
+#define WNI_CFG_ENABLE_MC_ADDR_LIST_STADEF    0
+
+#define WNI_CFG_ENABLE_MC_ADDR_LIST_APMIN    0
+#define WNI_CFG_ENABLE_MC_ADDR_LIST_APMAX    1
+#define WNI_CFG_ENABLE_MC_ADDR_LIST_APDEF    0
+
+#define WNI_CFG_ENABLE_UC_FILTER_STAMIN    0
+#define WNI_CFG_ENABLE_UC_FILTER_STAMAX    1
+#define WNI_CFG_ENABLE_UC_FILTER_STADEF    0
+
+#define WNI_CFG_ENABLE_UC_FILTER_APMIN    0
+#define WNI_CFG_ENABLE_UC_FILTER_APMAX    1
+#define WNI_CFG_ENABLE_UC_FILTER_APDEF    0
+
+#define WNI_CFG_ENABLE_LPWR_IMG_TRANSITION_STAMIN    0
+#define WNI_CFG_ENABLE_LPWR_IMG_TRANSITION_STAMAX    1
+#define WNI_CFG_ENABLE_LPWR_IMG_TRANSITION_STADEF    0
+
+#define WNI_CFG_ENABLE_LPWR_IMG_TRANSITION_APMIN    0
+#define WNI_CFG_ENABLE_LPWR_IMG_TRANSITION_APMAX    1
+#define WNI_CFG_ENABLE_LPWR_IMG_TRANSITION_APDEF    0
+
+#define WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED_STAMIN    0
+#define WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED_STAMAX    1
+#define WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED_STADEF    0
+
+#define WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED_APMIN    0
+#define WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED_APMAX    1
+#define WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED_APDEF    0
+
+#define WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP_STAMIN    0
+#define WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP_STAMAX    1
+#define WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP_STADEF    0
+
+#define WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP_APMIN    0
+#define WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP_APMAX    1
+#define WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP_APDEF    0
+
+#define WNI_CFG_AP_LINK_MONITOR_TIMEOUT_STAMIN    1
+#define WNI_CFG_AP_LINK_MONITOR_TIMEOUT_STAMAX    255
+#define WNI_CFG_AP_LINK_MONITOR_TIMEOUT_STADEF    3
+
+#define WNI_CFG_AP_LINK_MONITOR_TIMEOUT_APMIN    1
+#define WNI_CFG_AP_LINK_MONITOR_TIMEOUT_APMAX    255
+#define WNI_CFG_AP_LINK_MONITOR_TIMEOUT_APDEF    3
+
+#define WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK_STAMIN    0
+#define WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK_STAMAX    15
+#define WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK_STADEF    0
+
+#define WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK_APMIN    0
+#define WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK_APMAX    15
+#define WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK_APDEF    0
+
+#define WNI_CFG_TDLS_BUF_STA_ENABLED_STAMIN    0
+#define WNI_CFG_TDLS_BUF_STA_ENABLED_STAMAX    1
+#define WNI_CFG_TDLS_BUF_STA_ENABLED_STADEF    0
+
+#define WNI_CFG_TDLS_BUF_STA_ENABLED_APMIN    0
+#define WNI_CFG_TDLS_BUF_STA_ENABLED_APMAX    1
+#define WNI_CFG_TDLS_BUF_STA_ENABLED_APDEF    0
+
+#define WNI_CFG_TDLS_PUAPSD_INACT_TIME_STAMIN    0
+#define WNI_CFG_TDLS_PUAPSD_INACT_TIME_STAMAX    10
+#define WNI_CFG_TDLS_PUAPSD_INACT_TIME_STADEF    0
+
+#define WNI_CFG_TDLS_PUAPSD_INACT_TIME_APMIN    0
+#define WNI_CFG_TDLS_PUAPSD_INACT_TIME_APMAX    10
+#define WNI_CFG_TDLS_PUAPSD_INACT_TIME_APDEF    0
+
+#define WNI_CFG_TDLS_RX_FRAME_THRESHOLD_STAMIN    10
+#define WNI_CFG_TDLS_RX_FRAME_THRESHOLD_STAMAX    20
+#define WNI_CFG_TDLS_RX_FRAME_THRESHOLD_STADEF    10
+
+#define WNI_CFG_TDLS_RX_FRAME_THRESHOLD_APMIN    10
+#define WNI_CFG_TDLS_RX_FRAME_THRESHOLD_APMAX    20
+#define WNI_CFG_TDLS_RX_FRAME_THRESHOLD_APDEF    10
+
+#define WNI_CFG_ENABLE_ADAPT_RX_DRAIN_STAMIN    0
+#define WNI_CFG_ENABLE_ADAPT_RX_DRAIN_STAMAX    1
+#define WNI_CFG_ENABLE_ADAPT_RX_DRAIN_STADEF    1
+
+#define WNI_CFG_FLEX_CONNECT_POWER_FACTOR_STAMIN    0
+#define WNI_CFG_FLEX_CONNECT_POWER_FACTOR_STAMAX    9
+#define WNI_CFG_FLEX_CONNECT_POWER_FACTOR_STADEF    0
+
+#define WNI_CFG_FLEX_CONNECT_POWER_FACTOR_APMIN    0
+#define WNI_CFG_FLEX_CONNECT_POWER_FACTOR_APMAX    9
+#define WNI_CFG_FLEX_CONNECT_POWER_FACTOR_APDEF    0
+
+#define WNI_CFG_ANTENNA_DIVESITY_STAMIN    0
+#define WNI_CFG_ANTENNA_DIVESITY_STAMAX    3
+#define WNI_CFG_ANTENNA_DIVESITY_STADEF    0
+
+#define WNI_CFG_ANTENNA_DIVESITY_APMIN    0
+#define WNI_CFG_ANTENNA_DIVESITY_APMAX    3
+#define WNI_CFG_ANTENNA_DIVESITY_APDEF    0
+
+#define WNI_CFG_GO_LINK_MONITOR_TIMEOUT_STAMIN    3
+#define WNI_CFG_GO_LINK_MONITOR_TIMEOUT_STAMAX    50
+#define WNI_CFG_GO_LINK_MONITOR_TIMEOUT_STADEF    10
+
+#define WNI_CFG_GO_LINK_MONITOR_TIMEOUT_APMIN    3
+#define WNI_CFG_GO_LINK_MONITOR_TIMEOUT_APMAX    50
+#define WNI_CFG_GO_LINK_MONITOR_TIMEOUT_APDEF    10
+
+#define WNI_CFG_ATH_DISABLE_STAMIN    0
+#define WNI_CFG_ATH_DISABLE_STAMAX    1
+#define WNI_CFG_ATH_DISABLE_STADEF    0
+
+#define WNI_CFG_ATH_DISABLE_APMIN    0
+#define WNI_CFG_ATH_DISABLE_APMAX    1
+#define WNI_CFG_ATH_DISABLE_APDEF    0
+
+#define WNI_CFG_BTC_ACTIVE_WLAN_LEN_STAMIN    0
+#define WNI_CFG_BTC_ACTIVE_WLAN_LEN_STAMAX    250000
+#define WNI_CFG_BTC_ACTIVE_WLAN_LEN_STADEF    60000
+
+#define WNI_CFG_BTC_ACTIVE_WLAN_LEN_APMIN    0
+#define WNI_CFG_BTC_ACTIVE_WLAN_LEN_APMAX    250000
+#define WNI_CFG_BTC_ACTIVE_WLAN_LEN_APDEF    60000
+
+#define WNI_CFG_BTC_ACTIVE_BT_LEN_STAMIN    0
+#define WNI_CFG_BTC_ACTIVE_BT_LEN_STAMAX    250000
+#define WNI_CFG_BTC_ACTIVE_BT_LEN_STADEF    90000
+
+#define WNI_CFG_BTC_ACTIVE_BT_LEN_APMIN    0
+#define WNI_CFG_BTC_ACTIVE_BT_LEN_APMAX    250000
+#define WNI_CFG_BTC_ACTIVE_BT_LEN_APDEF    90000
+
+#define WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN_STAMIN    0
+#define WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN_STAMAX    250000
+#define WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN_STADEF    30000
+
+#define WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN_APMIN    0
+#define WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN_APMAX    250000
+#define WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN_APDEF    30000
+
+#define WNI_CFG_BTC_SAP_ACTIVE_BT_LEN_STAMIN    0
+#define WNI_CFG_BTC_SAP_ACTIVE_BT_LEN_STAMAX    250000
+#define WNI_CFG_BTC_SAP_ACTIVE_BT_LEN_STADEF    30000
+
+#define WNI_CFG_BTC_SAP_ACTIVE_BT_LEN_APMIN    0
+#define WNI_CFG_BTC_SAP_ACTIVE_BT_LEN_APMAX    250000
+#define WNI_CFG_BTC_SAP_ACTIVE_BT_LEN_APDEF    30000
+
+#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STAMIN    0
+#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STAMAX    4294967295
+#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STADEF    300
+
+#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_APMIN    0
+#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_APMAX    4294967295
+#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_APDEF    300
+
+#define WNI_CFG_ASD_PROBE_INTERVAL_STAMIN    10
+#define WNI_CFG_ASD_PROBE_INTERVAL_STAMAX    100
+#define WNI_CFG_ASD_PROBE_INTERVAL_STADEF    50
+
+#define WNI_CFG_ASD_PROBE_INTERVAL_APMIN    10
+#define WNI_CFG_ASD_PROBE_INTERVAL_APMAX    100
+#define WNI_CFG_ASD_PROBE_INTERVAL_APDEF    50
+
+#define WNI_CFG_ASD_TRIGGER_THRESHOLD_STAMIN    0
+#define WNI_CFG_ASD_TRIGGER_THRESHOLD_STAMAX    120
+#define WNI_CFG_ASD_TRIGGER_THRESHOLD_STADEF    45
+
+#define WNI_CFG_ASD_TRIGGER_THRESHOLD_APMIN    0
+#define WNI_CFG_ASD_TRIGGER_THRESHOLD_APMAX    120
+#define WNI_CFG_ASD_TRIGGER_THRESHOLD_APDEF    45
+
+#define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_STAMIN    0
+#define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_STAMAX    100
+#define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_STADEF    0
+
+#define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_APMIN    0
+#define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_APMAX    100
+#define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_APDEF    0
+
+#define WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL_STAMIN    0
+#define WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL_STAMAX    1
+#define WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL_STADEF    0
+
+#define WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL_APMIN    0
+#define WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL_APMAX    1
+#define WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL_APDEF    0
+
+#define WNI_CFG_BTC_CTS2S_DURING_SCO_STAMIN    0
+#define WNI_CFG_BTC_CTS2S_DURING_SCO_STAMAX    1
+#define WNI_CFG_BTC_CTS2S_DURING_SCO_STADEF    0
+
+#define WNI_CFG_BTC_CTS2S_DURING_SCO_APMIN    0
+#define WNI_CFG_BTC_CTS2S_DURING_SCO_APMAX    1
+#define WNI_CFG_BTC_CTS2S_DURING_SCO_APDEF    0
+
+#define WNI_CFG_CHANNEL_BONDING_24G_STAMIN    0
+#define WNI_CFG_CHANNEL_BONDING_24G_STAMAX    1
+#define WNI_CFG_CHANNEL_BONDING_24G_STADEF    0
+
+#define WNI_CFG_CHANNEL_BONDING_24G_APMIN    0
+#define WNI_CFG_CHANNEL_BONDING_24G_APMAX    1
+#define WNI_CFG_CHANNEL_BONDING_24G_APDEF    0
+
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN    5
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX    1000
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STADEF    20
+
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_APMIN    5
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_APMAX    1000
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_APDEF    20
+
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN    10
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX    1000
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STADEF    10
+
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_APMIN    10
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_APMAX    1000
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_APDEF    10
+
+#define WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN    10
+#define WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX    900
+#define WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STADEF    200
+
+#define WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_APMIN    10
+#define WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_APMAX    900
+#define WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_APDEF    200
+
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN    200
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX    10000
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STADEF    200
+
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_APMIN    200
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_APMAX    10000
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_APDEF    200
+
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN    20
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX    10000
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STADEF    20
+
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_APMIN    20
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_APMAX    10000
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_APDEF    20
+
+#define WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN    5
+#define WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX    100
+#define WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STADEF    5
+
+#define WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_APMIN    5
+#define WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_APMAX    100
+#define WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_APDEF    5
+
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN    0
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX    100
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STADEF    25
+
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_APMIN    0
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_APMAX    100
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_APDEF    25
+
+#define WNI_CFG_TDLS_OFF_CHANNEL_ENABLED_STAMIN    0
+#define WNI_CFG_TDLS_OFF_CHANNEL_ENABLED_STAMAX    1
+#define WNI_CFG_TDLS_OFF_CHANNEL_ENABLED_STADEF    0
+
+#define WNI_CFG_TDLS_OFF_CHANNEL_ENABLED_APMIN    0
+#define WNI_CFG_TDLS_OFF_CHANNEL_ENABLED_APMAX    1
+#define WNI_CFG_TDLS_OFF_CHANNEL_ENABLED_APDEF    0
+
+#define WNI_CFG_PMF_SA_QUERY_MAX_RETRIES_STAMIN    0
+#define WNI_CFG_PMF_SA_QUERY_MAX_RETRIES_STAMAX    20
+#define WNI_CFG_PMF_SA_QUERY_MAX_RETRIES_STADEF    5
+
+#define WNI_CFG_PMF_SA_QUERY_MAX_RETRIES_APMIN    0
+#define WNI_CFG_PMF_SA_QUERY_MAX_RETRIES_APMAX    20
+#define WNI_CFG_PMF_SA_QUERY_MAX_RETRIES_APDEF    5
+
+#define WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STAMIN    10
+#define WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STAMAX    2000
+#define WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STADEF    200
+
+#define WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_APMIN    10
+#define WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_APMAX    2000
+#define WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_APDEF    200
+
+#define WNI_CFG_RA_FILTER_ENABLE_STAMIN    0
+#define WNI_CFG_RA_FILTER_ENABLE_STAMAX    1
+#define WNI_CFG_RA_FILTER_ENABLE_STADEF    0
+
+#define WNI_CFG_RA_FILTER_ENABLE_APMIN    0
+#define WNI_CFG_RA_FILTER_ENABLE_APMAX    1
+#define WNI_CFG_RA_FILTER_ENABLE_APDEF    0
+
+#define WNI_CFG_RA_RATE_LIMIT_INTERVAL_STAMIN    0
+#define WNI_CFG_RA_RATE_LIMIT_INTERVAL_STAMAX    60
+#define WNI_CFG_RA_RATE_LIMIT_INTERVAL_STADEF    60
+
+#define WNI_CFG_RA_RATE_LIMIT_INTERVAL_APMIN    0
+#define WNI_CFG_RA_RATE_LIMIT_INTERVAL_APMAX    60
+#define WNI_CFG_RA_RATE_LIMIT_INTERVAL_APDEF    60
+
+#define WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE_STAMIN    0
+#define WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE_STAMAX    2
+#define WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE_STADEF    2
+
+#define WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE_APMIN    0
+#define WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE_APMAX    2
+#define WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE_APDEF    2
+
+#define WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE_STAMIN    0
+#define WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE_STAMAX    1
+#define WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE_STADEF    1
+
+#define WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE_APMIN    0
+#define WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE_APMAX    1
+#define WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE_APDEF    1
+
+#define WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD_STAMIN    0
+#define WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD_STAMAX    1
+#define WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD_STADEF    0
+
+#define WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD_APMIN    0
+#define WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD_APMAX    1
+#define WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD_APDEF    0
+
+#define WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD_STAMIN    0
+#define WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD_STAMAX    3
+#define WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD_STADEF    1
+
+#define WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD_APMIN    0
+#define WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD_APMAX    3
+#define WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD_APDEF    1
+
+#define WNI_CFG_TDLS_WMM_MODE_ENABLED_STAMIN    0
+#define WNI_CFG_TDLS_WMM_MODE_ENABLED_STAMAX    1
+#define WNI_CFG_TDLS_WMM_MODE_ENABLED_STADEF    0
+
+#define WNI_CFG_TDLS_WMM_MODE_ENABLED_APMIN    0
+#define WNI_CFG_TDLS_WMM_MODE_ENABLED_APMAX    1
+#define WNI_CFG_TDLS_WMM_MODE_ENABLED_APDEF    0
+
+#define WNI_CFG_MAX_UAPSD_CONSEC_SP_STAMIN    0
+#define WNI_CFG_MAX_UAPSD_CONSEC_SP_STAMAX    500
+#define WNI_CFG_MAX_UAPSD_CONSEC_SP_STADEF    10
+
+#define WNI_CFG_MAX_UAPSD_CONSEC_SP_APMIN    0
+#define WNI_CFG_MAX_UAPSD_CONSEC_SP_APMAX    500
+#define WNI_CFG_MAX_UAPSD_CONSEC_SP_APDEF    10
+
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_STAMIN    0
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_STAMAX    5000
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_STADEF    50
+
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_APMIN    0
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_APMAX    5000
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_APDEF    50
+
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_STAMIN    0
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_STAMAX    5000
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_STADEF    50
+
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_APMIN    0
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_APMAX    5000
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_APDEF    50
+
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW_STAMIN    50
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW_STAMAX    50000
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW_STADEF    500
+
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW_APMIN    50
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW_APMAX    50000
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW_APDEF    500
+
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW_STAMIN    50
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW_STAMAX    50000
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW_STADEF    500
+
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW_APMIN    50
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW_APMAX    50000
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW_APDEF    500
+
+#define WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE_STAMIN    0
+#define WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE_STAMAX    255
+#define WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE_STADEF    0
+
+#define WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE_APMIN    0
+#define WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE_APMAX    255
+#define WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE_APDEF    0
+
+#define WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS_STAMIN    1
+#define WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS_STAMAX    255
+#define WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS_STADEF    10
+
+#define WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS_APMIN    1
+#define WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS_APMAX    255
+#define WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS_APDEF    10
+
+#define WNI_CFG_ENABLE_DYNAMIC_WMMPS_STAMIN    0
+#define WNI_CFG_ENABLE_DYNAMIC_WMMPS_STAMAX    1
+#define WNI_CFG_ENABLE_DYNAMIC_WMMPS_STADEF    1
+
+#define WNI_CFG_ENABLE_DYNAMIC_WMMPS_APMIN    0
+#define WNI_CFG_ENABLE_DYNAMIC_WMMPS_APMAX    1
+#define WNI_CFG_ENABLE_DYNAMIC_WMMPS_APDEF    1
+
+#define WNI_CFG_BURST_MODE_BE_TXOP_VALUE_STAMIN    0
+#define WNI_CFG_BURST_MODE_BE_TXOP_VALUE_STAMAX    12288
+#define WNI_CFG_BURST_MODE_BE_TXOP_VALUE_STADEF    0
+
+#define WNI_CFG_BURST_MODE_BE_TXOP_VALUE_APMIN    0
+#define WNI_CFG_BURST_MODE_BE_TXOP_VALUE_APMAX    12288
+#define WNI_CFG_BURST_MODE_BE_TXOP_VALUE_APDEF    0
+
+#define WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE_APMIN 0
+#define WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE_APMAX 1
+#define WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE_APDEF 0
+
+#define WNI_CFG_BTC_FAST_WLAN_CONN_PREF_STAMIN    0
+#define WNI_CFG_BTC_FAST_WLAN_CONN_PREF_STAMAX    1
+#define WNI_CFG_BTC_FAST_WLAN_CONN_PREF_STADEF    1
+
+#define WNI_CFG_BTC_FAST_WLAN_CONN_PREF_APMIN    0
+#define WNI_CFG_BTC_FAST_WLAN_CONN_PREF_APMAX    1
+#define WNI_CFG_BTC_FAST_WLAN_CONN_PREF_APDEF    1
+
+#define CFG_PARAM_MAX_NUM         346
+#define CFG_AP_IBUF_MAX_SIZE      284
+#define CFG_AP_SBUF_MAX_SIZE      3422
+#define CFG_STA_IBUF_MAX_SIZE     280
+#define CFG_STA_SBUF_MAX_SIZE     3389
+#define CFG_SEM_MAX_NUM           19
+
+#define CFG_STA_MAGIC_DWORD     0xbeefbeef
+
+#define CFG_AP_MAGIC_DWORD      0xdeaddead
+
+
+#endif
diff --git a/wlan/prima/CORE/MAC/inc/wniCfg.h b/wlan/prima/CORE/MAC/inc/wniCfgSta.h
similarity index 77%
rename from wlan/prima/CORE/MAC/inc/wniCfg.h
rename to wlan/prima/CORE/MAC/inc/wniCfgSta.h
index 5c2f926..e76baa9 100644
--- a/wlan/prima/CORE/MAC/inc/wniCfg.h
+++ b/wlan/prima/CORE/MAC/inc/wniCfgSta.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -25,374 +25,365 @@
  * to the Linux Foundation.
  */
 
+/*
+ * DO NOT EDIT - This file is generated automatically
+ */
 
-#ifndef __WNICFG_H
-#define __WNICFG_H
+/*
+ * IMPORTANT:  This file is for system that supports STA mode ONLY.
+ */
+
+
+#ifndef __WNICFGSTA_H
+#define __WNICFGSTA_H
 
 /*
  * Configuration Parameter ID for STA
  */
 
-enum {
-     WNI_CFG_STA_ID,
-     WNI_CFG_CF_POLLABLE,
-     WNI_CFG_CFP_PERIOD,
-     WNI_CFG_CFP_MAX_DURATION,
-     WNI_CFG_SSID,
-     WNI_CFG_BEACON_INTERVAL,
-     WNI_CFG_DTIM_PERIOD,
-     WNI_CFG_WEP_KEY_LENGTH,
-     WNI_CFG_WEP_DEFAULT_KEY_1,
-     WNI_CFG_WEP_DEFAULT_KEY_2,
-     WNI_CFG_WEP_DEFAULT_KEY_3,
-     WNI_CFG_WEP_DEFAULT_KEY_4,
-     WNI_CFG_WEP_DEFAULT_KEYID,
-     WNI_CFG_EXCLUDE_UNENCRYPTED,
-     WNI_CFG_RTS_THRESHOLD,
-     WNI_CFG_SHORT_RETRY_LIMIT,
-     WNI_CFG_LONG_RETRY_LIMIT,
-     WNI_CFG_FRAGMENTATION_THRESHOLD,
-     WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME,
-     WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
-     WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME,
-     WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME,
-     WNI_CFG_JOIN_FAILURE_TIMEOUT,
-     WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
-     WNI_CFG_AUTHENTICATE_RSP_TIMEOUT,
-     WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
-     WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
-     WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS,
-     WNI_CFG_PS_ENABLE_BCN_FILTER,
-     WNI_CFG_PS_ENABLE_HEART_BEAT,
-     WNI_CFG_PS_ENABLE_RSSI_MONITOR,
-     WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT,
-     WNI_CFG_RF_SETTLING_TIME_CLK,
-     WNI_CFG_SUPPORTED_RATES_11B,
-     WNI_CFG_SUPPORTED_RATES_11A,
-     WNI_CFG_PHY_MODE,
-     WNI_CFG_DOT11_MODE,
-     WNI_CFG_OPERATIONAL_RATE_SET,
-     WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
-     WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET,
-     WNI_CFG_BSSID,
-     WNI_CFG_LISTEN_INTERVAL,
-     WNI_CFG_VALID_CHANNEL_LIST,
-     WNI_CFG_CURRENT_CHANNEL,
-     WNI_CFG_DEFAULT_RATE_INDEX_5GHZ,
-     WNI_CFG_DEFAULT_RATE_INDEX_24GHZ,
-     WNI_CFG_RATE_ADAPTATION_TYPE,
-     WNI_CFG_FIXED_RATE,
-     WNI_CFG_FIXED_RATE_MULTICAST_24GHZ,
-     WNI_CFG_FIXED_RATE_MULTICAST_5GHZ,
-     WNI_CFG_RETRYRATE_POLICY,
-     WNI_CFG_RETRYRATE_SECONDARY,
-     WNI_CFG_RETRYRATE_TERTIARY,
-     WNI_CFG_APSD_ENABLED,
-     WNI_CFG_SHARED_KEY_AUTH_ENABLE,
-     WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE,
-     WNI_CFG_AUTHENTICATION_TYPE,
-     WNI_CFG_CF_POLL_REQUEST,
-     WNI_CFG_PRIVACY_ENABLED,
-     WNI_CFG_SHORT_PREAMBLE,
-     WNI_CFG_SHORT_SLOT_TIME,
-     WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY,
-     WNI_CFG_QOS_ENABLED,
-     WNI_CFG_HCF_ENABLED,
-     WNI_CFG_RSN_ENABLED,
-     WNI_CFG_BACKGROUND_SCAN_PERIOD,
-     WNI_CFG_MAX_NUM_PRE_AUTH,
-     WNI_CFG_PREAUTH_CLNUP_TIMEOUT,
-     WNI_CFG_RELEASE_AID_TIMEOUT,
-     WNI_CFG_HEART_BEAT_THRESHOLD,
-     WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
-     WNI_CFG_MANUFACTURER_OUI,
-     WNI_CFG_MANUFACTURER_NAME,
-     WNI_CFG_MODEL_NUMBER,
-     WNI_CFG_MODEL_NAME,
-     WNI_CFG_MANUFACTURER_PRODUCT_NAME,
-     WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
-     WNI_CFG_11D_ENABLED,
-     WNI_CFG_MAX_TX_POWER_2_4,
-     WNI_CFG_MAX_TX_POWER_5,
-     WNI_CFG_NETWORK_DENSITY,
-     WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM,
-     WNI_CFG_CURRENT_TX_ANTENNA,
-     WNI_CFG_CURRENT_RX_ANTENNA,
-     WNI_CFG_CURRENT_TX_POWER_LEVEL,
-     WNI_CFG_POWER_STATE_PER_CHAIN,
-     WNI_CFG_NEW_BSS_FOUND_IND,
-     WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED,
-     WNI_CFG_PROPRIETARY_RATES_ENABLED,
-     WNI_CFG_AP_NODE_NAME,
-     WNI_CFG_COUNTRY_CODE,
-     WNI_CFG_11H_ENABLED,
-     WNI_CFG_WT_CNF_TIMEOUT,
-     WNI_CFG_KEEPALIVE_TIMEOUT,
-     WNI_CFG_PROXIMITY,
-     WNI_CFG_LOG_LEVEL,
-     WNI_CFG_OLBC_DETECT_TIMEOUT,
-     WNI_CFG_PROTECTION_ENABLED,
-     WNI_CFG_11G_PROTECTION_ALWAYS,
-     WNI_CFG_FORCE_POLICY_PROTECTION,
-     WNI_CFG_11G_SHORT_PREAMBLE_ENABLED,
-     WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED,
-     WNI_CFG_CAL_PERIOD,
-     WNI_CFG_STATS_PERIOD,
-     WNI_CFG_CAL_CONTROL,
-     WNI_CFG_11G_ONLY_POLICY,
-     WNI_CFG_PACKET_CLASSIFICATION,
-     WNI_CFG_WME_ENABLED,
-     WNI_CFG_ADDTS_RSP_TIMEOUT,
-     WNI_CFG_MAX_SP_LENGTH,
-     WNI_CFG_KEEP_ALIVE_STA_LIMIT_THRESHOLD,
-     WNI_CFG_SEND_SINGLE_SSID_ALWAYS,
-     WNI_CFG_WSM_ENABLED,
-     WNI_CFG_PROP_CAPABILITY,
-     WNI_CFG_EDCA_PROFILE,
-     WNI_CFG_EDCA_ANI_ACBK_LOCAL,
-     WNI_CFG_EDCA_ANI_ACBE_LOCAL,
-     WNI_CFG_EDCA_ANI_ACVI_LOCAL,
-     WNI_CFG_EDCA_ANI_ACVO_LOCAL,
-     WNI_CFG_EDCA_ANI_ACBK,
-     WNI_CFG_EDCA_ANI_ACBE,
-     WNI_CFG_EDCA_ANI_ACVI,
-     WNI_CFG_EDCA_ANI_ACVO,
-     WNI_CFG_EDCA_WME_ACBK_LOCAL,
-     WNI_CFG_EDCA_WME_ACBE_LOCAL,
-     WNI_CFG_EDCA_WME_ACVI_LOCAL,
-     WNI_CFG_EDCA_WME_ACVO_LOCAL,
-     WNI_CFG_EDCA_WME_ACBK,
-     WNI_CFG_EDCA_WME_ACBE,
-     WNI_CFG_EDCA_WME_ACVI,
-     WNI_CFG_EDCA_WME_ACVO,
-     WNI_CFG_EDCA_TIT_DEMO_ACBK_LOCAL,
-     WNI_CFG_EDCA_TIT_DEMO_ACBE_LOCAL,
-     WNI_CFG_EDCA_TIT_DEMO_ACVI_LOCAL,
-     WNI_CFG_EDCA_TIT_DEMO_ACVO_LOCAL,
-     WNI_CFG_EDCA_TIT_DEMO_ACBK,
-     WNI_CFG_EDCA_TIT_DEMO_ACBE,
-     WNI_CFG_EDCA_TIT_DEMO_ACVI,
-     WNI_CFG_EDCA_TIT_DEMO_ACVO,
-     WNI_CFG_RDET_FLAG,
-     WNI_CFG_RADAR_CHANNEL_LIST,
-     WNI_CFG_LOCAL_POWER_CONSTRAINT,
-     WNI_CFG_ADMIT_POLICY,
-     WNI_CFG_ADMIT_BWFACTOR,
-     WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE,
-     WNI_CFG_CHANNEL_BONDING_MODE,
-     WNI_CFG_CB_SECONDARY_CHANNEL_STATE,
-     WNI_CFG_DYNAMIC_THRESHOLD_ZERO,
-     WNI_CFG_DYNAMIC_THRESHOLD_ONE,
-     WNI_CFG_DYNAMIC_THRESHOLD_TWO,
-     WNI_CFG_TRIG_STA_BK_SCAN,
-     WNI_CFG_DYNAMIC_PROFILE_SWITCHING,
-     WNI_CFG_SCAN_CONTROL_LIST,
-     WNI_CFG_MIMO_ENABLED,
-     WNI_CFG_BLOCK_ACK_ENABLED,
-     WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT,
-     WNI_CFG_HT_RX_STBC,
-     WNI_CFG_HT_CAP_INFO,
-     WNI_CFG_HT_AMPDU_PARAMS,
-     WNI_CFG_SUPPORTED_MCS_SET,
-     WNI_CFG_EXT_HT_CAP_INFO,
-     WNI_CFG_TX_BF_CAP,
-     WNI_CFG_AS_CAP,
-     WNI_CFG_HT_INFO_FIELD1,
-     WNI_CFG_HT_INFO_FIELD2,
-     WNI_CFG_HT_INFO_FIELD3,
-     WNI_CFG_BASIC_MCS_SET,
-     WNI_CFG_CURRENT_MCS_SET,
-     WNI_CFG_GREENFIELD_CAPABILITY,
-     WNI_CFG_VHT_MAX_MPDU_LENGTH,
-     WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
-     WNI_CFG_VHT_LDPC_CODING_CAP,
-     WNI_CFG_VHT_SHORT_GI_80MHZ,
-     WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
-     WNI_CFG_VHT_TXSTBC,
-     WNI_CFG_VHT_RXSTBC,
-     WNI_CFG_VHT_SU_BEAMFORMER_CAP,
-     WNI_CFG_VHT_SU_BEAMFORMEE_CAP,
-     WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
-     WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
-     WNI_CFG_VHT_MU_BEAMFORMER_CAP,
-     WNI_CFG_VHT_MU_BEAMFORMEE_CAP,
-     WNI_CFG_VHT_TXOP_PS,
-     WNI_CFG_VHT_HTC_VHTC_CAP,
-     WNI_CFG_VHT_AMPDU_LEN_EXPONENT,
-     WNI_CFG_VHT_LINK_ADAPTATION_CAP,
-     WNI_CFG_VHT_RX_ANT_PATTERN,
-     WNI_CFG_VHT_TX_ANT_PATTERN,
-     WNI_CFG_VHT_RX_MCS_MAP,
-     WNI_CFG_VHT_TX_MCS_MAP,
-     WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
-     WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
-     WNI_CFG_VHT_CHANNEL_WIDTH,
-     WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
-     WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
-     WNI_CFG_VHT_BASIC_MCS_SET,
-     WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
-     WNI_CFG_VHT_SS_UNDER_UTIL,
-     WNI_CFG_VHT_40MHZ_UTILIZATION,
-     WNI_CFG_VHT_80MHZ_UTILIZATION,
-     WNI_CFG_VHT_160MHZ_UTILIZATION,
-     WNI_CFG_MAX_AMSDU_LENGTH,
-     WNI_CFG_MPDU_DENSITY,
-     WNI_CFG_NUM_BUFF_ADVERT,
-     WNI_CFG_MAX_RX_AMPDU_FACTOR,
-     WNI_CFG_SHORT_GI_20MHZ,
-     WNI_CFG_SHORT_GI_40MHZ,
-     WNI_CFG_RIFS_ENABLED,
-     WNI_CFG_MAX_PS_POLL,
-     WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE,
-     WNI_CFG_RSSI_FILTER_PERIOD,
-     WNI_CFG_MIN_RSSI_THRESHOLD,
-     WNI_CFG_NTH_BEACON_FILTER,
-     WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE,
-     WNI_CFG_SCAN_IN_POWERSAVE,
-     WNI_CFG_IGNORE_DTIM,
-     WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE,
-     WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE,
-     WNI_CFG_WOWLAN_DEAUTH_ENABLE,
-     WNI_CFG_WOWLAN_DISASSOC_ENABLE,
-     WNI_CFG_WOWLAN_MAX_MISSED_BEACON,
-     WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD,
-     WNI_CFG_BA_TIMEOUT,
-     WNI_CFG_BA_THRESHOLD_HIGH,
-     WNI_CFG_MAX_BA_BUFFERS,
-     WNI_CFG_MAX_BA_SESSIONS,
-     WNI_CFG_BA_AUTO_SETUP,
-     WNI_CFG_ADDBA_REQ_DECLINE,
-     WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC,
-     WNI_CFG_BG_SCAN_CHANNEL_LIST,
-     WNI_CFG_MAX_MEDIUM_TIME,
-     WNI_CFG_MAX_MPDUS_IN_AMPDU,
-     WNI_CFG_IBSS_AUTO_BSSID,
-     WNI_CFG_PROBE_REQ_ADDNIE_FLAG,
-     WNI_CFG_PROBE_REQ_ADDNIE_DATA,
-     WNI_CFG_PROBE_RSP_ADDNIE_FLAG,
-     WNI_CFG_PROBE_RSP_ADDNIE_DATA1,
-     WNI_CFG_PROBE_RSP_ADDNIE_DATA2,
-     WNI_CFG_PROBE_RSP_ADDNIE_DATA3,
-     WNI_CFG_ASSOC_RSP_ADDNIE_FLAG,
-     WNI_CFG_ASSOC_RSP_ADDNIE_DATA,
-     WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG,
-     WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA,
-     WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG,
-     WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA,
-     WNI_CFG_WPS_ENABLE,
-     WNI_CFG_WPS_STATE,
-     WNI_CFG_WPS_PROBE_REQ_FLAG,
-     WNI_CFG_WPS_VERSION,
-     WNI_CFG_WPS_REQUEST_TYPE,
-     WNI_CFG_WPS_CFG_METHOD,
-     WNI_CFG_WPS_UUID,
-     WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY,
-     WNI_CFG_WPS_PIMARY_DEVICE_OUI,
-     WNI_CFG_WPS_DEVICE_SUB_CATEGORY,
-     WNI_CFG_WPS_ASSOCIATION_STATE,
-     WNI_CFG_WPS_CONFIGURATION_ERROR,
-     WNI_CFG_WPS_DEVICE_PASSWORD_ID,
-     WNI_CFG_WPS_ASSOC_METHOD,
-     WNI_CFG_LOW_GAIN_OVERRIDE,
-     WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE,
-     WNI_CFG_RPE_POLLING_THRESHOLD,
-     WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG,
-     WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG,
-     WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG,
-     WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG,
-     WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS,
-     WNI_CFG_SINGLE_TID_RC,
-     WNI_CFG_RRM_ENABLED,
-     WNI_CFG_RRM_OPERATING_CHAN_MAX,
-     WNI_CFG_RRM_NON_OPERATING_CHAN_MAX,
-     WNI_CFG_TX_PWR_CTRL_ENABLE,
-     WNI_CFG_MCAST_BCAST_FILTER_SETTING,
-     WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK,
-     WNI_CFG_DYNAMIC_PS_POLL_VALUE,
-     WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT,
-     WNI_CFG_TELE_BCN_WAKEUP_EN,
-     WNI_CFG_TELE_BCN_TRANS_LI,
-     WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS,
-     WNI_CFG_TELE_BCN_MAX_LI,
-     WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS,
-     WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS,
-     WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD,
-     WNI_CFG_ASSOC_STA_LIMIT,
-     WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL,
-     WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL,
-     WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND,
-     WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD,
-     WNI_CFG_ENABLE_CLOSE_LOOP,
-     WNI_CFG_ENABLE_LTE_COEX,
-     WNI_CFG_AP_KEEP_ALIVE_TIMEOUT,
-     WNI_CFG_GO_KEEP_ALIVE_TIMEOUT,
-     WNI_CFG_ENABLE_MC_ADDR_LIST,
-     WNI_CFG_ENABLE_UC_FILTER,
-     WNI_CFG_ENABLE_LPWR_IMG_TRANSITION,
-     WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED,
-     WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,
-     WNI_CFG_AP_LINK_MONITOR_TIMEOUT,
-     WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK,
-     WNI_CFG_TDLS_BUF_STA_ENABLED,
-     WNI_CFG_TDLS_PUAPSD_INACT_TIME,
-     WNI_CFG_TDLS_RX_FRAME_THRESHOLD,
-     WNI_CFG_ENABLE_ADAPT_RX_DRAIN,
-     WNI_CFG_FLEX_CONNECT_POWER_FACTOR,
-     WNI_CFG_ANTENNA_DIVESITY,
-     WNI_CFG_GO_LINK_MONITOR_TIMEOUT,
-     WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY,
-     WNI_CFG_ATH_DISABLE,
-     WNI_CFG_BTC_ACTIVE_WLAN_LEN,
-     WNI_CFG_BTC_ACTIVE_BT_LEN,
-     WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN,
-     WNI_CFG_BTC_SAP_ACTIVE_BT_LEN,
-     WNI_CFG_ASD_PROBE_INTERVAL,
-     WNI_CFG_ASD_TRIGGER_THRESHOLD,
-     WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD,
-     WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL,
-     WNI_CFG_BTC_CTS2S_DURING_SCO,
-     WNI_CFG_CHANNEL_BONDING_24G,
-     WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
-     WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
-     WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
-     WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL,
-     WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
-     WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR,
-     WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD,
-     WNI_CFG_TDLS_OFF_CHANNEL_ENABLED,
-     WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
-     WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL,
-     WNI_CFG_RA_FILTER_ENABLE,
-     WNI_CFG_RA_RATE_LIMIT_INTERVAL,
-     WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE,
-     WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE,
-     WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD,
-     WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD,
-     WNI_CFG_TDLS_WMM_MODE_ENABLED,
-     WNI_CFG_MAX_UAPSD_CONSEC_SP,
-     WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT,
-     WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT,
-     WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW,
-     WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW,
-     WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE,
-     WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS,
-     WNI_CFG_ENABLE_DYNAMIC_WMMPS,
-     WNI_CFG_BURST_MODE_BE_TXOP_VALUE,
-     WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE,
-     WNI_CFG_BTC_FAST_WLAN_CONN_PREF,
-     WNI_CFG_ENABLE_RTSCTS_HTVHT,
-     WNI_CFG_TOGGLE_ARP_BDRATES,
-     WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN,
-     WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN,
-     WNI_CFG_LINK_FAIL_TIMEOUT,
-     WNI_CFG_LINK_FAIL_TX_CNT,
-     WNI_CFG_OPTIMIZE_CA_EVENT,
-     WNI_CFG_ACTIVE_PASSIVE_CON,
-     WNI_CFG_EXT_SCAN_CONC_MODE,
-     WNI_CFG_ENABLE_MAC_ADDR_SPOOFING,
-     WNI_CFG_DISABLE_BAR_WAKE_UP_HOST,
-     WNI_CFG_SAR_BOFFSET_SET_CORRECTION
-};
+#define WNI_CFG_STA_ID    0
+#define WNI_CFG_CFP_PERIOD    2
+#define WNI_CFG_CFP_MAX_DURATION    3
+#define WNI_CFG_SSID    4
+#define WNI_CFG_BEACON_INTERVAL    5
+#define WNI_CFG_DTIM_PERIOD    6
+#define WNI_CFG_WEP_KEY_LENGTH    7
+#define WNI_CFG_WEP_DEFAULT_KEY_TABLE    8
+#define WNI_CFG_WEP_DEFAULT_KEY_TABLE_ROW    4
+#define WNI_CFG_WEP_DEFAULT_KEY_TABLE_COL    1
+#define WNI_CFG_WEP_DEFAULT_KEY_1    8
+#define WNI_CFG_WEP_DEFAULT_KEY_2    9
+#define WNI_CFG_WEP_DEFAULT_KEY_3    10
+#define WNI_CFG_WEP_DEFAULT_KEY_4    11
+#define WNI_CFG_WEP_DEFAULT_KEYID    12
+#define WNI_CFG_EXCLUDE_UNENCRYPTED    13
+#define WNI_CFG_RTS_THRESHOLD    14
+#define WNI_CFG_SHORT_RETRY_LIMIT    15
+#define WNI_CFG_LONG_RETRY_LIMIT    16
+#define WNI_CFG_FRAGMENTATION_THRESHOLD    17
+#define WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME    18
+#define WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME    19
+#define WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME    20
+#define WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME    21
+#define WNI_CFG_JOIN_FAILURE_TIMEOUT    22
+#define WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT    23
+#define WNI_CFG_AUTHENTICATE_RSP_TIMEOUT    24
+#define WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT    25
+#define WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT    26
+#define WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS    27
+#define WNI_CFG_PS_ENABLE_BCN_FILTER    28
+#define WNI_CFG_PS_ENABLE_HEART_BEAT    29
+#define WNI_CFG_PS_ENABLE_RSSI_MONITOR    30
+#define WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT    31
+#define WNI_CFG_RF_SETTLING_TIME_CLK    32
+#define WNI_CFG_SUPPORTED_RATES_11B    33
+#define WNI_CFG_SUPPORTED_RATES_11A    34
+#define WNI_CFG_PHY_MODE    35
+#define WNI_CFG_DOT11_MODE    36
+#define WNI_CFG_OPERATIONAL_RATE_SET    37
+#define WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET    38
+#define WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET    39
+#define WNI_CFG_BSSID    40
+#define WNI_CFG_LISTEN_INTERVAL    41
+#define WNI_CFG_VALID_CHANNEL_LIST    42
+#define WNI_CFG_CURRENT_CHANNEL    43
+#define WNI_CFG_DEFAULT_RATE_INDEX_5GHZ    44
+#define WNI_CFG_DEFAULT_RATE_INDEX_24GHZ    45
+#define WNI_CFG_RATE_ADAPTATION_TYPE    46
+#define WNI_CFG_FIXED_RATE    47
+#define WNI_CFG_FIXED_RATE_MULTICAST_24GHZ    48
+#define WNI_CFG_FIXED_RATE_MULTICAST_5GHZ    49
+#define WNI_CFG_RETRYRATE_POLICY    50
+#define WNI_CFG_RETRYRATE_SECONDARY    51
+#define WNI_CFG_RETRYRATE_TERTIARY    52
+#define WNI_CFG_APSD_ENABLED    53
+#define WNI_CFG_SHARED_KEY_AUTH_ENABLE    54
+#define WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE    55
+#define WNI_CFG_AUTHENTICATION_TYPE    56
+#define WNI_CFG_PRIVACY_ENABLED    58
+#define WNI_CFG_SHORT_PREAMBLE    59
+#define WNI_CFG_SHORT_SLOT_TIME    60
+#define WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY    61
+#define WNI_CFG_QOS_ENABLED    62
+#define WNI_CFG_HCF_ENABLED    63
+#define WNI_CFG_RSN_ENABLED    64
+#define WNI_CFG_BACKGROUND_SCAN_PERIOD    65
+#define WNI_CFG_MAX_NUM_PRE_AUTH    66
+#define WNI_CFG_HEART_BEAT_THRESHOLD    69
+#define WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT    70
+#define WNI_CFG_MANUFACTURER_OUI    71
+#define WNI_CFG_MANUFACTURER_NAME    72
+#define WNI_CFG_MODEL_NUMBER    73
+#define WNI_CFG_MODEL_NAME    74
+#define WNI_CFG_MANUFACTURER_PRODUCT_NAME    75
+#define WNI_CFG_MANUFACTURER_PRODUCT_VERSION    76
+#define WNI_CFG_11D_ENABLED    77
+#define WNI_CFG_MAX_TX_POWER_2_4    78
+#define WNI_CFG_MAX_TX_POWER_5    79
+#define WNI_CFG_NETWORK_DENSITY    80
+#define WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM    81
+#define WNI_CFG_CURRENT_TX_ANTENNA    82
+#define WNI_CFG_CURRENT_RX_ANTENNA    83
+#define WNI_CFG_CURRENT_TX_POWER_LEVEL    84
+#define WNI_CFG_POWER_STATE_PER_CHAIN    85
+#define WNI_CFG_NEW_BSS_FOUND_IND    86
+#define WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED    87
+#define WNI_CFG_PROPRIETARY_RATES_ENABLED    88
+#define WNI_CFG_COUNTRY_CODE    90
+#define WNI_CFG_11H_ENABLED    91
+#define WNI_CFG_WT_CNF_TIMEOUT    92
+#define WNI_CFG_KEEPALIVE_TIMEOUT    93
+#define WNI_CFG_PROXIMITY    94
+#define WNI_CFG_LOG_LEVEL    95
+#define WNI_CFG_OLBC_DETECT_TIMEOUT    96
+#define WNI_CFG_PROTECTION_ENABLED    97
+#define WNI_CFG_11G_PROTECTION_ALWAYS    98
+#define WNI_CFG_FORCE_POLICY_PROTECTION    99
+#define WNI_CFG_11G_SHORT_PREAMBLE_ENABLED    100
+#define WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED    101
+#define WNI_CFG_CAL_PERIOD    102
+#define WNI_CFG_STATS_PERIOD    103
+#define WNI_CFG_CAL_CONTROL    104
+#define WNI_CFG_11G_ONLY_POLICY    105
+#define WNI_CFG_PACKET_CLASSIFICATION    106
+#define WNI_CFG_WME_ENABLED    107
+#define WNI_CFG_ADDTS_RSP_TIMEOUT    108
+#define WNI_CFG_MAX_SP_LENGTH    109
+#define WNI_CFG_SEND_SINGLE_SSID_ALWAYS    111
+#define WNI_CFG_WSM_ENABLED    112
+#define WNI_CFG_PROP_CAPABILITY    113
+#define WNI_CFG_EDCA_PROFILE    114
+#define WNI_CFG_EDCA_ANI_ACBK_LOCAL    115
+#define WNI_CFG_EDCA_ANI_ACBE_LOCAL    116
+#define WNI_CFG_EDCA_ANI_ACVI_LOCAL    117
+#define WNI_CFG_EDCA_ANI_ACVO_LOCAL    118
+#define WNI_CFG_EDCA_ANI_ACBK    119
+#define WNI_CFG_EDCA_ANI_ACBE    120
+#define WNI_CFG_EDCA_ANI_ACVI    121
+#define WNI_CFG_EDCA_ANI_ACVO    122
+#define WNI_CFG_EDCA_WME_ACBK_LOCAL    123
+#define WNI_CFG_EDCA_WME_ACBE_LOCAL    124
+#define WNI_CFG_EDCA_WME_ACVI_LOCAL    125
+#define WNI_CFG_EDCA_WME_ACVO_LOCAL    126
+#define WNI_CFG_EDCA_WME_ACBK    127
+#define WNI_CFG_EDCA_WME_ACBE    128
+#define WNI_CFG_EDCA_WME_ACVI    129
+#define WNI_CFG_EDCA_WME_ACVO    130
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK_LOCAL    131
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE_LOCAL    132
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI_LOCAL    133
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO_LOCAL    134
+#define WNI_CFG_EDCA_TIT_DEMO_ACBK    135
+#define WNI_CFG_EDCA_TIT_DEMO_ACBE    136
+#define WNI_CFG_EDCA_TIT_DEMO_ACVI    137
+#define WNI_CFG_EDCA_TIT_DEMO_ACVO    138
+#define WNI_CFG_RDET_FLAG    139
+#define WNI_CFG_RADAR_CHANNEL_LIST    140
+#define WNI_CFG_LOCAL_POWER_CONSTRAINT    141
+#define WNI_CFG_ADMIT_POLICY    142
+#define WNI_CFG_ADMIT_BWFACTOR    143
+#define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE    144
+#define WNI_CFG_CHANNEL_BONDING_MODE    145
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE    146
+#define WNI_CFG_DYNAMIC_THRESHOLD_ZERO    147
+#define WNI_CFG_DYNAMIC_THRESHOLD_ONE    148
+#define WNI_CFG_DYNAMIC_THRESHOLD_TWO    149
+#define WNI_CFG_TRIG_STA_BK_SCAN    150
+#define WNI_CFG_DYNAMIC_PROFILE_SWITCHING    151
+#define WNI_CFG_SCAN_CONTROL_LIST    152
+#define WNI_CFG_MIMO_ENABLED    153
+#define WNI_CFG_BLOCK_ACK_ENABLED    154
+#define WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT    155
+#define WNI_CFG_HT_RX_STBC    156
+#define WNI_CFG_HT_CAP_INFO    157
+#define WNI_CFG_HT_AMPDU_PARAMS    158
+#define WNI_CFG_SUPPORTED_MCS_SET    159
+#define WNI_CFG_EXT_HT_CAP_INFO    160
+#define WNI_CFG_TX_BF_CAP    161
+#define WNI_CFG_AS_CAP    162
+#define WNI_CFG_HT_INFO_FIELD1    163
+#define WNI_CFG_HT_INFO_FIELD2    164
+#define WNI_CFG_HT_INFO_FIELD3    165
+#define WNI_CFG_BASIC_MCS_SET    166
+#define WNI_CFG_CURRENT_MCS_SET    167
+#define WNI_CFG_GREENFIELD_CAPABILITY    168
+#define WNI_CFG_VHT_MAX_MPDU_LENGTH    169
+#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET    170
+#define WNI_CFG_VHT_LDPC_CODING_CAP    171
+#define WNI_CFG_VHT_SHORT_GI_80MHZ    172
+#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ    173
+#define WNI_CFG_VHT_TXSTBC    174
+#define WNI_CFG_VHT_RXSTBC    175
+#define WNI_CFG_VHT_SU_BEAMFORMER_CAP    176
+#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP    177
+#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED    178
+#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS    179
+#define WNI_CFG_VHT_MU_BEAMFORMER_CAP    180
+#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP    181
+#define WNI_CFG_VHT_TXOP_PS    182
+#define WNI_CFG_VHT_HTC_VHTC_CAP    183
+#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT    184
+#define WNI_CFG_VHT_LINK_ADAPTATION_CAP    185
+#define WNI_CFG_VHT_RX_ANT_PATTERN    186
+#define WNI_CFG_VHT_TX_ANT_PATTERN    187
+#define WNI_CFG_VHT_RX_MCS_MAP    188
+#define WNI_CFG_VHT_TX_MCS_MAP    189
+#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE    190
+#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE    191
+#define WNI_CFG_VHT_CHANNEL_WIDTH    192
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1    193
+#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2    194
+#define WNI_CFG_VHT_BASIC_MCS_SET    195
+#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT    196
+#define WNI_CFG_VHT_SS_UNDER_UTIL    197
+#define WNI_CFG_VHT_40MHZ_UTILIZATION    198
+#define WNI_CFG_VHT_80MHZ_UTILIZATION    199
+#define WNI_CFG_VHT_160MHZ_UTILIZATION    200
+#define WNI_CFG_MAX_AMSDU_LENGTH    201
+#define WNI_CFG_MPDU_DENSITY    202
+#define WNI_CFG_NUM_BUFF_ADVERT    203
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR    204
+#define WNI_CFG_SHORT_GI_20MHZ    205
+#define WNI_CFG_SHORT_GI_40MHZ    206
+#define WNI_CFG_RIFS_ENABLED    207
+#define WNI_CFG_MAX_PS_POLL    208
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE    209
+#define WNI_CFG_RSSI_FILTER_PERIOD    210
+#define WNI_CFG_MIN_RSSI_THRESHOLD    211
+#define WNI_CFG_NTH_BEACON_FILTER    212
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE    213
+#define WNI_CFG_SCAN_IN_POWERSAVE    214
+#define WNI_CFG_IGNORE_DTIM    215
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE    216
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE    217
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE    218
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE    219
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON    220
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD    221
+#define WNI_CFG_BA_TIMEOUT    222
+#define WNI_CFG_BA_THRESHOLD_HIGH    223
+#define WNI_CFG_MAX_BA_BUFFERS    224
+#define WNI_CFG_MAX_BA_SESSIONS    225
+#define WNI_CFG_BA_AUTO_SETUP    226
+#define WNI_CFG_ADDBA_REQ_DECLINE    227
+#define WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC    228
+#define WNI_CFG_BG_SCAN_CHANNEL_LIST    229
+#define WNI_CFG_MAX_MEDIUM_TIME    230
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU    231
+#define WNI_CFG_IBSS_AUTO_BSSID    232
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG    233
+#define WNI_CFG_PROBE_REQ_ADDNIE_DATA    234
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG    235
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA1    236
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA2    237
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA3    238
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG    239
+#define WNI_CFG_ASSOC_RSP_ADDNIE_DATA    240
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG    241
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA    242
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG    243
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA    244
+#define WNI_CFG_WPS_ENABLE    245
+#define WNI_CFG_WPS_STATE    246
+#define WNI_CFG_WPS_PROBE_REQ_FLAG    247
+#define WNI_CFG_WPS_VERSION    248
+#define WNI_CFG_WPS_REQUEST_TYPE    249
+#define WNI_CFG_WPS_CFG_METHOD    250
+#define WNI_CFG_WPS_UUID    251
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY    252
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI    253
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY    254
+#define WNI_CFG_WPS_ASSOCIATION_STATE    255
+#define WNI_CFG_WPS_CONFIGURATION_ERROR    256
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID    257
+#define WNI_CFG_WPS_ASSOC_METHOD    258
+#define WNI_CFG_LOW_GAIN_OVERRIDE    259
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE    260
+#define WNI_CFG_RPE_POLLING_THRESHOLD    261
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG    262
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG    263
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG    264
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG    265
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS    266
+#define WNI_CFG_SINGLE_TID_RC    267
+#define WNI_CFG_RRM_ENABLED    268
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX    269
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX    270
+#define WNI_CFG_TX_PWR_CTRL_ENABLE    271
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING    272
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK    273
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE    274
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT    275
+#define WNI_CFG_TELE_BCN_WAKEUP_EN    276
+#define WNI_CFG_TELE_BCN_TRANS_LI    277
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS    278
+#define WNI_CFG_TELE_BCN_MAX_LI    279
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS    280
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS    281
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD    282
+#define WNI_CFG_ASSOC_STA_LIMIT    283
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL    284
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL    285
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND    286
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD    287
+#define WNI_CFG_ENABLE_CLOSE_LOOP    288
+#define WNI_CFG_ENABLE_LTE_COEX    289
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT    290
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT    291
+#define WNI_CFG_ENABLE_MC_ADDR_LIST    292
+#define WNI_CFG_ENABLE_UC_FILTER    293
+#define WNI_CFG_ENABLE_LPWR_IMG_TRANSITION    294
+#define WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED    295
+#define WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP    296
+#define WNI_CFG_AP_LINK_MONITOR_TIMEOUT    297
+#define WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK    298
+#define WNI_CFG_TDLS_BUF_STA_ENABLED    299
+#define WNI_CFG_TDLS_PUAPSD_INACT_TIME    300
+#define WNI_CFG_TDLS_RX_FRAME_THRESHOLD    301
+#define WNI_CFG_ENABLE_ADAPT_RX_DRAIN    302
+#define WNI_CFG_FLEX_CONNECT_POWER_FACTOR    303
+#define WNI_CFG_ANTENNA_DIVESITY    304
+#define WNI_CFG_GO_LINK_MONITOR_TIMEOUT    305
+#define WNI_CFG_ATH_DISABLE    306
+#define WNI_CFG_BTC_ACTIVE_WLAN_LEN    307
+#define WNI_CFG_BTC_ACTIVE_BT_LEN    308
+#define WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN    309
+#define WNI_CFG_BTC_SAP_ACTIVE_BT_LEN    310
+#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY    311
+#define WNI_CFG_ASD_PROBE_INTERVAL    312
+#define WNI_CFG_ASD_TRIGGER_THRESHOLD    313
+#define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD    314
+#define WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL    315
+#define WNI_CFG_BTC_CTS2S_DURING_SCO    316
+#define WNI_CFG_CHANNEL_BONDING_24G    317
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME    318
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME    319
+#define WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL    320
+#define WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL    321
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL    322
+#define WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR    323
+#define WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD    324
+#define WNI_CFG_TDLS_OFF_CHANNEL_ENABLED    325
+#define WNI_CFG_PMF_SA_QUERY_MAX_RETRIES    326
+#define WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL    327
+#define WNI_CFG_RA_FILTER_ENABLE    328
+#define WNI_CFG_RA_RATE_LIMIT_INTERVAL    329
+#define WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE    330
+#define WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE    331
+#define WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD    332
+#define WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD    333
+#define WNI_CFG_TDLS_WMM_MODE_ENABLED    334
+#define WNI_CFG_MAX_UAPSD_CONSEC_SP    335
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT    336
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT    337
+#define WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW    338
+#define WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW    339
+#define WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE    340
+#define WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS    341
+#define WNI_CFG_ENABLE_DYNAMIC_WMMPS    342
+#define WNI_CFG_BURST_MODE_BE_TXOP_VALUE    343
+#define WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE    344
+#define WNI_CFG_BTC_FAST_WLAN_CONN_PREF    345
 
 /*
  * String parameter lengths 
@@ -410,7 +401,6 @@
 #define WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN    8
 #define WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET_LEN    4
 #define WNI_CFG_BSSID_LEN    6
-#define WNI_CFG_MACADDR_LEN    6
 #define WNI_CFG_VALID_CHANNEL_LIST_LEN    100
 #define WNI_CFG_MANUFACTURER_OUI_LEN    3
 #define WNI_CFG_MANUFACTURER_NAME_LEN    65
@@ -420,7 +410,6 @@
 #define WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN    33
 #define WNI_CFG_MAX_TX_POWER_2_4_LEN    128
 #define WNI_CFG_MAX_TX_POWER_5_LEN    128
-#define WNI_CFG_AP_NODE_NAME_LEN    32
 #define WNI_CFG_COUNTRY_CODE_LEN    3
 #define WNI_CFG_EDCA_ANI_ACBK_LOCAL_LEN    20
 #define WNI_CFG_EDCA_ANI_ACBE_LOCAL_LEN    20
@@ -1060,7 +1049,7 @@
 
 #define WNI_CFG_BLOCK_ACK_ENABLED_STAMIN    0
 #define WNI_CFG_BLOCK_ACK_ENABLED_STAMAX    3
-#define WNI_CFG_BLOCK_ACK_ENABLED_STADEF    0
+#define WNI_CFG_BLOCK_ACK_ENABLED_STADEF    2
 
 #define WNI_CFG_BLOCK_ACK_ENABLED_DELAYED    0
 #define WNI_CFG_BLOCK_ACK_ENABLED_IMMEDIATE    1
@@ -1200,7 +1189,7 @@
 
 #define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STAMIN    0
 #define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STAMAX    1
-#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STADEF    1
+#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STADEF    0
 
 #define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STAMIN    0
 #define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STAMAX    4
@@ -1701,10 +1690,6 @@
 #define WNI_CFG_GO_LINK_MONITOR_TIMEOUT_STAMAX    50
 #define WNI_CFG_GO_LINK_MONITOR_TIMEOUT_STADEF    10
 
-#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STAMIN    100
-#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STAMAX    1000
-#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STADEF    300
-
 #define WNI_CFG_ATH_DISABLE_STAMIN    0
 #define WNI_CFG_ATH_DISABLE_STAMAX    1
 #define WNI_CFG_ATH_DISABLE_STADEF    0
@@ -1725,17 +1710,21 @@
 #define WNI_CFG_BTC_SAP_ACTIVE_BT_LEN_STAMAX    250000
 #define WNI_CFG_BTC_SAP_ACTIVE_BT_LEN_STADEF    30000
 
-#define WNI_CFG_ASD_PROBE_INTERVAL_STAMIN    1
-#define WNI_CFG_ASD_PROBE_INTERVAL_STAMAX    500
+#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STAMIN    0
+#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STAMAX    4294967295
+#define WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STADEF    300
+
+#define WNI_CFG_ASD_PROBE_INTERVAL_STAMIN    10
+#define WNI_CFG_ASD_PROBE_INTERVAL_STAMAX    100
 #define WNI_CFG_ASD_PROBE_INTERVAL_STADEF    50
 
-#define WNI_CFG_ASD_TRIGGER_THRESHOLD_STAMIN    -100
-#define WNI_CFG_ASD_TRIGGER_THRESHOLD_STAMAX    -10
-#define WNI_CFG_ASD_TRIGGER_THRESHOLD_STADEF    -60
+#define WNI_CFG_ASD_TRIGGER_THRESHOLD_STAMIN    0
+#define WNI_CFG_ASD_TRIGGER_THRESHOLD_STAMAX    120
+#define WNI_CFG_ASD_TRIGGER_THRESHOLD_STADEF    45
 
 #define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_STAMIN    0
-#define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_STAMAX    5
-#define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_STADEF    3
+#define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_STAMAX    100
+#define WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_STADEF    0
 
 #define WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL_STAMIN    0
 #define WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL_STAMAX    1
@@ -1854,72 +1843,17 @@
 #define WNI_CFG_BURST_MODE_BE_TXOP_VALUE_STADEF    0
 
 #define WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE_STAMIN 0
-#define WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE_STAMAX 65535
+#define WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE_STAMAX 1
 #define WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE_STADEF 0
 
 #define WNI_CFG_BTC_FAST_WLAN_CONN_PREF_STAMIN 0
-#define WNI_CFG_BTC_FAST_WLAN_CONN_PREF_STAMAX 5
+#define WNI_CFG_BTC_FAST_WLAN_CONN_PREF_STAMAX 1
 #define WNI_CFG_BTC_FAST_WLAN_CONN_PREF_STADEF 1
 
-/* Bit mask value to enable RTS/CTS for different modes
- * for 2.4 GHz, HT20 - 0x0001, for 2.4 GHz, HT40 - 0x0002
- * for 2.4 GHz, VHT20 - 0x0004, for 2.4 GHz, VHT40 - 0x0008
- * for 5 GHz, HT20 - 0x0100, for 5 GHz, HT40 - 0x0200
- * for 5 GHz, VHT20 - 0x0400, for 5 GHz, VHT40 - 0x0800
- * for 5 GHz, VHT80 - 0x1000
- */
-#define WNI_CFG_ENABLE_RTSCTS_HTVHT_MIN 0x0000
-#define WNI_CFG_ENABLE_RTSCTS_HTVHT_MAX 0x1f0f
-#define WNI_CFG_ENABLE_RTSCTS_HTVHT_DEF 0x0000
-
-#define WNI_CFG_TOGGLE_ARP_BDRATES_MIN 0
-#define WNI_CFG_TOGGLE_ARP_BDRATES_MAX 2
-#define WNI_CFG_TOGGLE_ARP_BDRATES_DEF 0
-
-#define WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_MIN 0
-#define WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_MAX 250000
-#define WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_DEF 40000
-
-#define WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_MIN 0
-#define WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_MAX 250000
-#define WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_DEF 40000
-
-#define WNI_CFG_LINK_FAIL_TIMEOUT_MIN 1000
-#define WNI_CFG_LINK_FAIL_TIMEOUT_MAX 60000
-#define WNI_CFG_LINK_FAIL_TIMEOUT_DEF 6000
-
-#define WNI_CFG_LINK_FAIL_TX_CNT_MIN 50
-#define WNI_CFG_LINK_FAIL_TX_CNT_MAX 1000
-#define WNI_CFG_LINK_FAIL_TX_CNT_DEF 200
-
-#define WNI_CFG_OPTIMIZE_CA_EVENT_DISABLE 0
-#define WNI_CFG_OPTIMIZE_CA_EVENT_ENABLE  1
-#define WNI_CFG_OPTIMIZE_CA_EVENT_DEFAULT 0
-
-#define WNI_CFG_ACTIVE_PASSIVE_CON_MIN 0
-#define WNI_CFG_ACTIVE_PASSIVE_CON_MAX 1
-#define WNI_CFG_ACTIVE_PASSIVE_CON_DEF 1
-
-#define WNI_CFG_EXT_SCAN_CONC_MODE_MIN    0
-#define WNI_CFG_EXT_SCAN_CONC_MODE_MAX    2
-#define WNI_CFG_EXT_SCAN_CONC_MODE_DEF    1
-
-#define WNI_CFG_ENABLE_MAC_ADDR_SPOOFING_MIN 0
-#define WNI_CFG_ENABLE_MAC_ADDR_SPOOFING_MAX 2
-#define WNI_CFG_ENABLE_MAC_ADDR_SPOOFING_DEF 1
-
-#define WNI_CFG_DISABLE_BAR_WAKE_UP_HOST_MIN 0
-#define WNI_CFG_DISABLE_BAR_WAKE_UP_HOST_MAX 1
-#define WNI_CFG_DISABLE_BAR_WAKE_UP_HOST_DEF 0
-
-#define WNI_CFG_SAR_BOFFSET_SET_CORRECTION_MIN 0
-#define WNI_CFG_SAR_BOFFSET_SET_CORRECTION_MAX  1
-#define WNI_CFG_SAR_BOFFSET_SET_CORRECTION_DEFAULT 0
-
-
-#define CFG_PARAM_MAX_NUM        358
-#define CFG_STA_IBUF_MAX_SIZE    292
+#define CFG_PARAM_MAX_NUM        346
+#define CFG_STA_IBUF_MAX_SIZE    280
 #define CFG_STA_SBUF_MAX_SIZE    3389
+#define CFG_SEM_MAX_NUM          19
 
 #define CFG_STA_MAGIC_DWORD    0xbeefbeef
 
diff --git a/wlan/prima/CORE/MAC/src/cfg/cfgApi.c b/wlan/prima/CORE/MAC/src/cfg/cfgApi.c
index 9047d3a..a9ea14a 100644
--- a/wlan/prima/CORE/MAC/src/cfg/cfgApi.c
+++ b/wlan/prima/CORE/MAC/src/cfg/cfgApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -50,6 +50,8 @@
 static tANI_U32  __gCfgIBuf[CFG_STA_IBUF_MAX_SIZE]             ;
 static tANI_U8   __gCfgSBuf[CFG_STA_SBUF_MAX_SIZE]             ;
 static tANI_U8   __gSBuffer[CFG_MAX_STR_LEN]                   ;
+static tANI_U32  __gParamList[WNI_CFG_MAX_PARAM_NUM + 
+                              WNI_CFG_GET_PER_STA_STAT_RSP_NUM];
 
 
 static void Notify(tpAniSirGlobal, tANI_U16, tANI_U32);
@@ -140,6 +142,7 @@
    pMac->cfg.gCfgSBuf     = __gCfgSBuf;
    pMac->cfg.gSBuffer     = __gSBuffer;
    pMac->cfg.gCfgEntry    = __gCfgEntry;
+   pMac->cfg.gParamList   = __gParamList;
 
    for(i=0; i<CFG_PARAM_MAX_NUM; i++)
    {
@@ -164,6 +167,7 @@
    pMac->cfg.gCfgSBuf     = NULL;
    pMac->cfg.gSBuffer     = NULL;
    pMac->cfg.gCfgEntry    = NULL;
+   pMac->cfg.gParamList   = NULL;
 }
 
 // ---------------------------------------------------------------------
@@ -225,23 +229,13 @@
     // Check if parameter is valid
     if ((control & CFG_CTL_VALID) == 0)
     {
-        PELOGE(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
+        PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d"), cfgId);)
         retVal = eSIR_CFG_INVALID_ID;
     }
-    else if ((pMac->cfg.gCfgIBufMin[index] < pMac->cfg.gCfgIBufMax[index]) &&
-             ((pMac->cfg.gCfgIBufMin[index] > value) ||
-             (pMac->cfg.gCfgIBufMax[index] < value)))
+    else if ((pMac->cfg.gCfgIBufMin[index] > value) ||
+             (pMac->cfg.gCfgIBufMax[index] < value))
     {
-        PELOGE(cfgLog(pMac, LOGE, FL("Value %u out of range [%u,%u] cfgid %hu"),
-               value, pMac->cfg.gCfgIBufMin[index],
-               pMac->cfg.gCfgIBufMax[index], cfgId);)
-        retVal = eSIR_CFG_INVALID_ID;
-    }
-    else if (!(pMac->cfg.gCfgIBufMin[index] < pMac->cfg.gCfgIBufMax[index]) &&
-             (((tANI_S32)(pMac->cfg.gCfgIBufMin[index]) > (tANI_S32)value) ||
-              ((tANI_S32)(pMac->cfg.gCfgIBufMax[index]) < (tANI_S32)value)))
-    {
-        PELOGE(cfgLog(pMac, LOGE, FL("Value %d out of range [%d,%d] cfgid %hu"),
+        PELOGE(cfgLog(pMac, LOGE, FL("Value %d out of range [%d,%d] cfg id %d"),
                value, pMac->cfg.gCfgIBufMin[index],
                pMac->cfg.gCfgIBufMax[index], cfgId);)
         retVal = eSIR_CFG_INVALID_ID;
@@ -367,7 +361,7 @@
     // Check if parameter is valid
     if ((control & CFG_CTL_VALID) == 0)
     {
-        PELOGE(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
+        PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d"), cfgId);)
         retVal = eSIR_CFG_INVALID_ID;
     }
     else {
@@ -429,7 +423,7 @@
     // Check if parameter is valid
     if ((control & CFG_CTL_VALID) == 0)
     {
-        PELOGE(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
+        PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d"), cfgId);)
         retVal = eSIR_CFG_INVALID_ID;
     }
     else
@@ -642,7 +636,7 @@
     // Check if parameter is valid
     if ((control & CFG_CTL_VALID) == 0)
     {
-        PELOGE(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
+        PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d"), cfgId);)
         retVal = eSIR_CFG_INVALID_ID;
     }
     else
@@ -723,7 +717,7 @@
     // Check if parameter is valid
     if ((control & CFG_CTL_VALID) == 0)
     {
-        PELOGE(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
+        PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d"), cfgId);)
         retVal = eSIR_CFG_INVALID_ID;
     }
     else
@@ -789,7 +783,7 @@
     // Check if parameter is valid
     if ((control & CFG_CTL_VALID) == 0)
     {
-        PELOGE(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
+        PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d"), cfgId);)
         retVal = eSIR_CFG_INVALID_ID;
     }
     else
@@ -1055,7 +1049,7 @@
         return eSIR_FAILURE;
       }
 #if defined WLAN_VOWIFI_DEBUG
-      PELOGE(cfgLog( pMac, LOG1, "RRM = %d",val );)
+      PELOGE(cfgLog( pMac, LOGE, "RRM = %d",val );)
 #endif
       if (val)
         pCapInfo->rrm = 1;
diff --git a/wlan/prima/CORE/MAC/src/cfg/cfgDebug.c b/wlan/prima/CORE/MAC/src/cfg/cfgDebug.c
index 43982f5..820c2b3 100644
--- a/wlan/prima/CORE/MAC/src/cfg/cfgDebug.c
+++ b/wlan/prima/CORE/MAC/src/cfg/cfgDebug.c
@@ -33,6 +33,9 @@
 
   \author Sunit Bhatia
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/MAC/src/cfg/cfgDef.h b/wlan/prima/CORE/MAC/src/cfg/cfgDef.h
index 0b40d30..eb44e83 100644
--- a/wlan/prima/CORE/MAC/src/cfg/cfgDef.h
+++ b/wlan/prima/CORE/MAC/src/cfg/cfgDef.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -68,6 +68,8 @@
 #define CFG_CTL_NTF_HW        (CFG_CTL_NTF_MAC | CFG_CTL_NTF_PHY)
 
 #define CFG_BUF_INDX_MASK     0x00000fff
+#define CFG_SEM_INDX_MASK     0x0000f000
+#define CFG_SEM_INDX_SHIFT    12
 
 
 #endif /* __CFGDEF_H */
diff --git a/wlan/prima/CORE/MAC/src/cfg/cfgParamName.c b/wlan/prima/CORE/MAC/src/cfg/cfgParamName.c
index 5fda170..af2d1c7 100644
--- a/wlan/prima/CORE/MAC/src/cfg/cfgParamName.c
+++ b/wlan/prima/CORE/MAC/src/cfg/cfgParamName.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -341,12 +341,12 @@
     (unsigned char *)"FLEX_CONNECT_POWER_FACTOR",
     (unsigned char *)"ANTENNA_DIVESITY",
     (unsigned char *)"GO_LINK_MONITOR_TIMEOUT",
-    (unsigned char *)"RMC_ACTION_PERIOD_FREQUENCY",
     (unsigned char *)"ATH_DISABLE",
     (unsigned char *)"BTC_ACTIVE_WLAN_LEN",
     (unsigned char *)"BTC_ACTIVE_BT_LEN",
     (unsigned char *)"BTC_SAP_ACTIVE_WLAN_LEN",
     (unsigned char *)"BTC_SAP_ACTIVE_BT_LEN",
+    (unsigned char *)"RMC_ACTION_PERIOD_FREQUENCY",
     (unsigned char *)"ASD_PROBE_INTERVAL",
     (unsigned char *)"ASD_TRIGGER_THRESHOLD",
     (unsigned char *)"ASD_RTT_RSSI_HYST_THRESHOLD",
@@ -371,7 +371,6 @@
     (unsigned char *)"BTC_DYN_OPP_TX_QUEUE_THOLD",
     (unsigned char *)"TDLS_WMM_MODE_ENABLED",
     (unsigned char *)"BURST_MODE_BE_TXOP_VALUE",
-    (unsigned char *)"EXT_SCAN_CONC_MODE",
 };
 
 
diff --git a/wlan/prima/CORE/MAC/src/cfg/cfgPriv.h b/wlan/prima/CORE/MAC/src/cfg/cfgPriv.h
index acfa786..0d1100c 100644
--- a/wlan/prima/CORE/MAC/src/cfg/cfgPriv.h
+++ b/wlan/prima/CORE/MAC/src/cfg/cfgPriv.h
@@ -50,7 +50,7 @@
 #include <cfgApi.h>
 #include "cfgDef.h"
 
-    #include <wniCfg.h>
+    #include <wniCfgSta.h>
 
 /*--------------------------------------------------------------------*/
 /* CFG miscellaneous definition                                       */
diff --git a/wlan/prima/CORE/MAC/src/cfg/cfgProcMsg.c b/wlan/prima/CORE/MAC/src/cfg/cfgProcMsg.c
index ab7ed15..a5c2eb8 100644
--- a/wlan/prima/CORE/MAC/src/cfg/cfgProcMsg.c
+++ b/wlan/prima/CORE/MAC/src/cfg/cfgProcMsg.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -41,1668 +41,1625 @@
 #include "cfgDebug.h"
 #include "wlan_qct_wda.h"
 
+#define SEM_0 0x00000000
+#define SEM_1 0x00001000
+#define SEM_2 0x00002000
+#define SEM_3 0x00003000
+#define SEM_4 0x00004000
+#define SEM_5 0x00005000
+#define SEM_6 0x00006000
+#define SEM_7 0x00007000
+#define SEM_8 0x00008000
+#define SEM_9 0x00009000
+#define SEM_10 0x0000a000
+#define SEM_11 0x0000b000
+#define SEM_12 0x0000c000
+#define SEM_13 0x0000d000
+#define SEM_14 0x0000e000
+#define SEM_15 0x0000f000
+
 tAniSirCgStatic cfgStatic[CFG_PARAM_MAX_NUM] =
 {
     {WNI_CFG_STA_ID,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RELOAD | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RELOAD | CFG_CTL_NTF_HAL | SEM_1,
      0, 255, 1},
     {WNI_CFG_CF_POLLABLE,
-     CFG_CTL_RE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_RE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_1,
      0, 255, 1},
     {WNI_CFG_CFP_PERIOD,
-     CFG_CTL_VALID  | CFG_CTL_RE | CFG_CTL_INT,
+     CFG_CTL_VALID  | CFG_CTL_RE | CFG_CTL_INT | SEM_1,
      WNI_CFG_CFP_PERIOD_STAMIN,
      WNI_CFG_CFP_PERIOD_STAMAX,
      WNI_CFG_CFP_PERIOD_STADEF},
     {WNI_CFG_CFP_MAX_DURATION,
-     CFG_CTL_VALID  | CFG_CTL_RE | CFG_CTL_INT,
+     CFG_CTL_VALID  | CFG_CTL_RE | CFG_CTL_INT | SEM_1,
      WNI_CFG_CFP_MAX_DURATION_STAMIN,
      WNI_CFG_CFP_MAX_DURATION_STAMAX,
      WNI_CFG_CFP_MAX_DURATION_STADEF},
     {WNI_CFG_SSID,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_1,
      0, 255, 6},
     {WNI_CFG_BEACON_INTERVAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_SCH,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_SCH | SEM_2,
      WNI_CFG_BEACON_INTERVAL_STAMIN,
      WNI_CFG_BEACON_INTERVAL_STAMAX,
      WNI_CFG_BEACON_INTERVAL_STADEF},
     {WNI_CFG_DTIM_PERIOD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_INT | SEM_2,
      WNI_CFG_DTIM_PERIOD_STAMIN,
      WNI_CFG_DTIM_PERIOD_STAMAX,
      WNI_CFG_DTIM_PERIOD_STADEF},
     {WNI_CFG_WEP_KEY_LENGTH,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_5,
      WNI_CFG_WEP_KEY_LENGTH_STAMIN,
      WNI_CFG_WEP_KEY_LENGTH_STAMAX,
      WNI_CFG_WEP_KEY_LENGTH_STADEF},
     {WNI_CFG_WEP_DEFAULT_KEY_1,
-     CFG_CTL_VALID | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_WE | CFG_CTL_RESTART | SEM_4,
      0, 65535, 0},
     {WNI_CFG_WEP_DEFAULT_KEY_2,
-     CFG_CTL_VALID | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_WE | CFG_CTL_RESTART | SEM_4,
      1, 1, 1},
     {WNI_CFG_WEP_DEFAULT_KEY_3,
-     CFG_CTL_VALID | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_WE | CFG_CTL_RESTART | SEM_4,
      0, 5, 5},
     {WNI_CFG_WEP_DEFAULT_KEY_4,
-     CFG_CTL_VALID | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_WE | CFG_CTL_RESTART | SEM_4,
      0, 1, 0},
     {WNI_CFG_WEP_DEFAULT_KEYID,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_5,
      WNI_CFG_WEP_DEFAULT_KEYID_STAMIN,
      WNI_CFG_WEP_DEFAULT_KEYID_STAMAX,
      WNI_CFG_WEP_DEFAULT_KEYID_STADEF},
     {WNI_CFG_EXCLUDE_UNENCRYPTED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_5,
      WNI_CFG_EXCLUDE_UNENCRYPTED_STAMIN,
      WNI_CFG_EXCLUDE_UNENCRYPTED_STAMAX,
      WNI_CFG_EXCLUDE_UNENCRYPTED_STADEF},
     {WNI_CFG_RTS_THRESHOLD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_6,
      WNI_CFG_RTS_THRESHOLD_STAMIN,
      WNI_CFG_RTS_THRESHOLD_STAMAX,
      WNI_CFG_RTS_THRESHOLD_STADEF},
     {WNI_CFG_SHORT_RETRY_LIMIT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_6,
      WNI_CFG_SHORT_RETRY_LIMIT_STAMIN,
      WNI_CFG_SHORT_RETRY_LIMIT_STAMAX,
      WNI_CFG_SHORT_RETRY_LIMIT_STADEF},
     {WNI_CFG_LONG_RETRY_LIMIT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_6,
      WNI_CFG_LONG_RETRY_LIMIT_STAMIN,
      WNI_CFG_LONG_RETRY_LIMIT_STAMAX,
      WNI_CFG_LONG_RETRY_LIMIT_STADEF},
     {WNI_CFG_FRAGMENTATION_THRESHOLD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_6,
      WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN,
      WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX,
      WNI_CFG_FRAGMENTATION_THRESHOLD_STADEF},
     {WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_STAMIN,
      WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_STAMAX,
      WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME_STADEF},
     {WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STAMIN,
      WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STAMAX,
      WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STADEF},
     {WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_STAMIN,
      WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_STAMAX,
      WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME_STADEF},
     {WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STAMIN,
      WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STAMAX,
      WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STADEF},
     {WNI_CFG_JOIN_FAILURE_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_7,
      WNI_CFG_JOIN_FAILURE_TIMEOUT_STAMIN,
      WNI_CFG_JOIN_FAILURE_TIMEOUT_STAMAX,
      WNI_CFG_JOIN_FAILURE_TIMEOUT_STADEF},
     {WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_7,
      WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STAMIN,
      WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STAMAX,
      WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STADEF},
     {WNI_CFG_AUTHENTICATE_RSP_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_7,
      WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_STAMIN,
      WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_STAMAX,
      WNI_CFG_AUTHENTICATE_RSP_TIMEOUT_STADEF},
     {WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_8,
      WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STAMIN,
      WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STAMAX,
      WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STADEF},
     {WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_7,
      WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_STAMIN,
      WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_STAMAX,
      WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT_STADEF},
     {WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS_STAMIN,
      WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS_STAMAX,
      WNI_CFG_RA_PERIODICITY_TIMEOUT_IN_PS_STADEF},
     {WNI_CFG_PS_ENABLE_BCN_FILTER,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_PS_ENABLE_BCN_FILTER_STAMIN,
      WNI_CFG_PS_ENABLE_BCN_FILTER_STAMAX,
      WNI_CFG_PS_ENABLE_BCN_FILTER_STADEF},
     {WNI_CFG_PS_ENABLE_HEART_BEAT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_PS_ENABLE_HEART_BEAT_STAMIN,
      WNI_CFG_PS_ENABLE_HEART_BEAT_STAMAX,
      WNI_CFG_PS_ENABLE_HEART_BEAT_STADEF},
     {WNI_CFG_PS_ENABLE_RSSI_MONITOR,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_PS_ENABLE_RSSI_MONITOR_STAMIN,
      WNI_CFG_PS_ENABLE_RSSI_MONITOR_STAMAX,
      WNI_CFG_PS_ENABLE_RSSI_MONITOR_STADEF},
     {WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STAMIN,
      WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STAMAX,
      WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT_STADEF},
     {WNI_CFG_RF_SETTLING_TIME_CLK,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_RF_SETTLING_TIME_CLK_STAMIN,
      WNI_CFG_RF_SETTLING_TIME_CLK_STAMAX,
      WNI_CFG_RF_SETTLING_TIME_CLK_STADEF},
     {WNI_CFG_SUPPORTED_RATES_11B,
-     CFG_CTL_VALID | CFG_CTL_RE,
+     CFG_CTL_VALID | CFG_CTL_RE |  SEM_2,
      0, 3, 1},
-    {WNI_CFG_SUPPORTED_RATES_11A, CFG_CTL_VALID | CFG_CTL_RE,
+    {WNI_CFG_SUPPORTED_RATES_11A, CFG_CTL_VALID | CFG_CTL_RE |  SEM_7,
      0, 255, 15},
     {WNI_CFG_PHY_MODE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_9,
      WNI_CFG_PHY_MODE_STAMIN,
      WNI_CFG_PHY_MODE_STAMAX,
      WNI_CFG_PHY_MODE_STADEF},
     {WNI_CFG_DOT11_MODE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_9,
      WNI_CFG_DOT11_MODE_STAMIN,
      WNI_CFG_DOT11_MODE_STAMAX,
      WNI_CFG_DOT11_MODE_STADEF},
     {WNI_CFG_OPERATIONAL_RATE_SET,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_2,
      0, 1, 1},
     {WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_7,
      0, 65535, 65534},
     {WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_7,
      0, 0, 0},
     {WNI_CFG_BSSID,
-     CFG_CTL_VALID |  CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID |  CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_7,
      0,0,0},
     {WNI_CFG_LISTEN_INTERVAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_7,
      WNI_CFG_LISTEN_INTERVAL_STAMIN,
      WNI_CFG_LISTEN_INTERVAL_STAMAX,
      WNI_CFG_LISTEN_INTERVAL_STADEF},
     {WNI_CFG_VALID_CHANNEL_LIST,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_8,
      0, 1, 1},
     {WNI_CFG_CURRENT_CHANNEL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_INT | SEM_9,
      WNI_CFG_CURRENT_CHANNEL_STAMIN,
      WNI_CFG_CURRENT_CHANNEL_STAMAX,
      WNI_CFG_CURRENT_CHANNEL_STADEF},
     {WNI_CFG_DEFAULT_RATE_INDEX_5GHZ,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_STAMIN,
      WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_STAMAX,
      WNI_CFG_DEFAULT_RATE_INDEX_5GHZ_STADEF},
     {WNI_CFG_DEFAULT_RATE_INDEX_24GHZ,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_STAMIN,
      WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_STAMAX,
      WNI_CFG_DEFAULT_RATE_INDEX_24GHZ_STADEF},
     {WNI_CFG_RATE_ADAPTATION_TYPE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_SCH,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_SCH | SEM_0,
      WNI_CFG_RATE_ADAPTATION_TYPE_STAMIN,
      WNI_CFG_RATE_ADAPTATION_TYPE_STAMAX,
      WNI_CFG_RATE_ADAPTATION_TYPE_STADEF},
     {WNI_CFG_FIXED_RATE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_0,
      WNI_CFG_FIXED_RATE_STAMIN,
      WNI_CFG_FIXED_RATE_STAMAX,
      WNI_CFG_FIXED_RATE_STADEF},
     {WNI_CFG_FIXED_RATE_MULTICAST_24GHZ,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_8,
      WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_STAMIN,
      WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_STAMAX,
      WNI_CFG_FIXED_RATE_MULTICAST_24GHZ_STADEF},
     {WNI_CFG_FIXED_RATE_MULTICAST_5GHZ,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_8,
      WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_STAMIN,
      WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_STAMAX,
      WNI_CFG_FIXED_RATE_MULTICAST_5GHZ_STADEF},
     {WNI_CFG_RETRYRATE_POLICY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_0,
      WNI_CFG_RETRYRATE_POLICY_STAMIN,
      WNI_CFG_RETRYRATE_POLICY_STAMAX,
      WNI_CFG_RETRYRATE_POLICY_STADEF},
     {WNI_CFG_RETRYRATE_SECONDARY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_0,
      WNI_CFG_RETRYRATE_SECONDARY_STAMIN,
      WNI_CFG_RETRYRATE_SECONDARY_STAMAX,
      WNI_CFG_RETRYRATE_SECONDARY_STADEF},
     {WNI_CFG_RETRYRATE_TERTIARY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_0,
      WNI_CFG_RETRYRATE_TERTIARY_STAMIN,
      WNI_CFG_RETRYRATE_TERTIARY_STAMAX,
      WNI_CFG_RETRYRATE_TERTIARY_STADEF},
     {WNI_CFG_APSD_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_0,
      WNI_CFG_APSD_ENABLED_STAMIN,
      WNI_CFG_APSD_ENABLED_STAMAX,
      WNI_CFG_APSD_ENABLED_STADEF},
     {WNI_CFG_SHARED_KEY_AUTH_ENABLE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_SHARED_KEY_AUTH_ENABLE_STAMIN,
      WNI_CFG_SHARED_KEY_AUTH_ENABLE_STAMAX,
      WNI_CFG_SHARED_KEY_AUTH_ENABLE_STADEF},
     {WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STAMIN,
      WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STAMAX,
      WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STADEF},
     {WNI_CFG_AUTHENTICATION_TYPE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      WNI_CFG_AUTHENTICATION_TYPE_STAMIN,
      WNI_CFG_AUTHENTICATION_TYPE_STAMAX,
      WNI_CFG_AUTHENTICATION_TYPE_STADEF},
     {WNI_CFG_CF_POLL_REQUEST,
-     CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      0, 255, 1},
     {WNI_CFG_PRIVACY_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      WNI_CFG_PRIVACY_ENABLED_STAMIN,
      WNI_CFG_PRIVACY_ENABLED_STAMAX,
      WNI_CFG_PRIVACY_ENABLED_STADEF},
     {WNI_CFG_SHORT_PREAMBLE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      WNI_CFG_SHORT_PREAMBLE_STAMIN,
      WNI_CFG_SHORT_PREAMBLE_STAMAX,
      WNI_CFG_SHORT_PREAMBLE_STADEF},
     {WNI_CFG_SHORT_SLOT_TIME,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_SHORT_SLOT_TIME_STAMIN,
      WNI_CFG_SHORT_SLOT_TIME_STAMAX,
      WNI_CFG_SHORT_SLOT_TIME_STADEF},
     {WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_9,
      WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_STAMIN,
      WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_STAMAX,
      WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY_STADEF},
     {WNI_CFG_QOS_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      WNI_CFG_QOS_ENABLED_STAMIN,
      WNI_CFG_QOS_ENABLED_STAMAX,
      WNI_CFG_QOS_ENABLED_STADEF},
     {WNI_CFG_HCF_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      WNI_CFG_HCF_ENABLED_STAMIN,
      WNI_CFG_HCF_ENABLED_STAMAX,
      WNI_CFG_HCF_ENABLED_STADEF},
     {WNI_CFG_RSN_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      WNI_CFG_RSN_ENABLED_STAMIN,
      WNI_CFG_RSN_ENABLED_STAMAX,
      WNI_CFG_RSN_ENABLED_STADEF},
     {WNI_CFG_BACKGROUND_SCAN_PERIOD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_8,
      WNI_CFG_BACKGROUND_SCAN_PERIOD_STAMIN,
      WNI_CFG_BACKGROUND_SCAN_PERIOD_STAMAX,
      WNI_CFG_BACKGROUND_SCAN_PERIOD_STADEF},
     {WNI_CFG_MAX_NUM_PRE_AUTH,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      WNI_CFG_MAX_NUM_PRE_AUTH_STAMIN,
      WNI_CFG_MAX_NUM_PRE_AUTH_STAMAX,
      WNI_CFG_MAX_NUM_PRE_AUTH_STADEF},
     {WNI_CFG_PREAUTH_CLNUP_TIMEOUT,
-     CFG_CTL_INT,
+     CFG_CTL_INT | SEM_8,
      0, 255, 1},
     {WNI_CFG_RELEASE_AID_TIMEOUT,
-     CFG_CTL_INT,
+     CFG_CTL_INT | SEM_8,
      0, 255, 1},
     {WNI_CFG_HEART_BEAT_THRESHOLD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_8,
      WNI_CFG_HEART_BEAT_THRESHOLD_STAMIN,
      WNI_CFG_HEART_BEAT_THRESHOLD_STAMAX,
      WNI_CFG_HEART_BEAT_THRESHOLD_STADEF},
     {WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_STAMIN,
      WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_STAMAX,
      WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT_STADEF},
     {WNI_CFG_MANUFACTURER_OUI,
-     CFG_CTL_VALID | CFG_CTL_RE,
+     CFG_CTL_VALID | CFG_CTL_RE | SEM_8,
      0, 0, 0},
     {WNI_CFG_MANUFACTURER_NAME,
-     CFG_CTL_VALID | CFG_CTL_RE,
+     CFG_CTL_VALID | CFG_CTL_RE | SEM_8,
      0, 0, 0},
     {WNI_CFG_MODEL_NUMBER,
-     CFG_CTL_VALID | CFG_CTL_RE,
+     CFG_CTL_VALID | CFG_CTL_RE | SEM_8,
      0, 0, 0},
     {WNI_CFG_MODEL_NAME,
-     CFG_CTL_VALID | CFG_CTL_RE,
+     CFG_CTL_VALID | CFG_CTL_RE | SEM_8,
      0, 0, 0},
     {WNI_CFG_MANUFACTURER_PRODUCT_NAME,
-     CFG_CTL_VALID | CFG_CTL_RE,
+     CFG_CTL_VALID | CFG_CTL_RE | SEM_8,
      0, 0, 0},
     {WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
-     CFG_CTL_VALID | CFG_CTL_RE,
+     CFG_CTL_VALID | CFG_CTL_RE | SEM_8,
      0, 0, 0},
     {WNI_CFG_11D_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_9,
      WNI_CFG_11D_ENABLED_STAMIN,
      WNI_CFG_11D_ENABLED_STAMAX,
      WNI_CFG_11D_ENABLED_STADEF},
     {WNI_CFG_MAX_TX_POWER_2_4,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | SEM_8,
      0, 0, 0},
     {WNI_CFG_MAX_TX_POWER_5,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | SEM_8,
      0, 0, 0},
     {WNI_CFG_NETWORK_DENSITY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_9,
      WNI_CFG_NETWORK_DENSITY_STAMIN,
      WNI_CFG_NETWORK_DENSITY_STAMAX,
      WNI_CFG_NETWORK_DENSITY_STADEF},
     {WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_9,
      WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_STAMIN,
      WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_STAMAX,
      WNI_CFG_ADAPTIVE_THRESHOLD_ALGORITHM_STADEF},
     {WNI_CFG_CURRENT_TX_ANTENNA,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_9,
      WNI_CFG_CURRENT_TX_ANTENNA_STAMIN,
      WNI_CFG_CURRENT_TX_ANTENNA_STAMAX,
      WNI_CFG_CURRENT_TX_ANTENNA_STADEF},
     {WNI_CFG_CURRENT_RX_ANTENNA,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_9,
      WNI_CFG_CURRENT_RX_ANTENNA_STAMIN,
      WNI_CFG_CURRENT_RX_ANTENNA_STAMAX,
      WNI_CFG_CURRENT_RX_ANTENNA_STADEF},
     {WNI_CFG_CURRENT_TX_POWER_LEVEL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_INT | SEM_9,
      WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMIN,
      WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMAX,
      WNI_CFG_CURRENT_TX_POWER_LEVEL_STADEF},
     {WNI_CFG_POWER_STATE_PER_CHAIN,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_9,
      WNI_CFG_POWER_STATE_PER_CHAIN_STAMIN,
      WNI_CFG_POWER_STATE_PER_CHAIN_STAMAX,
      WNI_CFG_POWER_STATE_PER_CHAIN_STADEF},
     {WNI_CFG_NEW_BSS_FOUND_IND,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_NEW_BSS_FOUND_IND_STAMIN,
      WNI_CFG_NEW_BSS_FOUND_IND_STAMAX,
      WNI_CFG_NEW_BSS_FOUND_IND_STADEF},
     {WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_12,
      WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_STAMIN,
      WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_STAMAX,
      WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED_STADEF},
     {WNI_CFG_PROPRIETARY_RATES_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_12,
      WNI_CFG_PROPRIETARY_RATES_ENABLED_STAMIN,
      WNI_CFG_PROPRIETARY_RATES_ENABLED_STAMAX,
      WNI_CFG_PROPRIETARY_RATES_ENABLED_STADEF},
     {WNI_CFG_AP_NODE_NAME,
-     CFG_CTL_RE,
+     CFG_CTL_RE | SEM_8,
      0, 255, 1},
     {WNI_CFG_COUNTRY_CODE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | SEM_8,
      0, 0, 0},
     {WNI_CFG_11H_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_12,
      WNI_CFG_11H_ENABLED_STAMIN,
      WNI_CFG_11H_ENABLED_STAMAX,
      WNI_CFG_11H_ENABLED_STADEF},
     {WNI_CFG_WT_CNF_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_12,
      WNI_CFG_WT_CNF_TIMEOUT_STAMIN,
      WNI_CFG_WT_CNF_TIMEOUT_STAMAX,
      WNI_CFG_WT_CNF_TIMEOUT_STADEF},
     {WNI_CFG_KEEPALIVE_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_12,
      WNI_CFG_KEEPALIVE_TIMEOUT_STAMIN,
      WNI_CFG_KEEPALIVE_TIMEOUT_STAMAX,
      WNI_CFG_KEEPALIVE_TIMEOUT_STADEF},
     {WNI_CFG_PROXIMITY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_12,
      WNI_CFG_PROXIMITY_STAMIN,
      WNI_CFG_PROXIMITY_STAMAX,
      WNI_CFG_PROXIMITY_STADEF},
     {WNI_CFG_LOG_LEVEL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_12,
      WNI_CFG_LOG_LEVEL_STAMIN,
      WNI_CFG_LOG_LEVEL_STAMAX,
      WNI_CFG_LOG_LEVEL_STADEF},
     {WNI_CFG_OLBC_DETECT_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_12,
      WNI_CFG_OLBC_DETECT_TIMEOUT_STAMIN,
      WNI_CFG_OLBC_DETECT_TIMEOUT_STAMAX,
      WNI_CFG_OLBC_DETECT_TIMEOUT_STADEF},
     {WNI_CFG_PROTECTION_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_9,
      WNI_CFG_PROTECTION_ENABLED_STAMIN,
      WNI_CFG_PROTECTION_ENABLED_STAMAX,
      WNI_CFG_PROTECTION_ENABLED_STADEF},
     {WNI_CFG_11G_PROTECTION_ALWAYS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_9,
      WNI_CFG_11G_PROTECTION_ALWAYS_STAMIN,
      WNI_CFG_11G_PROTECTION_ALWAYS_STAMAX,
      WNI_CFG_11G_PROTECTION_ALWAYS_STADEF},
     {WNI_CFG_FORCE_POLICY_PROTECTION,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_HAL | SEM_9,
      WNI_CFG_FORCE_POLICY_PROTECTION_STAMIN,
      WNI_CFG_FORCE_POLICY_PROTECTION_STAMAX,
      WNI_CFG_FORCE_POLICY_PROTECTION_STADEF},
     {WNI_CFG_11G_SHORT_PREAMBLE_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_9,
      WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_STAMIN,
      WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_STAMAX,
      WNI_CFG_11G_SHORT_PREAMBLE_ENABLED_STADEF},
     {WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_9,
      WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_STAMIN,
      WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_STAMAX,
      WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED_STADEF},
     {WNI_CFG_CAL_PERIOD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_12,
      WNI_CFG_CAL_PERIOD_STAMIN,
      WNI_CFG_CAL_PERIOD_STAMAX,
      WNI_CFG_CAL_PERIOD_STADEF},
     {WNI_CFG_STATS_PERIOD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_12,
      WNI_CFG_STATS_PERIOD_STAMIN,
      WNI_CFG_STATS_PERIOD_STAMAX,
      WNI_CFG_STATS_PERIOD_STADEF},
     {WNI_CFG_CAL_CONTROL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_12,
      WNI_CFG_CAL_CONTROL_STAMIN,
      WNI_CFG_CAL_CONTROL_STAMAX,
      WNI_CFG_CAL_CONTROL_STADEF},
     {WNI_CFG_11G_ONLY_POLICY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_12,
      WNI_CFG_11G_ONLY_POLICY_STAMIN,
      WNI_CFG_11G_ONLY_POLICY_STAMAX,
      WNI_CFG_11G_ONLY_POLICY_STADEF},
     {WNI_CFG_PACKET_CLASSIFICATION,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_12,
      WNI_CFG_PACKET_CLASSIFICATION_STAMIN,
      WNI_CFG_PACKET_CLASSIFICATION_STAMAX,
      WNI_CFG_PACKET_CLASSIFICATION_STADEF},
     {WNI_CFG_WME_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      WNI_CFG_WME_ENABLED_STAMIN,
      WNI_CFG_WME_ENABLED_STAMAX,
      WNI_CFG_WME_ENABLED_STADEF},
     {WNI_CFG_ADDTS_RSP_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_ADDTS_RSP_TIMEOUT_STAMIN,
      WNI_CFG_ADDTS_RSP_TIMEOUT_STAMAX,
      WNI_CFG_ADDTS_RSP_TIMEOUT_STADEF},
     {WNI_CFG_MAX_SP_LENGTH,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_MAX_SP_LENGTH_STAMIN,
      WNI_CFG_MAX_SP_LENGTH_STAMAX,
      WNI_CFG_MAX_SP_LENGTH_STADEF},
     {WNI_CFG_KEEP_ALIVE_STA_LIMIT_THRESHOLD,
-     CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      0, 255, 1},
     {WNI_CFG_SEND_SINGLE_SSID_ALWAYS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_12,
      WNI_CFG_SEND_SINGLE_SSID_ALWAYS_STAMIN,
      WNI_CFG_SEND_SINGLE_SSID_ALWAYS_STAMAX,
      WNI_CFG_SEND_SINGLE_SSID_ALWAYS_STADEF},
     {WNI_CFG_WSM_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_WSM_ENABLED_STAMIN,
      WNI_CFG_WSM_ENABLED_STAMAX,
      WNI_CFG_WSM_ENABLED_STADEF},
     {WNI_CFG_PROP_CAPABILITY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_PROP_CAPABILITY_STAMIN,
      WNI_CFG_PROP_CAPABILITY_STAMAX,
      WNI_CFG_PROP_CAPABILITY_STADEF},
     {WNI_CFG_EDCA_PROFILE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_SCH,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_SCH | SEM_8,
      WNI_CFG_EDCA_PROFILE_STAMIN,
      WNI_CFG_EDCA_PROFILE_STAMAX,
      WNI_CFG_EDCA_PROFILE_STADEF},
     {WNI_CFG_EDCA_ANI_ACBK_LOCAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_ANI_ACBE_LOCAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_ANI_ACVI_LOCAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_ANI_ACVO_LOCAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_ANI_ACBK,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_ANI_ACBE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_ANI_ACVI,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_ANI_ACVO,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_WME_ACBK_LOCAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_WME_ACBE_LOCAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_WME_ACVI_LOCAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_WME_ACVO_LOCAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_WME_ACBK,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_WME_ACBE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_WME_ACVI,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_WME_ACVO,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_TIT_DEMO_ACBK_LOCAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_TIT_DEMO_ACBE_LOCAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_TIT_DEMO_ACVI_LOCAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_TIT_DEMO_ACVO_LOCAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_TIT_DEMO_ACBK,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_TIT_DEMO_ACBE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_TIT_DEMO_ACVI,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_EDCA_TIT_DEMO_ACVO,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_RDET_FLAG,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_RDET_FLAG_STAMIN,
      WNI_CFG_RDET_FLAG_STAMAX,
      WNI_CFG_RDET_FLAG_STADEF},
     {WNI_CFG_RADAR_CHANNEL_LIST,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | SEM_8,
      0, 0, 0},
     {WNI_CFG_LOCAL_POWER_CONSTRAINT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_12,
      WNI_CFG_LOCAL_POWER_CONSTRAINT_STAMIN,
      WNI_CFG_LOCAL_POWER_CONSTRAINT_STAMAX,
      WNI_CFG_LOCAL_POWER_CONSTRAINT_STADEF},
     {WNI_CFG_ADMIT_POLICY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      WNI_CFG_ADMIT_POLICY_STAMIN,
      WNI_CFG_ADMIT_POLICY_STAMAX,
      WNI_CFG_ADMIT_POLICY_STADEF},
     {WNI_CFG_ADMIT_BWFACTOR,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      WNI_CFG_ADMIT_BWFACTOR_STAMIN,
      WNI_CFG_ADMIT_BWFACTOR_STAMAX,
      WNI_CFG_ADMIT_BWFACTOR_STADEF},
     {WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STAMIN,
      WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STAMAX,
      WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STADEF},
     {WNI_CFG_CHANNEL_BONDING_MODE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_12,
      WNI_CFG_CHANNEL_BONDING_MODE_STAMIN,
      WNI_CFG_CHANNEL_BONDING_MODE_STAMAX,
      WNI_CFG_CHANNEL_BONDING_MODE_STADEF},
     {WNI_CFG_CB_SECONDARY_CHANNEL_STATE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_12,
      WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMIN,
      WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMAX,
      WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STADEF},
     {WNI_CFG_DYNAMIC_THRESHOLD_ZERO,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_12,
      WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMIN,
      WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMAX,
      WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STADEF},
     {WNI_CFG_DYNAMIC_THRESHOLD_ONE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_12,
      WNI_CFG_DYNAMIC_THRESHOLD_ONE_STAMIN,
      WNI_CFG_DYNAMIC_THRESHOLD_ONE_STAMAX,
      WNI_CFG_DYNAMIC_THRESHOLD_ONE_STADEF},
     {WNI_CFG_DYNAMIC_THRESHOLD_TWO,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_12,
      WNI_CFG_DYNAMIC_THRESHOLD_TWO_STAMIN,
      WNI_CFG_DYNAMIC_THRESHOLD_TWO_STAMAX,
      WNI_CFG_DYNAMIC_THRESHOLD_TWO_STADEF},
     {WNI_CFG_TRIG_STA_BK_SCAN,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_12,
      WNI_CFG_TRIG_STA_BK_SCAN_STAMIN,
      WNI_CFG_TRIG_STA_BK_SCAN_STAMAX,
      WNI_CFG_TRIG_STA_BK_SCAN_STADEF},
     {WNI_CFG_DYNAMIC_PROFILE_SWITCHING,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_8,
      WNI_CFG_DYNAMIC_PROFILE_SWITCHING_STAMIN,
      WNI_CFG_DYNAMIC_PROFILE_SWITCHING_STAMAX,
      WNI_CFG_DYNAMIC_PROFILE_SWITCHING_STADEF},
     {WNI_CFG_SCAN_CONTROL_LIST,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_8,
      0, 0, 0},
     {WNI_CFG_MIMO_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RELOAD,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RELOAD | SEM_9,
      WNI_CFG_MIMO_ENABLED_STAMIN,
      WNI_CFG_MIMO_ENABLED_STAMAX,
      WNI_CFG_MIMO_ENABLED_STADEF},
     {WNI_CFG_BLOCK_ACK_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_8,
      WNI_CFG_BLOCK_ACK_ENABLED_STAMIN,
      WNI_CFG_BLOCK_ACK_ENABLED_STAMAX,
      WNI_CFG_BLOCK_ACK_ENABLED_STADEF},
     {WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_STAMIN,
      WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_STAMAX,
      WNI_CFG_BA_ACTIVITY_CHECK_TIMEOUT_STADEF},
     {WNI_CFG_HT_RX_STBC,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_HT_RX_STBC_STAMIN,
      WNI_CFG_HT_RX_STBC_STAMAX,
      WNI_CFG_HT_RX_STBC_STADEF},
     {WNI_CFG_HT_CAP_INFO,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_10,
      WNI_CFG_HT_CAP_INFO_STAMIN,
      WNI_CFG_HT_CAP_INFO_STAMAX,
      WNI_CFG_HT_CAP_INFO_STADEF},
     {WNI_CFG_HT_AMPDU_PARAMS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_HT_AMPDU_PARAMS_STAMIN,
      WNI_CFG_HT_AMPDU_PARAMS_STAMAX,
      WNI_CFG_HT_AMPDU_PARAMS_STADEF},
     {WNI_CFG_SUPPORTED_MCS_SET,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_SAVE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_SAVE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      0, 0, 0},
     {WNI_CFG_EXT_HT_CAP_INFO,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_SAVE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_SAVE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_10,
      WNI_CFG_EXT_HT_CAP_INFO_STAMIN,
      WNI_CFG_EXT_HT_CAP_INFO_STAMAX,
      WNI_CFG_EXT_HT_CAP_INFO_STADEF},
     {WNI_CFG_TX_BF_CAP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_TX_BF_CAP_STAMIN,
      4294967295u,
      WNI_CFG_TX_BF_CAP_STADEF},
     {WNI_CFG_AS_CAP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_SAVE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_SAVE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_AS_CAP_STAMIN,
      WNI_CFG_AS_CAP_STAMAX,
      WNI_CFG_AS_CAP_STADEF},
     {WNI_CFG_HT_INFO_FIELD1,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_10,
      WNI_CFG_HT_INFO_FIELD1_STAMIN,
      WNI_CFG_HT_INFO_FIELD1_STAMAX,
      WNI_CFG_HT_INFO_FIELD1_STADEF},
     {WNI_CFG_HT_INFO_FIELD2,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_SAVE | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_SAVE | CFG_CTL_NTF_LIM | SEM_10,
      WNI_CFG_HT_INFO_FIELD2_STAMIN,
      WNI_CFG_HT_INFO_FIELD2_STAMAX,
      WNI_CFG_HT_INFO_FIELD2_STADEF},
     {WNI_CFG_HT_INFO_FIELD3,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_SAVE | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_SAVE | CFG_CTL_NTF_LIM | SEM_10,
      WNI_CFG_HT_INFO_FIELD3_STAMIN,
      WNI_CFG_HT_INFO_FIELD3_STAMAX,
      WNI_CFG_HT_INFO_FIELD3_STADEF},
     {WNI_CFG_BASIC_MCS_SET,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_SAVE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_SAVE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      0, 0, 0},
     {WNI_CFG_CURRENT_MCS_SET,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_SAVE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_SAVE | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      0, 0, 0},
     {WNI_CFG_GREENFIELD_CAPABILITY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_GREENFIELD_CAPABILITY_STAMIN,
      WNI_CFG_GREENFIELD_CAPABILITY_STAMAX,
      WNI_CFG_GREENFIELD_CAPABILITY_STADEF},
     {WNI_CFG_VHT_MAX_MPDU_LENGTH,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_MAX_MPDU_LENGTH_STAMIN,
      WNI_CFG_VHT_MAX_MPDU_LENGTH_STAMAX,
      WNI_CFG_VHT_MAX_MPDU_LENGTH_STADEF},
     {WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_STAMIN,
      WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_STAMAX,
      WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_STADEF},
     {WNI_CFG_VHT_LDPC_CODING_CAP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_LDPC_CODING_CAP_STAMIN,
      WNI_CFG_VHT_LDPC_CODING_CAP_STAMAX,
      WNI_CFG_VHT_LDPC_CODING_CAP_STADEF},
     {WNI_CFG_VHT_SHORT_GI_80MHZ,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_SHORT_GI_80MHZ_STAMIN,
      WNI_CFG_VHT_SHORT_GI_80MHZ_STAMAX,
      WNI_CFG_VHT_SHORT_GI_80MHZ_STADEF},
     {WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_STAMIN,
      WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_STAMAX,
      WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_STADEF},
     {WNI_CFG_VHT_TXSTBC,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_TXSTBC_STAMIN,
      WNI_CFG_VHT_TXSTBC_STAMAX,
      WNI_CFG_VHT_TXSTBC_STADEF},
     {WNI_CFG_VHT_RXSTBC,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_RXSTBC_STAMIN,
      WNI_CFG_VHT_RXSTBC_STAMAX,
      WNI_CFG_VHT_RXSTBC_STADEF},
     {WNI_CFG_VHT_SU_BEAMFORMER_CAP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_SU_BEAMFORMER_CAP_STAMIN,
      WNI_CFG_VHT_SU_BEAMFORMER_CAP_STAMAX,
      WNI_CFG_VHT_SU_BEAMFORMER_CAP_STADEF},
     {WNI_CFG_VHT_SU_BEAMFORMEE_CAP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STAMIN,
      WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STAMAX,
      WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STADEF},
     {WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STAMIN,
      WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STAMAX,
      WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STADEF},
     {WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_STAMIN,
      WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_STAMAX,
      WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_STADEF},
     {WNI_CFG_VHT_MU_BEAMFORMER_CAP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_MU_BEAMFORMER_CAP_STAMIN,
      WNI_CFG_VHT_MU_BEAMFORMER_CAP_STAMAX,
      WNI_CFG_VHT_MU_BEAMFORMER_CAP_STADEF},
     {WNI_CFG_VHT_MU_BEAMFORMEE_CAP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_MU_BEAMFORMEE_CAP_STAMIN,
      WNI_CFG_VHT_MU_BEAMFORMEE_CAP_STAMAX,
      WNI_CFG_VHT_MU_BEAMFORMEE_CAP_STADEF},
     {WNI_CFG_VHT_TXOP_PS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_TXOP_PS_STAMIN,
      WNI_CFG_VHT_TXOP_PS_STAMAX,
      WNI_CFG_VHT_TXOP_PS_STADEF},
     {WNI_CFG_VHT_HTC_VHTC_CAP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_HTC_VHTC_CAP_STAMIN,
      WNI_CFG_VHT_HTC_VHTC_CAP_STAMAX,
      WNI_CFG_VHT_HTC_VHTC_CAP_STADEF},
     {WNI_CFG_VHT_AMPDU_LEN_EXPONENT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_AMPDU_LEN_EXPONENT_STAMIN,
      WNI_CFG_VHT_AMPDU_LEN_EXPONENT_STAMAX,
      WNI_CFG_VHT_AMPDU_LEN_EXPONENT_STADEF},
     {WNI_CFG_VHT_LINK_ADAPTATION_CAP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_LINK_ADAPTATION_CAP_STAMIN,
      WNI_CFG_VHT_LINK_ADAPTATION_CAP_STAMAX,
      WNI_CFG_VHT_LINK_ADAPTATION_CAP_STADEF},
     {WNI_CFG_VHT_RX_ANT_PATTERN,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_RX_ANT_PATTERN_STAMIN,
      WNI_CFG_VHT_RX_ANT_PATTERN_STAMAX,
      WNI_CFG_VHT_RX_ANT_PATTERN_STADEF},
     {WNI_CFG_VHT_TX_ANT_PATTERN,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_TX_ANT_PATTERN_STAMIN,
      WNI_CFG_VHT_TX_ANT_PATTERN_STAMAX,
      WNI_CFG_VHT_TX_ANT_PATTERN_STADEF},
     {WNI_CFG_VHT_RX_MCS_MAP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_RX_MCS_MAP_STAMIN,
      WNI_CFG_VHT_RX_MCS_MAP_STAMAX,
      WNI_CFG_VHT_RX_MCS_MAP_STADEF},
     {WNI_CFG_VHT_TX_MCS_MAP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_TX_MCS_MAP_STAMIN,
      WNI_CFG_VHT_TX_MCS_MAP_STAMAX,
      WNI_CFG_VHT_TX_MCS_MAP_STADEF},
     {WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_STAMIN,
      WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_STAMAX,
      WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_STADEF},
     {WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_STAMIN,
      WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_STAMAX,
      WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_STADEF},
     {WNI_CFG_VHT_CHANNEL_WIDTH,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_CHANNEL_WIDTH_STAMIN,
      WNI_CFG_VHT_CHANNEL_WIDTH_STAMAX,
      WNI_CFG_VHT_CHANNEL_WIDTH_STADEF},
     {WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_STAMIN,
      WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_STAMAX,
      WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_STADEF},
     {WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_STAMIN,
      WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_STAMAX,
      WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_STADEF},
     {WNI_CFG_VHT_BASIC_MCS_SET,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_BASIC_MCS_SET_STAMIN,
      WNI_CFG_VHT_BASIC_MCS_SET_STAMAX,
      WNI_CFG_VHT_BASIC_MCS_SET_STADEF},
     {WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_STAMIN,
      WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_STAMAX,
      WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_STADEF},
     {WNI_CFG_VHT_SS_UNDER_UTIL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_SS_UNDER_UTIL_STAMIN,
      WNI_CFG_VHT_SS_UNDER_UTIL_STAMAX,
      WNI_CFG_VHT_SS_UNDER_UTIL_STADEF},
     {WNI_CFG_VHT_40MHZ_UTILIZATION,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_40MHZ_UTILIZATION_STAMIN,
      WNI_CFG_VHT_40MHZ_UTILIZATION_STAMAX,
      WNI_CFG_VHT_40MHZ_UTILIZATION_STADEF},
     {WNI_CFG_VHT_80MHZ_UTILIZATION,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_80MHZ_UTILIZATION_STAMIN,
      WNI_CFG_VHT_80MHZ_UTILIZATION_STAMAX,
      WNI_CFG_VHT_80MHZ_UTILIZATION_STADEF},
     {WNI_CFG_VHT_160MHZ_UTILIZATION,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_3,
      WNI_CFG_VHT_80MHZ_UTILIZATION_STADEF,
      WNI_CFG_VHT_160MHZ_UTILIZATION_STAMAX,
      WNI_CFG_VHT_160MHZ_UTILIZATION_STADEF},
     {WNI_CFG_MAX_AMSDU_LENGTH,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_MAX_AMSDU_LENGTH_STAMIN,
      WNI_CFG_MAX_AMSDU_LENGTH_STAMAX,
      WNI_CFG_MAX_AMSDU_LENGTH_STADEF},
     {WNI_CFG_MPDU_DENSITY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_MPDU_DENSITY_STAMIN,
      WNI_CFG_MPDU_DENSITY_STAMAX,
      WNI_CFG_MPDU_DENSITY_STADEF},
     {WNI_CFG_NUM_BUFF_ADVERT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_NUM_BUFF_ADVERT_STAMIN,
      WNI_CFG_NUM_BUFF_ADVERT_STAMAX,
      WNI_CFG_NUM_BUFF_ADVERT_STADEF},
     {WNI_CFG_MAX_RX_AMPDU_FACTOR,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_MAX_RX_AMPDU_FACTOR_STAMIN,
      WNI_CFG_MAX_RX_AMPDU_FACTOR_STAMAX,
      WNI_CFG_MAX_RX_AMPDU_FACTOR_STAMAX},
     {WNI_CFG_SHORT_GI_20MHZ,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_SHORT_GI_20MHZ_STAMIN,
      WNI_CFG_SHORT_GI_20MHZ_STAMAX,
      WNI_CFG_SHORT_GI_20MHZ_STADEF},
     {WNI_CFG_SHORT_GI_40MHZ,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_SHORT_GI_40MHZ_STAMIN,
      WNI_CFG_SHORT_GI_40MHZ_STAMAX,
      WNI_CFG_SHORT_GI_40MHZ_STADEF},
     {WNI_CFG_RIFS_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_7,
      WNI_CFG_RIFS_ENABLED_STAMIN,
      WNI_CFG_RIFS_ENABLED_STAMAX,
      WNI_CFG_RIFS_ENABLED_STADEF},
     {WNI_CFG_MAX_PS_POLL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_5,
      WNI_CFG_MAX_PS_POLL_STAMIN,
      WNI_CFG_MAX_PS_POLL_STAMAX,
      WNI_CFG_MAX_PS_POLL_STADEF},
     {WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_5,
      WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMIN,
      WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMAX,
      WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STADEF},
     {WNI_CFG_RSSI_FILTER_PERIOD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_5,
      WNI_CFG_RSSI_FILTER_PERIOD_STAMIN,
      WNI_CFG_RSSI_FILTER_PERIOD_STAMAX,
      WNI_CFG_RSSI_FILTER_PERIOD_STADEF},
     {WNI_CFG_MIN_RSSI_THRESHOLD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_5,
      WNI_CFG_MIN_RSSI_THRESHOLD_STAMIN,
      WNI_CFG_MIN_RSSI_THRESHOLD_STAMAX,
      WNI_CFG_MIN_RSSI_THRESHOLD_STADEF},
     {WNI_CFG_NTH_BEACON_FILTER,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_5,
      WNI_CFG_NTH_BEACON_FILTER_STAMIN,
      WNI_CFG_NTH_BEACON_FILTER_STAMAX,
      WNI_CFG_NTH_BEACON_FILTER_STADEF},
     {WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_5,
      WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE_STAMIN,
      WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE_STAMAX,
      WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE_STADEF},
     {WNI_CFG_SCAN_IN_POWERSAVE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_5,
      WNI_CFG_SCAN_IN_POWERSAVE_STAMIN,
      WNI_CFG_SCAN_IN_POWERSAVE_STAMAX,
      WNI_CFG_SCAN_IN_POWERSAVE_STADEF},
     {WNI_CFG_IGNORE_DTIM,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_5,
      WNI_CFG_IGNORE_DTIM_STAMIN,
      WNI_CFG_IGNORE_DTIM_STAMAX,
      WNI_CFG_IGNORE_DTIM_STADEF},
     {WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_5,
      WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE_STAMIN,
      WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE_STAMAX,
      WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE_STADEF},
     {WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_5,
      WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE_STAMIN,
      WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE_STAMAX,
      WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE_STADEF},
     {WNI_CFG_WOWLAN_DEAUTH_ENABLE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_5,
      WNI_CFG_WOWLAN_DEAUTH_ENABLE_STAMIN,
      WNI_CFG_WOWLAN_DEAUTH_ENABLE_STAMAX,
      WNI_CFG_WOWLAN_DEAUTH_ENABLE_STADEF},
     {WNI_CFG_WOWLAN_DISASSOC_ENABLE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_5,
      WNI_CFG_WOWLAN_DISASSOC_ENABLE_STAMIN,
      WNI_CFG_WOWLAN_DISASSOC_ENABLE_STAMAX,
      WNI_CFG_WOWLAN_DISASSOC_ENABLE_STADEF},
     {WNI_CFG_WOWLAN_MAX_MISSED_BEACON,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_5,
      WNI_CFG_WOWLAN_MAX_MISSED_BEACON_STAMIN,
      WNI_CFG_WOWLAN_MAX_MISSED_BEACON_STAMAX,
      WNI_CFG_WOWLAN_MAX_MISSED_BEACON_STADEF},
     {WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_5,
      WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD_STAMIN,
      WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD_STAMAX,
      WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD_STADEF},
     {WNI_CFG_BA_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BA_TIMEOUT_STAMIN,
      WNI_CFG_BA_TIMEOUT_STAMAX,
      WNI_CFG_BA_TIMEOUT_STADEF},
     {WNI_CFG_BA_THRESHOLD_HIGH,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BA_THRESHOLD_HIGH_STAMIN,
      WNI_CFG_BA_THRESHOLD_HIGH_STAMAX,
      WNI_CFG_BA_THRESHOLD_HIGH_STADEF},
     {WNI_CFG_MAX_BA_BUFFERS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_MAX_BA_BUFFERS_STAMIN,
      WNI_CFG_MAX_BA_BUFFERS_STAMAX,
      WNI_CFG_MAX_BA_BUFFERS_STADEF},
     {WNI_CFG_MAX_BA_SESSIONS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_MAX_BA_SESSIONS_STAMIN,
      WNI_CFG_MAX_BA_SESSIONS_STAMAX,
      WNI_CFG_MAX_BA_SESSIONS_STADEF},
     {WNI_CFG_BA_AUTO_SETUP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BA_AUTO_SETUP_STAMIN,
      WNI_CFG_BA_AUTO_SETUP_STAMAX,
      WNI_CFG_BA_AUTO_SETUP_STADEF},
     {WNI_CFG_ADDBA_REQ_DECLINE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_ADDBA_REQ_DECLINE_STAMIN,
      WNI_CFG_ADDBA_REQ_DECLINE_STAMAX,
      WNI_CFG_ADDBA_REQ_DECLINE_STADEF},
     {WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC_STAMIN,
      WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC_STAMAX,
      WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC_STADEF},
     {WNI_CFG_BG_SCAN_CHANNEL_LIST,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_NTF_LIM | SEM_8,
      0, 0, 0},
     {WNI_CFG_MAX_MEDIUM_TIME,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_8,
      WNI_CFG_MAX_MEDIUM_TIME_STAMIN,
      WNI_CFG_MAX_MEDIUM_TIME_STAMAX,
      WNI_CFG_MAX_MEDIUM_TIME_STADEF},
     {WNI_CFG_MAX_MPDUS_IN_AMPDU,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_8,
      WNI_CFG_MAX_MPDUS_IN_AMPDU_STAMIN,
      WNI_CFG_MAX_MPDUS_IN_AMPDU_STAMAX,
      WNI_CFG_MAX_MPDUS_IN_AMPDU_STADEF},
     {WNI_CFG_IBSS_AUTO_BSSID,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_0,
      WNI_CFG_IBSS_AUTO_BSSID_STAMIN,
      WNI_CFG_IBSS_AUTO_BSSID_STAMAX,
      WNI_CFG_IBSS_AUTO_BSSID_STADEF},
     {WNI_CFG_PROBE_REQ_ADDNIE_FLAG,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_0,
      WNI_CFG_PROBE_REQ_ADDNIE_FLAG_STAMIN,
      WNI_CFG_PROBE_REQ_ADDNIE_FLAG_STAMAX,
      WNI_CFG_PROBE_REQ_ADDNIE_FLAG_STADEF},
     {WNI_CFG_PROBE_REQ_ADDNIE_DATA,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | SEM_0,
      0, 0, 0},
     {WNI_CFG_PROBE_RSP_ADDNIE_FLAG,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_0,
      WNI_CFG_PROBE_RSP_ADDNIE_FLAG_STAMIN,
      WNI_CFG_PROBE_RSP_ADDNIE_FLAG_STAMAX,
      WNI_CFG_PROBE_RSP_ADDNIE_FLAG_STADEF},
     {WNI_CFG_PROBE_RSP_ADDNIE_DATA1,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | SEM_0,
      0, 0, 0},
     {WNI_CFG_PROBE_RSP_ADDNIE_DATA2,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | SEM_0,
      0, 0, 0},
     {WNI_CFG_PROBE_RSP_ADDNIE_DATA3,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | SEM_0,
      0, 0, 0},
     {WNI_CFG_ASSOC_RSP_ADDNIE_FLAG,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_0,
      WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_STAMIN,
      WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_STAMAX,
      WNI_CFG_ASSOC_RSP_ADDNIE_FLAG_STADEF},
     {WNI_CFG_ASSOC_RSP_ADDNIE_DATA,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | SEM_0,
      0, 0, 0},
     {WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_0,
      WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_STAMIN,
      WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_STAMAX,
      WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG_STADEF},
     {WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | SEM_0,
      0, 0, 0},
     {WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_0,
      WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_STAMIN,
      WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_STAMAX,
      WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG_STADEF},
     {WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_NTF_LIM | SEM_0,
      0, 0, 0},
     {WNI_CFG_WPS_ENABLE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_ENABLE_STAMIN,
      WNI_CFG_WPS_ENABLE_STAMAX,
      WNI_CFG_WPS_ENABLE_STADEF},
     {WNI_CFG_WPS_STATE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_STATE_STAMIN,
      WNI_CFG_WPS_STATE_STAMAX,
      WNI_CFG_WPS_STATE_STADEF},
     {WNI_CFG_WPS_PROBE_REQ_FLAG,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_PROBE_REQ_FLAG_STAMIN,
      WNI_CFG_WPS_PROBE_REQ_FLAG_STAMAX,
      WNI_CFG_WPS_PROBE_REQ_FLAG_STADEF},
     {WNI_CFG_WPS_VERSION,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_VERSION_STAMIN,
      WNI_CFG_WPS_VERSION_STAMAX,
      WNI_CFG_WPS_VERSION_STADEF},
     {WNI_CFG_WPS_REQUEST_TYPE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_REQUEST_TYPE_STAMIN,
      WNI_CFG_WPS_REQUEST_TYPE_STAMAX,
      WNI_CFG_WPS_REQUEST_TYPE_STADEF},
     {WNI_CFG_WPS_CFG_METHOD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_CFG_METHOD_STAMIN,
      4294967295u,
      WNI_CFG_WPS_CFG_METHOD_STADEF},
     {WNI_CFG_WPS_UUID,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_NTF_LIM | SEM_8,
      0, 0, 0},
     {WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_STAMIN,
      WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_STAMAX,
      WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY_STADEF},
     {WNI_CFG_WPS_PIMARY_DEVICE_OUI,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_PIMARY_DEVICE_OUI_STAMIN,
      4294967295u,
      WNI_CFG_WPS_PIMARY_DEVICE_OUI_STADEF},
     {WNI_CFG_WPS_DEVICE_SUB_CATEGORY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_DEVICE_SUB_CATEGORY_STAMIN,
      WNI_CFG_WPS_DEVICE_SUB_CATEGORY_STAMAX,
      WNI_CFG_WPS_DEVICE_SUB_CATEGORY_STADEF},
     {WNI_CFG_WPS_ASSOCIATION_STATE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_ASSOCIATION_STATE_STAMIN,
      WNI_CFG_WPS_ASSOCIATION_STATE_STAMAX,
      WNI_CFG_WPS_ASSOCIATION_STATE_STADEF},
     {WNI_CFG_WPS_CONFIGURATION_ERROR,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_CONFIGURATION_ERROR_STAMIN,
      WNI_CFG_WPS_CONFIGURATION_ERROR_STAMAX,
      WNI_CFG_WPS_CONFIGURATION_ERROR_STADEF},
     {WNI_CFG_WPS_DEVICE_PASSWORD_ID,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_DEVICE_PASSWORD_ID_STAMIN,
      4294967295u,
      WNI_CFG_WPS_DEVICE_PASSWORD_ID_STADEF},
     {WNI_CFG_WPS_ASSOC_METHOD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_WPS_ASSOC_METHOD_STAMIN,
      WNI_CFG_WPS_ASSOC_METHOD_STAMAX,
      WNI_CFG_WPS_ASSOC_METHOD_STADEF},
     {WNI_CFG_LOW_GAIN_OVERRIDE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_9,
      WNI_CFG_LOW_GAIN_OVERRIDE_STAMIN,
      WNI_CFG_LOW_GAIN_OVERRIDE_STAMAX,
      WNI_CFG_LOW_GAIN_OVERRIDE_STADEF},
     {WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_STAMIN,
      WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_STAMAX,
      WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE_STADEF},
     {WNI_CFG_RPE_POLLING_THRESHOLD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_2,
      WNI_CFG_RPE_POLLING_THRESHOLD_STAMIN,
      WNI_CFG_RPE_POLLING_THRESHOLD_STAMAX,
      WNI_CFG_RPE_POLLING_THRESHOLD_STADEF},
     {WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_2,
      WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_STAMIN,
      WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_STAMAX,
      WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG_STADEF},
     {WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_2,
      WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_STAMIN,
      WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_STAMAX,
      WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG_STADEF},
     {WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_2,
      WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_STAMIN,
      WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_STAMAX,
      WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG_STADEF},
     {WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_2,
      WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_STAMIN,
      WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_STAMAX,
      WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG_STADEF},
     {WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_2,
      WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_STAMIN,
      WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_STAMAX,
      WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS_STADEF},
     {WNI_CFG_SINGLE_TID_RC,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_7,
      WNI_CFG_SINGLE_TID_RC_STAMIN,
      WNI_CFG_SINGLE_TID_RC_STAMAX,
      WNI_CFG_SINGLE_TID_RC_STADEF},
     {WNI_CFG_RRM_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_RRM_ENABLED_STAMIN,
      WNI_CFG_RRM_ENABLED_STAMAX,
      WNI_CFG_RRM_ENABLED_STADEF},
     {WNI_CFG_RRM_OPERATING_CHAN_MAX,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_RRM_OPERATING_CHAN_MAX_STAMIN,
      WNI_CFG_RRM_OPERATING_CHAN_MAX_STAMAX,
      WNI_CFG_RRM_OPERATING_CHAN_MAX_STADEF},
     {WNI_CFG_RRM_NON_OPERATING_CHAN_MAX,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_STAMIN,
      WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_STAMAX,
      WNI_CFG_RRM_NON_OPERATING_CHAN_MAX_STADEF},
     {WNI_CFG_TX_PWR_CTRL_ENABLE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_TX_PWR_CTRL_ENABLE_STAMIN,
      WNI_CFG_TX_PWR_CTRL_ENABLE_STAMAX,
      WNI_CFG_TX_PWR_CTRL_ENABLE_STADEF},
     {WNI_CFG_MCAST_BCAST_FILTER_SETTING,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_MCAST_BCAST_FILTER_SETTING_STAMIN,
      WNI_CFG_MCAST_BCAST_FILTER_SETTING_STAMAX,
      WNI_CFG_MCAST_BCAST_FILTER_SETTING_STADEF},
     {WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_STAMIN,
      WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_STAMAX,
      WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK_STADEF},
     {WNI_CFG_DYNAMIC_PS_POLL_VALUE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_DYNAMIC_PS_POLL_VALUE_STAMIN,
      WNI_CFG_DYNAMIC_PS_POLL_VALUE_STAMAX,
      WNI_CFG_DYNAMIC_PS_POLL_VALUE_STADEF},
     {WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STAMIN,
      WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STAMAX,
      WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT_STADEF},
     {WNI_CFG_TELE_BCN_WAKEUP_EN,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_TELE_BCN_WAKEUP_EN_STAMIN,
      WNI_CFG_TELE_BCN_WAKEUP_EN_STAMAX,
      WNI_CFG_TELE_BCN_WAKEUP_EN_STADEF},
     {WNI_CFG_TELE_BCN_TRANS_LI,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_TELE_BCN_TRANS_LI_STAMIN,
      WNI_CFG_TELE_BCN_TRANS_LI_STAMAX,
      WNI_CFG_TELE_BCN_TRANS_LI_STADEF},
     {WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_STAMIN,
      WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_STAMAX,
      WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS_STADEF},
     {WNI_CFG_TELE_BCN_MAX_LI,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_TELE_BCN_MAX_LI_STAMIN,
      WNI_CFG_TELE_BCN_MAX_LI_STAMAX,
      WNI_CFG_TELE_BCN_MAX_LI_STADEF},
     {WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_STAMIN,
      WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_STAMAX,
      WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS_STADEF},
     {WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_STAMIN,
      WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_STAMAX,
      WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS_STADEF},
     {WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMIN,
      WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX,
      WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STADEF},
     {WNI_CFG_ASSOC_STA_LIMIT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_8,
      WNI_CFG_ASSOC_STA_LIMIT_STAMIN,
      WNI_CFG_ASSOC_STA_LIMIT_STAMAX,
      WNI_CFG_ASSOC_STA_LIMIT_STADEF},
     {WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_7,
      WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMIN,
      WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMAX,
      WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STADEF},
     {WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_7,
      WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMIN,
      WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMAX,
      WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STADEF},
     {WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_7,
      WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMIN,
      WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMAX,
      WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STADEF},
     {WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_8,
      WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STAMIN,
      WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STAMAX,
      WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD_STADEF},
     {WNI_CFG_ENABLE_CLOSE_LOOP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_0,
      WNI_CFG_ENABLE_CLOSE_LOOP_STAMIN,
      WNI_CFG_ENABLE_CLOSE_LOOP_STAMAX,
      WNI_CFG_ENABLE_CLOSE_LOOP_STADEF},
     {WNI_CFG_ENABLE_LTE_COEX,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_0,
      WNI_CFG_ENABLE_LTE_COEX_STAMIN,
      WNI_CFG_ENABLE_LTE_COEX_STAMAX,
      WNI_CFG_ENABLE_LTE_COEX_STADEF},
     {WNI_CFG_AP_KEEP_ALIVE_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_STAMIN,
      WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_STAMAX,
      WNI_CFG_AP_KEEP_ALIVE_TIMEOUT_STADEF},
     {WNI_CFG_GO_KEEP_ALIVE_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STAMIN,
      WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STAMAX,
      WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STADEF},
     {WNI_CFG_ENABLE_MC_ADDR_LIST,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_0,
      WNI_CFG_ENABLE_MC_ADDR_LIST_STAMIN,
      WNI_CFG_ENABLE_MC_ADDR_LIST_STAMAX,
      WNI_CFG_ENABLE_MC_ADDR_LIST_STADEF},
     {WNI_CFG_ENABLE_UC_FILTER,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_0,
      WNI_CFG_ENABLE_UC_FILTER_STAMIN,
      WNI_CFG_ENABLE_UC_FILTER_STAMAX,
      WNI_CFG_ENABLE_UC_FILTER_STADEF},
     {WNI_CFG_ENABLE_LPWR_IMG_TRANSITION,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_0,
      WNI_CFG_ENABLE_LPWR_IMG_TRANSITION_STAMIN,
      WNI_CFG_ENABLE_LPWR_IMG_TRANSITION_STAMAX,
      WNI_CFG_ENABLE_LPWR_IMG_TRANSITION_STADEF},
     {WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_0,
      WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED_STAMIN,
      WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED_STAMAX,
      WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED_STADEF},
     {WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_0,
      WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP_STAMIN,
      WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP_STAMAX,
      WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP_STADEF},
     {WNI_CFG_AP_LINK_MONITOR_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_AP_LINK_MONITOR_TIMEOUT_STAMIN,
      WNI_CFG_AP_LINK_MONITOR_TIMEOUT_STAMAX,
      WNI_CFG_AP_LINK_MONITOR_TIMEOUT_STADEF},
     {WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK_STAMIN,
      WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK_STAMAX,
      WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK_STADEF},
     {WNI_CFG_TDLS_BUF_STA_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_TDLS_BUF_STA_ENABLED_STAMIN,
      WNI_CFG_TDLS_BUF_STA_ENABLED_STAMAX,
      WNI_CFG_TDLS_BUF_STA_ENABLED_STADEF},
     {WNI_CFG_TDLS_PUAPSD_INACT_TIME,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_TDLS_PUAPSD_INACT_TIME_STAMIN,
      WNI_CFG_TDLS_PUAPSD_INACT_TIME_STAMAX,
      WNI_CFG_TDLS_PUAPSD_INACT_TIME_STADEF},
     {WNI_CFG_TDLS_RX_FRAME_THRESHOLD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_TDLS_RX_FRAME_THRESHOLD_STAMIN,
      WNI_CFG_TDLS_RX_FRAME_THRESHOLD_STAMAX,
      WNI_CFG_TDLS_RX_FRAME_THRESHOLD_STADEF},
     {WNI_CFG_ENABLE_ADAPT_RX_DRAIN,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_ENABLE_ADAPT_RX_DRAIN_STAMIN,
      WNI_CFG_ENABLE_ADAPT_RX_DRAIN_STAMAX,
      WNI_CFG_ENABLE_ADAPT_RX_DRAIN_STADEF},
     {WNI_CFG_FLEX_CONNECT_POWER_FACTOR,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_0,
      WNI_CFG_FLEX_CONNECT_POWER_FACTOR_STAMIN,
      WNI_CFG_FLEX_CONNECT_POWER_FACTOR_STAMAX,
      WNI_CFG_FLEX_CONNECT_POWER_FACTOR_STADEF},
     {WNI_CFG_ANTENNA_DIVESITY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_ANTENNA_DIVESITY_STAMIN,
      WNI_CFG_ANTENNA_DIVESITY_STAMAX,
      WNI_CFG_ANTENNA_DIVESITY_STADEF},
     {WNI_CFG_GO_LINK_MONITOR_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_GO_LINK_MONITOR_TIMEOUT_STAMIN,
      WNI_CFG_GO_LINK_MONITOR_TIMEOUT_STAMAX,
      WNI_CFG_GO_LINK_MONITOR_TIMEOUT_STADEF},
-    {WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STAMIN,
-     WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STAMAX,
-     WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STADEF},
-
     {WNI_CFG_ATH_DISABLE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_7,
      WNI_CFG_ATH_DISABLE_STAMIN,
      WNI_CFG_ATH_DISABLE_STAMAX,
      WNI_CFG_ATH_DISABLE_STADEF},
     {WNI_CFG_BTC_ACTIVE_WLAN_LEN,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BTC_ACTIVE_WLAN_LEN_STAMIN,
      WNI_CFG_BTC_ACTIVE_WLAN_LEN_STAMAX,
      WNI_CFG_BTC_ACTIVE_WLAN_LEN_STADEF},
     {WNI_CFG_BTC_ACTIVE_BT_LEN,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BTC_ACTIVE_BT_LEN_STAMIN,
      WNI_CFG_BTC_ACTIVE_BT_LEN_STAMAX,
      WNI_CFG_BTC_ACTIVE_BT_LEN_STADEF},
     {WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN_STAMIN,
      WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN_STAMAX,
      WNI_CFG_BTC_SAP_ACTIVE_WLAN_LEN_STADEF},
     {WNI_CFG_BTC_SAP_ACTIVE_BT_LEN,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BTC_SAP_ACTIVE_BT_LEN_STAMIN,
      WNI_CFG_BTC_SAP_ACTIVE_BT_LEN_STAMAX,
      WNI_CFG_BTC_SAP_ACTIVE_BT_LEN_STADEF},
+    {WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
+     WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STAMIN,
+     4294967295u,
+     WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY_STADEF},
     {WNI_CFG_ASD_PROBE_INTERVAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_ASD_PROBE_INTERVAL_STAMIN,
      WNI_CFG_ASD_PROBE_INTERVAL_STAMAX,
      WNI_CFG_ASD_PROBE_INTERVAL_STADEF},
     {WNI_CFG_ASD_TRIGGER_THRESHOLD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_ASD_TRIGGER_THRESHOLD_STAMIN,
      WNI_CFG_ASD_TRIGGER_THRESHOLD_STAMAX,
      WNI_CFG_ASD_TRIGGER_THRESHOLD_STADEF},
     {WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_STAMIN,
      WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_STAMAX,
      WNI_CFG_ASD_RTT_RSSI_HYST_THRESHOLD_STADEF},
     {WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_7,
      WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL_STAMIN,
      WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL_STAMAX,
      WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL_STADEF},
     {WNI_CFG_BTC_CTS2S_DURING_SCO,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BTC_CTS2S_DURING_SCO_STAMIN,
      WNI_CFG_BTC_CTS2S_DURING_SCO_STAMAX,
      WNI_CFG_BTC_CTS2S_DURING_SCO_STADEF},
     {WNI_CFG_CHANNEL_BONDING_24G,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | CFG_CTL_NTF_LIM | SEM_12,
      WNI_CFG_CHANNEL_BONDING_24G_STAMIN,
      WNI_CFG_CHANNEL_BONDING_24G_STAMAX,
      WNI_CFG_CHANNEL_BONDING_24G_STADEF},
     {WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN,
      WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX,
      WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STADEF},
     {WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN,
      WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX,
      WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STADEF},
     {WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN,
      WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX,
      WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STADEF},
     {WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN,
      WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX,
      WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STADEF},
     {WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN,
      WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX,
      WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STADEF},
     {WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN,
      WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX,
      WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STADEF},
     {WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | SEM_9,
      WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN,
      WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX,
      WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STADEF},
     {WNI_CFG_TDLS_OFF_CHANNEL_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_TDLS_OFF_CHANNEL_ENABLED_STAMIN,
      WNI_CFG_TDLS_OFF_CHANNEL_ENABLED_STAMAX,
      WNI_CFG_TDLS_OFF_CHANNEL_ENABLED_STADEF},
     {WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_1,
      WNI_CFG_PMF_SA_QUERY_MAX_RETRIES_STAMIN,
      WNI_CFG_PMF_SA_QUERY_MAX_RETRIES_STAMAX,
      WNI_CFG_PMF_SA_QUERY_MAX_RETRIES_STADEF},
     {WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_RESTART | SEM_1,
      WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STAMIN,
      WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STAMAX,
      WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STADEF},
     {WNI_CFG_RA_FILTER_ENABLE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_RA_FILTER_ENABLE_STAMIN,
      WNI_CFG_RA_FILTER_ENABLE_STAMAX,
      WNI_CFG_RA_FILTER_ENABLE_STADEF},
     {WNI_CFG_RA_RATE_LIMIT_INTERVAL,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_RA_RATE_LIMIT_INTERVAL_STAMIN,
      WNI_CFG_RA_RATE_LIMIT_INTERVAL_STAMAX,
      WNI_CFG_RA_RATE_LIMIT_INTERVAL_STADEF},
     {WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE_STAMIN,
      WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE_STAMAX,
      WNI_CFG_BTC_FATAL_HID_NSNIFF_BLK_GUIDANCE_STADEF},
     {WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE_STAMIN,
      WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE_STAMAX,
      WNI_CFG_BTC_CRITICAL_HID_NSNIFF_BLK_GUIDANCE_STADEF},
     {WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD_STAMIN,
      WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD_STAMAX,
      WNI_CFG_BTC_DYN_A2DP_TX_QUEUE_THOLD_STADEF},
     {WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD_STAMIN,
      WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD_STAMAX,
      WNI_CFG_BTC_DYN_OPP_TX_QUEUE_THOLD_STADEF},
     {WNI_CFG_TDLS_WMM_MODE_ENABLED,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_LIM | SEM_7,
      WNI_CFG_TDLS_WMM_MODE_ENABLED_STAMIN,
      WNI_CFG_TDLS_WMM_MODE_ENABLED_STAMAX,
      WNI_CFG_TDLS_WMM_MODE_ENABLED_STADEF},
 
 
     {WNI_CFG_MAX_UAPSD_CONSEC_SP,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_MAX_UAPSD_CONSEC_SP_STAMIN,
      WNI_CFG_MAX_UAPSD_CONSEC_SP_STAMAX,
      WNI_CFG_MAX_UAPSD_CONSEC_SP_STADEF},
     {WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_STAMIN,
      WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_STAMAX,
      WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_STADEF},
     {WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_STAMIN,
      WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_STAMAX,
      WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_STADEF},
     {WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW_STAMIN,
      WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW_STAMAX,
      WNI_CFG_MAX_UAPSD_CONSEC_TX_CNT_MEAS_WINDOW_STADEF},
     {WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW_STAMIN,
      WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW_STAMAX,
      WNI_CFG_MAX_UAPSD_CONSEC_RX_CNT_MEAS_WINDOW_STADEF},
     {WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE_STAMIN,
      WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE_STAMAX,
      WNI_CFG_MAX_PSPOLL_IN_WMM_UAPSD_PS_MODE_STADEF},
     {WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS_STAMIN,
      WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS_STAMAX,
      WNI_CFG_MAX_UAPSD_INACTIVITY_INTERVALS_STADEF},
     {WNI_CFG_ENABLE_DYNAMIC_WMMPS,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_ENABLE_DYNAMIC_WMMPS_STAMIN,
      WNI_CFG_ENABLE_DYNAMIC_WMMPS_STAMAX,
      WNI_CFG_ENABLE_DYNAMIC_WMMPS_STADEF},
     {WNI_CFG_BURST_MODE_BE_TXOP_VALUE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BURST_MODE_BE_TXOP_VALUE_STAMIN,
      WNI_CFG_BURST_MODE_BE_TXOP_VALUE_STAMAX,
      WNI_CFG_BURST_MODE_BE_TXOP_VALUE_STADEF},
     {WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE_STAMIN,
      WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE_STAMAX,
      WNI_CFG_ENABLE_DYNAMIC_RA_START_RATE_STADEF},
     {WNI_CFG_BTC_FAST_WLAN_CONN_PREF,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
+     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL | SEM_7,
      WNI_CFG_BTC_FAST_WLAN_CONN_PREF_STAMIN,
      WNI_CFG_BTC_FAST_WLAN_CONN_PREF_STAMAX,
      WNI_CFG_BTC_FAST_WLAN_CONN_PREF_STADEF},
-    {WNI_CFG_ENABLE_RTSCTS_HTVHT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_ENABLE_RTSCTS_HTVHT_MIN,
-     WNI_CFG_ENABLE_RTSCTS_HTVHT_MAX,
-     WNI_CFG_ENABLE_RTSCTS_HTVHT_DEF},
-    {WNI_CFG_TOGGLE_ARP_BDRATES,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_TOGGLE_ARP_BDRATES_MIN,
-     WNI_CFG_TOGGLE_ARP_BDRATES_MAX,
-     WNI_CFG_TOGGLE_ARP_BDRATES_DEF},
-    {WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_MIN,
-     WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_MAX,
-     WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_DEF},
-    {WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_MIN,
-     WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_MAX,
-     WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_DEF},
-    {WNI_CFG_LINK_FAIL_TIMEOUT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_LINK_FAIL_TIMEOUT_MIN,
-     WNI_CFG_LINK_FAIL_TIMEOUT_MAX,
-     WNI_CFG_LINK_FAIL_TIMEOUT_DEF},
-    {WNI_CFG_LINK_FAIL_TX_CNT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_LINK_FAIL_TX_CNT_MIN,
-     WNI_CFG_LINK_FAIL_TX_CNT_MAX,
-     WNI_CFG_LINK_FAIL_TX_CNT_DEF},
-    {WNI_CFG_OPTIMIZE_CA_EVENT,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_OPTIMIZE_CA_EVENT_DISABLE,
-     WNI_CFG_OPTIMIZE_CA_EVENT_ENABLE,
-     WNI_CFG_OPTIMIZE_CA_EVENT_DEFAULT},
-    {WNI_CFG_ACTIVE_PASSIVE_CON,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_ACTIVE_PASSIVE_CON_MIN,
-     WNI_CFG_ACTIVE_PASSIVE_CON_MAX,
-     WNI_CFG_ACTIVE_PASSIVE_CON_DEF},
-    {WNI_CFG_EXT_SCAN_CONC_MODE,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_EXT_SCAN_CONC_MODE_MIN,
-     WNI_CFG_EXT_SCAN_CONC_MODE_MAX,
-     WNI_CFG_EXT_SCAN_CONC_MODE_DEF},
-    {WNI_CFG_ENABLE_MAC_ADDR_SPOOFING,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_ENABLE_MAC_ADDR_SPOOFING_MIN,
-     WNI_CFG_ENABLE_MAC_ADDR_SPOOFING_MAX,
-     WNI_CFG_ENABLE_MAC_ADDR_SPOOFING_DEF},
-    {WNI_CFG_DISABLE_BAR_WAKE_UP_HOST,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_DISABLE_BAR_WAKE_UP_HOST_MIN,
-     WNI_CFG_DISABLE_BAR_WAKE_UP_HOST_MAX,
-     WNI_CFG_DISABLE_BAR_WAKE_UP_HOST_DEF},
-    {WNI_CFG_SAR_BOFFSET_SET_CORRECTION,
-     CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT | CFG_CTL_NTF_HAL,
-     WNI_CFG_SAR_BOFFSET_SET_CORRECTION_MIN,
-     WNI_CFG_SAR_BOFFSET_SET_CORRECTION_MAX,
-     WNI_CFG_SAR_BOFFSET_SET_CORRECTION_DEFAULT},
+
 };
 
 tAniSirCfgStaticString cfgStaticString[CFG_MAX_STATIC_STRING] =
@@ -2067,7 +2024,6 @@
     tpCfgBinHdr pHdr;
     tANI_U32    logLevel;
     tSirMsgQ    mmhMsg;
-    tANI_U32    paramList[WNI_CFG_DNLD_CNF_NUM];
 
     // First Dword must contain the AP or STA magic dword
     PELOGW(cfgLog(pMac, LOGW, FL("CFG size %d bytes MAGIC dword is 0x%x"),
@@ -2250,9 +2206,9 @@
         pMac->cfg.gCfgStatus = CFG_FAILURE;
 
     // Send response message to host
-    paramList[WNI_CFG_DNLD_CNF_RES] = retVal;
+    pMac->cfg.gParamList[WNI_CFG_DNLD_CNF_RES] = retVal;
     cfgSendHostMsg(pMac, WNI_CFG_DNLD_CNF, WNI_CFG_DNLD_CNF_LEN,
-                   WNI_CFG_DNLD_CNF_NUM, paramList, 0, 0);
+                   WNI_CFG_DNLD_CNF_NUM, pMac->cfg.gParamList, 0, 0);
 
     // Notify WDA that the config has downloaded
     mmhMsg.type = SIR_CFG_DOWNLOAD_COMPLETE_IND;
@@ -2294,7 +2250,6 @@
     tANI_U16    cfgId, i;
     tANI_U32    value, valueLen, result;
     tANI_U32    *pValue;
-    tANI_U32    paramList[WNI_CFG_GET_RSP_NUM];
 
     PELOG1(cfgLog(pMac, LOG1, FL("Rcvd cfg get request %d bytes"), length);)
     for (i=0; i<length/4; i++)
@@ -2304,11 +2259,11 @@
     {
         cfgId = (tANI_U16)sirReadU32N((tANI_U8*)pParam);
         PELOGE(cfgLog(pMac, LOGE, FL("CFG not ready, param %d"), cfgId);)
-        paramList[WNI_CFG_GET_RSP_RES]  = WNI_CFG_NOT_READY;
-        paramList[WNI_CFG_GET_RSP_PID]  = cfgId;
-        paramList[WNI_CFG_GET_RSP_PLEN] = 0;
+        pMac->cfg.gParamList[WNI_CFG_GET_RSP_RES]  = WNI_CFG_NOT_READY;
+        pMac->cfg.gParamList[WNI_CFG_GET_RSP_PID]  = cfgId;
+        pMac->cfg.gParamList[WNI_CFG_GET_RSP_PLEN] = 0;
         cfgSendHostMsg(pMac, WNI_CFG_GET_RSP, WNI_CFG_GET_RSP_PARTIAL_LEN,
-                       WNI_CFG_GET_RSP_NUM, paramList, 0, 0);
+                       WNI_CFG_GET_RSP_NUM, pMac->cfg.gParamList, 0, 0);
     }
     else
     {
@@ -2349,15 +2304,15 @@
             }
 
             // Send response message to host
-            paramList[WNI_CFG_GET_RSP_RES]  = result;
-            paramList[WNI_CFG_GET_RSP_PID]  = cfgId;
-            paramList[WNI_CFG_GET_RSP_PLEN] = valueLen;
+            pMac->cfg.gParamList[WNI_CFG_GET_RSP_RES]  = result;
+            pMac->cfg.gParamList[WNI_CFG_GET_RSP_PID]  = cfgId;
+            pMac->cfg.gParamList[WNI_CFG_GET_RSP_PLEN] = valueLen;
 
             // We need to round up buffer length to word-increment
             valueLen = (((valueLen + 3) >> 2) << 2);
             cfgSendHostMsg(pMac, WNI_CFG_GET_RSP,
                            WNI_CFG_GET_RSP_PARTIAL_LEN + valueLen,
-                           WNI_CFG_GET_RSP_NUM, paramList, valueLen, pValue);
+                           WNI_CFG_GET_RSP_NUM, pMac->cfg.gParamList, valueLen, pValue);
 
             // Decrement length
             length -= sizeof(tANI_U32);
@@ -2396,7 +2351,6 @@
 {
     tANI_U16    cfgId, valueLen, valueLenRoundedUp4;
     tANI_U32    value, result;
-    tANI_U32    paramList[WNI_CFG_SET_CNF_NUM];
 
     PELOG1(cfgLog(pMac, LOG1, FL("Rcvd cfg set request %d bytes"), length);)
     //for (i=0; i<length/4; i++)
@@ -2405,13 +2359,13 @@
     if (!pMac->cfg.gCfgStatus)
     {
         cfgId = (tANI_U16)sirReadU32N((tANI_U8*)pParam);
-        cfgLog(pMac, LOGW, FL("CFG not ready, param %d"), cfgId);
-        if (fRsp)
+        PELOG1(cfgLog(pMac, LOGW, FL("CFG not ready, param %d"), cfgId);)
+        pMac->cfg.gParamList[WNI_CFG_SET_CNF_RES] = WNI_CFG_NOT_READY;
+        pMac->cfg.gParamList[WNI_CFG_SET_CNF_PID] = cfgId;
+        if( fRsp )
         {
-           paramList[WNI_CFG_SET_CNF_RES] = WNI_CFG_NOT_READY;
-           paramList[WNI_CFG_SET_CNF_PID] = cfgId;
            cfgSendHostMsg(pMac, WNI_CFG_SET_CNF, WNI_CFG_SET_CNF_LEN,
-                          WNI_CFG_SET_CNF_NUM, paramList, 0, 0);
+                          WNI_CFG_SET_CNF_NUM, pMac->cfg.gParamList, 0, 0);
         }
     }
     else
@@ -2498,13 +2452,13 @@
                 result = WNI_CFG_INVALID_LEN;
             }
 
-            if (fRsp)
+            // Send confirm message to host
+            pMac->cfg.gParamList[WNI_CFG_SET_CNF_RES] = result;
+            pMac->cfg.gParamList[WNI_CFG_SET_CNF_PID] = cfgId;
+            if( fRsp )
             {
-                /* Send confirm message to host */
-                paramList[WNI_CFG_SET_CNF_RES] = result;
-                paramList[WNI_CFG_SET_CNF_PID] = cfgId;
                 cfgSendHostMsg(pMac, WNI_CFG_SET_CNF, WNI_CFG_SET_CNF_LEN,
-                               WNI_CFG_SET_CNF_NUM, paramList, 0, 0);
+                               WNI_CFG_SET_CNF_NUM, pMac->cfg.gParamList, 0, 0);
             }
             else
             {
@@ -2754,6 +2708,9 @@
     retVal = WNI_CFG_SUCCESS;
     PELOG1(cfgLog(pMac, LOG1, "<CFG> Completed successfully");)
 
+
+    pMac->cfg.gParamList[WNI_CFG_DNLD_CNF_RES] = retVal;
+
 } /*** end ProcessDownloadReq() ***/
 
 
diff --git a/wlan/prima/CORE/MAC/src/cfg/cfgUtil/cfg.txt b/wlan/prima/CORE/MAC/src/cfg/cfgUtil/cfg.txt
index c08458f..5968d30 100644
--- a/wlan/prima/CORE/MAC/src/cfg/cfgUtil/cfg.txt
+++ b/wlan/prima/CORE/MAC/src/cfg/cfgUtil/cfg.txt
@@ -1,5 +1,5 @@
  *
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -2449,10 +2449,10 @@
 WNI_CFG_BLOCK_ACK_ENABLED    I    4    8
 V    RW    NP RESTART
 LIM
-0    3    0
+0    3    2
 V    RW    NP RESTART
 LIM
-0    3    0
+0    3    2
 
 #ENUM DELAYED 0
 #ENUM IMMEDIATE 1
@@ -4601,18 +4601,7 @@
 *
 *
 
-* RMC action period frequency (milli seconds)
-*
-WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY    I    4    7
-V    RW    NP
-HAL
-100   1000    300
-V    RW    NP
-HAL
-100   1000    300
-*
-*
-
+* ATH Enable/Disable
 *
 WNI_CFG_ATH_DISABLE	I    4    7
 V    RW    NP
@@ -4669,6 +4658,18 @@
 *
 *
 
+* RMC action period frequency (milli seconds)
+*
+WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY    I    4    7
+V    RW    NP
+HAL
+0   0xFFFFFFFF    300
+V    RW    NP
+HAL
+0   0xFFFFFFFF    300
+*
+*
+
 * Rssi probe interval (milli seconds)
 *
 WNI_CFG_ASD_PROBE_INTERVAL    I    4    7
diff --git a/wlan/prima/CORE/MAC/src/cfg/cfgUtil/dot11f.frms b/wlan/prima/CORE/MAC/src/cfg/cfgUtil/dot11f.frms
index 18c9889..87bbc65 100644
--- a/wlan/prima/CORE/MAC/src/cfg/cfgUtil/dot11f.frms
+++ b/wlan/prima/CORE/MAC/src/cfg/cfgUtil/dot11f.frms
@@ -419,31 +419,6 @@
     ouiSubtype, 1;
 }
 
-FF RMCOUI (3)
-{
-     oui[3];
-}
-
-FF MagicCode (6)
-{
-     magic[6];
-}
-
-FF RMCVersion (1)
-{
-     version, 1;
-}
-
-FF RMCDialogToken (4)
-{
-     token, 4;
-}
-
-FF Ruler (6)
-{
-     mac[6];
-}
-
 FF VhtMembershipStatusArray(8)                    // 8.4.1.51
 {
     membershipStatusArray[8];
@@ -4267,17 +4242,6 @@
     MANDIE  QosMapSet;
 }
 
-FRAME RMC
-{
-    FF     Category;
-    FF     RMCOUI;
-    FF     MagicCode;
-    FF     RMCVersion;
-    FF     Action;
-    FF     RMCDialogToken;
-    FF     Ruler;
-}
-
 FRAME VHTGidManagementActionFrame
 {
     FF     Category;
diff --git a/wlan/prima/CORE/MAC/src/dph/dphHashTable.c b/wlan/prima/CORE/MAC/src/dph/dphHashTable.c
index 161779d..8cfddfa 100644
--- a/wlan/prima/CORE/MAC/src/dph/dphHashTable.c
+++ b/wlan/prima/CORE/MAC/src/dph/dphHashTable.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -134,12 +134,6 @@
     tpDphHashNode ptr = NULL;
     tANI_U16 index = hashFunction(pMac, staAddr, pDphHashTable->size);
 
-    if (!pDphHashTable->pHashTable)
-    {
-        limLog(pMac, LOGE, FL(" pHashTable is NULL "));
-        return ptr;
-    }
-
     for (ptr = pDphHashTable->pHashTable[index]; ptr; ptr = ptr->next)
         {
             if (dphCompareMacAddr(staAddr, ptr->staAddr))
@@ -291,10 +285,6 @@
     pStaDs->apsdMaxSpLen = 0;
     pStaDs->acMode[0] = pStaDs->acMode[1] = pStaDs->acMode[2] = pStaDs->acMode[3] =  0;
 #endif /* WMM_APSD */
-    pStaDs->isDisassocDeauthInProgress = 0;
-#ifdef WLAN_FEATURE_11W
-    pStaDs->last_assoc_received_time = 0;
-#endif
     pStaDs->valid = 1;
     return pStaDs;
 }
@@ -322,9 +312,9 @@
     tpDphHashNode ptr, node;
     tANI_U16 index = hashFunction(pMac, staAddr, pDphHashTable->size);
 
-    limLog(pMac, LOG1, FL("assocId %d index %d STA addr"),
+    PELOG1(limLog(pMac, LOG1, FL("assocId %d index %d STA addr"),
            assocId, index);
-    dphPrintMacAddr(pMac, staAddr, LOG1);
+    dphPrintMacAddr(pMac, staAddr, LOG1);)
 
     if (assocId >= pDphHashTable->size)
     {
@@ -399,9 +389,9 @@
   tANI_U16 index = hashFunction(pMac, staAddr, pDphHashTable->size);
 
 
-  limLog(pMac, LOG1, FL("assocId %d index %d STA addr"),
+  PELOG1(limLog(pMac, LOG1, FL("assocId %d index %d STA addr"),
                   assocId, index);
-  dphPrintMacAddr(pMac, staAddr, LOG1);
+  dphPrintMacAddr(pMac, staAddr, LOG1);)
 
   if (assocId >= pDphHashTable->size)
   {
@@ -439,11 +429,6 @@
       else
          prev->next = ptr->next;
       ptr->added = 0;
-      ptr->isDisassocDeauthInProgress = 0;
-#ifdef WLAN_FEATURE_11W
-      ptr->last_assoc_received_time = 0;
-#endif
-
       ptr->next = 0;
     }
   else
@@ -477,7 +462,7 @@
 void
 dphPrintMacAddr(tpAniSirGlobal pMac, tANI_U8 addr[], tANI_U32 level)
 {
-    limLog(pMac, (tANI_U16) level, FL("MAC ADDR = %02x:%02x:%02x:%02x:%02x:%02x"),
+    limLog(pMac, (tANI_U16) level, FL("MAC ADDR = %d:%d:%d:%d:%d:%d"),
            addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
 }
 
diff --git a/wlan/prima/CORE/MAC/src/include/cfgGlobal.h b/wlan/prima/CORE/MAC/src/include/cfgGlobal.h
index 742c50f..63a9ff0 100644
--- a/wlan/prima/CORE/MAC/src/include/cfgGlobal.h
+++ b/wlan/prima/CORE/MAC/src/include/cfgGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -40,8 +40,8 @@
 
 #include "sirCommon.h"
 #include "sirTypes.h"
-#include "wniCfg.h"
-
+#include "wniCfgSta.h"
+#include "wniCfgAp.h"
 #define CFG_MAX_NUM_STA      SIR_MAX_NUM_STA_IN_IBSS
 
 #define CFG_MAX_STATIC_STRING   70
@@ -89,6 +89,9 @@
 
     // Static buffer for string parameter (must be word-aligned)
     tANI_U8    *gSBuffer;
+
+    // Message parameter list buffer (enough for largest possible response)
+    tANI_U32   *gParamList;
 } tAniSirCfg,  *tpAniSirCfg;
 
 #endif
diff --git a/wlan/prima/CORE/MAC/src/include/dot11f.h b/wlan/prima/CORE/MAC/src/include/dot11f.h
index 32e6981..021e3b0 100644
--- a/wlan/prima/CORE/MAC/src/include/dot11f.h
+++ b/wlan/prima/CORE/MAC/src/include/dot11f.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -19,6 +19,12 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
+/**
+  * Copyright (c) 2012 - 2014 Qualcomm Atheros, Inc.
+  * All Rights Reserved.
+  * Qualcomm Atheros Confidential and Proprietary.
+  */
+
 #ifndef DOT11F_H
 #define DOT11F_H
 /**
@@ -30,7 +36,7 @@
   *
   *
   * This file was automatically generated by 'framesc'
-  * Wed Sep  9 10:17:04 2015 from the following file(s):
+  * Mon Nov 10 19:49:53 2014 from the following file(s):
   *
   * dot11f.frms
   *
@@ -316,16 +322,6 @@
 
 void dot11fPackFfListenInterval(tpAniSirGlobal, tDot11fFfListenInterval*, tANI_U8*);
 
-typedef struct sDot11fFfMagicCode {
-    tANI_U8 magic[6];
-} tDot11fFfMagicCode;
-
-#define DOT11F_FF_MAGICCODE_LEN ( 6 )
-
-void dot11fUnpackFfMagicCode(tpAniSirGlobal, tANI_U8*, tDot11fFfMagicCode*);
-
-void dot11fPackFfMagicCode(tpAniSirGlobal, tDot11fFfMagicCode*, tANI_U8*);
-
 typedef struct sDot11fFfMaxTxPower {
     tANI_U8 maxTxPower;
 } tDot11fFfMaxTxPower;
@@ -398,36 +394,6 @@
 
 void dot11fPackFfRCPI(tpAniSirGlobal, tDot11fFfRCPI*, tANI_U8*);
 
-typedef struct sDot11fFfRMCDialogToken {
-    tANI_U32 token;
-} tDot11fFfRMCDialogToken;
-
-#define DOT11F_FF_RMCDIALOGTOKEN_LEN ( 4 )
-
-void dot11fUnpackFfRMCDialogToken(tpAniSirGlobal, tANI_U8*, tDot11fFfRMCDialogToken*);
-
-void dot11fPackFfRMCDialogToken(tpAniSirGlobal, tDot11fFfRMCDialogToken*, tANI_U8*);
-
-typedef struct sDot11fFfRMCOUI {
-    tANI_U8 oui[3];
-} tDot11fFfRMCOUI;
-
-#define DOT11F_FF_RMCOUI_LEN ( 3 )
-
-void dot11fUnpackFfRMCOUI(tpAniSirGlobal, tANI_U8*, tDot11fFfRMCOUI*);
-
-void dot11fPackFfRMCOUI(tpAniSirGlobal, tDot11fFfRMCOUI*, tANI_U8*);
-
-typedef struct sDot11fFfRMCVersion {
-    tANI_U8 version;
-} tDot11fFfRMCVersion;
-
-#define DOT11F_FF_RMCVERSION_LEN ( 1 )
-
-void dot11fUnpackFfRMCVersion(tpAniSirGlobal, tANI_U8*, tDot11fFfRMCVersion*);
-
-void dot11fPackFfRMCVersion(tpAniSirGlobal, tDot11fFfRMCVersion*, tANI_U8*);
-
 typedef struct sDot11fFfRSNI {
     tANI_U8 rsni;
 } tDot11fFfRSNI;
@@ -448,16 +414,6 @@
 
 void dot11fPackFfReason(tpAniSirGlobal, tDot11fFfReason*, tANI_U8*);
 
-typedef struct sDot11fFfRuler {
-    tANI_U8 mac[6];
-} tDot11fFfRuler;
-
-#define DOT11F_FF_RULER_LEN ( 6 )
-
-void dot11fUnpackFfRuler(tpAniSirGlobal, tANI_U8*, tDot11fFfRuler*);
-
-void dot11fPackFfRuler(tpAniSirGlobal, tDot11fFfRuler*, tANI_U8*);
-
 typedef struct sDot11fFfRxAntennaId {
     tANI_U8 antennaId;
 } tDot11fFfRxAntennaId;
@@ -7348,30 +7304,6 @@
 } /* End extern "C". */
 #endif /* C++ */
 
-typedef struct sDot11fRMC{
-    tDot11fFfCategory       Category;
-    tDot11fFfRMCOUI         RMCOUI;
-    tDot11fFfMagicCode      MagicCode;
-    tDot11fFfRMCVersion     RMCVersion;
-    tDot11fFfAction         Action;
-    tDot11fFfRMCDialogToken RMCDialogToken;
-    tDot11fFfRuler         Ruler;
-} tDot11fRMC;
-
-#define DOT11F_RMC ( 41 )
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* C++ */
-
-tANI_U32 dot11fUnpackRMC(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fRMC *pFrm);
-tANI_U32 dot11fPackRMC(tpAniSirGlobal pCtx, tDot11fRMC *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed);
-tANI_U32 dot11fGetPackedRMCSize(tpAniSirGlobal pCtx, tDot11fRMC *pFrm, tANI_U32 *pnNeeded);
-
-#ifdef __cplusplus
-} /* End extern "C". */
-#endif /* C++ */
-
 typedef struct sDot11fRadioMeasurementReport{
     tDot11fFfCategory          Category;
     tDot11fFfAction            Action;
@@ -7380,7 +7312,7 @@
     tDot11fIEMeasurementReport MeasurementReport[4];
 } tDot11fRadioMeasurementReport;
 
-#define DOT11F_RADIOMEASUREMENTREPORT ( 42 )
+#define DOT11F_RADIOMEASUREMENTREPORT ( 41 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7403,7 +7335,7 @@
     tDot11fIEMeasurementRequest MeasurementRequest[2];
 } tDot11fRadioMeasurementRequest;
 
-#define DOT11F_RADIOMEASUREMENTREQUEST ( 43 )
+#define DOT11F_RADIOMEASUREMENTREQUEST ( 42 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7454,7 +7386,7 @@
     tDot11fIEQosMapSet          QosMapSet;
 } tDot11fReAssocRequest;
 
-#define DOT11F_REASSOCREQUEST ( 44 )
+#define DOT11F_REASSOCREQUEST ( 43 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7504,7 +7436,7 @@
     tDot11fIEQosMapSet          QosMapSet;
 } tDot11fReAssocResponse;
 
-#define DOT11F_REASSOCRESPONSE ( 45 )
+#define DOT11F_REASSOCRESPONSE ( 44 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7524,7 +7456,7 @@
     tDot11fFfSMPowerModeSet SMPowerModeSet;
 } tDot11fSMPowerSave;
 
-#define DOT11F_SMPOWERSAVE ( 46 )
+#define DOT11F_SMPOWERSAVE ( 45 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7544,7 +7476,7 @@
     tDot11fFfTransactionId TransactionId;
 } tDot11fSaQueryReq;
 
-#define DOT11F_SAQUERYREQ ( 47 )
+#define DOT11F_SAQUERYREQ ( 46 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7564,7 +7496,7 @@
     tDot11fFfTransactionId TransactionId;
 } tDot11fSaQueryRsp;
 
-#define DOT11F_SAQUERYRSP ( 48 )
+#define DOT11F_SAQUERYRSP ( 47 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7585,7 +7517,7 @@
     tDot11fIELinkIdentifier LinkIdentifier;
 } tDot11fTDLSDisReq;
 
-#define DOT11F_TDLSDISREQ ( 49 )
+#define DOT11F_TDLSDISREQ ( 48 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7619,7 +7551,7 @@
     tDot11fIEVHTCaps              VHTCaps;
 } tDot11fTDLSDisRsp;
 
-#define DOT11F_TDLSDISRSP ( 50 )
+#define DOT11F_TDLSDISRSP ( 49 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7642,7 +7574,7 @@
     tDot11fIEPUBufferStatus PUBufferStatus;
 } tDot11fTDLSPeerTrafficInd;
 
-#define DOT11F_TDLSPEERTRAFFICIND ( 51 )
+#define DOT11F_TDLSPEERTRAFFICIND ( 50 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7663,7 +7595,7 @@
     tDot11fIELinkIdentifier LinkIdentifier;
 } tDot11fTDLSPeerTrafficRsp;
 
-#define DOT11F_TDLSPEERTRAFFICRSP ( 52 )
+#define DOT11F_TDLSPEERTRAFFICRSP ( 51 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7694,7 +7626,7 @@
     tDot11fIEOperatingMode        OperatingMode;
 } tDot11fTDLSSetupCnf;
 
-#define DOT11F_TDLSSETUPCNF ( 53 )
+#define DOT11F_TDLSSETUPCNF ( 52 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7732,7 +7664,7 @@
     tDot11fIEVHTCaps              VHTCaps;
 } tDot11fTDLSSetupReq;
 
-#define DOT11F_TDLSSETUPREQ ( 54 )
+#define DOT11F_TDLSSETUPREQ ( 53 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7772,7 +7704,7 @@
     tDot11fIEOperatingMode        OperatingMode;
 } tDot11fTDLSSetupRsp;
 
-#define DOT11F_TDLSSETUPRSP ( 55 )
+#define DOT11F_TDLSSETUPRSP ( 54 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7794,7 +7726,7 @@
     tDot11fIELinkIdentifier LinkIdentifier;
 } tDot11fTDLSTeardown;
 
-#define DOT11F_TDLSTEARDOWN ( 56 )
+#define DOT11F_TDLSTEARDOWN ( 55 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7815,7 +7747,7 @@
     tDot11fIETPCReport   TPCReport;
 } tDot11fTPCReport;
 
-#define DOT11F_TPCREPORT ( 57 )
+#define DOT11F_TPCREPORT ( 56 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7836,7 +7768,7 @@
     tDot11fIETPCRequest  TPCRequest;
 } tDot11fTPCRequest;
 
-#define DOT11F_TPCREQUEST ( 58 )
+#define DOT11F_TPCREQUEST ( 57 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7857,7 +7789,7 @@
     tDot11fFfVhtUserPositionArray     VhtUserPositionArray;
 } tDot11fVHTGidManagementActionFrame;
 
-#define DOT11F_VHTGIDMANAGEMENTACTIONFRAME ( 59 )
+#define DOT11F_VHTGIDMANAGEMENTACTIONFRAME ( 58 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7880,7 +7812,7 @@
     tDot11fIEESETrafStrmRateSet ESETrafStrmRateSet;
 } tDot11fWMMAddTSRequest;
 
-#define DOT11F_WMMADDTSREQUEST ( 60 )
+#define DOT11F_WMMADDTSREQUEST ( 59 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7903,7 +7835,7 @@
     tDot11fIEESETrafStrmMet ESETrafStrmMet;
 } tDot11fWMMAddTSResponse;
 
-#define DOT11F_WMMADDTSRESPONSE ( 61 )
+#define DOT11F_WMMADDTSRESPONSE ( 60 )
 
 #ifdef __cplusplus
 extern "C" {
@@ -7925,7 +7857,7 @@
     tDot11fIEWMMTSPEC    WMMTSPEC;
 } tDot11fWMMDelTS;
 
-#define DOT11F_WMMDELTS ( 62 )
+#define DOT11F_WMMDELTS ( 61 )
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/wlan/prima/CORE/MAC/src/include/dphGlobal.h b/wlan/prima/CORE/MAC/src/include/dphGlobal.h
index 5a6b278..2c9c959 100644
--- a/wlan/prima/CORE/MAC/src/include/dphGlobal.h
+++ b/wlan/prima/CORE/MAC/src/include/dphGlobal.h
@@ -619,9 +619,6 @@
     tANI_U16 pmfSaQueryCurrentTransId;
     tANI_U16 pmfSaQueryStartTransId;
     TX_TIMER pmfSaQueryTimer;
-    v_TIME_t last_unprot_deauth_disassoc;
-    tANI_U8 proct_deauh_disassoc_cnt;
-    v_TIME_t last_assoc_received_time;
 #endif
 
     tANI_U8 htLdpcCapable;
@@ -637,7 +634,7 @@
      * end of the structure.
 
      */
-    tANI_U8 isDisassocDeauthInProgress;
+
     struct sDphHashNode  *next;
 
 
diff --git a/wlan/prima/CORE/MAC/src/include/parserApi.h b/wlan/prima/CORE/MAC/src/include/parserApi.h
index 39281f2..08d5005 100644
--- a/wlan/prima/CORE/MAC/src/include/parserApi.h
+++ b/wlan/prima/CORE/MAC/src/include/parserApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -106,10 +106,8 @@
 #ifdef WLAN_FEATURE_VOWIFI_11R
     tANI_U8                   mdie[SIR_MDIE_SIZE];
 #endif
-#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_ROAM_SCAN_OFFLOAD)
 #ifdef FEATURE_WLAN_ESE
     tDot11fIEESETxmitPower    eseTxPwr;
-#endif
     tDot11fIEQBSSLoad         QBSSLoad;
 #endif
     tANI_U8                   ssidPresent;
@@ -143,7 +141,6 @@
     tDot11fIEVHTCaps          VHTCaps;
     tDot11fIEVHTOperation     VHTOperation;
     tDot11fIEVHTExtBssLoad    VHTExtBssLoad;
-    tDot11fIEExtCap           ExtCap;
     tDot11fIEOperatingMode    OperatingMode;
     tANI_U8                   WiderBWChanSwitchAnnPresent;
     tDot11fIEWiderBWChanSwitchAnn WiderBWChanSwitchAnn;
@@ -580,13 +577,6 @@
                      tDot11fIEHTInfo *pDot11f,
                      tpPESession      psessionEntry);
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-tSirRetStatus
-PopulateDot11fOBSSScanParameters(tpAniSirGlobal   pMac,
-                     tDot11fIEOBSSScanParameters *pDot11f,
-                     tpPESession      psessionEntry);
-#endif
-
 void PopulateDot11fIBSSParams(tpAniSirGlobal  pMac,
        tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry);
 
@@ -733,11 +723,6 @@
                         tANI_U8                  nChannelNum,
                         tDot11fIESuppRates *pDot11f,tpPESession);
 
-tSirRetStatus
-PopulateDot11fRatesTdls(tpAniSirGlobal p_mac,
-                           tDot11fIESuppRates *p_supp_rates,
-                           tDot11fIEExtSuppRates *p_ext_supp_rates,
-                           tANI_U8 curr_oper_channel);
 
 tSirRetStatus PopulateDot11fTPCReport(tpAniSirGlobal      pMac,
                                       tDot11fIETPCReport *pDot11f,
@@ -891,12 +876,10 @@
 
 #ifdef WLAN_FEATURE_11AC
 tSirRetStatus
-PopulateDot11fVHTCaps(tpAniSirGlobal  pMac, tDot11fIEVHTCaps *pDot11f,
-          tANI_U8 nChannelNum, tAniBool isProbeRspAssocRspBeacon);
+PopulateDot11fVHTCaps(tpAniSirGlobal  pMac, tDot11fIEVHTCaps *pDot11f, tAniBool isProbeRspAssocRspBeacon );
 
 tSirRetStatus
-PopulateDot11fVHTOperation(tpAniSirGlobal  pMac,
-                     tDot11fIEVHTOperation  *pDot11f, tANI_U8 nChannelNum);
+PopulateDot11fVHTOperation(tpAniSirGlobal  pMac, tDot11fIEVHTOperation  *pDot11f);
 
 tSirRetStatus
 PopulateDot11fVHTExtBssLoad(tpAniSirGlobal  pMac, tDot11fIEVHTExtBssLoad   *pDot11f);
diff --git a/wlan/prima/CORE/MAC/src/include/sirParams.h b/wlan/prima/CORE/MAC/src/include/sirParams.h
index 1f64736..823e80a 100644
--- a/wlan/prima/CORE/MAC/src/include/sirParams.h
+++ b/wlan/prima/CORE/MAC/src/include/sirParams.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -104,7 +104,9 @@
    UPDATE_CHANNEL_LIST    = 35,
    WLAN_MCADDR_FLT        = 36,
    WLAN_CH144             = 37,
+#ifdef WLAN_FEATURE_NAN
    NAN = 38,
+#endif
 #ifdef FEATURE_WLAN_TDLS
    TDLS_SCAN_COEXISTENCE  = 39,
 #endif
@@ -118,32 +120,11 @@
 #endif
 
    DYNAMIC_WMM_PS        = 43,
+
    MAC_SPOOFED_SCAN      = 44,
    BMU_ERROR_GENERIC_RECOVERY = 45,
-   DISA                  = 46,
-   FW_STATS              = 47,
    WPS_PRBRSP_TMPL       = 48,
    BCN_IE_FLT_DELTA      = 49,
-#ifdef FEATURE_WLAN_TDLS
-   TDLS_OFF_CHANNEL      = 51,
-#endif
-   RTT3                  = 52,
-   MGMT_FRAME_LOGGING    = 53,
-   ENHANCED_TXBD_COMPLETION = 54,
-   LOGGING_ENHANCEMENT   = 55,
-
-#ifdef WLAN_FEATURE_EXTSCAN
-   EXT_SCAN_ENHANCED     = 56,
-#endif
-
-   MEMORY_DUMP_SUPPORTED = 57,
-   PER_PKT_STATS_SUPPORTED  = 58,
-   EXT_LL_STAT              = 60,
-   WIFI_CONFIG            = 61,
-   ANTENNA_DIVERSITY_SELECTION  = 62,
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-   PER_BASED_ROAMING = 63,
-#endif
    //MAX_FEATURE_SUPPORTED = 128
 } placeHolderInCapBitmap;
 
@@ -347,7 +328,6 @@
 
 // HAL message types
 #define SIR_HAL_MSG_TYPES_BEGIN            (SIR_HAL_MODULE_ID << 8)
-#define SIR_HAL_EXT_MSG_TYPES_BEGIN        (SIR_HAL_EXT_MODULE_ID << 8)
 #define SIR_HAL_ITC_MSG_TYPES_BEGIN        (SIR_HAL_MSG_TYPES_BEGIN+0x20)
 #define SIR_HAL_RADAR_DETECTED_IND         SIR_HAL_ITC_MSG_TYPES_BEGIN
 #define SIR_HAL_WDT_KAM_RSP                (SIR_HAL_ITC_MSG_TYPES_BEGIN + 1)
@@ -639,51 +619,36 @@
 #define SIR_HAL_DHCP_STOP_IND              (SIR_HAL_ITC_MSG_TYPES_BEGIN + 205)
 #define SIR_HAL_IBSS_PEER_INACTIVITY_IND   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 206)
 
-#define SIR_HAL_LPHB_CONF_IND              (SIR_HAL_ITC_MSG_TYPES_BEGIN + 207)
-#define SIR_HAL_LPHB_WAIT_EXPIRE_IND       (SIR_HAL_ITC_MSG_TYPES_BEGIN + 208)
+#define SIR_HAL_LPHB_CONF_IND              (SIR_HAL_ITC_MSG_TYPES_BEGIN + 206)
+#define SIR_HAL_LPHB_WAIT_EXPIRE_IND       (SIR_HAL_ITC_MSG_TYPES_BEGIN + 207)
 
-#define SIR_HAL_ADD_PERIODIC_TX_PTRN_IND   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 209)
-#define SIR_HAL_DEL_PERIODIC_TX_PTRN_IND   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 210)
-
-#ifdef WLAN_FEATURE_RMC
-#define SIR_HAL_RMC_BECOME_RULER          (SIR_HAL_ITC_MSG_TYPES_BEGIN + 211)
-#define SIR_HAL_RMC_RULER_SELECT_RESP     (SIR_HAL_ITC_MSG_TYPES_BEGIN + 212)
-#define SIR_HAL_RMC_RULER_REQ             (SIR_HAL_ITC_MSG_TYPES_BEGIN + 213)
-#define SIR_HAL_RMC_UPDATE_IND             (SIR_HAL_ITC_MSG_TYPES_BEGIN + 214)
-
-/* For IBSS peer info related messages */
-#define SIR_HAL_IBSS_PEER_INFO_REQ         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 215)
-#define SIR_HAL_IBSS_PEER_INFO_RSP         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 216)
-#endif /* WLAN_FEATURE_RMC */
-
-#define SIR_HAL_RATE_UPDATE_IND            (SIR_HAL_ITC_MSG_TYPES_BEGIN + 217)
+#define SIR_HAL_ADD_PERIODIC_TX_PTRN_IND   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 208)
+#define SIR_HAL_DEL_PERIODIC_TX_PTRN_IND   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 209)
 
 #ifdef FEATURE_WLAN_BATCH_SCAN
-#define SIR_HAL_SET_BATCH_SCAN_REQ         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 218)
-#define SIR_HAL_SET_BATCH_SCAN_RSP         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 219)
-#define SIR_HAL_STOP_BATCH_SCAN_IND        (SIR_HAL_ITC_MSG_TYPES_BEGIN + 220)
-#define SIR_HAL_TRIGGER_BATCH_SCAN_RESULT_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 221)
+#define SIR_HAL_SET_BATCH_SCAN_REQ         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 210)
+#define SIR_HAL_SET_BATCH_SCAN_RSP         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 211)
+#define SIR_HAL_STOP_BATCH_SCAN_IND        (SIR_HAL_ITC_MSG_TYPES_BEGIN + 212)
+#define SIR_HAL_TRIGGER_BATCH_SCAN_RESULT_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 213)
 #endif
 
-#define SIR_HAL_START_SCAN_OFFLOAD_REQ     (SIR_HAL_ITC_MSG_TYPES_BEGIN + 223)
-#define SIR_HAL_START_SCAN_OFFLOAD_RSP     (SIR_HAL_ITC_MSG_TYPES_BEGIN + 224)
-#define SIR_HAL_UPDATE_CHAN_LIST_REQ       (SIR_HAL_ITC_MSG_TYPES_BEGIN + 225)
+#define SIR_HAL_RATE_UPDATE_IND            (SIR_HAL_ITC_MSG_TYPES_BEGIN + 217)
+#define SIR_HAL_START_SCAN_OFFLOAD_REQ     (SIR_HAL_ITC_MSG_TYPES_BEGIN + 218)
+#define SIR_HAL_START_SCAN_OFFLOAD_RSP     (SIR_HAL_ITC_MSG_TYPES_BEGIN + 219)
+#define SIR_HAL_UPDATE_CHAN_LIST_REQ       (SIR_HAL_ITC_MSG_TYPES_BEGIN + 220)
 
-#ifdef WLAN_FEATURE_RMC
-#define SIR_HAL_TX_FAIL_MONITOR_IND         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 226)
-#endif /* WLAN_FEATURE_RMC */
+#define SIR_HAL_SET_MAX_TX_POWER_PER_BAND_REQ \
+        (SIR_HAL_ITC_MSG_TYPES_BEGIN + 221)
+#define SIR_HAL_SET_MAX_TX_POWER_PER_BAND_RSP \
+        (SIR_HAL_ITC_MSG_TYPES_BEGIN + 222)
+
 
 /* OBSS Scan start Indication to FW*/
 #define SIR_HAL_HT40_OBSS_SCAN_IND      (SIR_HAL_ITC_MSG_TYPES_BEGIN +227)
 /* OBSS Scan stop Indication to FW*/
 #define SIR_HAL_HT40_OBSS_STOP_SCAN_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN +228)
 
-#define SIR_HAL_SET_MAX_TX_POWER_PER_BAND_REQ \
-        (SIR_HAL_ITC_MSG_TYPES_BEGIN + 229)
-#define SIR_HAL_SET_MAX_TX_POWER_PER_BAND_RSP \
-        (SIR_HAL_ITC_MSG_TYPES_BEGIN + 230)
-
-#define SIR_HAL_BCN_MISS_RATE_REQ         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 231)
+#define SIR_HAL_BCN_MISS_RATE_REQ         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 229)
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
 #define SIR_HAL_LL_STATS_CLEAR_REQ      (SIR_HAL_ITC_MSG_TYPES_BEGIN + 232)
@@ -703,11 +668,10 @@
 #define SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP    (SIR_HAL_ITC_MSG_TYPES_BEGIN + 243)
 #define SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_REQ  (SIR_HAL_ITC_MSG_TYPES_BEGIN + 244)
 #define SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP  (SIR_HAL_ITC_MSG_TYPES_BEGIN + 245)
-#define SIR_HAL_EXTSCAN_SET_SSID_HOTLIST_REQ   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 246)
-#define SIR_HAL_EXTSCAN_SET_SSID_HOTLIST_RSP   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 247)
-#define SIR_HAL_EXTSCAN_RESET_SSID_HOTLIST_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 248)
-#define SIR_HAL_EXTSCAN_RESET_SSID_HOTLIST_RSP (SIR_HAL_ITC_MSG_TYPES_BEGIN + 249)
-
+#define SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 246)
+#define SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 247)
+#define SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 248)
+#define SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP (SIR_HAL_ITC_MSG_TYPES_BEGIN + 249)
 #define SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 250)
 #define SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP (SIR_HAL_ITC_MSG_TYPES_BEGIN + 251)
 
@@ -715,8 +679,7 @@
 #define SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND     (SIR_HAL_ITC_MSG_TYPES_BEGIN + 253)
 #define SIR_HAL_EXTSCAN_SCAN_RESULT_IND        (SIR_HAL_ITC_MSG_TYPES_BEGIN + 254)
 #define SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND      (SIR_HAL_ITC_MSG_TYPES_BEGIN + 255)
-#define SIR_HAL_EXTSCAN_SSID_HOTLIST_MATCH_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 256)
-
+#define SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND  (SIR_HAL_ITC_MSG_TYPES_BEGIN + 256)
 #define SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 257)
 
 #endif /* WLAN_FEATURE_EXTSCAN */
@@ -728,44 +691,8 @@
 #define SIR_HAL_TDLS_CHAN_SWITCH_REQ_RSP      (SIR_HAL_ITC_MSG_TYPES_BEGIN + 259)
 #endif
 #define SIR_HAL_SPOOF_MAC_ADDR_REQ            (SIR_HAL_ITC_MSG_TYPES_BEGIN + 260)
-#define SIR_HAL_SPOOF_MAC_ADDR_RSP            (SIR_HAL_ITC_MSG_TYPES_BEGIN + 261)
 
-#define SIR_HAL_FW_STATS_GET_REQ              (SIR_HAL_ITC_MSG_TYPES_BEGIN + 262)
-
-#define SIR_HAL_ENCRYPT_MSG_REQ               (SIR_HAL_ITC_MSG_TYPES_BEGIN + 263)
-#define SIR_HAL_ENCRYPT_MSG_RSP               (SIR_HAL_ITC_MSG_TYPES_BEGIN + 264)
-
-#define SIR_HAL_MGMT_LOGGING_INIT_REQ         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 265)
-#define SIR_HAL_GET_FRAME_LOG_REQ             (SIR_HAL_ITC_MSG_TYPES_BEGIN + 266)
-
-#define SIR_HAL_NAN_REQUEST                   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 267)
-
-#define SIR_HAL_SET_RTS_CTS_HTVHT            (SIR_HAL_ITC_MSG_TYPES_BEGIN + 268)
-#define SIR_HAL_MON_START_REQ               (SIR_HAL_ITC_MSG_TYPES_BEGIN + 269)
-#define SIR_HAL_MON_STOP_REQ                (SIR_HAL_ITC_MSG_TYPES_BEGIN + 270)
-#define SIR_HAL_FATAL_EVENT_LOGS_REQ         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 271)
-#define SIR_HAL_SEND_LOG_DONE_IND            (SIR_HAL_ITC_MSG_TYPES_BEGIN + 272)
-#define SIR_HAL_LOST_LINK_PARAMS_IND         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 273)
-#define SIR_HAL_SEND_FREQ_RANGE_CONTROL_IND  (SIR_HAL_ITC_MSG_TYPES_BEGIN + 274)
-#define SIR_HAL_FW_MEM_DUMP_REQ              (SIR_HAL_ITC_MSG_TYPES_BEGIN + 275)
-#define SIR_HAL_RSSI_MON_START_REQ           (SIR_HAL_ITC_MSG_TYPES_BEGIN + 276)
-#define SIR_HAL_RSSI_MON_STOP_REQ            (SIR_HAL_ITC_MSG_TYPES_BEGIN + 277)
-#define SIR_HAL_HIGH_PRIORITY_DATA_INFO_IND  (SIR_HAL_ITC_MSG_TYPES_BEGIN + 278)
-#define SIR_HAL_WIFI_CONFIG_PARAMS           (SIR_HAL_ITC_MSG_TYPES_BEGIN + 279)
-#define SIR_HAL_START_OEM_DATA_REQ_IND_NEW   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 280)
-#define SIR_HAL_START_OEM_DATA_RSP_IND_NEW   (SIR_HAL_ITC_MSG_TYPES_BEGIN + 281)
-#define SIR_HAL_ANTENNA_DIVERSITY_SELECTION_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 282)
-#define SIR_HAL_MODIFY_ROAM_PARAMS_IND     (SIR_HAL_ITC_MSG_TYPES_BEGIN + 283)
-#define SIR_HAL_SET_ALLOWED_ACTION_FRAMES  (SIR_HAL_ITC_MSG_TYPES_BEGIN + 284)
-#define SIR_HAL_PAUSE_TL_IND               (SIR_HAL_ITC_MSG_TYPES_BEGIN + 285)
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-#define SIR_HAL_PER_ROAM_SCAN_OFFLOAD_REQ  (SIR_HAL_ITC_MSG_TYPES_BEGIN + 286)
-#define SIR_HAL_PER_ROAM_SCAN_OFFLOAD_RSP  (SIR_HAL_ITC_MSG_TYPES_BEGIN + 287)
-#define SIR_HAL_PER_ROAM_SCAN_TRIGGER_REQ  (SIR_HAL_ITC_MSG_TYPES_BEGIN + 288)
-#define SIR_HAL_PER_ROAM_SCAN_TRIGGER_RSP  (SIR_HAL_ITC_MSG_TYPES_BEGIN + 289)
-#endif
 #define SIR_HAL_MSG_TYPES_END              (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF)
-
 // CFG message types
 #define SIR_CFG_MSG_TYPES_BEGIN        (SIR_CFG_MODULE_ID << 8)
 #define SIR_CFG_ITC_MSG_TYPES_BEGIN    (SIR_CFG_MSG_TYPES_BEGIN+0xB0)
@@ -859,9 +786,12 @@
 #define SIR_LIM_DEAUTH_ACK_TIMEOUT       (SIR_LIM_TIMEOUT_MSG_START + 0x27)
 #define SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT (SIR_LIM_TIMEOUT_MSG_START + 0x28)
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+#define SIR_LIM_TDLS_DISCOVERY_RSP_WAIT     (SIR_LIM_TIMEOUT_MSG_START + 0x29)
+#define SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT (SIR_LIM_TIMEOUT_MSG_START + 0x2A)
+#define SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT (SIR_LIM_TIMEOUT_MSG_START + 0x2B)
+#endif
 #define SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE (SIR_LIM_TIMEOUT_MSG_START + 0x2C)
-#define SIR_LIM_AUTH_RETRY_TIMEOUT            (SIR_LIM_TIMEOUT_MSG_START + 0x2D)
-
 #define SIR_LIM_MSG_TYPES_END            (SIR_LIM_MSG_TYPES_BEGIN+0xFF)
 
 // SCH message types
diff --git a/wlan/prima/CORE/MAC/src/pe/include/limApi.h b/wlan/prima/CORE/MAC/src/pe/include/limApi.h
index 5b869d3..4063d57 100644
--- a/wlan/prima/CORE/MAC/src/pe/include/limApi.h
+++ b/wlan/prima/CORE/MAC/src/pe/include/limApi.h
@@ -97,7 +97,6 @@
     eMGMT_DROP_SCAN_MODE_FRAME,
     eMGMT_DROP_NON_SCAN_MODE_FRAME,
     eMGMT_DROP_INVALID_SIZE,
-    eMGMT_DROP_SPURIOUS_FRAME,
 }tMgmtFrmDropReason;
 
 
@@ -127,8 +126,6 @@
 extern void limCleanup(tpAniSirGlobal);
 /// Function to post messages to LIM thread
 extern tANI_U32  limPostMsgApi(tpAniSirGlobal, tSirMsgQ *);
-tANI_U32  limPostMsgApiHighPri(tpAniSirGlobal, tSirMsgQ *);
-
 /**
  * Function to process messages posted to LIM thread
  * and dispatch to various sub modules within LIM module.
@@ -193,18 +190,7 @@
 void limHandleBmpsStatusInd(tpAniSirGlobal pMac);
 void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
 tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType);
-boolean limIsDeauthDiassocForDrop(tpAniSirGlobal pMac,
-                                          tANI_U8 *pRxPacketInfo);
-#ifdef WLAN_FEATURE_11W
-bool lim_is_assoc_req_for_drop(tpAniSirGlobal mac, uint8_t *rx_pkt_info);
-#endif
 void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
-
-void limProcessLostLinkParamsInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
-void limUpdateLostLinkParams(tpAniSirGlobal pMac,
-                   tpPESession psessionEntry, tANI_U8 *pRxPacketInfo);
-
-
 /* ----------------------------------------------------------------------- */
 // These used to be in DPH
 extern void limSetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId);
diff --git a/wlan/prima/CORE/MAC/src/pe/include/limGlobal.h b/wlan/prima/CORE/MAC/src/pe/include/limGlobal.h
index 449697b..8be34bb 100644
--- a/wlan/prima/CORE/MAC/src/pe/include/limGlobal.h
+++ b/wlan/prima/CORE/MAC/src/pe/include/limGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -45,7 +45,7 @@
 #include "sirMacPropExts.h"
 #include "sirCommon.h"
 #include "sirDebug.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "csrApi.h"
 #include "sapApi.h"
 #include "dot11f.h"
@@ -357,8 +357,6 @@
     tANI_U8             fFree:1;
     tANI_U8             rsvd:5;
     TX_TIMER            timer;
-    tANI_U16            seqNo;
-    v_TIME_t            timestamp;
 }tLimPreAuthNode, *tpLimPreAuthNode;
 
 // Pre-authentication table definition
@@ -671,6 +669,14 @@
     tANI_BOOLEAN       fRadarIntrConfigured; /* Whether radar interrupt has been configured */
 }tLimSpecMgmtInfo, *tpLimSpecMgmtInfo;
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+typedef struct sLimDisResultList
+{
+    struct sLimDisResultList *next ;
+    tSirTdlsPeerInfo tdlsDisPeerInfo ;
+}tLimDisResultList ;
+#endif
+
 #ifdef FEATURE_WLAN_TDLS
 /*
  * Peer info needed for TDLS setup..
diff --git a/wlan/prima/CORE/MAC/src/pe/include/limSession.h b/wlan/prima/CORE/MAC/src/pe/include/limSession.h
index bd9f228..8238f48 100644
--- a/wlan/prima/CORE/MAC/src/pe/include/limSession.h
+++ b/wlan/prima/CORE/MAC/src/pe/include/limSession.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -91,8 +91,6 @@
     tANI_U8                 operMode;               // AP - 0; STA - 1 ; 
     tSirNwType              nwType;
     tpSirSmeStartBssReq     pLimStartBssReq;        //handle to smestart bss req
-    tANI_BOOLEAN            bOSENAssociation;       //handle to OSEN assoc req
-    tANI_BOOLEAN            bWPSAssociation;        //WPS Registration
     tpSirSmeJoinReq         pLimJoinReq;            // handle to sme join req
     tpSirSmeJoinReq         pLimReAssocReq;         //handle to sme reassoc req
     tpLimMlmJoinReq         pLimMlmJoinReq;         //handle to MLM join Req
@@ -358,9 +356,6 @@
     /*  DSCP to UP mapping for HS 2.0 */
     tSirQosMapSet QosMapSet;
     tANI_U8  isKeyInstalled;
-    tANI_BOOLEAN is11Gonly;
-    tANI_BOOLEAN addBssfailed;
-    tANI_BOOLEAN is_ext_caps_present;
 }tPESession, *tpPESession;
 
 #define LIM_MAX_ACTIVE_SESSIONS 4
diff --git a/wlan/prima/CORE/MAC/src/pe/include/limTrace.h b/wlan/prima/CORE/MAC/src/pe/include/limTrace.h
index 24ffb8c..e669df5 100644
--- a/wlan/prima/CORE/MAC/src/pe/include/limTrace.h
+++ b/wlan/prima/CORE/MAC/src/pe/include/limTrace.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,6 +33,9 @@
 
 *  \author Sunit Bhatia
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -93,7 +96,6 @@
 
 
 void limTraceInit(tpAniSirGlobal pMac);
-void lim_register_debug_callback(void);
 void limTraceReset(tpAniSirGlobal pMac);
 void limTraceUpdateMgmtStat(tpAniSirGlobal pMac, tANI_U8 subtype);
 void limTraceDumpMgmtStat(tpAniSirGlobal pMac, tANI_U8 subtype);
diff --git a/wlan/prima/CORE/MAC/src/pe/include/rrmGlobal.h b/wlan/prima/CORE/MAC/src/pe/include/rrmGlobal.h
index ab2b30d..6edcaeb 100644
--- a/wlan/prima/CORE/MAC/src/pe/include/rrmGlobal.h
+++ b/wlan/prima/CORE/MAC/src/pe/include/rrmGlobal.h
@@ -36,6 +36,9 @@
 
   \brief Definitions for SME APIs
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limAIDmgmt.c b/wlan/prima/CORE/MAC/src/pe/lim/limAIDmgmt.c
index f90598a..bdae1f0 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limAIDmgmt.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limAIDmgmt.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,7 +36,7 @@
  */
  
 #include "palTypes.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "aniGlobal.h"
 #include "cfgApi.h"
 #include "sirParams.h"
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limAdmitControl.c b/wlan/prima/CORE/MAC/src/pe/lim/limAdmitControl.c
index 9f3cb9d..bc1fb1b 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limAdmitControl.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limAdmitControl.c
@@ -1216,7 +1216,7 @@
 
     if(pAddTsRspMsg->status == eHAL_STATUS_SUCCESS)
     {
-        limLog(pMac, LOG1, FL("Received successful ADDTS response from HAL "));
+        PELOG1(limLog(pMac, LOG1, FL("Received successful ADDTS response from HAL "));)
         // Use the smesessionId and smetransactionId from the PE session context
         limSendSmeAddtsRsp(pMac, rspReqd, eSIR_SME_SUCCESS, psessionEntry, pAddTsRspMsg->tspec,
                 psessionEntry->smeSessionId, psessionEntry->transactionId);
@@ -1224,7 +1224,7 @@
     }
     else
     {
-        limLog(pMac, LOG1, FL("Received failure ADDTS response from HAL "));
+        PELOG1(limLog(pMac, LOG1, FL("Received failure ADDTS response from HAL "));)
 
         // Send DELTS action frame to AP        
         // 090803: Get peer MAC addr from session        
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limApi.c b/wlan/prima/CORE/MAC/src/pe/lim/limApi.c
index f49aa01..2e33362 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limApi.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -40,7 +40,7 @@
  *
  */
 #include "palTypes.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "wniApi.h"
 #include "sirCommon.h"
 #include "sirDebug.h"
@@ -351,9 +351,6 @@
     pMac->lim.gScanInPowersave = 0;
     pMac->lim.probeCounter = 0;
     pMac->lim.maxProbe = 0;
-    pMac->lim.txBdToken = 0;
-
-    pMac->lim.EnableTdls2040BSSCoexIE = 1;
 }
 
 static void __limInitAssocVars(tpAniSirGlobal pMac)
@@ -444,7 +441,6 @@
     pMac->lim.gHTDualCTSProtection = 0;
     pMac->lim.gHTSTBCBasicMCS = 0;
     pMac->lim.gAddBA_Declined = 0;               // Flag to Decline the BAR if the particular bit (0-7) is being set   
-    vos_mem_set(&pMac->lim.staBaInfo, sizeof(pMac->lim.staBaInfo), 0);
 }
 
 static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
@@ -668,7 +664,7 @@
 {
    tSirResultCodes retCode = eSIR_SUCCESS;
 
-   limLog(pMac, LOG1, FL(" enter"));
+   PELOG1(limLog(pMac, LOG1, FL(" enter"));)
 
    if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
    {
@@ -763,10 +759,6 @@
     limFTOpen(pMac);
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-    limRmcInit(pMac);
-#endif /* WLAN_FEATURE_RMC */
-
     vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
 
 #if 0
@@ -862,14 +854,10 @@
     limCleanupMlm(pMac);
     limCleanupLmm(pMac);
 
-#ifdef WLAN_FEATURE_RMC
-    limRmcCleanup(pMac);
-#endif /* WLAN_FEATURE_RMC */
-
     // free up preAuth table
     if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
     {
-        vos_mem_vfree(pMac->lim.gLimPreAuthTimerTable.pTable);
+        vos_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable);
         pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
         pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
     }
@@ -1011,29 +999,50 @@
          return eSIR_FAILURE;
     }
 
-    pMac->lim.limTimers.gpLimCnfWaitTimer = vos_mem_vmalloc(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;
     }
 
-    pMac->lim.gpSession = vos_mem_vmalloc(sizeof(tPESession)* pMac->lim.maxBssId);
+#if 0
+    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
+    pMac->lim.gpSession = vos_mem_malloc(sizeof(tPESession)* pMac->lim.maxBssId);
     if (NULL == pMac->lim.gpSession)
     {
         limLog(pMac, LOGE, FL("memory allocate failed!"));
-        vos_mem_vfree(pMac->lim.limTimers.gpLimCnfWaitTimer);
         return eSIR_FAILURE;
     }
  
     vos_mem_set(pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId, 0);
 
+
+ /*
+    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;
+    }
+
+    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;
+    }
+    */
     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!"));)
-        vos_mem_vfree(pMac->lim.limTimers.gpLimCnfWaitTimer);
-        vos_mem_vfree(pMac->lim.gpSession);
         return eSIR_FAILURE;
     }
     vos_mem_set(pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation, 0);
@@ -1044,9 +1053,9 @@
     if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
     {
         PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!"));)
-        vos_mem_vfree(pMac->lim.limTimers.gpLimCnfWaitTimer);
+        vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
         pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
-        vos_mem_vfree(pMac->lim.gpSession);
+        vos_mem_free(pMac->lim.gpSession);
         pMac->lim.gpSession = NULL;
         vos_mem_free(pMac->pmm.gPmmTim.pTim);
         pMac->pmm.gPmmTim.pTim = NULL;
@@ -1054,7 +1063,6 @@
     }
     pMac->lim.deauthMsgCnt = 0;
     pMac->lim.retryPacketCnt = 0;
-    pMac->lim.gLimIbssRetryCnt = 0;
 
     /*
      * peOpen is successful by now, so it is right time to initialize
@@ -1064,7 +1072,6 @@
 #ifdef LIM_TRACE_RECORD
     MTRACE(limTraceInit(pMac));
 #endif
-    lim_register_debug_callback();
     return eSIR_SUCCESS;
 }
 
@@ -1091,11 +1098,21 @@
             peDeleteSession(pMac,&pMac->lim.gpSession[i]);
         }
     }
-    vos_mem_vfree(pMac->lim.limTimers.gpLimCnfWaitTimer);
+    vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
     pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
-    vos_mem_vfree(pMac->lim.gpSession);
+#if 0
+    vos_mem_free(pMac->lim.gpLimAIDpool);
+    pMac->lim.gpLimAIDpool = NULL;
+#endif
+    
+    vos_mem_free(pMac->lim.gpSession);
     pMac->lim.gpSession = NULL;
-
+    /*
+    vos_mem_free(pMac->dph.dphHashTable.pHashTable);
+    pMac->dph.dphHashTable.pHashTable = NULL;
+    vos_mem_free(pMac->dph.dphHashTable.pDphNodeArray);
+    pMac->dph.dphHashTable.pDphNodeArray = NULL;
+    */
     vos_mem_free(pMac->pmm.gPmmTim.pTim);
     pMac->pmm.gPmmTim.pTim = NULL;
     if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
@@ -1227,7 +1244,6 @@
             case SIR_LIM_ASSOC_FAIL_TIMEOUT:
             case SIR_LIM_AUTH_FAIL_TIMEOUT:
             case SIR_LIM_ADDTS_RSP_TIMEOUT:
-            case SIR_LIM_AUTH_RETRY_TIMEOUT:
                 retStatus = TRUE;
                 break;
 
@@ -1275,35 +1291,6 @@
 
 } /*** end limPostMsgApi() ***/
 
-/**
- * limPostMsgApiHighPri()
- *
- * FUNCTION:
- * This function is called from other thread while posting a
- * message to LIM message Queue gSirLimMsgQ.
- *
- * LOGIC:
- * NA
- *
- * ASSUMPTIONS:
- * NA
- *
- * NOTE:
- * NA
- *
- * @param  pMac - Pointer to Global MAC structure
- * @param  pMsg - Pointer to the message structure
- * @return None
- */
-
-tANI_U32
-limPostMsgApiHighPri(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
-{
-    return  vos_mq_post_message_high_pri(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
-
-
-} /*** end limPostMsgApi() ***/
-
 
 /*--------------------------------------------------------------------------
 
@@ -1418,15 +1405,9 @@
        FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d  Sizes:FC%d Mgmt%d"),
        pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
 
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-       if (WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
-           limLog(pMac, LOG1, FL("roamCandidateInd %d"),
-                  WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo));
-
-       if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo))
-           limLog(pMac, LOG1, FL("offloadScanLearn %d"),
-                  WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo));
-#endif
+    MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION, 
+                        LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,  
+                        (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
     }
 
 
@@ -1440,8 +1421,6 @@
     {
         vos_spin_lock_release( &pMac->sys.lock );
         // drop all management packets
-        limLog( pMac, LOGW,
-                FL ( "Management queue 1/4th full, dropping management packets" ));
         vos_pkt_return_packet(pVosPkt);
         return  VOS_STATUS_SUCCESS;
     }
@@ -1454,8 +1433,6 @@
             SIR_MAC_MGMT_PROBE_REQ ||  mHdr->fc.subType == SIR_MAC_MGMT_PROBE_RSP )
         {
             vos_spin_lock_release( &pMac->sys.lock );
-            limLog( pMac, LOGW,
-                    FL ( "Dropping probe req, probe resp or beacon" ));
             vos_pkt_return_packet(pVosPkt);
             return  VOS_STATUS_SUCCESS;
         }
@@ -1469,11 +1446,6 @@
                                                   mHdr->fc.subType ))
     {
         vos_pkt_return_packet(pVosPkt);
-
-        /* Decrement gSysBbtPendingMgmtCount if packet
-         * is dropped before posting to LIM
-         */
-        limDecrementPendingMgmtCount(pMac);
         limLog( pMac, LOGW,
                 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG" ));
         return VOS_STATUS_E_FAILURE;
@@ -1779,7 +1751,7 @@
         ieLen    = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
         tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
         pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
-        limLog(pMac, LOG1, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);
+        PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
         retCode  = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
     }
     return retCode;
@@ -1796,10 +1768,9 @@
                   pBeacon->capabilityInfo.privacy, pBeacon->wpaPresent,
                                                          pBeacon->rsnPresent);
     limLog(pMac, LOG1,
-            FL("pSession:: Privacy :%d EncyptionType: %d WPS %d OSEN %d"),
+            FL("pSession:: Privacy :%d EncyptionType: %d"),
                   SIR_MAC_GET_PRIVACY(pSession->limCurrentBssCaps),
-                       pSession->encryptType, pSession->bWPSAssociation,
-                       pSession->bOSENAssociation);
+                                               pSession->encryptType);
 
     /* This is handled by sending probe req due to IOT issues so return TRUE
      */
@@ -1837,24 +1808,6 @@
                 (pSession->encryptType == eSIR_ED_AES_128_CMAC)))
         return eSIR_TRUE;
 
-    /* For HS2.0, RSN ie is not present
-     * in beacon. Therefore no need to
-     * check for security type in case
-     * OSEN session.
-     * For WPS registration session no need to detect
-     * security mismatch as it wont match and
-     * driver may end up sending probe request without
-     * WPS IE during WPS registartion process.
-     */
-    /*TODO: AP capability mismatch
-     * is not checked here because
-     * no logic for beacon parsing
-     * is avilable for HS2.0.
-     */
-    if (pSession->bOSENAssociation ||
-             pSession->bWPSAssociation)
-        return eSIR_TRUE;
-
     return eSIR_FALSE;
 }
 
@@ -2073,7 +2026,7 @@
     if (nShortSlot != psessionEntry->shortSlotTimeSupported)
     {
         // Short slot time capability of AP has changed. Adopt to it.
-        limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d"),  nShortSlot);
+        PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d"),  nShortSlot);)
         ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
         psessionEntry->shortSlotTimeSupported = nShortSlot;
         pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
@@ -2147,7 +2100,7 @@
         case ePMM_STATE_UAPSD_SLEEP:
         case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
         case ePMM_STATE_WOWLAN:
-            limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME "));
+            PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME "));)
             limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
             break;
 
@@ -2186,12 +2139,6 @@
          return;
     }
 #endif
-    if (pMac->pmm.inMissedBeaconScenario == TRUE) {
-         limLog(pMac, LOGW,
-               FL("beacon miss handling is already going on for BSSIdx:%d"),
-               pSirMissedBeaconInd->bssIdx);
-         return;
-    }
     if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
          (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
          (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
@@ -2221,112 +2168,6 @@
     return;
 }
 
-
-void limUpdateLostLinkParams(tpAniSirGlobal pMac,
-                     tpPESession psessionEntry, tANI_U8 *pRxPacketInfo)
-{
-    tpSirSmeLostLinkParamsInd pSmeLostLinkParams;
-    tSirMsgQ    mmhMsg;
-    if (NULL == pRxPacketInfo)
-    {
-        return;
-    }
-    pSmeLostLinkParams =
-    (tpSirSmeLostLinkParamsInd)vos_mem_malloc(sizeof(tSirSmeLostLinkParamsInd));
-    if (NULL == pSmeLostLinkParams)
-    {
-        limLog(pMac, LOGP,
-            FL("Failed to alloc mem of size %zu for tSirSmeLostLinkParamsInd"),
-            sizeof(*pSmeLostLinkParams));
-        return;
-    }
-    vos_mem_set(pSmeLostLinkParams, sizeof(tSirSmeLostLinkParamsInd), 0);
-    pSmeLostLinkParams->messageType = eWNI_SME_LOST_LINK_PARAMS_IND;
-    pSmeLostLinkParams->length = sizeof(tSirSmeLostLinkParamsInd);
-    pSmeLostLinkParams->sessionId = psessionEntry->smeSessionId;
-    pSmeLostLinkParams->info.bssIdx = psessionEntry->bssIdx;
-
-    /*
-     * Since FW adds 100 to RSSI, here also we are adding 100 so that
-     * HDD has common logic to subtract 100 from RSSI received
-     */
-    pSmeLostLinkParams->info.rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo) + 100;
-    vos_mem_copy(pSmeLostLinkParams->info.selfMacAddr,
-                 psessionEntry->selfMacAddr,
-                 sizeof(tSirMacAddr));
-    pSmeLostLinkParams->info.lastDataRate = 0;
-    pSmeLostLinkParams->info.linkFlCnt = 0;
-    pSmeLostLinkParams->info.linkFlTx = 0;
-    pSmeLostLinkParams->info.rsvd1 = 0;
-    pSmeLostLinkParams->info.rsvd2 = 0;
-
-    mmhMsg.type = eWNI_SME_LOST_LINK_PARAMS_IND;
-    mmhMsg.bodyptr = pSmeLostLinkParams;
-    mmhMsg.bodyval = 0;
-    limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
-}
-
-/** -----------------------------------------------------------------
-  \brief limProcessLostLinkParamsInd() - handles lost link params indication
-
-  This function process the SIR_HAL_LOST_LINK_PARAMS_IND message from HAL,
-
-  \param pMac - global mac structure
-  \return - none
-  \sa
-  ----------------------------------------------------------------- */
-
-void limProcessLostLinkParamsInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
-{
-    tpSirSmeLostLinkParamsInd pSmeLostLinkParamsInd;
-    tpSirSmeLostLinkParamsInd pLostLInkParamsInd = (tpSirSmeLostLinkParamsInd)pMsg->bodyptr;
-    tpPESession psessionEntry ;
-    tSirMsgQ    mmhMsg;
-
-    if (NULL == pLostLInkParamsInd)
-    {
-         limLog(pMac, LOGE,
-               FL("pLostLInkParamsInd is NULL"));
-         return;
-    }
-
-    psessionEntry = peFindSessionByBssIdx(pMac,pLostLInkParamsInd->info.bssIdx);
-    if (psessionEntry == NULL)
-    {
-         limLog(pMac, LOGE,
-               FL("session does not exist for bdssIdx : %d"),
-               pLostLInkParamsInd->info.bssIdx);
-
-         return;
-    }
-    pSmeLostLinkParamsInd = vos_mem_malloc(sizeof(tSirSmeLostLinkParamsInd));
-    if (pSmeLostLinkParamsInd == NULL)
-    {
-        limLog(pMac, LOGP,
-               FL("memory allocate failed for eWNI_SME_LOST_LINK_PARAMD_IND"));
-        return;
-    }
-    pSmeLostLinkParamsInd->messageType = eWNI_SME_LOST_LINK_PARAMS_IND;
-    pSmeLostLinkParamsInd->length = sizeof(tSirSmeLostLinkParamsInd);
-    pSmeLostLinkParamsInd->sessionId = psessionEntry->smeSessionId;
-    pSmeLostLinkParamsInd->info.bssIdx = pLostLInkParamsInd->info.bssIdx;
-    pSmeLostLinkParamsInd->info.rssi = pLostLInkParamsInd->info.rssi;
-    vos_mem_copy(pSmeLostLinkParamsInd->info.selfMacAddr,
-                pLostLInkParamsInd->info.selfMacAddr,
-                sizeof(tSirMacAddr));
-    pSmeLostLinkParamsInd->info.linkFlCnt = pLostLInkParamsInd->info.linkFlCnt;
-    pSmeLostLinkParamsInd->info.linkFlTx = pLostLInkParamsInd->info.linkFlTx;
-    pSmeLostLinkParamsInd->info.lastDataRate = pLostLInkParamsInd->info.lastDataRate;
-    pSmeLostLinkParamsInd->info.rsvd1 = pLostLInkParamsInd->info.rsvd1;
-    pSmeLostLinkParamsInd->info.rsvd2 = pLostLInkParamsInd->info.rsvd2;
-
-    mmhMsg.type = eWNI_SME_LOST_LINK_PARAMS_IND;
-    mmhMsg.bodyptr = pSmeLostLinkParamsInd;
-    mmhMsg.bodyval = 0;
-    limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
-    return;
-}
-
 /** -----------------------------------------------------------------
   \brief limMicFailureInd() - handles mic failure  indication
  
@@ -2361,7 +2202,7 @@
     }
 
     pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
-    pSirSmeMicFailureInd->length = sizeof(*pSirSmeMicFailureInd);
+    pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
     pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
 
     vos_mem_copy(pSirSmeMicFailureInd->bssId,
@@ -2399,158 +2240,12 @@
     mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
     mmhMsg.bodyptr = pSirSmeMicFailureInd;
     mmhMsg.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
     return;
 }
 
-#ifdef WLAN_FEATURE_11W
-/** --------------------------------------------------------------------
- * lim_is_assoc_req_for_drop()- function to decides to drop assoc\reassoc
- *  frames.
- * @mac: pointer to global mac structure
- * @rx_pkt_info: rx packet meta information
- *
- * This function is called before enqueuing the frame to PE queue to
- * drop flooded assoc/reassoc frames getting into PE Queue.
- *
- * Return: true for dropping the frame otherwise false
-----------------------------------------------------------------------*/
 
-bool lim_is_assoc_req_for_drop(tpAniSirGlobal pMac, uint8_t *rx_pkt_info)
-{
-    tANI_U8 session_id;
-    tANI_U16 aid;
-    tpPESession session_entry;
-    tpSirMacMgmtHdr pMacHdr;
-    tpDphHashNode sta_ds;
-
-    pMacHdr = WDA_GET_RX_MAC_HEADER(rx_pkt_info);
-    session_entry = peFindSessionByBssid(pMac, pMacHdr->bssId, &session_id);
-    if (!session_entry)
-    {
-       PELOG1(limLog(pMac, LOG1,
-       FL("session does not exist for given STA [%pM]"),
-       pMacHdr->sa););
-       return false;
-    }
-    sta_ds = dphLookupHashEntry(pMac, pMacHdr->sa, &aid,
-                       &session_entry->dph.dphHashTable);
-    if (!sta_ds)
-    {
-       PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL")););
-       return false;
-    }
-
-    if (!sta_ds->rmfEnabled)
-       return false;
-
-    if (sta_ds->pmfSaQueryState == DPH_SA_QUERY_IN_PROGRESS)
-       return true;
-
-    if (sta_ds->last_assoc_received_time &&
-       ((vos_timer_get_system_time() -
-         sta_ds->last_assoc_received_time) < 1000))
-       return true;
-
-    sta_ds->last_assoc_received_time = vos_timer_get_system_time();
-    return false;
-}
-#endif
-
-/** ----------------------------------------------------------------------
- *\brief limIsDeauthDiassocForDrop()..decides to drop deauth\diassoc frames.
- *This function is called before enqueuing the frame to PE queue.
- *This prevents deauth/diassoc frames getting into PE Queue.
-
------------------------------------------------------------------------- */
-
-
-boolean limIsDeauthDiassocForDrop(tpAniSirGlobal pMac,
-                                          tANI_U8 *pRxPacketInfo)
-{
-    tANI_U8         sessionId;
-    tANI_U16          aid;
-    tpPESession     psessionEntry;
-    tpSirMacMgmtHdr pMacHdr;
-    tpDphHashNode     pStaDs;
-    eHalStatus lock_status = eHAL_STATUS_SUCCESS;
-    boolean ret = FALSE;
-
-    pMacHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
-    psessionEntry = peFindSessionByBssid(pMac,pMacHdr->bssId,&sessionId);
-    if (!psessionEntry)
-    {
-        PELOG1(sysLog(pMac, LOG1,
-               FL("session does not exist for given STA [%pM]"),
-                  pMacHdr->sa););
-        return TRUE;
-    }
-
-    lock_status =  pe_AcquireGlobalLock(&pMac->lim);
-    if (lock_status != eHAL_STATUS_SUCCESS)
-    {
-        limLog(pMac, LOGE, FL("pe_AcquireGlobalLock error"));
-        return TRUE;
-    }
-
-    pStaDs = dphLookupHashEntry(pMac, pMacHdr->sa, &aid,
-                               &psessionEntry->dph.dphHashTable);
-    if (!pStaDs)
-    {
-        PELOG1(sysLog(pMac, LOG1,FL("pStaDs is NULL")););
-        ret = TRUE;
-        goto end;
-    }
-#ifdef WLAN_FEATURE_11W
-    if (psessionEntry->limRmfEnabled)
-    {
-        if ((WDA_GET_RX_DPU_FEEDBACK(pRxPacketInfo) &
-                               DPU_FEEDBACK_UNPROTECTED_ERROR))
-        {
-            /* It may be possible that deauth/diassoc frames from a spoofy
-             * AP is received. So if all further deauth/diassoc frmaes are
-             * dropped, then it may result in lossing deauth/diassoc frames
-             * from genuine AP. So process all deauth/diassoc frames with
-             * a time difference of 1 sec.
-             */
-            if (vos_timer_get_system_time() - pStaDs->last_unprot_deauth_disassoc < 1000)
-            {
-                ret = TRUE;
-                goto end;
-            }
-            pStaDs->last_unprot_deauth_disassoc =
-                              vos_timer_get_system_time();
-        }
-/* PMF enabed, Management frames are protected */
-        else
-        {
-            if (pStaDs->proct_deauh_disassoc_cnt)
-            {
-                ret = TRUE;
-                goto end;
-            }
-            else
-                pStaDs->proct_deauh_disassoc_cnt++;
-        }
-    }
-    else
-#endif
-/* PMF disabled */
-    {
-        if (pStaDs->isDisassocDeauthInProgress)
-        {
-            ret = TRUE;
-            goto end;
-        }
-         else
-            pStaDs->isDisassocDeauthInProgress++;
-    }
-
-end:
-    pe_ReleaseGlobalLock(&pMac->lim);
-    return ret;
-}
 /** -----------------------------------------------------------------
   \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
 
@@ -2626,12 +2321,6 @@
         return eMGMT_DROP_NO_DROP;
 #endif
 
-#ifdef WLAN_FEATURE_11W
-    if ((subType == SIR_MAC_MGMT_ASSOC_REQ ||
-         subType == SIR_MAC_MGMT_REASSOC_REQ) &&
-         lim_is_assoc_req_for_drop(pMac, pRxPacketInfo))
-        return eMGMT_DROP_SPURIOUS_FRAME;
-#endif
     //Drop INFRA Beacons and Probe Responses in IBSS Mode
     if( (subType == SIR_MAC_MGMT_BEACON) ||
         (subType == SIR_MAC_MGMT_PROBE_RSP))
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limAssocUtils.c b/wlan/prima/CORE/MAC/src/pe/lim/limAssocUtils.c
index 44c301e..0b601c8 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limAssocUtils.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limAssocUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -42,7 +42,7 @@
 #include "wniApi.h"
 #include "sirCommon.h"
 
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "pmmApi.h"
 #include "cfgApi.h"
 
@@ -666,10 +666,7 @@
     tSirRetStatus       retCode = eSIR_SUCCESS;
 
 
-    limLog( pMac, LOG1, FL("Cleanup Rx Path for AID : %d"
-                 "psessionEntry->limSmeState : %d, mlmState : %d"),
-                 pStaDs->assocId, psessionEntry->limSmeState,
-                 pStaDs->mlmStaContext.mlmState);
+    limLog( pMac, LOG1, FL("**Initiate cleanup"));
 
     limAbortBackgroundScan( pMac );
     psessionEntry->isCiscoVendorAP = FALSE;
@@ -743,15 +740,12 @@
     pMac->lim.gLimNumRxCleanup++;
 #endif
 
-    /* Do DEL BSS or DEL STA only if ADD BSS was success */
-    if (!psessionEntry->addBssfailed)
-    {
-        if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE)
-           retCode = limDelBss( pMac, pStaDs,
-                          psessionEntry->bssIdx, psessionEntry);
-        else
-           retCode = limDelSta( pMac, pStaDs, true, psessionEntry);
+    if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) {
+        retCode = limDelBss( pMac, pStaDs, psessionEntry->bssIdx, psessionEntry);
     }
+    else
+        retCode = limDelSta( pMac, pStaDs, true, psessionEntry);
+
     return retCode;
 
 } /*** end limCleanupRxPath() ***/
@@ -791,7 +785,7 @@
     tLimMlmDeauthCnf   mlmDeauthCnf;
     tLimMlmPurgeStaInd mlmPurgeStaInd;
 
-    limLog(pMac, LOG1, FL("Sessionid: %d staDsAssocId: %d Trigger: %d "
+    limLog(pMac, LOG1, FL("Sessionid: %d staDsAssocId: %d Trigger: %X "
           "statusCode: %d staDsAddr: "MAC_ADDRESS_STR),psessionEntry->peSessionId,
            staDsAssocId, mlmStaContext.cleanupTrigger, statusCode,
            MAC_ADDR_ARRAY(staDsAddr));
@@ -823,28 +817,27 @@
 
         psessionEntry->limAID = 0;
 
+
     }
 
     if ((mlmStaContext.cleanupTrigger ==
                                       eLIM_HOST_DISASSOC) ||
         (mlmStaContext.cleanupTrigger ==
-                                      eLIM_PROMISCUOUS_MODE_DISASSOC) ||
+                                      eLIM_LINK_MONITORING_DISASSOC) ||
         (mlmStaContext.cleanupTrigger ==
-                                      eLIM_LINK_MONITORING_DISASSOC))
+                                      eLIM_PROMISCUOUS_MODE_DISASSOC))
     {
         /**
          * Host or LMM driven Disassociation.
          * Issue Disassoc Confirm to SME.
          */
-        limLog( pMac, LOGW, FL("Lim Posting DISASSOC_CNF to Sme.Trigger: %d"),
-                                mlmStaContext.cleanupTrigger);
+           limLog( pMac, LOGW, FL("Lim Posting DISASSOC_CNF to Sme. Trigger: %X"), mlmStaContext.cleanupTrigger);
 
 
         vos_mem_copy((tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
                      (tANI_U8 *) staDsAddr,
                       sizeof(tSirMacAddr));
         mlmDisassocCnf.resultCode = statusCode;
-        mlmDisassocCnf.aid          = staDsAssocId;
         mlmDisassocCnf.disassocTrigger =
                                    mlmStaContext.cleanupTrigger;
         /* Update PE session Id*/
@@ -854,20 +847,20 @@
                           LIM_MLM_DISASSOC_CNF,
                           (tANI_U32 *) &mlmDisassocCnf);
     }
-    else if ((mlmStaContext.cleanupTrigger == eLIM_HOST_DEAUTH) ||
-             (mlmStaContext.cleanupTrigger == eLIM_LINK_MONITORING_DEAUTH))
+    else if ((mlmStaContext.cleanupTrigger ==
+                                           eLIM_HOST_DEAUTH) ||
+             (mlmStaContext.cleanupTrigger ==
+                                           eLIM_LINK_MONITORING_DEAUTH))
     {
         /**
          * Host or LMM driven Deauthentication.
          * Issue Deauth Confirm to SME.
          */
-        limLog( pMac, LOGW, FL("Lim Posting DEAUTH_CNF to Sme.Trigger: %d"),
-                                mlmStaContext.cleanupTrigger);
+        limLog( pMac, LOGW, FL("Lim Posting DEAUTH_CNF to Sme. Trigger: %X"), mlmStaContext.cleanupTrigger);
         vos_mem_copy((tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
                      (tANI_U8 *) staDsAddr,
                       sizeof(tSirMacAddr));
         mlmDeauthCnf.resultCode    = statusCode;
-        mlmDeauthCnf.aid           = staDsAssocId;
         mlmDeauthCnf.deauthTrigger =
                                    mlmStaContext.cleanupTrigger;
         /* PE session Id */
@@ -886,8 +879,7 @@
          * Received Disassociation/Deauthentication from peer.
          * Issue Purge Ind to SME.
          */
-        limLog( pMac, LOGW, FL("Lim Posting PURGE_STA_IND to Sme.Trigger: %d"),
-                              mlmStaContext.cleanupTrigger) ;
+        limLog( pMac, LOGW, FL("Lim Posting PURGE_STA_IND to Sme. Trigger: %X"), mlmStaContext.cleanupTrigger) ;
         vos_mem_copy((tANI_U8 *) &mlmPurgeStaInd.peerMacAddr,
                      (tANI_U8 *) staDsAddr,
                      sizeof(tSirMacAddr));
@@ -925,39 +917,28 @@
             && tempLimSmeState == eLIM_SME_WT_REASSOC_STATE)
           )
         {
-            limLog( pMac, LOG1, FL("Lim Posting eWNI_SME_REASSOC_RSP to SME"
-                                   "resultCode: %d, statusCode: %d,"
-                                   "sessionId: %d"),
-                                    mlmStaContext.resultCode,
-                                    mlmStaContext.protStatusCode,
-                                    psessionEntry->peSessionId);
             if(mlmStaContext.resultCode != eSIR_SME_SUCCESS )
             {
                 peDeleteSession(pMac, psessionEntry);
                 psessionEntry = NULL;
-            }
+            } 
+
             limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
                                mlmStaContext.resultCode, mlmStaContext.protStatusCode, psessionEntry,
                                smesessionId, smetransactionId);
         }
         else
         {
-            vos_mem_free(psessionEntry->pLimJoinReq);
-            psessionEntry->pLimJoinReq = NULL;
+        vos_mem_free(psessionEntry->pLimJoinReq);
+        psessionEntry->pLimJoinReq = NULL;
 
-            limLog( pMac, LOG1, FL("Lim Posting eWNI_SME_JOIN_RSP to SME."
-                                   "resultCode: %d,statusCode: %d,"
-                                   "sessionId: %d"),
-                                    mlmStaContext.resultCode,
-                                    mlmStaContext.protStatusCode,
-                                    psessionEntry->peSessionId);
-            if(mlmStaContext.resultCode != eSIR_SME_SUCCESS)
-            {
-                peDeleteSession(pMac,psessionEntry);
-                psessionEntry = NULL;
-            }
-
-            limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, mlmStaContext.resultCode, mlmStaContext.protStatusCode,
+        if(mlmStaContext.resultCode != eSIR_SME_SUCCESS)
+        {
+            peDeleteSession(pMac,psessionEntry);
+            psessionEntry = NULL;
+        } 
+        
+        limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, mlmStaContext.resultCode, mlmStaContext.protStatusCode,
                                  psessionEntry, smesessionId, smetransactionId);
         }
         
@@ -1033,7 +1014,6 @@
             pAuthNode->fTimerStarted = 0;
             pAuthNode->mlmState = eLIM_MLM_AUTHENTICATED_STATE;
             pAuthNode->authType = (tAniAuthType) authType;
-            pAuthNode->timestamp = vos_timer_get_system_ticks();
             limAddPreAuthNode(pMac, pAuthNode);
         }
     }
@@ -1850,9 +1830,9 @@
 
         }
 
-        limLog(pMac, LOG1, FL("MCS Rate Set Bitmap: "));
+        PELOG2(limLog(pMac, LOG2, FL("MCS Rate Set Bitmap: "));)
         for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
-            limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);
+            PELOG2(limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);)
     }
 
 #ifdef WLAN_FEATURE_11AC
@@ -2002,9 +1982,9 @@
             for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
                     pRates->supportedMCSSet[i] &= pSupportedMCSSet[i];
         }
-        limLog(pMac, LOG1, FL("MCS Rate Set Bitmap: "));
+        PELOG2(limLog(pMac, LOG2, FL("MCS Rate Set Bitmap: "));)
         for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
-            limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);
+            PELOG2(limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);)
     }
 #ifdef WLAN_FEATURE_11AC
     limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
@@ -2169,7 +2149,7 @@
     {
       if((tempRateSet.numRates + pExtRateSet->numRates) > 12 )
       {
-        limLog( pMac, LOG1,
+        limLog( pMac, LOG2,
             "Sum of SUPPORTED and EXTENDED Rate Set (%1d) exceeds 12!",
             tempRateSet.numRates + pExtRateSet->numRates );
 
@@ -2202,7 +2182,7 @@
           }
         }
         else
-          limLog( pMac, LOG1,
+          limLog( pMac, LOG2,
               "Relying only on the SUPPORTED Rate Set IE..." );
       }
       else
@@ -2279,11 +2259,10 @@
         for(i=0; i<val; i++)
            pStaDs->supportedRates.supportedMCSSet[i] = mcsSet[i] & pSupportedMCSSet[i];
 
-        limLog(pMac, LOG1, FL(" MCS Rate Set Bitmap from  CFG and DPH : "));
+        PELOG2(limLog(pMac, LOG2, FL("limPopulateMatchingRateSet: MCS Rate Set Bitmap from  CFG and DPH : "));)
         for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
         {
-            limLog(pMac, LOG1,FL("%x %x "), mcsSet[i],
-                      pStaDs->supportedRates.supportedMCSSet[i]);
+            PELOG2(limLog(pMac, LOG2,FL("%x %x "), mcsSet[i], pStaDs->supportedRates.supportedMCSSet[i]);)
         }
     }
 
@@ -2403,7 +2382,7 @@
     pStaDs->valid                  = 0;
     pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
 
-    limLog(pMac, LOG1, FL(" Assoc ID: %d wmmEnabled = %d listenInterval = %d"
+    limLog(pMac, LOG2, FL(" Assoc ID: %d wmmEnabled = %d listenInterval = %d"
     " shortPreambleSupported: %d "), pAddStaParams->assocId,
     pAddStaParams->wmmEnabled, pAddStaParams->listenInterval,
     pAddStaParams->shortPreambleSupported);
@@ -2416,9 +2395,7 @@
      */
     if((STA_ENTRY_TDLS_PEER == pStaDs->staType) &&
       (true == updateEntry))
-    {
         pAddStaParams->staIdx = pStaDs->staIndex;
-    }
     else
 #endif
         pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
@@ -2456,9 +2433,9 @@
 
     }
 #ifdef WLAN_FEATURE_11AC
-    limLog(pMac, LOG1, FL("vhtCapable: %d "), pAddStaParams->vhtCapable);
+    limLog(pMac, LOG2, FL("vhtCapable: %d "),pAddStaParams->vhtCapable);
 #endif
-    limLog(pMac, LOG1, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
+    limLog(pMac, LOG2, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
     pAddStaParams->staIdx,pAddStaParams->updateSta,
     pAddStaParams->htCapable);
 
@@ -2473,15 +2450,15 @@
     pAddStaParams->txChannelWidthSet = pStaDs->htSupportedChannelWidthSet;
     pAddStaParams->mimoPS = pStaDs->htMIMOPSState;
 
-    limLog(pMac, LOG1, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
+    limLog(pMac, LOG2, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
     "maxAmpduDensity = %d"), pAddStaParams->greenFieldCapable,
     pAddStaParams->maxAmpduDensity, pAddStaParams->maxAmpduSize);
 
-    limLog(pMac, LOG1, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
+    limLog(pMac, LOG2, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
     "fShortGI40Mhz: %d"), pAddStaParams->fDsssCckMode40Mhz,
     pAddStaParams->fShortGI20Mhz, pAddStaParams->fShortGI40Mhz);
 
-    limLog(pMac, LOG1, FL("lsigTxopProtection: %d maxAmsduSize: %d "
+    limLog(pMac, LOG2, FL("lsigTxopProtection: %d maxAmsduSize: %d "
     "txChannelWidthSet: %d mimoPS: %d "), pAddStaParams->lsigTxopProtection,
     pAddStaParams->maxAmsduSize,pAddStaParams->txChannelWidthSet,
     pAddStaParams->mimoPS);
@@ -2498,7 +2475,7 @@
         ( STA_ENTRY_PEER == pStaDs->staType ) ? pStaDs->vhtBeamFormerCapable :
                                 psessionEntry->txBFIniFeatureEnabled ;
 #endif
-        limLog(pMac, LOG1, FL("vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
+        limLog(pMac, LOG2, FL("vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
         pAddStaParams->vhtTxChannelWidthSet,pAddStaParams->vhtTxBFCapable);
     }
 #endif
@@ -2519,14 +2496,8 @@
         }
         else
         {
-            if (psessionEntry->txLdpcIniFeatureEnabled & 0x1)
-                pAddStaParams->htLdpcCapable = pStaDs->htLdpcCapable;
-            else
-                pAddStaParams->htLdpcCapable = 0;
-            if (psessionEntry->txLdpcIniFeatureEnabled & 0x2)
-                pAddStaParams->vhtLdpcCapable = pStaDs->vhtLdpcCapable;
-            else
-                pAddStaParams->vhtLdpcCapable = 0;
+            pAddStaParams->htLdpcCapable = pStaDs->htLdpcCapable;
+            pAddStaParams->vhtLdpcCapable = pStaDs->vhtLdpcCapable;
         }
     }
     else if( STA_ENTRY_SELF == pStaDs->staType)
@@ -2589,7 +2560,7 @@
     limLog( pMac, LOG1, FL( "PMF enabled %d"), pAddStaParams->rmfEnabled);
 #endif
 
-    limLog(pMac, LOG1, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
+    limLog(pMac, LOG2, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
     "p2pCapableSta: %d"), pAddStaParams->htLdpcCapable,
     pAddStaParams->vhtLdpcCapable, pAddStaParams->p2pCapableSta);
 
@@ -2829,7 +2800,6 @@
     tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
     tANI_U32 shortGi20MhzSupport;
     tANI_U32 shortGi40MhzSupport;
-    tANI_U32 val;
     /*This self Sta dot 11 mode comes from the cfg and the expectation here is
      * that cfg carries the systemwide capability that device under
      * consideration can support. This capability gets plumbed into the cfg
@@ -2882,12 +2852,7 @@
     pAddStaParams->staIdx = staIdx;
     pAddStaParams->updateSta = updateSta;
 
-    if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
-    {
-        limLog(pMac, LOGP, FL("Get short preamble failed. Set Default value"));
-         pAddStaParams->shortPreambleSupported = 1;
-    }
-    pAddStaParams->shortPreambleSupported = val;
+    pAddStaParams->shortPreambleSupported = psessionEntry->beaconParams.fShortPreamble;
 
 #ifdef WLAN_FEATURE_11AC
     limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry,NULL);
@@ -2982,16 +2947,16 @@
                                              "CFG,setting value to default"));)
                 pAddStaParams->fShortGI40Mhz = WNI_CFG_SHORT_GI_40MHZ_STADEF;
             }
-            limLog(pMac, LOG1, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
+            limLog(pMac, LOG2, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
             "maxAmpduSize = %d"), pAddStaParams->greenFieldCapable,
             pAddStaParams->maxAmpduDensity, pAddStaParams->maxAmpduSize);
 
-            limLog(pMac, LOG1, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
+            limLog(pMac, LOG2, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
             "fShortGI40Mhz: %d lsigTxopProtection: %d"),
             pAddStaParams->fDsssCckMode40Mhz, pAddStaParams->fShortGI20Mhz,
             pAddStaParams->fShortGI40Mhz, pAddStaParams->lsigTxopProtection);
 
-            limLog(pMac, LOG1, FL(" maxAmsduSize: %d txChannelWidthSet: %d "
+            limLog(pMac, LOG2, FL(" maxAmsduSize: %d txChannelWidthSet: %d "
             "mimoPS: %d rifsMode %d delBASupport %d"),
             pAddStaParams->maxAmsduSize,
             pAddStaParams->txChannelWidthSet, pAddStaParams->mimoPS,
@@ -3005,7 +2970,7 @@
         limLog( pMac, LOG1, FL("VHT WIDTH SET %d"),pAddStaParams->vhtTxChannelWidthSet);
     }
     pAddStaParams->vhtTxBFCapable = psessionEntry->txBFIniFeatureEnabled;
-    limLog(pMac, LOG1, FL("vhtCapable: %d vhtTxBFCapable %d "),
+    limLog(pMac, LOG2, FL("vhtCapable: %d vhtTxBFCapable %d "),
     pAddStaParams->vhtCapable, pAddStaParams->vhtTxBFCapable);
 #endif
 
@@ -3027,16 +2992,16 @@
     //limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
      pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
 
-    limLog(pMac, LOG1, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
+    limLog(pMac, LOG2, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
     pAddStaParams->staIdx,pAddStaParams->updateSta,
     pAddStaParams->htCapable);
 
-    limLog(pMac, LOG1, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
+    limLog(pMac, LOG2, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
     "p2pCapableSta: %d"),
     pAddStaParams->htLdpcCapable,pAddStaParams->vhtLdpcCapable,
     pAddStaParams->p2pCapableSta);
 
-    limLog(pMac, LOG1, FL(" sessionid: %d  Assoc ID: %d listenInterval = %d"
+    limLog(pMac, LOG2, FL(" sessionid: %d  Assoc ID: %d listenInterval = %d"
     " shortPreambleSupported: %d "), psessionEntry->smeSessionId,
     pAddStaParams->assocId, pAddStaParams->listenInterval,
     pAddStaParams->shortPreambleSupported);
@@ -3299,7 +3264,7 @@
          * Received SSID does not match with the one we've.
          * Ignore received Beacon frame
          */
-        limLog(pMac, LOG1, FL("SSID received in Beacon does not match"));
+        PELOG1(limLog(pMac, LOG1, FL("SSID received in Beacon does not match"));)
 #ifdef WLAN_DEBUG            
         pMac->lim.gLimBcnSSIDMismatchCnt++;
 #endif
@@ -3360,9 +3325,6 @@
         psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
         MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
 
-        /* update the capability info based on recently
-         * received beacon/probe response frame */
-        psessionEntry->limCurrentBssCaps = limGetU16((tANI_U8 *) &pBPR->capabilityInfo);
 
         /**
          * Announce join success by sending
@@ -3614,17 +3576,17 @@
     pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
     pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;   
 
-    limLog(pMac, LOG1, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
+    limLog(pMac, LOG2, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
     "cfpCount: %d"),pAddBssParams->bssType, pAddBssParams->beaconInterval,
     pAddBssParams->dtimPeriod, pAddBssParams->cfParamSet.cfpCount);
 
-    limLog(pMac, LOG1, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
+    limLog(pMac, LOG2, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
     " %d numRates: %d "),pAddBssParams->cfParamSet.cfpPeriod,
     pAddBssParams->cfParamSet.cfpMaxDuration,
     pAddBssParams->cfParamSet.cfpDurRemaining,
     pAddBssParams->rateSet.numRates);
 
-    limLog(pMac, LOG1, FL("nwType:%d shortSlotTimeSupported: %d"
+    limLog(pMac, LOG2, FL("nwType:%d shortSlotTimeSupported: %d"
     "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d"),
     pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported,
     pAddBssParams->llaCoexist, pAddBssParams->llbCoexist,
@@ -3636,7 +3598,7 @@
     if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present ))
     {
         pAddBssParams->htCapable = pAssocRsp->HTCaps.present;
-        limLog(pMac, LOG1, FL("htCapable: %d"),pAddBssParams->htCapable);
+        limLog(pMac, LOG2, FL("htCapable: %d"),pAddBssParams->htCapable);
         if ( pBeaconStruct->HTInfo.present )
         {
             pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pAssocRsp->HTInfo.opMode;
@@ -3657,12 +3619,12 @@
             pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
             pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode;
 
-            limLog(pMac, LOG1, FL("htOperMode: %d dualCTSProtection: %d "
+            limLog(pMac, LOG2, FL("htOperMode: %d dualCTSProtection: %d "
             "txChannelWidthSet: %d currentExtChannel: %d "),
             pAddBssParams->htOperMode, pAddBssParams->dualCTSProtection,
             pAddBssParams->txChannelWidthSet,pAddBssParams->currentExtChannel);
 
-            limLog(pMac, LOG1, FL("llnNonGFCoexist: %d "
+            limLog(pMac, LOG2, FL("llnNonGFCoexist: %d "
             "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d"),
             pAddBssParams->llnNonGFCoexist,
             pAddBssParams->fLsigTXOPProtectionFullSupport,
@@ -3671,7 +3633,7 @@
     }
 
     pAddBssParams->currentOperChannel = bssDescription->channelId;
-    limLog(pMac, LOG1, FL("currentOperChannel %d"),
+    limLog(pMac, LOG2, FL("currentOperChannel %d"),
     pAddBssParams->currentOperChannel);
 #ifdef WLAN_FEATURE_11AC
     if (psessionEntry->vhtCapability && ( pAssocRsp->VHTCaps.present ))
@@ -3688,7 +3650,7 @@
     {
         pAddBssParams->vhtCapable = 0;
     }
-    limLog(pMac, LOG1, FL("vhtCapable %d vhtTxChannelWidthSet %d "
+    limLog(pMac, LOG2, FL("vhtCapable %d vhtTxChannelWidthSet %d "
     "currentExtChannel %d"),pAddBssParams->vhtCapable,
     pAddBssParams->vhtTxChannelWidthSet,
     pAddBssParams->currentExtChannel);
@@ -3717,11 +3679,10 @@
         }
         pAddBssParams->staContext.uAPSD = 0;
         pAddBssParams->staContext.maxSPLen = 0;
-        pAddBssParams->staContext.shortPreambleSupported =
-                       psessionEntry->beaconParams.fShortPreamble;
+        pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble;
         pAddBssParams->staContext.updateSta = updateEntry;
 
-        limLog(pMac, LOG1, FL("StaContext: "MAC_ADDRESS_STR
+        limLog(pMac, LOG2, FL("StaContext: "MAC_ADDRESS_STR
         " shortPreambleSupported: %d"),
         MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac),
         pAddBssParams->staContext.shortPreambleSupported);
@@ -3732,13 +3693,12 @@
             pAddBssParams->staContext.htCapable = 1;
             pAddBssParams->staContext.greenFieldCapable  = ( tANI_U8 )pAssocRsp->HTCaps.greenField;
             pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection;
-            limLog(pMac, LOG1,FL("StaContext htCapable: %d greenFieldCapable: %d "
+            limLog(pMac, LOG2,FL("StaContext htCapable: %d greenFieldCapable: %d "
             "lsigTxopProtection: %d"), pAddBssParams->staContext.htCapable,
             pAddBssParams->staContext.greenFieldCapable,
             pAddBssParams->staContext.lsigTxopProtection);
 #ifdef WLAN_FEATURE_11AC
-            if (psessionEntry->vhtCapability &&
-                IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps))
+            if (psessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
             {
                 pAddBssParams->staContext.vhtCapable = 1;
                 if ((pAssocRsp->VHTCaps.suBeamFormerCap ||
@@ -3768,7 +3728,7 @@
                 {
                     pAddBssParams->staContext.vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; //pMac->lim.apChanWidth;
                 }
-                limLog(pMac, LOG1,FL("StaContext vhtCapable %d "
+                limLog(pMac, LOG2,FL("StaContext vhtCapable %d "
                 "vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
                 pAddBssParams->staContext.vhtCapable,
                 pAddBssParams->staContext.vhtTxChannelWidthSet,
@@ -3842,34 +3802,26 @@
             }
             else
             {
-                if (psessionEntry->txLdpcIniFeatureEnabled & 0x1)
-                    pAddBssParams->staContext.htLdpcCapable =
-                            (tANI_U8)pAssocRsp->HTCaps.advCodingCap;
-                else
-                    pAddBssParams->staContext.htLdpcCapable = 0;
-                if (psessionEntry->txLdpcIniFeatureEnabled & 0x2)
-                    pAddBssParams->staContext.vhtLdpcCapable =
-                        (tANI_U8)pAssocRsp->VHTCaps.ldpcCodingCap;
-                else
-                    pAddBssParams->staContext.vhtLdpcCapable = 0;
+                pAddBssParams->staContext.htLdpcCapable = (tANI_U8)pAssocRsp->HTCaps.advCodingCap;
+                pAddBssParams->staContext.vhtLdpcCapable = (tANI_U8)pAssocRsp->VHTCaps.ldpcCodingCap;
             }
 
             if( pBeaconStruct->HTInfo.present )
                 pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode;
 
-            limLog(pMac, LOG1, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
+            limLog(pMac, LOG2, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
             " delBASupport: %d maxAmsduSize: %d"),
             pAddBssParams->staContext.txChannelWidthSet,
             pAddBssParams->staContext.mimoPS,
             pAddBssParams->staContext.delBASupport,
             pAddBssParams->staContext.maxAmsduSize);
 
-            limLog(pMac, LOG1, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
+            limLog(pMac, LOG2, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
             "fShortGI20Mhz: %d "),pAddBssParams->staContext.maxAmpduDensity,
             pAddBssParams->staContext.fDsssCckMode40Mhz,
             pAddBssParams->staContext.fShortGI20Mhz);
 
-            limLog(pMac, LOG1, FL("fShortGI40Mh: %d  maxAmpduSize: %d "
+            limLog(pMac, LOG2, FL("fShortGI40Mh: %d  maxAmpduSize: %d "
             "htLdpcCapable: %d vhtLdpcCapable: %d"),
             pAddBssParams->staContext.fShortGI40Mhz,
             pAddBssParams->staContext.maxAmpduSize,
@@ -3912,7 +3864,7 @@
 
 #if defined WLAN_FEATURE_VOWIFI  
     pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
-    limLog(pMac, LOG1,FL("maxTxPower: %d"),
+    limLog(pMac, LOG2,FL("maxTxPower: %d"),
                        pAddBssParams->maxTxPower);
 #endif
     // FIXME_GEN4 - Any other value that can be used for initialization?
@@ -3930,7 +3882,7 @@
 
 #if defined WLAN_FEATURE_VOWIFI_11R
     pAddBssParams->extSetStaKeyParamValid = 0;
-    limLog(pMac, LOG1,FL("extSetStaKeyParamValid: %d"),
+    limLog(pMac, LOG2,FL("extSetStaKeyParamValid: %d"),
                       pAddBssParams->extSetStaKeyParamValid);
 #endif
 
@@ -3947,15 +3899,14 @@
         psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
     else
         psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
-
     MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
-    limLog(pMac, LOG1, FL("staContext wmmEnabled: %d encryptType: %d "
+    limLog(pMac, LOG2, FL("staContext wmmEnabled: %d encryptType: %d "
     "p2pCapableSta: %d"),pAddBssParams->staContext.wmmEnabled,
     pAddBssParams->staContext.encryptType,
     pAddBssParams->staContext.p2pCapableSta);
 
-    limLog(pMac, LOG1, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
+    limLog(pMac, LOG2, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
     "LimMlm state to %d"), pAddBssParams->bSpectrumMgtEnabled,
     pAddBssParams->halPersona, psessionEntry->limMlmState);
 
@@ -4077,17 +4028,17 @@
     pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
     pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
 
-    limLog(pMac, LOG1, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
+    limLog(pMac, LOG2, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
     "cfpCount: %d"),pAddBssParams->bssType, pAddBssParams->beaconInterval,
     pAddBssParams->dtimPeriod, pAddBssParams->cfParamSet.cfpCount);
 
-    limLog(pMac, LOG1, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
+    limLog(pMac, LOG2, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
     " %d numRates: %d "),pAddBssParams->cfParamSet.cfpPeriod,
     pAddBssParams->cfParamSet.cfpMaxDuration,
     pAddBssParams->cfParamSet.cfpDurRemaining,
     pAddBssParams->rateSet.numRates);
 
-    limLog(pMac, LOG1, FL("nwType:%d shortSlotTimeSupported: %d"
+    limLog(pMac, LOG2, FL("nwType:%d shortSlotTimeSupported: %d"
     "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d"),
     pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported,
     pAddBssParams->llaCoexist, pAddBssParams->llbCoexist,
@@ -4096,7 +4047,7 @@
     if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
     {
         pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
-        limLog(pMac, LOG1, FL("htCapable: %d"),pAddBssParams->htCapable);
+        limLog(pMac, LOG2, FL("htCapable: %d"),pAddBssParams->htCapable);
         if ( pBeaconStruct->HTInfo.present )
         {
             pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
@@ -4118,12 +4069,12 @@
             pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
             pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
 
-            limLog(pMac, LOG1, FL("htOperMode: %d dualCTSProtection: %d "
+            limLog(pMac, LOG2, FL("htOperMode: %d dualCTSProtection: %d "
             "txChannelWidthSet: %d currentExtChannel: %d "),
             pAddBssParams->htOperMode, pAddBssParams->dualCTSProtection,
             pAddBssParams->txChannelWidthSet,pAddBssParams->currentExtChannel);
 
-            limLog(pMac, LOG1, FL("llnNonGFCoexist: %d "
+            limLog(pMac, LOG2, FL("llnNonGFCoexist: %d "
             "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d"),
             pAddBssParams->llnNonGFCoexist,
             pAddBssParams->fLsigTXOPProtectionFullSupport,
@@ -4132,11 +4083,10 @@
     }
 
     pAddBssParams->currentOperChannel = bssDescription->channelId;
-    limLog(pMac, LOG1, FL("currentOperChannel %d"),
+    limLog(pMac, LOG2, FL("currentOperChannel %d"),
     pAddBssParams->currentOperChannel);
 #ifdef WLAN_FEATURE_11AC
-    if (psessionEntry->vhtCapability &&
-        IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps))
+    if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
     {
         pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
         pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth; 
@@ -4150,7 +4100,7 @@
     {
         pAddBssParams->vhtCapable = 0;
     }
-    limLog(pMac, LOG1, FL("vhtCapable %d vhtTxChannelWidthSet %d "
+    limLog(pMac, LOG2, FL("vhtCapable %d vhtTxChannelWidthSet %d "
     "currentExtChannel %d"),pAddBssParams->vhtCapable,
     pAddBssParams->vhtTxChannelWidthSet,
     pAddBssParams->currentExtChannel);
@@ -4172,7 +4122,7 @@
         pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
         pAddBssParams->staContext.updateSta = updateEntry;
 
-        limLog(pMac, LOG1, FL("StaContext: "MAC_ADDRESS_STR
+        limLog(pMac, LOG2, FL("StaContext: "MAC_ADDRESS_STR
         " shortPreambleSupported: %d"),
         MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac),
         pAddBssParams->staContext.shortPreambleSupported);
@@ -4183,14 +4133,13 @@
             pAddBssParams->staContext.htCapable = 1;
             pAddBssParams->staContext.greenFieldCapable  = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
             pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
-            limLog(pMac, LOG1, FL("StaContext htCapable: %d "
+            limLog(pMac, LOG2, FL("StaContext htCapable: %d "
             "greenFieldCapable: %d lsigTxopProtection: %d"),
             pAddBssParams->staContext.htCapable,
             pAddBssParams->staContext.greenFieldCapable,
             pAddBssParams->staContext.lsigTxopProtection);
 #ifdef WLAN_FEATURE_11AC
-            if (psessionEntry->vhtCapability &&
-                IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps))
+            if (psessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
             {
                 pAddBssParams->staContext.vhtCapable = 1;
                 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
@@ -4222,7 +4171,7 @@
                     pAddBssParams->staContext.vhtTxChannelWidthSet =
                                      pBeaconStruct->VHTOperation.chanWidth;
                 }
-                limLog(pMac, LOG1,FL("StaContext vhtCapable %d "
+                limLog(pMac, LOG2,FL("StaContext vhtCapable %d "
                 "vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
                 pAddBssParams->staContext.vhtCapable,
                 pAddBssParams->staContext.vhtTxChannelWidthSet,
@@ -4296,33 +4245,25 @@
             }
             else
             {
-                if (psessionEntry->txLdpcIniFeatureEnabled & 0x1)
-                    pAddBssParams->staContext.htLdpcCapable =
-                            (tANI_U8)pBeaconStruct->HTCaps.advCodingCap;
-                else
-                    pAddBssParams->staContext.htLdpcCapable = 0;
-                if (psessionEntry->txLdpcIniFeatureEnabled & 0x2)
-                    pAddBssParams->staContext.vhtLdpcCapable =
-                        (tANI_U8)pBeaconStruct->VHTCaps.ldpcCodingCap;
-                else
-                    pAddBssParams->staContext.vhtLdpcCapable = 0;
+                pAddBssParams->staContext.htLdpcCapable = (tANI_U8)pBeaconStruct->HTCaps.advCodingCap;
+                pAddBssParams->staContext.vhtLdpcCapable = (tANI_U8)pBeaconStruct->VHTCaps.ldpcCodingCap;
             }
             
             if( pBeaconStruct->HTInfo.present )
                 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
-            limLog(pMac, LOG1, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
+            limLog(pMac, LOG2, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
             " delBASupport: %d maxAmsduSize: %d"),
             pAddBssParams->staContext.txChannelWidthSet,
             pAddBssParams->staContext.mimoPS,
             pAddBssParams->staContext.delBASupport,
             pAddBssParams->staContext.maxAmsduSize);
 
-            limLog(pMac, LOG1, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
+            limLog(pMac, LOG2, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
             "fShortGI20Mhz: %d "),pAddBssParams->staContext.maxAmpduDensity,
             pAddBssParams->staContext.fDsssCckMode40Mhz,
             pAddBssParams->staContext.fShortGI20Mhz);
 
-            limLog(pMac, LOG1, FL("fShortGI40Mh: %d  maxAmpduSize: %d "
+            limLog(pMac, LOG2, FL("fShortGI40Mh: %d  maxAmpduSize: %d "
             "htLdpcCapable: %d vhtLdpcCapable: %d"),
             pAddBssParams->staContext.fShortGI40Mhz,
             pAddBssParams->staContext.maxAmpduSize,
@@ -4364,7 +4305,7 @@
 
 #if defined WLAN_FEATURE_VOWIFI  
     pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
-    limLog(pMac, LOG1,FL("maxTxPower: %d"),
+    limLog(pMac, LOG2,FL("maxTxPower: %d"),
                        pAddBssParams->maxTxPower);
 #endif
 
@@ -4380,7 +4321,7 @@
 
 #if defined WLAN_FEATURE_VOWIFI_11R
     pAddBssParams->extSetStaKeyParamValid = 0;
-    limLog(pMac, LOG1,FL("extSetStaKeyParamValid: %d"),
+    limLog(pMac, LOG2,FL("extSetStaKeyParamValid: %d"),
                       pAddBssParams->extSetStaKeyParamValid);
 #endif
 
@@ -4399,12 +4340,12 @@
     
     MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
-    limLog(pMac, LOG1, FL("staContext wmmEnabled: %d encryptType: %d "
+    limLog(pMac, LOG2, FL("staContext wmmEnabled: %d encryptType: %d "
     "p2pCapableSta: %d"),pAddBssParams->staContext.wmmEnabled,
     pAddBssParams->staContext.encryptType,
     pAddBssParams->staContext.p2pCapableSta);
 
-    limLog(pMac, LOG1, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
+    limLog(pMac, LOG2, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
     "LimMlm state to %d"), pAddBssParams->bSpectrumMgtEnabled,
     pAddBssParams->halPersona, psessionEntry->limMlmState);
 
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limDebug.c b/wlan/prima/CORE/MAC/src/pe/lim/limDebug.c
index 4d2dcc5..7a6445d 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limDebug.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limDebug.c
@@ -33,6 +33,9 @@
 
   \author Sunit Bhatia
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limFT.c b/wlan/prima/CORE/MAC/src/pe/lim/limFT.c
index 8058e13..a2a6835 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limFT.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limFT.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -48,7 +48,10 @@
 #include <limSession.h>
 #include <limAdmitControl.h>
 #include "wmmApsd.h"
+
+#ifdef DEBUG_ROAM_DELAY
 #include "vos_utils.h"
+#endif
 
 #define LIM_FT_RIC_BA_SSN                       1
 #define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0         248
@@ -105,11 +108,11 @@
             PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
             peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
         }
-#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
-        PELOGE(limLog( pMac, LOGE, "%s: Setting pftSessionEntry= %p to NULL",
-            __func__, pMac->ft.ftPEContext.pftSessionEntry);)
-#endif
         pMac->ft.ftPEContext.pftSessionEntry = NULL;
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
+        PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
+            __func__, pMac->ft.ftPEContext.psavedsessionEntry);) 
+#endif
     }
 
     if (pMac->ft.ftPEContext.pAddBssReq)
@@ -125,7 +128,8 @@
         pMac->ft.ftPEContext.pAddStaReq = NULL;
     }
 
-    vos_mem_zero(&pMac->ft.ftPEContext, sizeof(tftPEContext));
+    pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS; 
+
 }
 
 /*--------------------------------------------------------------------------
@@ -271,11 +275,18 @@
     // 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;
 
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
-    PELOGE(limLog( pMac, LOG1, "%s: PRE Auth ft_ies_length=%02x%02x%02x", __func__,
+    PELOGE(limLog( pMac, LOG1, "%s: PE Auth ft_ies_length=%02x%02x%02x", __func__,
         pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
         pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
         pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
@@ -291,26 +302,31 @@
         limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
         // Post the FT Pre Auth Response to SME
         limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
-
-        /* return FALSE, since the Pre-Auth Req will be freed in
-         * limPostFTPreAuthRsp on failure
-         */
-        return bufConsumed;
+        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
+        limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
+#endif
 
     // Dont need to suspend if APs are in same channel
     if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum) 
     {
         // Need to suspend link only if the channels are different
-        limLog(pMac, LOG1, FL(" Performing pre-auth on different"
-               " channel (session %p)"), psessionEntry);
+        PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
+               " channel (session %p)", __func__, psessionEntry);)
         limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler, 
                        (tANI_U32 *)psessionEntry); 
     }
     else 
     {
-        limLog(pMac, LOG1, FL(" Performing pre-auth on same"
-               " channel (session %p)"), psessionEntry);
+        PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
+               " channel (session %p)", __func__, psessionEntry);)
         // We are in the same channel. Perform pre-auth
         limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
     }
@@ -348,9 +364,9 @@
     pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
 
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
-    limLog(pMac, LOG1, FL("Entered wait auth2 state for FT"
-           " (old session %p)"),
-           pMac->ft.ftPEContext.psavedsessionEntry);
+    PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
+           " (old session %p)",
+           pMac->ft.ftPEContext.psavedsessionEntry);)
 #endif
 
 
@@ -378,22 +394,16 @@
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
         PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
 #endif
-        pMac->ft.ftPEContext.psavedsessionEntry = NULL;
-        goto preauth_fail;
     }
 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
 
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
     PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
 #endif
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-      limDiagEventReport(pMac, WLAN_PE_DIAG_ROAM_AUTH_START_EVENT,
-             pMac->lim.pSessionEntry, eSIR_SUCCESS, eSIR_SUCCESS);
-#endif
 
     limSendAuthMgmtFrame(pMac, &authFrame,
         pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
-        LIM_NO_WEP_IN_FC, psessionEntry, eSIR_FALSE);
+        LIM_NO_WEP_IN_FC, psessionEntry);
 
     return;
 preauth_fail:
@@ -566,8 +576,7 @@
                 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
             }                                                           
 #ifdef WLAN_FEATURE_11AC
-            if (pftSessionEntry->vhtCapability &&
-                        IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps))
+            if (pftSessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
             {
                 pAddBssParams->staContext.vhtCapable = 1;
                 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
@@ -576,12 +585,6 @@
                 {
                     pAddBssParams->staContext.vhtTxBFCapable = 1;
                 }
-                if (pBeaconStruct->VHTCaps.muBeamformerCap &&
-                                    pftSessionEntry->txMuBformee )
-                {
-                    pAddBssParams->staContext.vhtTxMUBformeeCapable = 1;
-                    limLog(pMac, LOG1, FL("Enabling MUBformee for peer"));
-                }
             }
 #endif
             if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
@@ -751,62 +754,17 @@
         pftSessionEntry->ssId.length);
 
     wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfDot11Mode);
-    limLog(pMac, LOG1, FL("selfDot11Mode %d"),selfDot11Mode );
     pftSessionEntry->dot11mode = selfDot11Mode;
-    pftSessionEntry->vhtCapability =
-               (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode)
-                && IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps));
+    pftSessionEntry->vhtCapability = (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode)
+                                     && pBeaconStruct->VHTCaps.present);
     pftSessionEntry->htCapability = (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode)
                                      && pBeaconStruct->HTCaps.present);
 #ifdef WLAN_FEATURE_11AC
-    if (IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps)
-                    && pBeaconStruct->VHTOperation.present)
+    if ( pBeaconStruct->VHTCaps.present && pBeaconStruct->VHTOperation.present)
     {
        pftSessionEntry->vhtCapabilityPresentInBeacon = 1;
        pftSessionEntry->apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
        pftSessionEntry->apChanWidth = pBeaconStruct->VHTOperation.chanWidth;
-
-       pftSessionEntry->txBFIniFeatureEnabled =
-                                      pMac->roam.configParam.txBFEnable;
-
-       limLog(pMac, LOG1, FL("txBFIniFeatureEnabled=%d"),
-                pftSessionEntry->txBFIniFeatureEnabled);
-
-       if (pftSessionEntry->txBFIniFeatureEnabled)
-       {
-           if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP,
-                             pftSessionEntry->txBFIniFeatureEnabled)
-                                                          != eSIR_SUCCESS)
-           {
-               limLog(pMac, LOGE, FL("could not set  "
-                              "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
-           }
-           limLog(pMac, LOG1, FL("txBFCsnValue=%d"),
-                    pMac->roam.configParam.txBFCsnValue);
-
-           if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
-                                     pMac->roam.configParam.txBFCsnValue)
-                                                             != eSIR_SUCCESS)
-           {
-               limLog(pMac, LOGE, FL("could not set "
-                    "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
-           }
-
-           if (IS_MUMIMO_BFORMEE_CAPABLE)
-               pftSessionEntry->txMuBformee =
-                                            pMac->roam.configParam.txMuBformee;
-        }
-
-        limLog(pMac, LOG1, FL("txMuBformee = %d"),
-                                       pftSessionEntry->txMuBformee);
-
-        if (cfgSetInt(pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP,
-                                          pftSessionEntry->txMuBformee)
-                                                             != eSIR_SUCCESS)
-        {
-           limLog(pMac, LOGE, FL("could not set "
-                                  "WNI_CFG_VHT_MU_BEAMFORMEE_CAP at CFG"));
-        }
     }
     else
     {
@@ -1095,12 +1053,12 @@
        VOS_ASSERT(pFTPreAuthRsp != NULL);
        return;
     }
-
+    vos_mem_zero( pFTPreAuthRsp, rspLen);
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
     PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
 #endif
-
-    vos_mem_zero(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;
@@ -1135,16 +1093,7 @@
         */
     }
 #endif
-
-    if (status != eSIR_SUCCESS)
-    {
-        /* Ensure that on Pre-Auth failure the cached Pre-Auth Req and
-         * other allocated memory is freed up before returning.
-         */
-        limLog(pMac, LOG1, "Pre-Auth Failed, Cleanup!");
-        limFTCleanup(pMac);
-    }
-
+    
     mmhMsg.type = pFTPreAuthRsp->messageType;
     mmhMsg.bodyptr = pFTPreAuthRsp;
     mmhMsg.bodyval = 0;
@@ -1152,6 +1101,11 @@
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
     PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
 #endif
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+    if (status == eSIR_SUCCESS)
+        limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
+                           status, 0);
+#endif
     limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 }
 
@@ -1173,8 +1127,7 @@
     tANI_U8 sessionId;
     tpSirBssDescription  pbssDescription;
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
-    limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT,
-                       psessionEntry, status, eSIR_SUCCESS);
+    limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
 #endif
 
     // Save the status of pre-auth
@@ -1314,12 +1267,6 @@
         vos_mem_free(pMlmReassocReq);
         return;
     }
-
-    lim_update_caps_info_for_bss(pMac, &caps,
-                  psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo);
-
-    limLog(pMac, LOG1, FL("Capabilities info FT Reassoc: 0x%X"), caps);
-
     pMlmReassocReq->capabilityInfo = caps;
 
     /* Update PE sessionId*/
@@ -1395,10 +1342,9 @@
     }
     // Dont need this anymore
     pMac->ft.ftPEContext.pAddBssReq = NULL;
-    if (pMac->roam.configParam.roamDelayStatsEnabled)
-    {
-        vos_record_roam_event(e_LIM_ADD_BS_REQ, NULL, 0);
-    }
+#ifdef DEBUG_ROAM_DELAY
+    vos_record_roam_event(e_LIM_ADD_BS_REQ, NULL, 0);
+#endif
     return;
 }
 
@@ -1425,15 +1371,6 @@
     /* To handle the race condition where we recieve preauth rsp after
      * timer has expired.
      */
-
-    if (pMac->ft.ftPEContext.pFTPreAuthReq == NULL)
-    {
-       limLog(pMac, LOGE, FL("Auth Rsp might already be posted to SME"
-              " and ftcleanup done! sessionId:%d"),
-              pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId);
-       return;
-    }
-
     if (eANI_BOOLEAN_TRUE ==
         pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed)
     {
@@ -1498,18 +1435,18 @@
     }
 
     pAddBssParams->extSetStaKeyParam.singleTidRc = val;
-    limLog(pMac, LOG1, FL("Key valid %d key len = %d"),
+    PELOG1(limLog(pMac, LOG1, FL("Key valid %d"),
                 pAddBssParams->extSetStaKeyParamValid,
-                pAddBssParams->extSetStaKeyParam.key[0].keyLength);
+                pAddBssParams->extSetStaKeyParam.key[0].keyLength);)
 
     pAddBssParams->extSetStaKeyParam.staIdx = 0;
 
-    limLog(pMac, LOG1,
-           FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));
+    PELOG1(limLog(pMac, LOG1,
+           FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));)
 
     if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
     {
-        limLog(pMac, LOG1,
+        PELOG1(limLog(pMac, LOG1,
         FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
         "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
         pAddBssParams->extSetStaKeyParam.key[0].key[0],
@@ -1527,7 +1464,7 @@
         pAddBssParams->extSetStaKeyParam.key[0].key[12],
         pAddBssParams->extSetStaKeyParam.key[0].key[13],
         pAddBssParams->extSetStaKeyParam.key[0].key[14],
-        pAddBssParams->extSetStaKeyParam.key[0].key[15]);
+        pAddBssParams->extSetStaKeyParam.key[0].key[15]);)
     }
 
     return TRUE;
@@ -1714,7 +1651,7 @@
     tpPESession  psessionEntry = NULL;
     int i = 0;
 
-    limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));
+    PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));)
 
     /* Need to process all the deferred messages enqueued since sending the
        SIR_HAL_AGGR_ADD_TS_REQ */
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c b/wlan/prima/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
index 4ca42d3..2a3477d 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -40,7 +40,7 @@
 #include "palTypes.h"
 #include "aniGlobal.h"
 #include "sirCommon.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "limUtils.h"
 #include "limAssocUtils.h"
 #include "limStaHashApi.h"
@@ -49,9 +49,6 @@
 #include "limSendMessages.h"
 #include "limSession.h"
 #include "limIbssPeerMgmt.h"
-#ifdef WLAN_FEATURE_RMC
-#include "limRMC.h"
-#endif
 
 
 /**
@@ -208,7 +205,7 @@
 
     /* Collect peer VHT capabilities based on the received beacon from the peer */
 #ifdef WLAN_FEATURE_11AC
-    if (IS_BSS_VHT_CAPABLE(pBeacon->VHTCaps))
+    if ( pBeacon->VHTCaps.present )
     {
         pPeer->vhtSupportedChannelWidthSet = pBeacon->VHTOperation.chanWidth;
         pPeer->vhtCapable = pBeacon->VHTCaps.present;
@@ -262,7 +259,6 @@
         {
             pStaDs->htGreenfield = pPeerNode->htGreenfield;
             pStaDs->htSupportedChannelWidthSet =  pPeerNode->htSupportedChannelWidthSet;
-            pStaDs->htSecondaryChannelOffset =  pPeerNode->htSecondaryChannelOffset;
             pStaDs->htMIMOPSState =             pPeerNode->htMIMOPSState;
             pStaDs->htMaxAmsduLength =  pPeerNode->htMaxAmsduLength;
             pStaDs->htAMpduDensity =             pPeerNode->htAMpduDensity;
@@ -660,7 +656,7 @@
                  (tANI_U8 *) &psessionEntry->pLimStartBssReq->ssId,
                   psessionEntry->pLimStartBssReq->ssId.length + 1);
 
-    limLog(pMac, LOG1, FL("invoking ADD_BSS as part of coalescing!"));
+    PELOG1(limLog(pMac, LOG1, FL("invoking ADD_BSS as part of coalescing!"));)
     if (limMlmAddBss(pMac, &mlmStartReq,psessionEntry) != eSIR_SME_SUCCESS)
     {
         PELOGE(limLog(pMac, LOGE, FL("AddBss failure"));)
@@ -823,10 +819,6 @@
 limIbssDelete(
     tpAniSirGlobal pMac,tpPESession psessionEntry)
 {
-#ifdef WLAN_FEATURE_RMC
-    limRmcIbssDelete(pMac);
-#endif /* WLAN_FEATURE_RMC */
-
     limIbssDeleteAllPeers(pMac,psessionEntry);
 
     ibss_coalesce_free(pMac);
@@ -913,7 +905,7 @@
 
     if(!pMac->lim.cfgProtection.fromllb)
     {
-        limLog(pMac, LOG1, FL("protection from 11b is disabled"));
+        PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
         return;
     }
 
@@ -954,21 +946,21 @@
 {
   tANI_U32 i;
 
-  limLog(pMac,LOG1, FL("A STA is associated:"));
+  PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
   limLog(pMac,LOG1, FL("Addr : "));
-  limPrintMacAddr(pMac, peerMacAddr, LOG1);
+  limPrintMacAddr(pMac, peerMacAddr, LOG1);)
 
   for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
   {
       if (pMac->lim.protStaCache[i].active)
       {
-          limLog(pMac, LOG1, FL("Addr: "));
-          limPrintMacAddr(pMac, pMac->lim.protStaCache[i].addr, LOG1);
+          PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
+          PELOG1(limPrintMacAddr(pMac, pMac->lim.protStaCache[i].addr, LOG1);)
 
           if (vos_mem_compare(pMac->lim.protStaCache[i].addr,
               peerMacAddr, sizeof(tSirMacAddr)))
           {
-              limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);
+              PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
               return;
           }
       }
@@ -1148,93 +1140,6 @@
     return retCode;
 }
 
-static void
-__limIbssSearchAndDeletePeer(tpAniSirGlobal    pMac,
-                             tpPESession psessionEntry,
-                             tSirMacAddr macAddr)
-{
-   tLimIbssPeerNode *pTempNode, *pPrevNode;
-   tLimIbssPeerNode *pTempNextNode = NULL;
-   tpDphHashNode     pStaDs=NULL;
-   tANI_U16          peerIdx=0;
-   tANI_U16          staIndex=0;
-   tANI_U8           ucUcastSig;
-   tANI_U8           ucBcastSig;
-
-   pPrevNode = pTempNode  = pMac->lim.gLimIbssPeerList;
-
-   limLog(pMac, LOG1,
-       FL(" PEER ADDR :" MAC_ADDRESS_STR ),MAC_ADDR_ARRAY(macAddr));
-
-   /** Compare Peer */
-   while (NULL != pTempNode)
-   {
-      pTempNextNode = pTempNode->next;
-
-      /* Delete the STA with MAC address */
-      if (vos_mem_compare( (tANI_U8 *) macAddr,
-               (tANI_U8 *) &pTempNode->peerMacAddr,
-               sizeof(tSirMacAddr)) )
-      {
-         pStaDs = dphLookupHashEntry(pMac, macAddr,
-               &peerIdx, &psessionEntry->dph.dphHashTable);
-         if (pStaDs)
-         {
-            staIndex = pStaDs->staIndex;
-            ucUcastSig = pStaDs->ucUcastSig;
-            ucBcastSig = pStaDs->ucBcastSig;
-
-#ifdef WLAN_FEATURE_RMC
-            limRmcTransmitterDelete(pMac, pStaDs->staAddr);
-#endif /* WLAN_FEATURE_RMC */
-
-            /* Send DEL STA only if STA id is valid, mean ADD STA was
-             * success.
-             */
-            if(HAL_STA_INVALID_IDX != staIndex)
-               limDelSta(pMac, pStaDs, false /*asynchronous*/, psessionEntry);
-            limDeleteDphHashEntry(pMac,
-                                     pStaDs->staAddr, peerIdx, psessionEntry);
-            limReleasePeerIdx(pMac, peerIdx, psessionEntry);
-
-            /* Send indication to upper layers only if ADD STA was success
-             * i.e staid is Valid.
-             */
-            if(HAL_STA_INVALID_IDX != staIndex)
-                ibss_status_chg_notify(pMac, macAddr, staIndex,
-                                   ucUcastSig, ucBcastSig,
-                                   eWNI_SME_IBSS_PEER_DEPARTED_IND,
-                                   psessionEntry->smeSessionId );
-            if (pTempNode == pMac->lim.gLimIbssPeerList)
-            {
-               pMac->lim.gLimIbssPeerList = pTempNode->next;
-               pPrevNode = pMac->lim.gLimIbssPeerList;
-            }
-            else
-               pPrevNode->next = pTempNode->next;
-
-            vos_mem_free(pTempNode);
-            pMac->lim.gLimNumIbssPeers--;
-
-            pTempNode = pTempNextNode;
-            break;
-         }
-      }
-      pPrevNode = pTempNode;
-      pTempNode = pTempNextNode;
-   }
-   /*
-    * if it is the last peer walking out, we better
-    * we set IBSS state to inactive.
-    */
-   if (0 == pMac->lim.gLimNumIbssPeers)
-   {
-       VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
-            "Last STA from IBSS walked out");
-       psessionEntry->limIbssActive = false;
-   }
-}
-
 /* handle the response from HAL for an ADD STA request */
 tSirRetStatus
 limIbssAddStaRsp(
@@ -1252,25 +1157,19 @@
         return eSIR_FAILURE;
     }
 
-    pStaDs = dphLookupHashEntry(pMac,
-                pAddStaParams->staMac, &peerIdx,
-                  &psessionEntry->dph.dphHashTable);
+    pStaDs = dphLookupHashEntry(pMac, pAddStaParams->staMac, &peerIdx, &psessionEntry->dph.dphHashTable);
     if (pStaDs == NULL)
     {
-        limLog(pMac, LOGE,
-           FL("IBSS: ADD_STA_RSP for unknown MAC addr: "MAC_ADDRESS_STR),
-           MAC_ADDR_ARRAY(pAddStaParams->staMac));
+        PELOGE(limLog(pMac, LOGE, FL("IBSS: ADD_STA_RSP for unknown MAC addr "));)
+        limPrintMacAddr(pMac, pAddStaParams->staMac, LOGE);
         vos_mem_free(pAddStaParams);
         return eSIR_FAILURE;
     }
 
     if (pAddStaParams->status != eHAL_STATUS_SUCCESS)
     {
-        limLog(pMac, LOGE,
-          FL("IBSS: ADD_STA_RSP error (%x) from MAC: " MAC_ADDRESS_STR),
-          pAddStaParams->status, MAC_ADDR_ARRAY(pAddStaParams->staMac));
-        __limIbssSearchAndDeletePeer(pMac,
-                      psessionEntry, pAddStaParams->staMac);
+        PELOGE(limLog(pMac, LOGE, FL("IBSS: ADD_STA_RSP error (%x) "), pAddStaParams->status);)
+        limPrintMacAddr(pMac, pAddStaParams->staMac, LOGE);
         vos_mem_free(pAddStaParams);
         return eSIR_FAILURE;
     }
@@ -1284,15 +1183,10 @@
 
     PELOGW(limLog(pMac, LOGW, FL("IBSS: sending IBSS_NEW_PEER msg to SME!"));)
 
-    ibss_status_chg_notify(pMac, pAddStaParams->staMac, pStaDs->staIndex,
+    ibss_status_chg_notify(pMac, pAddStaParams->staMac, pStaDs->staIndex, 
                            pStaDs->ucUcastSig, pStaDs->ucBcastSig,
                            eWNI_SME_IBSS_NEW_PEER_IND,
                            psessionEntry->smeSessionId);
-
-#ifdef WLAN_FEATURE_RMC
-    limRmcTriggerRulerSelection(pMac, psessionEntry->selfMacAddr);
-#endif
-
     vos_mem_free(pAddStaParams);
 
     return eSIR_SUCCESS;
@@ -1371,6 +1265,8 @@
     ibss_coalesce_free(pMac);
 }
 
+
+
 void
 limIbssDelBssRsp(
     tpAniSirGlobal  pMac,
@@ -1456,6 +1352,80 @@
     }
 }
 
+static void
+__limIbssSearchAndDeletePeer(tpAniSirGlobal    pMac,
+                             tpPESession psessionEntry,
+                             tSirMacAddr macAddr)
+{
+   tLimIbssPeerNode *pTempNode, *pPrevNode;
+   tLimIbssPeerNode *pTempNextNode = NULL;
+   tpDphHashNode     pStaDs=NULL;
+   tANI_U16          peerIdx=0;
+   tANI_U16          staIndex=0;
+   tANI_U8           ucUcastSig;
+   tANI_U8           ucBcastSig;
+
+   pPrevNode = pTempNode  = pMac->lim.gLimIbssPeerList;
+
+   limLog(pMac, LOG1, FL(" PEER ADDR :" MAC_ADDRESS_STR ),MAC_ADDR_ARRAY(macAddr));
+
+   /** Compare Peer */
+   while (NULL != pTempNode)
+   {
+      pTempNextNode = pTempNode->next;
+
+      /* Delete the STA with MAC address */
+      if (vos_mem_compare( (tANI_U8 *) macAddr,
+               (tANI_U8 *) &pTempNode->peerMacAddr,
+               sizeof(tSirMacAddr)) )
+      {
+         pStaDs = dphLookupHashEntry(pMac, macAddr,
+               &peerIdx, &psessionEntry->dph.dphHashTable);
+         if (pStaDs)
+         {
+            staIndex = pStaDs->staIndex;
+            ucUcastSig = pStaDs->ucUcastSig;
+            ucBcastSig = pStaDs->ucBcastSig;
+
+            (void) limDelSta(pMac, pStaDs, false /*asynchronous*/, psessionEntry);
+            limDeleteDphHashEntry(pMac, pStaDs->staAddr, peerIdx, psessionEntry);
+            limReleasePeerIdx(pMac, peerIdx, psessionEntry);
+
+            /* Send indication to upper layers */
+            ibss_status_chg_notify(pMac, macAddr, staIndex,
+                                   ucUcastSig, ucBcastSig,
+                                   eWNI_SME_IBSS_PEER_DEPARTED_IND,
+                                   psessionEntry->smeSessionId );
+            if (pTempNode == pMac->lim.gLimIbssPeerList)
+            {
+               pMac->lim.gLimIbssPeerList = pTempNode->next;
+               pPrevNode = pMac->lim.gLimIbssPeerList;
+            }
+            else
+               pPrevNode->next = pTempNode->next;
+
+            vos_mem_free(pTempNode);
+            pMac->lim.gLimNumIbssPeers--;
+
+            pTempNode = pTempNextNode;
+            break;
+         }
+      }
+      pPrevNode = pTempNode;
+      pTempNode = pTempNextNode;
+   }
+   /*
+    * if it is the last peer walking out, we better
+    * we set IBSS state to inactive.
+    */
+   if (0 == pMac->lim.gLimNumIbssPeers)
+   {
+       VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+            "Last STA from IBSS walked out");
+       psessionEntry->limIbssActive = false;
+   }
+}
+
 /**
  * limIbssCoalesce()
  *
@@ -1490,7 +1460,7 @@
     tSirMacAddr         currentBssId;
     tLimIbssPeerNode    *pPeerNode;
     tpDphHashNode       pStaDs;
-    tUpdateBeaconParams beaconParams;
+    tUpdateBeaconParams beaconParams; 
 
     vos_mem_set((tANI_U8 *)&beaconParams, sizeof(tUpdateBeaconParams), 0);
 
@@ -1563,12 +1533,8 @@
          * pMac->lim.gLimIbssStaLimit
          */
         if ((pMac->lim.gLimNumIbssPeers+1) >= pMac->lim.gLimIbssStaLimit)
-        {   /*Print every 100th time */
-            if (pMac->lim.gLimIbssRetryCnt % 100 == 0)
-            {
-               limLog(pMac, LOG1, FL("**** MAX STA LIMIT HAS REACHED ****"));
-            }
-            pMac->lim.gLimIbssRetryCnt++;
+        {
+            PELOGE(limLog(pMac, LOGE, FL("**** MAX STA LIMIT HAS REACHED ****"));)
             return eSIR_LIM_MAX_STA_REACHED_ERROR;
         }
         PELOGW(limLog(pMac, LOGW, FL("IBSS Peer node does not exist, adding it***"));)
@@ -1602,8 +1568,8 @@
         if (pStaDs != NULL)
         {
             /// DPH node already exists for the peer
-            limLog(pMac, LOG1, FL("DPH Node present for just learned peer"));
-            limPrintMacAddr(pMac, pPeerNode->peerMacAddr, LOG1);
+            PELOGW(limLog(pMac, LOGW, FL("DPH Node present for just learned peer"));)
+            PELOG1(limPrintMacAddr(pMac, pPeerNode->peerMacAddr, LOG1);)
             ibss_sta_info_update(pMac, pStaDs, pPeerNode,psessionEntry);
             return eSIR_SUCCESS;
         }
@@ -1708,10 +1674,6 @@
                     ucUcastSig = pStaDs->ucUcastSig;
                     ucBcastSig = pStaDs->ucBcastSig;
 
-#ifdef WLAN_FEATURE_RMC
-                    limRmcTransmitterDelete(pMac, pStaDs->staAddr);
-#endif /* WLAN_FEATURE_RMC */
-
                     (void) limDelSta(pMac, pStaDs, false /*asynchronous*/,psessionEntry);
                     limDeleteDphHashEntry(pMac, pStaDs->staAddr, peerIdx,psessionEntry);
                     limReleasePeerIdx(pMac, peerIdx, psessionEntry);
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c b/wlan/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
index 94aa90f..d10f72e 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,7 +38,7 @@
  */
 
 #include "aniGlobal.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "cfgApi.h"
 
 
@@ -144,8 +144,8 @@
              if((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) ||
                      (eLIM_AP_ROLE == psessionEntry->limSystemRole))
              {
-                 limLog(pMac, LOG1, FL("SAP:lim Delete Station Context (staId: %d, assocId: %d) "),
-                             pMsg->staId, pMsg->assocId);
+                 PELOG1(limLog(pMac, LOG1, FL("SAP:lim Delete Station Context (staId: %d, assocId: %d) "),
+                             pMsg->staId, pMsg->assocId);)
                  /*
                   * Check if Deauth/Disassoc is triggered from Host.
                   * If mlmState is in some transient state then
@@ -166,12 +166,7 @@
                      return;
                  }
                  else
-                 {
-                     limSendDisassocMgmtFrame(pMac,
-                                     eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
-                                     pStaDs->staAddr, psessionEntry, FALSE);
                      limTriggerSTAdeletion(pMac, pStaDs, psessionEntry);
-                 }
              }
              else
              {
@@ -231,14 +226,14 @@
                         eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
                     pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DEAUTH;
 
-                    if (pStaDs->isDisassocDeauthInProgress)
-                    {
-                        limLog(pMac, LOGE, FL("No need to cleanup as already"
-                               "disassoc or deauth in progress"));
-                        return;
-                    }
-                    else
-                        pStaDs->isDisassocDeauthInProgress++;
+                   /** Set state to mlm State to eLIM_MLM_WT_DEL_STA_RSP_STATE
+                    * This is to address the issue of race condition between
+                    * disconnect request from the HDD and deauth from
+                    * Tx inactivity timer by FWR. This will make sure that we will not
+                    * process disassoc if deauth is in progress for the station
+                    * and thus mlmStaContext.cleanupTrigger will not be overwritten.
+                    */
+                    pStaDs->mlmStaContext.mlmState   = eLIM_MLM_WT_DEL_STA_RSP_STATE;
 
                     // Issue Deauth Indication to SME.
                     vos_mem_copy((tANI_U8 *) &mlmDeauthInd.peerMacAddr,
@@ -295,37 +290,81 @@
 void
 limTriggerSTAdeletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
 {
-    tLimMlmDisassocInd mlmDisassocInd;
+    tSirSmeDeauthReq    *pSmeDeauthReq;
+    tANI_U8             *pBuf;
+    tANI_U8             *pLen;
+    tANI_U16            msgLength = 0;
+
+    if (! pStaDs)
+    {
+        PELOGW(limLog(pMac, LOGW, FL("Skip STA deletion (invalid STA)"));)
+        return;
+    }
+    /**
+     * MAC based Authentication was used. Trigger
+     * Deauthentication frame to peer since it will
+     * take care of disassociation as well.
+     */
+
+    pSmeDeauthReq = vos_mem_malloc(sizeof(tSirSmeDeauthReq));
+    if (NULL == pSmeDeauthReq)
+    {
+        limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DEAUTH_REQ "));
+        return;
+    }
+
+    pBuf = (tANI_U8 *) &pSmeDeauthReq->messageType;
+
+    //messageType
+    limCopyU16((tANI_U8*)pBuf, eWNI_SME_DISASSOC_REQ);
+    pBuf += sizeof(tANI_U16);
+    msgLength += sizeof(tANI_U16);
+
+    //length
+    pLen = pBuf;
+    pBuf += sizeof(tANI_U16);
+    msgLength += sizeof(tANI_U16);
+
+    //sessionId
+    *pBuf = psessionEntry->smeSessionId;
+    pBuf++;
+    msgLength++;
+
+    //transactionId
+    limCopyU16((tANI_U8*)pBuf, psessionEntry->transactionId);
+    pBuf += sizeof(tANI_U16);
+    msgLength += sizeof(tANI_U16);
+
+    //bssId
+    vos_mem_copy(pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
+    pBuf += sizeof(tSirMacAddr);
+    msgLength += sizeof(tSirMacAddr);
+
+    //peerMacAddr
+    vos_mem_copy(pBuf, pStaDs->staAddr, sizeof(tSirMacAddr));
+    pBuf += sizeof(tSirMacAddr);
+    msgLength += sizeof(tSirMacAddr);
+
+    //reasonCode 
+    limCopyU16((tANI_U8*)pBuf, (tANI_U16)eLIM_LINK_MONITORING_DISASSOC);
+    pBuf += sizeof(tANI_U16);
+    msgLength += sizeof(tANI_U16);
+
+    //Do not send disassoc OTA
+    //pBuf[0] = 1 means do not send the disassoc frame over the air
+    //pBuf[0] = 0 means send the disassoc frame over the air
+    pBuf[0]= 0;
+    pBuf += sizeof(tANI_U8);
+    msgLength += sizeof(tANI_U8);
 
 
-     if (!pStaDs)
-     {
-         PELOGW(limLog(pMac, LOGW, FL("Skip STA deletion (invalid STA)"));)
-         return;
-     }
+  
+    //Fill in length
+    limCopyU16((tANI_U8*)pLen , msgLength);
 
-     if ((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
-         (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE)) {
-         /* Already in the process of deleting context for the peer */
-         PELOGE(limLog(pMac, LOGE,
-                 FL("Deletion is in progress for peer:%pM"), pStaDs->staAddr);)
-         return;
-     }
+    limPostSmeMessage(pMac, eWNI_SME_DISASSOC_REQ, (tANI_U32 *) pSmeDeauthReq);
+    vos_mem_free(pSmeDeauthReq);
 
-     pStaDs->mlmStaContext.disassocReason =
-              eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
-     pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DISASSOC;
-     vos_mem_copy(&mlmDisassocInd.peerMacAddr, pStaDs->staAddr,
-                  sizeof(tSirMacAddr));
-     mlmDisassocInd.reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
-     mlmDisassocInd.disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
-
-     /* Update PE session Id  */
-     mlmDisassocInd.sessionId = psessionEntry->peSessionId;
-     limPostSmeMessage(pMac, LIM_MLM_DISASSOC_IND,
-                       (tANI_U32 *) &mlmDisassocInd);
-     // Issue Disassoc Indication to SME.
-     limSendSmeDisassocInd(pMac, pStaDs, psessionEntry);
 } /*** end limTriggerSTAdeletion() ***/
 
 
@@ -528,8 +567,8 @@
             * or in states other than link-established state.
             * Log error.
             */
-        limLog(pMac, LOG1, FL("received heartbeat timeout in state %d"),
-               psessionEntry->limMlmState);
+        PELOG1(limLog(pMac, LOG1, FL("received heartbeat timeout in state %d"),
+               psessionEntry->limMlmState);)
         limPrintMlmState(pMac, LOG1, psessionEntry->limMlmState);
         pMac->lim.gLimHBfailureCntInOtherStates++;
         limReactivateHeartBeatTimer(pMac, psessionEntry);
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limLogDump.c b/wlan/prima/CORE/MAC/src/pe/lim/limLogDump.c
index 9280c7d..a43afa0 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limLogDump.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limLogDump.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,6 +33,9 @@
 
 Implements the dump commands specific to the lim module. 
 
+Copyright (c) 2007 QUALCOMM Incorporated.
+All Rights Reserved.
+Qualcomm Confidential and Proprietary
  ============================================================================*/
 
 #include "vos_types.h"
@@ -57,10 +60,6 @@
 #endif
 #include "smeInside.h"
 #include "wlan_qct_wda.h"
-#ifdef WLAN_FEATURE_RMC
-#include "wlan_qct_tl.h"
-#include "limRMC.h"
-#endif
 #include "wlan_qct_wdi_dts.h"
 
 void WDA_TimerTrafficStatsInd(tWDA_CbContext *pWDA);
@@ -1212,7 +1211,7 @@
         state = (tSirMacHTMIMOPowerSaveState) arg1;
 
     pMBMsg = vos_mem_malloc(WNI_CFG_MB_HDR_LEN + sizeof(tSirMacHTMIMOPowerSaveState));
-    if (NULL == pMBMsg)
+    if(NULL == pMBMsg)
     {
         p += log_sprintf( pMac,p, "pMBMsg is NULL\n");
         return p;
@@ -1520,8 +1519,6 @@
         case 5:
             statsMask = PE_PER_STA_STATS_INFO;
             break;
-        case 6:
-            statsMask = PE_PER_TX_PKT_STATS_INFO;
         default:
             return p;
     }
@@ -2372,102 +2369,6 @@
 }
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-
-static char *
-dump_lim_enable_rmc_data_path
-(
-    tpAniSirGlobal pMac,
-    tANI_U32 arg1,
-    tANI_U32 arg2,
-    tANI_U32 arg3,
-    tANI_U32 arg4,
-    char *p
-)
-{
-    v_MACADDR_t rmcTransmitterAddr;
-    v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_WDA, NULL);
-
-    rmcTransmitterAddr.bytes[0] = (tANI_U8)((arg1 & 0xFF000000) >> 24);
-    rmcTransmitterAddr.bytes[1] = (tANI_U8)((arg1 & 0x00FF0000) >> 16);
-    rmcTransmitterAddr.bytes[2] = (tANI_U8)((arg1 & 0x0000FF00) >>  8);
-    rmcTransmitterAddr.bytes[3] = (tANI_U8)((arg1 & 0x000000FF));
-    rmcTransmitterAddr.bytes[4] = (tANI_U8)((arg2 & 0xFF000000) >> 24);
-    rmcTransmitterAddr.bytes[5] = (tANI_U8)((arg2 & 0x00FF0000) >> 16);
-
-    limLog(pMac, LOGE,
-        FL("Enable RMC data path for MCAST transmitter:" MAC_ADDRESS_STR),
-        MAC_ADDR_ARRAY( rmcTransmitterAddr.bytes));
-
-    /*Input format is in MAC address fromat for example
-      iwpriv wlan0 dump 0xaabbccdd 0xeeff0000 translates into enable RMC for
-      MAC address 0xaa:0xbb:0xcc:0xdd:0xee:0xff*/
-
-    /*Enable TL data path*/
-    WLANTL_EnableRMC( pVosContext, &rmcTransmitterAddr );
-
-  return p;
-}
-
-static char *
-dump_lim_disable_rmc_data_path
-(
-    tpAniSirGlobal pMac,
-    tANI_U32 arg1,
-    tANI_U32 arg2,
-    tANI_U32 arg3,
-    tANI_U32 arg4,
-    char *p
-)
-{
-    v_MACADDR_t rmcTransmitterAddr;
-    v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_WDA, NULL);
-
-    rmcTransmitterAddr.bytes[0] = (tANI_U8)((arg1 & 0xFF000000) >> 24);
-    rmcTransmitterAddr.bytes[1] = (tANI_U8)((arg1 & 0x00FF0000) >> 16);
-    rmcTransmitterAddr.bytes[2] = (tANI_U8)((arg1 & 0x0000FF00) >>  8);
-    rmcTransmitterAddr.bytes[3] = (tANI_U8)((arg1 & 0x000000FF));
-    rmcTransmitterAddr.bytes[4] = (tANI_U8)((arg2 & 0xFF000000) >> 24);
-    rmcTransmitterAddr.bytes[5] = (tANI_U8)((arg2 & 0x00FF0000) >> 16);
-
-
-    limLog(pMac, LOGE,
-        FL("Disable RMC data path for MCAST transmitter:" MAC_ADDRESS_STR),
-        MAC_ADDR_ARRAY( rmcTransmitterAddr.bytes));
-
-    /*Input format is in MAC address fromat for example
-      iwpriv wlan0 dump 0xaabbccdd 0xeeff0000 translates into enable RMC for
-      MAC address 0xaa:0xbb:0xcc:0xdd:0xee:0xff*/
-
-    /*Disable TL data path*/
-    WLANTL_DisableRMC( pVosContext, &rmcTransmitterAddr );
-
-    return p;
-}
-
-static char *
-dump_lim_rmc_status(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2,
-             tANI_U32 arg3, tANI_U32 arg4, char *p)
-{
-    limRmcDumpStatus(pMac);
-    return p;
-}
-
-static char *
-dump_set_mcast_dup_detect(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2,
-             tANI_U32 arg3, tANI_U32 arg4, char *p)
-{
-    v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_WDA, NULL);
-    v_U8_t enable;
-
-    enable = (tANI_U8)arg1;
-
-    /* Enable or Disable Multicast Duplicate Detection */
-    WLANTL_SetMcastDuplicateDetection( pVosContext, enable);
-
-    return p;
-}
-#endif /* WLAN_FEATURE_RMC */
 
 static char *
 dump_set_max_probe_req(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2,
@@ -2567,17 +2468,7 @@
     {369,   "PE.LIM: pkts/rateIdx: iwpriv wlan0 dump 368 <staId> <boolean to flush counter>",    dump_lim_get_pkts_rcvd_per_rate_idx},
     {370,   "PE.LIM: pkts/rssi: : iwpriv wlan0 dump 369 <staId> <boolean to flush counter>",    dump_lim_get_pkts_rcvd_per_rssi_values},
 #endif
-#ifdef WLAN_FEATURE_RMC
-    {371,   "PE.LIM: Enable RMC data path in TL for input MCAST addr",
-        dump_lim_enable_rmc_data_path },
-    {372,   "PE.LIM: Disable RMC data path in TL for input MCAST addr",
-        dump_lim_disable_rmc_data_path },
-    {373,   "PE.LIM: Dump RMC transmitter and ruler status", dump_lim_rmc_status },
-#endif /* WLAN_FEATURE_RMC */
     {374,   "PE.LIM: MAS RX stats MAC eff <MAC eff in percentage>",  dump_limRateInfoBasedOnMacEff},
-#ifdef WLAN_FEATURE_RMC
-    {375,   "PE.LIM: Enable(1)/Disable(0) RMC duplicate detection", dump_set_mcast_dup_detect },
-#endif /* WLAN_FEATURE_RMC */
     {376,   "PE.LIM: max number of probe per scan", dump_set_max_probe_req },
 };
 
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limP2P.c b/wlan/prima/CORE/MAC/src/pe/lim/limP2P.c
index d3028fe..f31f324 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limP2P.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limP2P.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,6 +33,9 @@
   This software unit holds the implementation of the WLAN Protocol Engine for
   P2P.
 
+  Copyright (c) 2011 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
@@ -86,7 +89,7 @@
                          tpSetLinkStateCallback callback, void *callbackArg);
 
 static tSirRetStatus limCreateSessionForRemainOnChn(tpAniSirGlobal pMac, tPESession **ppP2pSession);
-eHalStatus limP2PActionCnf(tpAniSirGlobal pMac, void *pData);
+eHalStatus limP2PActionCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess);
 
 /*----------------------------------------------------------------------------
  *
@@ -342,8 +345,7 @@
         }
         /* Store PE sessionId in session Table  */
         psessionEntry->peSessionId = sessionId;
-        /* Store SME session Id in sessionTable */
-        psessionEntry->smeSessionId = pMac->lim.gpLimRemainOnChanReq->sessionId;
+
         psessionEntry->limSystemRole = eLIM_P2P_DEVICE_ROLE;
         CFG_GET_STR( nSirStatus, pMac,  WNI_CFG_SUPPORTED_RATES_11A,
                psessionEntry->rateSet.rate, val , SIR_MAC_MAX_NUMBER_OF_RATES );
@@ -671,8 +673,6 @@
     tANI_U8             sessionId;
     tSirRemainOnChnReq *MsgRemainonChannel = pMac->lim.gpLimRemainOnChanReq;
     tSirMacAddr             nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-    tANI_U32 txStatus = 0;
-    tSirTxBdStatus txBdStatus = {0};
 
     if ( NULL == MsgRemainonChannel )
     {
@@ -687,6 +687,9 @@
     //Cleanup Everything
     if(eHAL_STATUS_FAILURE == status)
     {
+       //Deactivate Remain on Channel Timer
+       limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
+
        //Set the Link State to Idle
        /* get the previous valid LINK state */
        if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
@@ -697,7 +700,6 @@
 
        pMac->lim.gLimSystemInScanLearnMode = 0;
        pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
-       SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
     }
 
     /* delete the session */
@@ -723,13 +725,9 @@
      * indicaiton confirmation with status failure */
     if (pMac->lim.mgmtFrameSessionId != 0xff)
     {
-        limLog(pMac, LOGE,
-                FL("Remain on channel expired, Action frame status failure"));
-
-        if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
-            limP2PActionCnf(pMac, &txBdStatus);
-        else
-            limP2PActionCnf(pMac, &txStatus);
+       limLog(pMac, LOGE,
+              FL("Remain on channel expired, Action frame status failure"));
+       limP2PActionCnf(pMac, 0);
     }
 
     return;
@@ -746,6 +744,7 @@
                     tANI_U8 *pRxPacketInfo, tpPESession psessionEntry,
                     tANI_S8 rxRssi)
 {
+    tSirMsgQ              mmhMsg;
     tpSirSmeMgmtFrameInd  pSirSmeMgmtFrame = NULL;
     tANI_U16              length;
     tANI_U8               frameType;
@@ -770,7 +769,8 @@
     }
     vos_mem_set((void*)pSirSmeMgmtFrame, length, 0);
 
-    pSirSmeMgmtFrame->frameLen = frameLen;
+    pSirSmeMgmtFrame->mesgType = eWNI_SME_MGMT_FRM_IND;
+    pSirSmeMgmtFrame->mesgLen = length;
     pSirSmeMgmtFrame->sessionId = sessionId;
     pSirSmeMgmtFrame->frameType = frameType;
     pSirSmeMgmtFrame->rxRssi = rxRssi;
@@ -830,49 +830,20 @@
     vos_mem_zero(pSirSmeMgmtFrame->frameBuf, frameLen);
     vos_mem_copy(pSirSmeMgmtFrame->frameBuf, frame, frameLen);
 
-    if (pMac->mgmt_frame_ind_cb)
-       pMac->mgmt_frame_ind_cb(pSirSmeMgmtFrame);
-    else
-    {
-       limLog(pMac, LOGW,
-               FL("Management indication callback not registered!!"));
-    }
-    vos_mem_free(pSirSmeMgmtFrame);
+    mmhMsg.type = eWNI_SME_MGMT_FRM_IND;
+    mmhMsg.bodyptr = pSirSmeMgmtFrame;
+    mmhMsg.bodyval = 0;
+
+    limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
     return;
 } /*** end limSendSmeListenRsp() ***/
 
 
-eHalStatus limP2PActionCnf(tpAniSirGlobal pMac, void *pData)
+eHalStatus limP2PActionCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess)
 {
-    tANI_U32 txCompleteSuccess;
-    tpSirTxBdStatus pTxBdStatus;
-
-    if (!pData)
-    {
-        limLog(pMac, LOG1,
-                FL(" pData is NULL"));
-        return eHAL_STATUS_FAILURE;
-    }
-
-    if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
-    {
-        pTxBdStatus = (tpSirTxBdStatus) pData;
-        txCompleteSuccess = pTxBdStatus->txCompleteStatus;
-
-        limLog(pMac, LOG1,
-                FL("txCompleteSuccess %d, Token %u, Session Id %d"),
-                txCompleteSuccess, pTxBdStatus->txBdToken,
-                pMac->lim.mgmtFrameSessionId);
-    }
-    else
-    {
-        txCompleteSuccess = *((tANI_U32*) pData);
-
-        limLog(pMac, LOG1,
-                FL(" %s txCompleteSuccess %d, Session Id %d"),
-                __func__, txCompleteSuccess, pMac->lim.mgmtFrameSessionId);
-    }
-
+    limLog(pMac, LOG1,
+              FL(" %s txCompleteSuccess %d, Session Id %d"),
+              __func__, txCompleteSuccess, pMac->lim.mgmtFrameSessionId);
     if (pMac->lim.mgmtFrameSessionId != 0xff)
     {
         /* The session entry might be invalid(0xff) action confirmation received after
@@ -893,7 +864,6 @@
     tDot11fIEHTCaps     dot11HtCap;
 
     PopulateDot11fHTCaps(pMac, psessionEntry, &dot11HtCap);
-
     pIe = limGetIEPtr(pMac,pIeStartPtr, nBytes,
                                        DOT11F_EID_HTCAPS,ONE_BYTE);
     limLog( pMac, LOG2, FL("pIe %p dot11HtCap.supportedMCSSet[0]=0x%x"),
@@ -1128,7 +1098,7 @@
             if (pMac->lim.gpLimRemainOnChanReq == NULL)
             {
                 limLog( pMac, LOGE,
-                        FL("Failed to Send Action frame"));
+                        FL("Failed to Send Action frame \n"));
                 limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF,
                               eHAL_STATUS_FAILURE, pMbMsg->sessionId, 0);
                 return;
@@ -1168,19 +1138,58 @@
 
 #ifdef WLAN_FEATURE_11W
     pActionHdr = (tpSirMacActionFrameHdr) (pFrame + sizeof(tSirMacMgmtHdr));
-    pMacHdr = (tpSirMacMgmtHdr)pFrame;
 
     /*
-     * Setting Protected bit only for Robust Action Frames
+     * Setting Protected bit for SA_QUERY Action Frame
      * This has to be based on the current Connection with the station
-     * limSetProtectedBit API will set the protected bit if connection is PMF
+     * limSetProtectedBit API will set the protected bit if connection if PMF
      */
-    if ((SIR_MAC_MGMT_ACTION == pFc->subType) &&
-        psessionEntry->limRmfEnabled && (!limIsGroupAddr(pMacHdr->da)) &&
-        lim_is_robust_mgmt_action_frame(pActionHdr->category)) {
-        /* All psession checks are already done at start */
-        limSetProtectedBit(pMac, psessionEntry, pMacHdr->da, pMacHdr);
 
+    if ((SIR_MAC_MGMT_ACTION == pFc->subType) &&
+        (SIR_MAC_ACTION_SA_QUERY == pActionHdr->category))
+    {
+        pMacHdr    = (tpSirMacMgmtHdr ) pFrame;
+        psessionEntry = peFindSessionByBssid(pMac,
+                        (tANI_U8*)pMbMsg->data + BSSID_OFFSET, &sessionId);
+
+        /* Check for session corresponding to ADDR2 ss supplicant is filling
+           ADDR2  with BSSID */
+        if(NULL == psessionEntry)
+        {
+            psessionEntry = peFindSessionByBssid(pMac,
+                       (tANI_U8*)pMbMsg->data + ADDR2_OFFSET, &sessionId);
+        }
+
+        if(NULL != psessionEntry)
+        {
+            limSetProtectedBit(pMac, psessionEntry, pMacHdr->da, pMacHdr);
+        }
+        else
+        {
+            limLog(pMac, LOGE,
+                FL("Dropping SA Query frame - Unable to find PE Session \n"));
+            limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF,
+                    eHAL_STATUS_FAILURE, pMbMsg->sessionId, 0);
+            palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+                    ( void* ) pFrame, ( void* ) pPacket );
+            return;
+        }
+
+        /*
+         * If wep bit is not set in MAC header then we are trying to
+         * send SA Query via non PMF connection. Drop the packet.
+         */
+
+        if(0 ==  pMacHdr->fc.wep)
+        {
+            limLog(pMac, LOGE,
+                FL("Dropping SA Query frame due to non PMF connection\n"));
+            limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF,
+                    eHAL_STATUS_FAILURE, pMbMsg->sessionId, 0);
+            palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
+                    ( void* ) pFrame, ( void* ) pPacket );
+            return;
+        }
     }
 #endif
 
@@ -1217,7 +1226,7 @@
         halstatus = halTxFrameWithTxComplete( pMac, pPacket, (tANI_U16)nBytes,
                         HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
                         7,/*SMAC_SWBD_TX_TID_MGMT_HIGH */ limTxComplete, pFrame,
-                        limP2PActionCnf, txFlag, pMac->lim.txBdToken++ );
+                        limP2PActionCnf, txFlag );
 
         if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
         {
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessActionFrame.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessActionFrame.c
index ab54e41..f0b4cdd 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessActionFrame.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessActionFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -42,7 +42,7 @@
 #include "wniApi.h"
 #include "sirApi.h"
 #include "aniGlobal.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "schApi.h"
 #include "utilsApi.h"
 #include "limTypes.h"
@@ -59,9 +59,6 @@
 #include "rrmApi.h"
 #endif
 #include "limSessionUtils.h"
-#ifdef WLAN_FEATURE_RMC
-#include "limRMC.h"
-#endif
 
 #if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
 #include "eseApi.h"
@@ -103,8 +100,8 @@
       return;
     }
 
-    limLog(pMac, LOG1, FL("Channel switch Mode == %d"),
-                       psessionEntry->gLimChannelSwitch.switchMode);
+    PELOG1(limLog(pMac, LOG1, FL("Channel switch Mode == %d"),
+                       psessionEntry->gLimChannelSwitch.switchMode);)
 
     if (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT ||
         psessionEntry->gLimChannelSwitch.switchCount <= SIR_CHANSW_TX_STOP_MAX_COUNT)
@@ -168,7 +165,7 @@
 ------------------------------------------------------------*/
 tSirRetStatus limStartChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
 {
-    limLog(pMac, LOG1, FL(" ENTER"));
+    PELOG1(limLog(pMac, LOG1, FL("Starting the channel switch"));)
     
     /*If channel switch is already running and it is on a different session, just return*/  
     /*This need to be removed for MCC */
@@ -178,11 +175,6 @@
        limLog(pMac, LOGW, FL("Ignoring channel switch on session %d"), psessionEntry->peSessionId);
        return eSIR_SUCCESS;
     }
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-    limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
-                       psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_CSA);
-#endif
-
     psessionEntry->channelChangeCSA =  LIM_SWITCH_CHANNEL_CSA;
     /* Deactivate and change reconfigure the timeout value */
     //limDeactivateAndChangeTimer(pMac, eLIM_CHANNEL_SWITCH_TIMER);
@@ -267,7 +259,7 @@
     pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
     frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
 
-    limLog(pMac, LOG1, FL("Received Channel switch action frame"));
+    PELOG3(limLog(pMac, LOG3, FL("Received Channel switch action frame"));)
     if (!psessionEntry->lim11hEnable)
         return;
 
@@ -331,8 +323,8 @@
         }
 #endif
 
-       limLog(pMac, LOG1, FL("Rcv Chnl Swtch Frame: Timeout in %d ticks"),
-                             psessionEntry->gLimChannelSwitch.switchTimeoutValue);
+       PELOG3(limLog(pMac, LOG3, FL("Rcv Chnl Swtch Frame: Timeout in %d ticks"),
+                             psessionEntry->gLimChannelSwitch.switchTimeoutValue);)
 
         /* Only primary channel switch element is present */
         psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
@@ -370,12 +362,12 @@
     }
     else
     {
-        limLog(pMac, LOG1, FL("LIM: Received action frame not from our BSS, dropping..."));
+        PELOG1(limLog(pMac, LOG1, FL("LIM: Received action frame not from our BSS, dropping..."));)
     }
 
     if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
     {
-        limLog(pMac, LOG1, FL("Could not start channel switch"));
+        PELOG1(limLog(pMac, LOG1, FL("Could not start channel switch"));)
     }
 
     vos_mem_free(pChannelSwitchFrame);
@@ -459,11 +451,6 @@
             frameLen);
     }
     pSta = dphLookupHashEntry(pMac, pHdr->sa, &aid, &psessionEntry->dph.dphHashTable);
-    if (pSta == NULL)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("Station context not found"));)
-        return;
-    }
     
     operMode = pSta->vhtSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_80MHZ : pSta->htSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
     if( operMode != pOperatingModeframe->OperatingMode.chanWidth)
@@ -771,15 +758,15 @@
             PELOGW(limLog(pMac, LOGW, FL("Ignoring delts request: wme not enabled/capable"));)
             return;
         }
-        limLog(pMac, LOG1, FL("WME Delts received"));
+        PELOG2(limLog(pMac, LOG2, FL("WME Delts received"));)
     }
     else if ((psessionEntry->limQosEnabled) && pSta->lleEnabled)
         {
-        limLog(pMac, LOG1, FL("11e QoS Delts received"));
+        PELOG2(limLog(pMac, LOG2, FL("11e QoS Delts received"));)
         }
     else if ((psessionEntry->limWsmEnabled) && pSta->wsmEnabled)
         {
-        limLog(pMac, LOG1, FL("WSM Delts received"));
+        PELOG2(limLog(pMac, LOG2, FL("WSM Delts received"));)
         }
     else
     {
@@ -884,7 +871,7 @@
     else
         limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
 
-    limLog(pMac, LOG1, FL("DeleteTS succeeded"));
+    PELOG1(limLog(pMac, LOG1, FL("DeleteTS succeeded"));)
 
 #ifdef FEATURE_WLAN_ESE
 #ifdef FEATURE_WLAN_ESE_UPLOAD
@@ -915,8 +902,7 @@
          FL("QosMapConfigure frame parsing failed (error %d)"), retval);)
          return;
      }
-     limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
-                                        pRxPacketInfo, psessionEntry, 0);
+     limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo, psessionEntry, 0);
 }
 
 #ifdef ANI_SUPPORT_11H
@@ -1087,8 +1073,8 @@
             break;
 
         default:
-            limLog(pMac, LOG1, FL("Unknown Measurement Type %d "),
-                   pMeasReqFrame->measReqIE.measType);
+            PELOG1(limLog(pMac, LOG1, FL("Unknown Measurement Type %d "),
+                   pMeasReqFrame->measReqIE.measType);)
             break;
     }
 
@@ -1120,7 +1106,7 @@
     pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
     frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
 
-    limLog(pMac, LOG1, FL("****LIM: Processing TPC Request from peer ****"));
+    PELOG1(limLog(pMac, LOG1, FL("****LIM: Processing TPC Request from peer ****"));)
 
     pTpcReqFrame = vos_mem_malloc(sizeof( tSirMacTpcReqActionFrame ));
     if (NULL == pTpcReqFrame)
@@ -1320,8 +1306,6 @@
     if (!(IS_HWSTA_IDX(pSta->staIndex)))
     {
         status = eSIR_MAC_REQ_DECLINED_STATUS;
-        limLog( pMac, LOG1,
-            FL( "ta Id is not HW Sta Id, Status code is %d " ), status);
         goto returnAfterError;
     }
 #endif //WLAN_SOFTAP_VSTA_FEATURE
@@ -1350,11 +1334,7 @@
                                               frmAddBAReq.AddBAParameterSet,
                                               0, //dialogue token is don't care in request validation.
                                               LIM_ADDBA_REQ, &delBAFlag)))
-    {
-        limLog( pMac, LOGE,
-            FL( "ADDBA parameters validation failed with status %d" ), status);
         goto returnAfterError;
-    }
 
     //BA already set, so we need to delete it before adding new one.
     if(delBAFlag)
@@ -1365,9 +1345,6 @@
             eBA_RECIPIENT,psessionEntry))
         {
             status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
-            limLog( pMac, LOGE,
-                FL( "Deletion of Existing BA session failed with status %d" ),
-                    status);
             goto returnAfterError;
         }
     }
@@ -1418,12 +1395,7 @@
         frmAddBAReq.BATimeout.timeout,
         (tANI_U16) frmAddBAReq.BAStartingSequenceControl.ssn,
         eBA_RECIPIENT,psessionEntry))
-  {
-        status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
-        limLog( pMac, LOGE,
-            FL( "Request to setup new BA session with peer "
-                " "MAC_ADDRESS_STR " failed" ), MAC_ADDR_ARRAY(pSta->staAddr));
-  }
+    status = eSIR_MAC_UNSPEC_FAILURE_STATUS;
   else
     return;
 
@@ -1491,7 +1463,6 @@
   // Request, so we should never be processing a ADDBA Response
   if (!(IS_HWSTA_IDX(pSta->staIndex)))
   {
-    limLog( pMac, LOGE, FL( "Sta Id is not HW Sta Id " ));
     return;
   }
 #endif //WLAN_SOFTAP_VSTA_FEATURE
@@ -1532,8 +1503,7 @@
   if(eSIR_SUCCESS != limSearchAndDeleteDialogueToken(pMac, frmAddBARsp.DialogToken.token,
         pSta->assocId, frmAddBARsp.AddBAParameterSet.tid))
   {
-      limLog(pMac, LOGE,
-        FL("dialogueToken in received addBARsp did not match with outstanding requests"));
+      PELOGW(limLog(pMac, LOGE, FL("dialogueToken in received addBARsp did not match with outstanding requests"));)
       return;
   }
 
@@ -1541,10 +1511,6 @@
   if( eSIR_MAC_SUCCESS_STATUS == frmAddBARsp.Status.status )
   {
     tANI_U32 val;
-    pMac->lim.staBaInfo[pSta->staIndex].
-        failed_count[frmAddBARsp.AddBAParameterSet.tid] = 0;
-    pMac->lim.staBaInfo[pSta->staIndex].
-        failed_timestamp[frmAddBARsp.AddBAParameterSet.tid] = 0;
     if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
     {
         limLog(pMac, LOG1, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
@@ -1564,20 +1530,11 @@
                                        frmAddBARsp.AddBAParameterSet,
                                        (tANI_U8)frmAddBARsp.DialogToken.token,
                                        LIM_ADDBA_RSP, NULL))
-    {
-        limLog( pMac, LOGE,
-            FL( "ADDBA parameters validation failed" ));
-        goto returnAfterError;
-    }
+      goto returnAfterError;
   }
   else
-  {
-    pMac->lim.staBaInfo[pSta->staIndex].
-       failed_count[frmAddBARsp.AddBAParameterSet.tid]++;
-    pMac->lim.staBaInfo[pSta->staIndex].failed_timestamp[
-       frmAddBARsp.AddBAParameterSet.tid] = jiffies_to_msecs(jiffies);
     goto returnAfterError;
-  }
+
   // Change STA state to wait for ADDBA Rsp from HAL
   LIM_SET_STA_BA_STATE(pSta, frmAddBARsp.AddBAParameterSet.tid, eLIM_BA_STATE_WT_ADD_RSP);
 
@@ -1596,12 +1553,7 @@
         frmAddBARsp.BATimeout.timeout,
         0,
         eBA_INITIATOR,psessionEntry))
-  {
-      reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
-      limLog( pMac, LOGE,
-          FL( "Request to setup new BA session with peer "
-              " "MAC_ADDRESS_STR " failed" ), MAC_ADDR_ARRAY(pSta->staAddr));
-  }
+    reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
   else
     return;
 
@@ -1704,11 +1656,8 @@
   if( eSIR_MAC_SUCCESS_STATUS != __limValidateDelBAParameterSet( pMac,
                                              frmDelBAInd.DelBAParameterSet,
                                              pSta ))
-  {
-      limLog( pMac, LOGE,
-          FL( "ADDBA parameters validation failed " ));
       return;
-  }
+
   //
   // Post WDA_DELBA_IND to HAL and delete the
   // existing BA session
@@ -1917,141 +1866,6 @@
 
 #endif
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-static void
-__limProcess2040bssCoexistenceActionFrame(tpAniSirGlobal pMac,
-                  tANI_U16 sessionId, tANI_U8 *pRxPacketInfo,
-                  tpPESession psessionEntry)
-{
-    tpSirMacMgmtHdr     pHdr;
-    tANI_U8             *pBody , i;
-    tANI_U32            frameLen, nStatus;
-    tDot11fHT2040BSSCoexistenceManagementActionFrame *pFrm;
-    tpSirHT2040CoexInfoInd pSirSmeHT2040CoexInfoInd = NULL;
-    tANI_U16              length;
-    tSirMsgQ              mmhMsg;
-    tANI_U8               num_channelList;
-
-    pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo );
-    pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
-    frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
-
-    pFrm =
-     vos_mem_malloc(sizeof(tDot11fHT2040BSSCoexistenceManagementActionFrame));
-
-    if (NULL == pFrm)
-    {
-        limLog(pMac, LOGE, FL("Unable to allocate memory"));
-        return;
-    }
-
-    if(psessionEntry == NULL)
-    {
-         vos_mem_free(pFrm);
-         return;
-    }
-
-    /**Unpack the received frame */
-    nStatus = dot11fUnpackHT2040BSSCoexistenceManagementActionFrame( pMac,
-                                                     pBody, frameLen, pFrm );
-
-    if( DOT11F_FAILED( nStatus ))
-    {
-         limLog( pMac, LOGE, FL( "Failed to unpack and parse a 20/40"
-                                 "Coex Action Frame (0x%08x, %d bytes):"),
-                                  nStatus, frameLen );
-         PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
-         vos_mem_free(pFrm);
-         return;
-    }
-    else if ( DOT11F_WARNED( nStatus ))
-    {
-         limLog(pMac, LOGW, FL( "There were warnings while unpacking a"
-                                " 20/40 Coex Action Frame (0x%08x, %d bytes):"),
-                                nStatus, frameLen );
-         PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
-    }
-
-    num_channelList = pFrm->HT2040BSSIntolerantReport.num_channelList;
-
-    if (num_channelList > 0)
-    {
-        length = (sizeof(tSirHT2040CoexInfoInd) - sizeof(tANI_U8) +
-                   (num_channelList * sizeof(tANI_U8)));
-    }
-    else
-        length = sizeof(tSirHT2040CoexInfoInd);
-
-    limLog(pMac, LOGW,FL("tSirHT2040CoexInfoInd: Length: %d"),length);
-
-    pSirSmeHT2040CoexInfoInd = vos_mem_malloc(length);
-
-    if (NULL == pSirSmeHT2040CoexInfoInd)
-    {
-        limLog(pMac, LOGP,
-               FL("AllocateMemory failed for eWNI_SME_2040_COEX_IND"));
-         vos_mem_free(pFrm);
-        return;
-    }
-
-    vos_mem_set((void*)pSirSmeHT2040CoexInfoInd, length, 0);
-
-    pSirSmeHT2040CoexInfoInd->messageType = eWNI_SME_2040_COEX_IND;
-    pSirSmeHT2040CoexInfoInd->sessionId = sessionId;
-    pSirSmeHT2040CoexInfoInd->length = length;
-
-    if (pFrm->HT2040BSSCoexistence.present)
-    {
-
-        limLog(pMac, LOGW, FL("infoRequest: %d fortyMHzIntolerant: %d"
-                           " twentyMHzBssWidthReq: %d obssScanExemptionReq: %d"
-                           " obssScanExemptionGrant: %d "),
-                           pFrm->HT2040BSSCoexistence.infoRequest,
-                           pFrm->HT2040BSSCoexistence.fortyMHzIntolerant,
-                           pFrm->HT2040BSSCoexistence.twentyMHzBssWidthReq,
-                           pFrm->HT2040BSSCoexistence.obssScanExemptionReq,
-                           pFrm->HT2040BSSCoexistence.obssScanExemptionGrant);
-
-       pSirSmeHT2040CoexInfoInd->HT40MHzIntolerant =
-                             pFrm->HT2040BSSCoexistence.fortyMHzIntolerant;
-       pSirSmeHT2040CoexInfoInd->HT20MHzBssWidthReq =
-                             pFrm->HT2040BSSCoexistence.twentyMHzBssWidthReq;
-    }
-
-    if (pFrm->HT2040BSSIntolerantReport.present)
-    {
-       limLog(pMac, LOGW, FL("operatingClass: %d  num_channelList: %d "),
-                         pFrm->HT2040BSSIntolerantReport.operatingClass,
-                         num_channelList);
-
-       if (num_channelList > 0)
-       {
-           vos_mem_zero(pSirSmeHT2040CoexInfoInd->HT2040BssIntoChanReport,
-                         num_channelList);
-           vos_mem_copy(pSirSmeHT2040CoexInfoInd->HT2040BssIntoChanReport,
-                               pFrm->HT2040BSSIntolerantReport.channelList,
-                               num_channelList);
-
-           pSirSmeHT2040CoexInfoInd->channel_num = num_channelList;
-       }
-
-       for(i=0; i < num_channelList; i++)
-       {
-           limLog(pMac, LOGW, FL("Channel : %d "),
-                        pSirSmeHT2040CoexInfoInd->HT2040BssIntoChanReport[i]);
-       }
-    }
-
-    mmhMsg.type = eWNI_SME_2040_COEX_IND;
-    mmhMsg.bodyptr = pSirSmeHT2040CoexInfoInd;
-    mmhMsg.bodyval = 0;
-    limLog(pMac, LOGW, FL("Posting eWNI_SME_2040_COEX_IND Message to SME "));
-    limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
-
-    vos_mem_free(pFrm);
-}
-#endif
-
 #ifdef WLAN_FEATURE_11W
 /**
  * limProcessSAQueryRequestActionFrame
@@ -2143,8 +1957,7 @@
        Forward to SME to HDD to wpa_supplicant. */
     if (eLIM_STA_ROLE == psessionEntry->limSystemRole)
     {
-        limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
-                                    pRxPacketInfo, psessionEntry, 0);
+        limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo, psessionEntry, 0);
         return;
     }
 
@@ -2265,26 +2078,15 @@
     tpSirMacActionFrameHdr pActionHdr = (tpSirMacActionFrameHdr) pBody;
 #ifdef WLAN_FEATURE_11W
     tpSirMacMgmtHdr pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
-
-    if (lim_is_robust_mgmt_action_frame(pActionHdr->category) &&
-        limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr,
-                                      pActionHdr->category)) {
-        limLog(pMac, LOGE,
-               FL("Don't send unprotect action frame to upper layer categ %d "),
-               pActionHdr->category);
-        return;
-    }
 #endif
 
     switch (pActionHdr->category)
     {
-
-        /*
-         * WARNING: If you add Action frame category case here, set the
-         * corresponding bit to 1 in sme_set_allowed_action_frames() for
-         * the FW to hand over that frame to host without dropping itself
-         */
         case SIR_MAC_ACTION_QOS_MGMT:
+#ifdef WLAN_FEATURE_11W
+            if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
+                break;
+#endif
             if ( (psessionEntry->limQosEnabled) ||
                   (pActionHdr->actionID == SIR_MAC_QOS_MAP_CONFIGURE) )
             {
@@ -2306,9 +2108,7 @@
                         __limProcessQosMapConfigureFrame(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
                     break;
                     default:
-                        limLog(pMac, LOG1,
-                         FL("Qos action %d not handled"),
-                         pActionHdr->actionID);
+                        PELOGE(limLog(pMac, LOGE, FL("Qos action %d not handled"), pActionHdr->actionID);)
                         break;
                 }
                 break ;
@@ -2317,6 +2117,10 @@
            break;
 
         case SIR_MAC_ACTION_SPECTRUM_MGMT:
+#ifdef WLAN_FEATURE_11W
+            if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
+                break;
+#endif
             switch (pActionHdr->actionID)
             {
 #ifdef ANI_SUPPORT_11H
@@ -2346,9 +2150,7 @@
                     }
                     break;
                 default:
-                    limLog(pMac, LOG1,
-                      FL("Spectrum mgmt action id %d not handled"),
-                      pActionHdr->actionID);
+                    PELOGE(limLog(pMac, LOGE, FL("Spectrum mgmt action id %d not handled"), pActionHdr->actionID);)
                     break;
             }
             break;
@@ -2379,14 +2181,17 @@
                     break;
 
                 default:
-                    limLog(pMac, LOG1, FL("WME action %d not handled"),
-                                                  pActionHdr->actionID);
+                    PELOGE(limLog(pMac, LOGE, FL("WME action %d not handled"), pActionHdr->actionID);)
                     break;
             }
             break;
 
         case SIR_MAC_ACTION_BLKACK:
             // Determine the "type" of BA Action Frame
+#ifdef WLAN_FEATURE_11W
+            if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
+                break;
+#endif
             switch(pActionHdr->actionID)
             {
               case SIR_MAC_BLKACK_ADD_REQ:
@@ -2413,15 +2218,17 @@
             __limProcessSMPowerSaveUpdate(pMac, (tANI_U8 *) pRxPacketInfo,psessionEntry);
             break;
         default:
-            limLog(pMac, LOG1,
-                   FL("Action ID %d not handled in HT Action category"),
-                   pActionHdr->actionID);
+            PELOGE(limLog(pMac, LOGE, FL("Action ID %d not handled in HT Action category"), pActionHdr->actionID);)
             break;
         }
         break;
 
     case SIR_MAC_ACTION_WNM:
     {
+#ifdef WLAN_FEATURE_11W
+        if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
+            break;
+#endif
         PELOGE(limLog(pMac, LOG1, FL("WNM Action category %d action %d."),
                                 pActionHdr->category, pActionHdr->actionID);)
         switch (pActionHdr->actionID)
@@ -2436,8 +2243,7 @@
                tANI_S8 rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
                pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
                /* Forward to the SME to HDD to wpa_supplicant */
-               limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
-                                       pRxPacketInfo,
+               limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo,
                                        psessionEntry, rssi);
                break;
             }
@@ -2446,9 +2252,11 @@
     }
 #if defined WLAN_FEATURE_VOWIFI
     case SIR_MAC_ACTION_RRM:
-        /* Ignore RRM measurement request until DHCP is set */
-        if(pMac->rrm.rrmPEContext.rrmEnable &&
-           pMac->roam.roamSession[psessionEntry->smeSessionId].dhcp_done)
+#ifdef WLAN_FEATURE_11W
+        if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
+            break;
+#endif
+        if( pMac->rrm.rrmPEContext.rrmEnable )
         {
             switch(pActionHdr->actionID) {
                 case SIR_MAC_RRM_RADIO_MEASURE_REQ:
@@ -2461,8 +2269,7 @@
                     __limProcessNeighborReport( pMac, (tANI_U8*) pRxPacketInfo, psessionEntry );
                     break;
                 default:
-                    limLog( pMac, LOG1, FL("Action ID %d not handled in RRM"),
-                         pActionHdr->actionID);
+                    PELOGE( limLog( pMac, LOGE, FL("Action ID %d not handled in RRM"), pActionHdr->actionID);)
                     break;
 
             }
@@ -2470,15 +2277,11 @@
         else
         {
             // Else we will just ignore the RRM messages.
-            limLog( pMac, LOG1,
-              FL("RRM Action frame ignored as rrmEnable is %d or DHCP not completed %d"),
-              pMac->rrm.rrmPEContext.rrmEnable,
-              pMac->roam.roamSession[psessionEntry->smeSessionId].dhcp_done);
+            PELOGE( limLog( pMac, LOGE, FL("RRM Action frame ignored as RRM is disabled in cfg"));)
         }
         break;
 #endif
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) \
-    || defined (WLAN_FEATURE_RMC)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
         case SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY:
             {
               tpSirMacVendorSpecificFrameHdr pVendorSpecific = (tpSirMacVendorSpecificFrameHdr) pActionHdr;
@@ -2498,76 +2301,22 @@
                          pVendorSpecific->Oui[0], pVendorSpecific->Oui[1], pVendorSpecific->Oui[2]);)
                  /* Forward to the SME to HDD to wpa_supplicant */
                  // type is ACTION
-                  limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
-                                         pRxPacketInfo,
+                  limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo,
                                          psessionEntry, 0);
               }
-#if defined (WLAN_FEATURE_RMC)
-              else if ((eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole) &&
-                  ((VOS_TRUE == vos_mem_compare(SIR_MAC_RMC_MCAST_ADDRESS,
-                    &pHdr->da[0], sizeof(tSirMacAddr))) ||
-                   (VOS_TRUE == vos_mem_compare(psessionEntry->selfMacAddr,
-                     &pHdr->da[0], sizeof(tSirMacAddr)))) &&
-                   vos_mem_compare(pVendorSpecific->Oui, SIR_MAC_RMC_OUI, 3))
-              {
-                  tANI_U8 MagicCode[] =
-                         { 0x4f, 0x58, 0x59, 0x47, 0x45, 0x4e };
-                  tpSirMacIbssExtNetworkFrameHdr pIbssExtHdr =
-                             (tpSirMacIbssExtNetworkFrameHdr) pActionHdr;
-
-                  if (vos_mem_compare(pIbssExtHdr->MagicCode,
-                      MagicCode, sizeof(MagicCode)) &&
-                      pIbssExtHdr->version == SIR_MAC_RMC_VER )
-                  {
-                      switch (pIbssExtHdr->actionID)
-                      {
-                          default:
-                              PELOGE(limLog(pMac, LOGE,
-                                 FL("Action RMC actionID %d not handled"),
-                                     pIbssExtHdr->actionID);)
-                              break;
-                          case SIR_MAC_RMC_RULER_INFORM_SELECTED:
-                              limLog(pMac, LOG1,
-                                 FL("Action RMC RULER_INFORM_SELECTED."));
-                              limProcessRMCMessages(pMac,
-                                 eLIM_RMC_OTA_RULER_INFORM_SELECTED,
-                                 (tANI_U32 *)pRxPacketInfo);
-                              break;
-                          case SIR_MAC_RMC_RULER_INFORM_CANCELLED:
-                              limLog(pMac, LOG1,
-                                 FL("Action RMC RULER_INFORM_CANCELLED."));
-                              limProcessRMCMessages(pMac,
-                                 eLIM_RMC_OTA_RULER_INFORM_CANCELLED,
-                                 (tANI_U32 *)pRxPacketInfo);
-                              break;
-                      }
-                  }
-                  else
-                  {
-                      limLog( pMac, LOG1,
-                         FL("Dropping the vendor specific action frame in IBSS "
-                             "mode because of Ibss Ext Magic mismatch "
-                             MAC_ADDRESS_STR " or Version mismatch = %d"),
-                             MAC_ADDR_ARRAY(pIbssExtHdr->MagicCode),
-                             pIbssExtHdr->version );
-                  }
-              }
-#endif /* WLAN_FEATURE_RMC */
               else
               {
-                 limLog( pMac, LOG1,
-                      FL("Dropping the vendor specific action frame because of( "
-                      "WES Mode not enabled (WESMODE = %d) or OUI mismatch (%02x %02x %02x) or "
-                      "not received with SelfSta Mac address) system role = %d"),
-                      IS_WES_MODE_ENABLED(pMac),
-                      pVendorSpecific->Oui[0], pVendorSpecific->Oui[1],
-                      pVendorSpecific->Oui[2],
-                      psessionEntry->limSystemRole );
+                 limLog( pMac, LOGE, FL("Dropping the vendor specific action frame because of( "
+                                        "WES Mode not enabled (WESMODE = %d) or OUI mismatch (%02x %02x %02x) or "
+                                        "not received with SelfSta Mac address) system role = %d"),
+                                        IS_WES_MODE_ENABLED(pMac),
+                                        pVendorSpecific->Oui[0], pVendorSpecific->Oui[1],
+                                        pVendorSpecific->Oui[2],
+                                        psessionEntry->limSystemRole );
               }
            }
            break;
-#endif /* WLAN_FEATURE_VOWIFI_11R || FEATURE_WLAN_ESE ||
-          FEATURE_WLAN_LFR || WLAN_FEATURE_RMC */
+#endif
     case SIR_MAC_ACTION_PUBLIC_USAGE:
         switch(pActionHdr->actionID) {
         case SIR_MAC_ACTION_VENDOR_SPECIFIC:
@@ -2580,52 +2329,37 @@
               {
                  /* Forward to the SME to HDD to wpa_supplicant */
                  // type is ACTION
-                 limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
-                                        pRxPacketInfo,
+                 limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo,
                                         psessionEntry, 0);
               }
               else
               {
-                 limLog( pMac, LOG1,
-                    FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
-                      pPubAction->Oui[0], pPubAction->Oui[1],
-                      pPubAction->Oui[2], pPubAction->Oui[3] );
+                 limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
+                      pPubAction->Oui[0], pPubAction->Oui[1], pPubAction->Oui[2], pPubAction->Oui[3] );
               }
            }
             break;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        case SIR_MAC_ACTION_2040_BSS_COEXISTENCE:
-            {
-               if (pMac->roam.configParam.apHT40_24GEnabled)
-               {
-                   limLog( pMac, LOGW, FL("Public Action 20/40 BSS"
-                                  "Coexistence Management frame"));
-
-                   __limProcess2040bssCoexistenceActionFrame(pMac,
-                       psessionEntry->smeSessionId, (tANI_U8 *) pRxPacketInfo,
-                       psessionEntry);
-               }
-               break;
-            }
-#endif
 #ifdef FEATURE_WLAN_TDLS
            case SIR_MAC_TDLS_DIS_RSP:
            {
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+               //LIM_LOG_TDLS(printk("Public Action TDLS Discovery RSP ..")) ;
+               limProcessTdlsPublicActionFrame(pMac, (tANI_U32*)pRxPacketInfo, psessionEntry) ;
+#else
                tANI_S8             rssi;
 
                rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
                VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
                                     ("Public Action TDLS Discovery RSP ..")) ;
-               limSendSmeMgmtFrameInd(pMac, psessionEntry->smeSessionId,
-                                      pRxPacketInfo,
+               limSendSmeMgmtFrameInd(pMac, 0, pRxPacketInfo,
                                       psessionEntry, rssi);
+#endif
            }
                break;
 #endif
 
         default:
-            limLog(pMac, LOG1, FL("Unhandled public action frame -- %x "),
-                             pActionHdr->actionID);
+            PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x "), pActionHdr->actionID);)
             break;
         }
         break;
@@ -2634,6 +2368,8 @@
     case SIR_MAC_ACTION_SA_QUERY:
     {
         PELOGE(limLog(pMac, LOG1, FL("SA Query Action category %d action %d."), pActionHdr->category, pActionHdr->actionID);)
+        if (limDropUnprotectedActionFrame(pMac, psessionEntry, pHdr, pActionHdr->category))
+            break;
         switch (pActionHdr->actionID)
         {
             case  SIR_MAC_SA_QUERY_REQ:
@@ -2670,8 +2406,7 @@
     }
 #endif
     default:
-       limLog(pMac, LOG1,
-         FL("Action category %d not handled"), pActionHdr->category);
+       PELOGE(limLog(pMac, LOGE, FL("Action category %d not handled"), pActionHdr->category);)
        break;
     }
 }
@@ -2721,24 +2456,19 @@
                 }
                 else
                 {
-                  limLog( pMac, LOG1,
-                     FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
-                      pActionHdr->Oui[0], pActionHdr->Oui[1],
-                      pActionHdr->Oui[2], pActionHdr->Oui[3]);
+                  limLog( pMac, LOGE, FL("Unhandled public action frame (Vendor specific). OUI %x %x %x %x"),
+                      pActionHdr->Oui[0], pActionHdr->Oui[1], pActionHdr->Oui[2], pActionHdr->Oui[3] );
                 }
               }
                break;
             default:
-               limLog(pMac, LOG1,
-                FL("Unhandled public action frame -- %x "), pActionHdr->actionID);
+               PELOGE(limLog(pMac, LOGE, FL("Unhandled public action frame -- %x "), pActionHdr->actionID);)
                   break;
          }
          break;
       default:
-         limLog(pMac, LOG1,
-          FL("Unhandled action frame without session -- %x "),
-                                    pActionHdr->category);
-         break;
+         PELOGE(limLog(pMac, LOG1, FL("Unhandled action frame without session -- %x "), pActionHdr->category);)
+            break;
 
    }
 }
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c
index 66eef4a..f40d538 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c
@@ -38,7 +38,7 @@
  */
 #include "palTypes.h"
 #include "aniGlobal.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "sirApi.h"
 #include "cfgApi.h"
 
@@ -54,6 +54,9 @@
 #include "limAdmitControl.h"
 #include "palApi.h"
 #include "limSessionUtils.h"
+#ifdef WLAN_FEATURE_11W
+#include "wniCfgAp.h"
+#endif
 
 
 #include "vos_types.h"
@@ -231,47 +234,14 @@
      */
     pStaDs = dphLookupHashEntry(pMac, pHdr->sa, &peerIdx,
                              &psessionEntry->dph.dphHashTable);
-    if (NULL != pStaDs)
+    if ((NULL != pStaDs) && (pHdr->fc.retry > 0))
     {
-        if (pHdr->fc.retry > 0)
-        {
-            /* Ignore the Retry */
-            limLog(pMac, LOGE,
-                    FL("STA is initiating Assoc Req after ACK lost. "
-                        "So, do not Process sessionid: %d sys subType=%d "
-                        "for role=%d from: "MAC_ADDRESS_STR),
-                    psessionEntry->peSessionId, subType,
-                    psessionEntry->limSystemRole,
-                    MAC_ADDR_ARRAY(pHdr->sa));
-            return;
-        }
-        else
-        {
-#ifdef WLAN_FEATURE_11W
-            /* Do not send Assoc rsp for duplicate assoc req in case of PMF
-             * enabled STA, as driver needs to start SA Querry in this case
-             */
-            if (!pStaDs->rmfEnabled)
-#endif
-            {
-               /* STA might have missed the assoc response,
-                * so it is sending assoc request frame again.
-                */
-                limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS,
-                    pStaDs->assocId, pStaDs->staAddr,
-                    pStaDs->mlmStaContext.subType, pStaDs,
-                    psessionEntry);
-                limLog(pMac, LOGE,
-                    FL("DUT already received an assoc request frame "
-                        "and STA is sending another assoc req.So, do not "
-                        "Process sessionid: %d sys subType=%d for role=%d "
-                        "from: "MAC_ADDRESS_STR),
-                    psessionEntry->peSessionId, subType,
-                    psessionEntry->limSystemRole,
-                    MAC_ADDR_ARRAY(pHdr->sa));
-                return;
-            }
-        }
+        limLog(pMac, LOGE,
+            FL("STA is initiating Assoc Req after ACK lost.So, do not Process"
+             "sessionid: %d sys subType=%d for role=%d from: "MAC_ADDRESS_STR),
+                psessionEntry->peSessionId, subType,
+                 psessionEntry->limSystemRole, MAC_ADDR_ARRAY(pHdr->sa));
+        return;
     }
 
     // Get pointer to Re/Association Request frame body
@@ -333,8 +303,7 @@
 
     if (status != eSIR_SUCCESS)
     {
-        limLog(pMac, LOGW,
-               FL("Parse error AssocRequest, length=%d from "MAC_ADDRESS_STR),
+        limLog(pMac, LOGW, FL("Parse error AssocRequest, length=%d from "MAC_ADDRESS_STR),
                              framelen, MAC_ADDR_ARRAY(pHdr->sa));
         limSendAssocRspMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_STATUS, 1, pHdr->sa, subType, 0, psessionEntry);
         goto error;
@@ -363,8 +332,8 @@
                                pAssocReq,
                                &localCapabilities,psessionEntry) == false)
     {
-        limLog(pMac, LOGE, FL("local caps mismatch received caps"));
-        limLog(pMac, LOGE, FL("Received %s Req with unsupported "
+        limLog(pMac, LOGW, FL("local caps mismatch received caps"));
+        limLog(pMac, LOGW, FL("Received %s Req with unsupported "
         "capabilities from"MAC_ADDRESS_STR),
         (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
         MAC_ADDR_ARRAY(pHdr->sa));
@@ -387,7 +356,7 @@
 
     if (limCmpSSid(pMac, &pAssocReq->ssId, psessionEntry) == false)
     {
-        limLog(pMac, LOGE, FL("Received %s Req with unmatched ssid ( Received"
+        limLog(pMac, LOGW, FL("Received %s Req with unmatched ssid ( Received"
         " SSID: %.*s current SSID: %.*s ) from "MAC_ADDRESS_STR),
         (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", pAssocReq->ssId.length,
         pAssocReq->ssId.ssId, psessionEntry->ssId.length,
@@ -428,7 +397,7 @@
     }
     if (limCheckRxBasicRates(pMac, basicRates, psessionEntry) == false)
     {
-        limLog(pMac, LOGE, FL("Received %s Req with unsupported "
+        limLog(pMac, LOGW, FL("Received %s Req with unsupported "
         "rates from"MAC_ADDRESS_STR),
         (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
         MAC_ADDR_ARRAY(pHdr->sa));
@@ -540,7 +509,7 @@
 
     if ( (pAssocReq->HTCaps.present) && (limCheckMCSSet(pMac, pAssocReq->HTCaps.supportedMCSSet) == false))
     {
-         limLog(pMac, LOGE, FL("received %s req with unsupported"
+         limLog(pMac, LOGW, FL("received %s req with unsupported"
          "MCS Rate Set from "MAC_ADDRESS_STR),
          (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
          MAC_ADDR_ARRAY(pHdr->sa));
@@ -571,7 +540,7 @@
 
         if (!pAssocReq->extendedRatesPresent && val)
         {
-            limLog(pMac, LOGE, FL("Rejecting Re/Assoc req from 11b STA: "
+            limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from 11b STA: "
             MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
             /**
              * Received Re/Association Request from
@@ -693,7 +662,7 @@
             && psessionEntry->pLimStartBssReq->privacy 
             && psessionEntry->pLimStartBssReq->rsnIE.length)
         {
-            limLog(pMac, LOG1,
+            limLog(pMac, LOGE,
                    FL("RSN enabled auth, Re/Assoc req from STA: "MAC_ADDRESS_STR),
                        MAC_ADDR_ARRAY(pHdr->sa));
             if(pAssocReq->rsnPresent)
@@ -713,7 +682,7 @@
                         if(eSIR_SUCCESS != (status = limCheckRxRSNIeMatch(pMac, Dot11fIERSN, psessionEntry,
                                                                           pAssocReq->HTCaps.present, &pmfConnection)))
                         {
-                            limLog(pMac, LOGE, FL("RSN Mismatch. Rejecting Re/Assoc req from "
+                            limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from "
                                                   "STA: "MAC_ADDRESS_STR),
                                                     MAC_ADDR_ARRAY(pHdr->sa));
 
@@ -732,8 +701,7 @@
                     }
                     else
                     {
-                        limLog(pMac, LOGE, FL("RSN Version mismatch. "
-                                              "Rejecting Re/Assoc req from "
+                        limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from "
                                               "STA: "MAC_ADDRESS_STR),
                                               MAC_ADDR_ARRAY(pHdr->sa));
 
@@ -750,10 +718,8 @@
                 }
                 else
                 {
-                    limLog(pMac, LOGW, FL("RSN length not correct. "
-                                          "Rejecting Re/Assoc req from STA:"
-                                          MAC_ADDRESS_STR),
-                                          MAC_ADDR_ARRAY(pHdr->sa));
+                    limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA:"
+                     MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
                     /* received Association req frame with RSN IE but length is 0 */
                     limSendAssocRspMgmtFrame(
                                    pMac,
@@ -778,10 +744,8 @@
                     /* check the groupwise and pairwise cipher suites */
                     if(eSIR_SUCCESS != (status = limCheckRxWPAIeMatch(pMac, Dot11fIEWPA, psessionEntry, pAssocReq->HTCaps.present)))
                     {
-                        limLog(pMac, LOGW, FL("WPA IE mismatch. "
-                                              "Rejecting Re/Assoc req from "
-                                              "STA: "MAC_ADDRESS_STR),
-                                               MAC_ADDR_ARRAY(pHdr->sa));
+                        limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from "
+                              "STA: "MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
                         /* received Association req frame with WPA IE but mismatch */
                         limSendAssocRspMgmtFrame(
                                        pMac,
@@ -795,10 +759,8 @@
                 }
                 else
                 {
-                    limLog(pMac, LOGW, FL("WPA len incorrect. "
-                                          "Rejecting Re/Assoc req from STA: "
-                                          MAC_ADDRESS_STR),
-                                          MAC_ADDR_ARRAY(pHdr->sa));
+                    limLog(pMac, LOGW, FL("Rejecting Re/Assoc req from STA: "
+                    MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));
                     /* received Association req frame with invalid WPA IE */
                     limSendAssocRspMgmtFrame(
                                    pMac,
@@ -833,8 +795,6 @@
              * Maximum number of STAs that AP can handle reached.
              * Send Association response to peer MAC entity
              */
-            limLog(pMac, LOGE, FL("Max Sta count reached : %d"),
-                                  pMac->lim.maxStation);
             limRejectAssociation(pMac, pHdr->sa,
                                  subType, false,
                                  (tAniAuthType) 0, 0,
@@ -863,7 +823,7 @@
                      eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, //=9
                      pHdr->sa, psessionEntry, FALSE);
 
-            limLog(pMac, LOGE, FL("received %s req on sessionid: %d from STA "
+            limLog(pMac, LOGW, FL("received %s req on sessionid: %d from STA "
             "that does not have pre-auth context"MAC_ADDRESS_STR),
             (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc",
             psessionEntry->peSessionId,
@@ -895,7 +855,7 @@
 #ifdef WLAN_DEBUG    
                 pMac->lim.gLimNumAssocReqDropInvldState++;
 #endif
-                limLog(pMac, LOGE, FL("received Assoc req in state "
+                limLog(pMac, LOG1, FL("received Assoc req in state "
                    "%d from "), pStaDs->mlmStaContext.mlmState);
             }
             else
@@ -903,7 +863,7 @@
 #ifdef WLAN_DEBUG    
                 pMac->lim.gLimNumReassocReqDropInvldState++;
 #endif
-                limLog(pMac, LOGE, FL("received ReAssoc req in state %d"
+                limLog(pMac, LOG1, FL("received ReAssoc req in state %d"
                             " from "), pStaDs->mlmStaContext.mlmState);
             }
             limPrintMacAddr(pMac, pHdr->sa, LOG1);
@@ -984,8 +944,6 @@
          * 'associated' state. Update STA capabilities and
          * send Association response frame with same AID
          */
-            limLog(pMac, LOG1, FL("Received Assoc req from STA already connected"
-                                  " UpdateConext"));
             pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo;
             if (pStaPreAuthContext &&
                 (pStaPreAuthContext->mlmState ==
@@ -1025,7 +983,7 @@
             if (limAdmitControlAddTS(pMac, pHdr->sa, &(pAssocReq->addtsReq),
                                      &(pAssocReq->qosCapability), 0, false, NULL, &tspecIdx, psessionEntry) != eSIR_SUCCESS)
             {
-                limLog(pMac, LOGE, FL("AdmitControl: TSPEC rejected"));
+                limLog(pMac, LOGW, FL("AdmitControl: TSPEC rejected"));
                 limSendAssocRspMgmtFrame(
                                pMac,
                                eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
@@ -1041,7 +999,7 @@
         else if (limAdmitControlAddSta(pMac, pHdr->sa, false)
                                                != eSIR_SUCCESS)
         {
-            limLog(pMac, LOGE, FL("AdmitControl: Sta rejected"));
+            limLog(pMac, LOGW, FL("AdmitControl: Sta rejected"));
             limSendAssocRspMgmtFrame(
                     pMac,
                     eSIR_MAC_QAP_NO_BANDWIDTH_REASON,
@@ -1077,8 +1035,6 @@
     {
         // Could not assign AID
         // Reject association
-        limLog(pMac, LOGE, FL("PeerIdx not avaialble. Reject associaton"));
-
         limRejectAssociation(pMac, pHdr->sa,
                              subType, true, authType,
                              peerIdx, false,
@@ -1171,36 +1127,8 @@
         pStaDs->htMaxAmsduLength = (tANI_U8)pAssocReq->HTCaps.maximalAMSDUsize;
         pStaDs->htMaxRxAMpduFactor = pAssocReq->HTCaps.maxRxAMPDUFactor;
         pStaDs->htMIMOPSState = pAssocReq->HTCaps.mimoPowerSave;
-
-        /* pAssocReq will be copied to psessionEntry->parsedAssocReq later */
-        /* check whether AP is enabled with shortGI */
-        if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val) !=
-                           eSIR_SUCCESS) {
-           limLog(pMac, LOGE,
-                         FL("could not retrieve shortGI 20Mhz CFG"));
-           goto error;
-        }
-        if (val) {
-            pStaDs->htShortGI20Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI20MHz;
-        } else {
-            /* Unset htShortGI20Mhz in ht_caps*/
-            pAssocReq->HTCaps.shortGI20MHz = 0;
-            pStaDs->htShortGI20Mhz = 0;
-        }
-
-        if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val) !=
-                           eSIR_SUCCESS) {
-           limLog(pMac, LOGE,
-                         FL("could not retrieve shortGI 40Mhz CFG"));
-           goto error;
-        }
-        if (val) {
-            pStaDs->htShortGI40Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI40MHz;
-        } else {
-            /* Unset htShortGI40Mhz in ht_caps */
-            pAssocReq->HTCaps.shortGI40MHz = 0;
-            pStaDs->htShortGI40Mhz = 0;
-        }
+        pStaDs->htShortGI20Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI20MHz;
+        pStaDs->htShortGI40Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI40MHz;
         pStaDs->htSupportedChannelWidthSet = (tANI_U8)pAssocReq->HTCaps.supportedChannelWidthSet;
         /* peer just follows AP; so when we are softAP/GO, we just store our session entry's secondary channel offset here in peer INFRA STA
          * However, if peer's 40MHz channel width support is disabled then secondary channel will be zero
@@ -1360,9 +1288,9 @@
                              (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
         goto error;
     }
-    if (WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STAMIN > retryInterval)
+    if (WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_APMIN > retryInterval)
     {
-        retryInterval = WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STADEF;
+        retryInterval = WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_APDEF;
     }
     if (tx_timer_create(&pStaDs->pmfSaQueryTimer, "PMF SA Query timer",
                         limPmfSaQueryTimerHandler, timerId.value,
@@ -1438,8 +1366,8 @@
             /* use the same AID, already allocated */
             if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
             {
-                    limLog(pMac, LOGE, FL( "Could not AddSta with assocId= %d staId %d"),
-                                            pStaDs->assocId, pStaDs->staIndex);
+                    limLog( pMac, LOGE, FL( "AP do not support UPASD "
+                                            "REASSOC Failed"));
                     limRejectAssociation( pMac, pStaDs->staAddr, pStaDs->mlmStaContext.subType, true, pStaDs->mlmStaContext.authType,
                                           pStaDs->assocId, true,(tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, psessionEntry);
 
@@ -1628,15 +1556,6 @@
             /* Note: we are not rejecting association here because IOT will fail */
 
         }
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        if(pAssocReq->HTCaps.present)
-        {
-            limLog(pMac, LOGW, FL("HT40MHzInto: %d"),
-                         pAssocReq->HTCaps.stbcControlFrame);
-            pMlmAssocInd->HT40MHzIntoPresent =
-                         pAssocReq->HTCaps.stbcControlFrame;
-        }
-#endif
 
         // Required for indicating the frames to upper layer
         pMlmAssocInd->assocReqLength = pAssocReq->assocReqFrameLength;
@@ -1645,9 +1564,6 @@
         pMlmAssocInd->beaconPtr = psessionEntry->beacon;
         pMlmAssocInd->beaconLength = psessionEntry->bcnLen;
 
-        pMlmAssocInd->rate_flags =
-            limGetMaxRateFlags(pStaDs, psessionEntry);
-
         limPostSmeMessage(pMac, LIM_MLM_ASSOC_IND, (tANI_U32 *) pMlmAssocInd);
         vos_mem_free(pMlmAssocInd);
     }
@@ -1765,16 +1681,6 @@
 
         }
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        if(pAssocReq->HTCaps.present)
-        {
-            limLog(pMac, LOGW, FL("RASSOC HT40MHzInto: %d"),
-                                   pAssocReq->HTCaps.stbcControlFrame);
-            pMlmReassocInd->HT40MHzIntoPresent =
-                            pAssocReq->HTCaps.stbcControlFrame;
-        }
-#endif
-
         // Required for indicating the frames to upper layer
         pMlmReassocInd->assocReqLength = pAssocReq->assocReqFrameLength;
         pMlmReassocInd->assocReqPtr = pAssocReq->assocReqFrame;
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c
index fb8d7e4..84cae75 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,7 +38,7 @@
  */
 
 #include "wniApi.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "aniGlobal.h"
 #include "cfgApi.h"
 
@@ -85,8 +85,6 @@
     //tpSirBoardCapabilities pBoardCaps;
     tANI_BOOLEAN    qosMode; 
     tANI_U16        rxHighestRate = 0;
-    uint32_t        shortgi_20mhz_support;
-    uint32_t        shortgi_40mhz_support;
 
     limGetPhyMode(pMac, &phyMode, psessionEntry);
 
@@ -133,6 +131,8 @@
                    pStaDs->htMaxAmsduLength = ( tANI_U8 ) pAssocRsp->HTCaps.maximalAMSDUsize;
                    pStaDs->htAMpduDensity =             pAssocRsp->HTCaps.mpduDensity;
                    pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
+                   pStaDs->htShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
+                   pStaDs->htShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
                    pStaDs->htMaxRxAMpduFactor = pAssocRsp->HTCaps.maxRxAMPDUFactor;
                    limFillRxHighestSupportedRate(pMac, &rxHighestRate, pAssocRsp->HTCaps.supportedMCSSet);
                    pStaDs->supportedRates.rxHighestDataRate = rxHighestRate;
@@ -143,41 +143,6 @@
                    // In the future, may need to check for "assoc.HTCaps.delayedBA"
                    // For now, it is IMMEDIATE BA only on ALL TID's
                    pStaDs->baPolicyFlag = 0xFF;
-
-                   /*
-                    * Check if we have support for gShortGI20Mhz and
-                    * gShortGI40Mhz from ini file.
-                    */
-                   if (HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac,
-                                   WNI_CFG_SHORT_GI_20MHZ,
-                                   &shortgi_20mhz_support))) {
-                       if (VOS_TRUE == shortgi_20mhz_support)
-                           pStaDs->htShortGI20Mhz =
-                               (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
-                       else
-                           pStaDs->htShortGI20Mhz = VOS_FALSE;
-                   } else {
-                       limLog(pMac, LOGE,
-                          FL("could not retrieve shortGI 20Mhz CFG,"
-                             "setting value to default"));
-                       pStaDs->htShortGI20Mhz = WNI_CFG_SHORT_GI_20MHZ_STADEF;
-                   }
-
-                   if (HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac,
-                                   WNI_CFG_SHORT_GI_40MHZ,
-                                   &shortgi_40mhz_support))) {
-                       if (VOS_TRUE == shortgi_40mhz_support)
-                           pStaDs->htShortGI40Mhz =
-                               (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
-                       else
-                           pStaDs->htShortGI40Mhz = VOS_FALSE;
-                   } else {
-                       limLog(pMac, LOGE,
-                               FL("could not retrieve shortGI 40Mhz CFG,"
-                                   "setting value to default"));
-                       pStaDs->htShortGI40Mhz = WNI_CFG_SHORT_GI_40MHZ_STADEF;
-                   }
-
            }
        }
 
@@ -406,9 +371,9 @@
         /// Received unexpected Re/Association Response frame
 
 #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
-        limLog(pMac, LOG1,  FL("Recieved Re/Assoc rsp in unexpected "
+        PELOG1(limLog(pMac, LOG1,  FL("Recieved Re/Assoc rsp in unexpected "
             "state %d on session=%d"),
-            psessionEntry->limMlmState, psessionEntry->peSessionId);
+            psessionEntry->limMlmState, psessionEntry->peSessionId);)
 #endif
         // Log error
         if (!pHdr->fc.retry)
@@ -504,8 +469,7 @@
     }
     if(pAssocRsp->ExtCap.present)
     {
-        limLog(pMac, LOG1,
-            FL("Filling tdls prohibited in session entry"));
+        limLog(pMac, LOGE, FL("Filling tdls prohibited in session entry"));
         psessionEntry->tdlsChanSwitProhibited =
                        pAssocRsp->ExtCap.TDLSChanSwitProhibited ;
     }
@@ -588,13 +552,13 @@
             vos_mem_copy(psessionEntry->tspecIes,
                          &pAssocRsp->TSPECInfo[0], psessionEntry->tspecLen);
         }
-        limLog(pMac, LOG1, FL(" Tspec EID present in assoc rsp "));
+        PELOG1(limLog(pMac, LOG1, FL(" Tspec EID present in assoc rsp "));)
     }
     else
     {
         psessionEntry->tspecLen = 0;
         psessionEntry->tspecIes = NULL;
-        limLog(pMac, LOG1, FL(" Tspec EID *NOT* present in assoc rsp "));
+        PELOG1(limLog(pMac, LOG1, FL(" Tspec EID *NOT* present in assoc rsp "));)
     }
 #endif
 
@@ -710,11 +674,7 @@
     if (subType == LIM_REASSOC)
     {
         // Log success
-        limLog(pMac, LOG1, FL("Successfully Reassociated with BSS"));
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-        limDiagEventReport(pMac, WLAN_PE_DIAG_ROAM_ASSOC_COMP_EVENT,
-            psessionEntry, eSIR_SUCCESS, eSIR_SUCCESS);
-#endif
+        PELOG1(limLog(pMac, LOG1, FL("Successfully Reassociated with BSS"));)
 #ifdef FEATURE_WLAN_ESE
         {
             tANI_U8 cnt = 0;
@@ -832,8 +792,8 @@
     }
 
     // Log success
-    limLog(pMac, LOG1, FL("Successfully Associated with BSS "MAC_ADDRESS_STR),
-           MAC_ADDR_ARRAY(pHdr->sa));
+    PELOG1(limLog(pMac, LOG1, FL("Successfully Associated with BSS "MAC_ADDRESS_STR),
+           MAC_ADDR_ARRAY(pHdr->sa));)
 #ifdef FEATURE_WLAN_ESE
     if(psessionEntry->eseContext.tsm.tsmInfo.state)
     {
@@ -889,12 +849,9 @@
         else
             psessionEntry->beaconParams.fShortPreamble = true;
     }
-
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-    limDiagEventReport(pMac, WLAN_PE_DIAG_CONNECTED, psessionEntry,
-                       eSIR_SUCCESS, eSIR_SUCCESS);
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+    limDiagEventReport(pMac, WLAN_PE_DIAG_CONNECTED, psessionEntry, 0, 0);
 #endif
-
     if(pAssocRsp->OBSSScanParameters.present)
     {
         limUpdateOBSSScanParams(psessionEntry , &pAssocRsp->OBSSScanParameters);
@@ -966,7 +923,7 @@
 
     /* CR: vos packet memory is leaked when assoc rsp timeouted/failed. */
     /* notify TL that association is failed so that TL can flush the cached frame  */
-    limLog(pMac, LOG1,  FL("notify TL that association is failed"));
+    PELOG1(limLog(pMac, LOG1,  FL("notify TL that association is failed"));)
     WLANTL_AssocFailed (psessionEntry->staId);
 
     vos_mem_free(pBeaconStruct);
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessAuthFrame.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessAuthFrame.c
index 09bb745..806ff12 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessAuthFrame.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessAuthFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,7 +38,7 @@
  */
 
 #include "wniApi.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "aniGlobal.h"
 #include "cfgApi.h"
 
@@ -156,13 +156,13 @@
     tANI_U8                 challengeTextArray[SIR_MAC_AUTH_CHALLENGE_LENGTH];
     tpDphHashNode           pStaDs = NULL;
     tANI_U16                assocId = 0;
-    tANI_U16                currSeqNo = 0;
     /* Added For BT -AMP support */
     // Get pointer to Authentication frame header and body
  
 
     pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
     frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
+    
 
     if (!frameLen)
     {
@@ -178,13 +178,12 @@
     {
         // Received Auth frame from a BC/MC address
         // Log error and ignore it
-       limLog(pMac, LOGE,
-               FL("received Auth frame from a BC/MC address - "));
-       limPrintMacAddr(pMac, pHdr->sa, LOGE);
+        PELOGE(limLog(pMac, LOGE,
+               FL("received Auth frame from a BC/MC address - "));)
+       PELOG1( limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
         return;
     }
-    currSeqNo = (pHdr->seqControl.seqNumHi << 4) | (pHdr->seqControl.seqNumLo);
     limLog(pMac, LOG1,
                FL("Sessionid: %d System role : %d limMlmState: %d :Auth "
                "Frame Received: BSSID: "MAC_ADDRESS_STR " (RSSI %d)"),
@@ -248,8 +247,7 @@
                    psessionEntry->limSystemRole, MAC_ADDR_ARRAY(pHdr->sa) );)
             limSendAuthMgmtFrame(pMac, &authFrame,
                                  pHdr->sa,
-                                 LIM_NO_WEP_IN_FC,
-                                 psessionEntry, eSIR_FALSE);
+                                 LIM_NO_WEP_IN_FC,psessionEntry);
             return;
         }
 
@@ -311,8 +309,7 @@
 
                 limSendAuthMgmtFrame(pMac, &authFrame,
                                      pHdr->sa,
-                                     LIM_NO_WEP_IN_FC,
-                                     psessionEntry, eSIR_FALSE);
+                                     LIM_NO_WEP_IN_FC,psessionEntry);
 
                 return;
             }
@@ -350,8 +347,7 @@
 
                     limSendAuthMgmtFrame(pMac, &authFrame,
                                          pHdr->sa,
-                                         LIM_NO_WEP_IN_FC,
-                                         psessionEntry, eSIR_FALSE);
+                                         LIM_NO_WEP_IN_FC,psessionEntry);
 
                     return;
                 }
@@ -386,8 +382,7 @@
 
                     limSendAuthMgmtFrame(pMac, &authFrame,
                                          pHdr->sa,
-                                         LIM_NO_WEP_IN_FC,
-                                         psessionEntry, eSIR_FALSE);
+                                         LIM_NO_WEP_IN_FC,psessionEntry);
 
                     return;
                 } // if (!pKeyMapEntry->wepOn)
@@ -420,8 +415,7 @@
                         limSendAuthMgmtFrame(
                                             pMac, &authFrame,
                                             pHdr->sa,
-                                            LIM_NO_WEP_IN_FC,
-                                            psessionEntry, eSIR_FALSE);
+                                            LIM_NO_WEP_IN_FC,psessionEntry);
 
 
                         return;
@@ -474,8 +468,7 @@
 
                     limSendAuthMgmtFrame(pMac, &authFrame,
                                          pHdr->sa,
-                                         LIM_NO_WEP_IN_FC,
-                                         psessionEntry, eSIR_FALSE);
+                                         LIM_NO_WEP_IN_FC,psessionEntry);
 
                     return;
                 }
@@ -508,8 +501,7 @@
                         limSendAuthMgmtFrame(
                                             pMac, &authFrame,
                                             pHdr->sa,
-                                            LIM_NO_WEP_IN_FC,
-                                            psessionEntry, eSIR_FALSE);
+                                            LIM_NO_WEP_IN_FC,psessionEntry);
 
                         return;
                     }
@@ -548,8 +540,7 @@
 
             limSendAuthMgmtFrame(pMac, &authFrame,
                                  pHdr->sa,
-                                 LIM_NO_WEP_IN_FC,
-                                 psessionEntry, eSIR_FALSE);
+                                 LIM_NO_WEP_IN_FC,psessionEntry);
 
             return;
         } // else if (wlan_cfgGetInt(CFG_PRIVACY_OPTION_IMPLEMENTED))
@@ -578,19 +569,6 @@
            (tANI_U32) pRxAuthFrameBody->authTransactionSeqNumber,
            (tANI_U32) pRxAuthFrameBody->authStatusCode,(tANI_U32)pMac->lim.gLimNumPreAuthContexts);)
 
-    // IOT Workaround: with invalid WEP password, some APs reply AUTH frame 4
-    // with invalid seqNumber. This AUTH frame will be dropped by driver,
-    // thus driver sends the generic status code instead of protocol status code.
-    // As a workaround, assign the correct seqNumber for the AUTH frame 4.
-    if (psessionEntry->limMlmState == eLIM_MLM_WT_AUTH_FRAME4_STATE &&
-        pRxAuthFrameBody->authTransactionSeqNumber != SIR_MAC_AUTH_FRAME_1 &&
-        pRxAuthFrameBody->authTransactionSeqNumber != SIR_MAC_AUTH_FRAME_2 &&
-        pRxAuthFrameBody->authTransactionSeqNumber != SIR_MAC_AUTH_FRAME_3) {
-        PELOGE(limLog(pMac, LOGE, FL("Workaround: Assign a correct seqNumber=4 "
-                "for AUTH frame 4"));)
-        pRxAuthFrameBody->authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_4;
-    }
-
     switch (pRxAuthFrameBody->authTransactionSeqNumber)
     {
         case SIR_MAC_AUTH_FRAME_1:
@@ -664,7 +642,7 @@
             if (pAuthNode)
             {
                 /// Pre-auth context exists for the STA
-                if (pHdr->fc.retry == 0 || pAuthNode->seqNo != currSeqNo)
+                if (pHdr->fc.retry == 0)
                 {
                     /**
                      * STA is initiating brand-new Authentication
@@ -743,9 +721,7 @@
                 limLog(pMac, LOGP,
                        FL("could not retrieve MaxNumPreAuth"));
             }
-
-            if (pMac->lim.gLimNumPreAuthContexts == maxNumPreAuth &&
-                !limDeleteOpenAuthPreAuthNode(pMac))
+            if (pMac->lim.gLimNumPreAuthContexts == maxNumPreAuth)
             {
                 PELOGE(limLog(pMac, LOGE, FL("Max number of "
                     "preauth context reached"));)
@@ -763,8 +739,7 @@
 
                 limSendAuthMgmtFrame(pMac, &authFrame,
                                      pHdr->sa,
-                                     LIM_NO_WEP_IN_FC,
-                                     psessionEntry, eSIR_FALSE);
+                                     LIM_NO_WEP_IN_FC,psessionEntry);
 
                 return;
             }
@@ -790,9 +765,8 @@
                             return;
                         }
 
-                        limLog(pMac, LOG1,
-                               FL("Alloc new data: peer "MAC_ADDRESS_STR),
-                                                 MAC_ADDR_ARRAY(pHdr->sa));
+                        PELOG1(limLog(pMac, LOG1, FL("Alloc new data: %x peer "), pAuthNode);
+                        limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                         vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr,
                                       pHdr->sa,
@@ -804,9 +778,6 @@
                                               pRxAuthFrameBody->authAlgoNumber;
                         pAuthNode->fSeen = 0;
                         pAuthNode->fTimerStarted = 0;
-                        pAuthNode->seqNo = ((pHdr->seqControl.seqNumHi << 4) |
-                                            (pHdr->seqControl.seqNumLo));
-                        pAuthNode->timestamp = vos_timer_get_system_ticks();
                         limAddPreAuthNode(pMac, pAuthNode);
 
                         /**
@@ -822,8 +793,7 @@
                         limSendAuthMgmtFrame(
                                             pMac, &authFrame,
                                             pHdr->sa,
-                                            LIM_NO_WEP_IN_FC,
-                                            psessionEntry, eSIR_FALSE);
+                                            LIM_NO_WEP_IN_FC,psessionEntry);
 
                         /// Send Auth indication to SME
 
@@ -883,8 +853,7 @@
                             limSendAuthMgmtFrame(
                                                 pMac, &authFrame,
                                                 pHdr->sa,
-                                                LIM_NO_WEP_IN_FC,
-                                                psessionEntry, eSIR_FALSE);
+                                                LIM_NO_WEP_IN_FC,psessionEntry);
 
                             return;
                         }
@@ -914,14 +883,11 @@
                             pRxAuthFrameBody->authAlgoNumber;
                             pAuthNode->fSeen = 0;
                             pAuthNode->fTimerStarted = 0;
-                            pAuthNode->seqNo = ((pHdr->seqControl.seqNumHi << 4) |
-                                                (pHdr->seqControl.seqNumLo));
-                            pAuthNode->timestamp = vos_timer_get_system_ticks();
                             limAddPreAuthNode(pMac, pAuthNode);
 
-                            limLog(pMac, LOG1,
-                                   FL("Alloc new data: id %d peer "MAC_ADDRESS_STR),
-                                    pAuthNode->authNodeIdx, MAC_ADDR_ARRAY(pHdr->sa));
+                            PELOG1(limLog(pMac, LOG1, FL("Alloc new data: %x id %d peer "),
+                                          pAuthNode, pAuthNode->authNodeIdx);)
+                            PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                             /// Create and activate Auth Response timer
                             if (tx_timer_change_context(&pAuthNode->timer, pAuthNode->authNodeIdx) != TX_SUCCESS)
@@ -946,8 +912,7 @@
 
                                 limSendAuthMgmtFrame(pMac, &authFrame,
                                                      pHdr->sa,
-                                                     LIM_NO_WEP_IN_FC,
-                                                     psessionEntry, eSIR_FALSE);
+                                                     LIM_NO_WEP_IN_FC,psessionEntry);
 
                                 limDeletePreAuthNode(pMac, pHdr->sa);
                                 return;
@@ -991,8 +956,7 @@
                             limSendAuthMgmtFrame(
                                                 pMac, &authFrame,
                                                 pHdr->sa,
-                                                LIM_NO_WEP_IN_FC,
-                                                psessionEntry, eSIR_FALSE);
+                                                LIM_NO_WEP_IN_FC,psessionEntry);
                         } // if (wlan_cfgGetInt(CFG_PRIVACY_OPTION_IMPLEMENTED))
 
                         break;
@@ -1023,8 +987,7 @@
                         limSendAuthMgmtFrame(
                                             pMac, &authFrame,
                                             pHdr->sa,
-                                            LIM_NO_WEP_IN_FC,
-                                            psessionEntry, eSIR_FALSE);
+                                            LIM_NO_WEP_IN_FC,psessionEntry);
 
                         return;
                 } // end switch(pRxAuthFrameBody->authAlgoNumber)
@@ -1052,8 +1015,7 @@
 
                 limSendAuthMgmtFrame(pMac, &authFrame,
                                      pHdr->sa,
-                                     LIM_NO_WEP_IN_FC,
-                                     psessionEntry, eSIR_FALSE);
+                                     LIM_NO_WEP_IN_FC,psessionEntry);
 
                 return;
             } //end if (limIsAuthAlgoSupported(pRxAuthFrameBody->authAlgoNumber))
@@ -1070,10 +1032,10 @@
                  */
 
                 // Log error
-                limLog(pMac, LOG1,
+                PELOG1(limLog(pMac, LOG1,
                        FL("received Auth frame2 from peer in state %d, addr "),
-                       psessionEntry->limMlmState);
-                limPrintMacAddr(pMac, pHdr->sa, LOG1);
+                       psessionEntry->limMlmState);)
+                PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                 return;
             }
@@ -1153,18 +1115,14 @@
                         return;
                     }
 
-                    limLog(pMac, LOG1,
-                              FL("Alloc new data: peer "MAC_ADDRESS_STR),
-                                                 MAC_ADDR_ARRAY(pHdr->sa));
+                    PELOG1(limLog(pMac, LOG1, FL("Alloc new data: %x peer "), pAuthNode);)
+                    PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                     vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr,
                                  pMac->lim.gpLimMlmAuthReq->peerMacAddr,
                                  sizeof(tSirMacAddr));
                     pAuthNode->fTimerStarted = 0;
                     pAuthNode->authType = pMac->lim.gpLimMlmAuthReq->authType;
-                    pAuthNode->seqNo = ((pHdr->seqControl.seqNumHi << 4) |
-                                        (pHdr->seqControl.seqNumLo));
-                    pAuthNode->timestamp = vos_timer_get_system_ticks();
                     limAddPreAuthNode(pMac, pAuthNode);
 
                     limRestoreFromAuthState(pMac, eSIR_SME_SUCCESS,
@@ -1214,8 +1172,7 @@
 
                         limSendAuthMgmtFrame(pMac, &authFrame,
                                             pHdr->sa,
-                                            LIM_NO_WEP_IN_FC,
-                                            psessionEntry, eSIR_FALSE);
+                                            LIM_NO_WEP_IN_FC,psessionEntry);
                         return;
                     }
                     else
@@ -1263,8 +1220,7 @@
 
                                 limSendAuthMgmtFrame(pMac, &authFrame,
                                                      pHdr->sa,
-                                                     LIM_NO_WEP_IN_FC,
-                                                     psessionEntry, eSIR_FALSE);
+                                                     LIM_NO_WEP_IN_FC,psessionEntry);
 
                                 limRestoreFromAuthState(pMac, eSIR_SME_NO_KEY_MAPPING_KEY_FOR_PEER,
                                                               eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
@@ -1295,8 +1251,7 @@
                                 limSendAuthMgmtFrame(pMac,
                                                      (tpSirMacAuthFrameBody) encrAuthFrame,
                                                      pHdr->sa,
-                                                     LIM_WEP_IN_FC,
-                                                     psessionEntry, eSIR_FALSE);
+                                                     LIM_WEP_IN_FC,psessionEntry);
 
                                 break;
                             } // end if (pKeyMapEntry->key == NULL)
@@ -1344,8 +1299,7 @@
                                 limSendAuthMgmtFrame(
                                                     pMac, &authFrame,
                                                     pHdr->sa,
-                                                    LIM_NO_WEP_IN_FC,
-                                                    psessionEntry, eSIR_FALSE);
+                                                    LIM_NO_WEP_IN_FC,psessionEntry);
 
                                 limRestoreFromAuthState(pMac, eSIR_SME_INVALID_WEP_DEFAULT_KEY,
                                                               eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
@@ -1376,8 +1330,7 @@
                                 limSendAuthMgmtFrame(pMac,
                                                      (tpSirMacAuthFrameBody) encrAuthFrame,
                                                      pHdr->sa,
-                                                     LIM_WEP_IN_FC,
-                                                     psessionEntry, eSIR_FALSE);
+                                                     LIM_WEP_IN_FC,psessionEntry);
 
                                 break;
                         } // end if (pKeyMapEntry)
@@ -1428,8 +1381,7 @@
 
                 limSendAuthMgmtFrame(pMac, &authFrame,
                                      pHdr->sa,
-                                     LIM_NO_WEP_IN_FC,
-                                     psessionEntry, eSIR_FALSE);
+                                     LIM_NO_WEP_IN_FC,psessionEntry);
 
                 return;
             }
@@ -1459,8 +1411,7 @@
 
                     limSendAuthMgmtFrame(pMac, &authFrame,
                                          pHdr->sa,
-                                         LIM_NO_WEP_IN_FC,
-                                         psessionEntry, eSIR_FALSE);
+                                         LIM_NO_WEP_IN_FC,psessionEntry);
 
                     return;
                 }
@@ -1490,8 +1441,7 @@
 
                     limSendAuthMgmtFrame(pMac, &authFrame,
                                          pHdr->sa,
-                                         LIM_NO_WEP_IN_FC,
-                                         psessionEntry, eSIR_FALSE);
+                                         LIM_NO_WEP_IN_FC,psessionEntry);
 
                     return;
                 }
@@ -1516,8 +1466,7 @@
                     limSendAuthMgmtFrame(
                                         pMac, &authFrame,
                                         pHdr->sa,
-                                        LIM_NO_WEP_IN_FC,
-                                        psessionEntry, eSIR_FALSE);
+                                        LIM_NO_WEP_IN_FC,psessionEntry);
 
                     /// Delete pre-auth context of STA
                     limDeletePreAuthNode(pMac,
@@ -1572,8 +1521,7 @@
 
                     limSendAuthMgmtFrame(pMac, &authFrame,
                                          pHdr->sa,
-                                         LIM_NO_WEP_IN_FC,
-                                         psessionEntry, eSIR_FALSE);
+                                         LIM_NO_WEP_IN_FC,psessionEntry);
 
                     /// Send Auth indication to SME
                     vos_mem_copy((tANI_U8 *) mlmAuthInd.peerMacAddr,
@@ -1612,8 +1560,7 @@
 
                     limSendAuthMgmtFrame(pMac, &authFrame,
                                          pHdr->sa,
-                                         LIM_NO_WEP_IN_FC,
-                                         psessionEntry, eSIR_FALSE);
+                                         LIM_NO_WEP_IN_FC,psessionEntry);
 
                     return;
                 }
@@ -1631,10 +1578,10 @@
                  */
 
                 // Log error
-                limLog(pMac, LOG1,
+                PELOG1(limLog(pMac, LOG1,
                        FL("received unexpected Auth frame4 from peer in state "
                        "%d, addr "MAC_ADDRESS_STR), psessionEntry->limMlmState,
-                       MAC_ADDR_ARRAY(pHdr->sa));
+                       MAC_ADDR_ARRAY(pHdr->sa));)
 
                 return;
             }
@@ -1712,18 +1659,14 @@
 
                     return;
                 }
-                limLog(pMac, LOG1,
-                         FL("Alloc new data: peer " MAC_ADDRESS_STR),
-                                              MAC_ADDR_ARRAY(pHdr->sa));
+                PELOG1(limLog(pMac, LOG1, FL("Alloc new data: %x peer "), pAuthNode);
+                limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                 vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr,
                              pMac->lim.gpLimMlmAuthReq->peerMacAddr,
                              sizeof(tSirMacAddr));
                 pAuthNode->fTimerStarted = 0;
                 pAuthNode->authType = pMac->lim.gpLimMlmAuthReq->authType;
-                pAuthNode->seqNo = ((pHdr->seqControl.seqNumHi << 4) |
-                                    (pHdr->seqControl.seqNumLo));
-                pAuthNode->timestamp = vos_timer_get_system_ticks();
                 limAddPreAuthNode(pMac, pAuthNode);
 
                 limRestoreFromAuthState(pMac, eSIR_SME_SUCCESS,
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
index 6e1b64f..6f25f85 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
@@ -37,7 +37,7 @@
  *
  */
 
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "aniGlobal.h"
 #include "cfgApi.h"
 #include "schApi.h"
@@ -82,9 +82,9 @@
     pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
 
 
-    limLog(pMac, LOG2, FL("Received Beacon frame with length=%d from "),
+    PELOG2(limLog(pMac, LOG2, FL("Received Beacon frame with length=%d from "),
            WDA_GET_RX_MPDU_LEN(pRxPacketInfo));
-    limPrintMacAddr(pMac, pHdr->sa, LOG2);
+    limPrintMacAddr(pMac, pHdr->sa, LOG2);)
 
     if (!pMac->fScanOffload)
     {
@@ -106,7 +106,7 @@
         || pMac->fScanOffload
         )
     {
-        pBeacon = vos_mem_vmalloc(sizeof(tSchBeaconStruct));
+        pBeacon = vos_mem_malloc(sizeof(tSchBeaconStruct));
         if ( NULL == pBeacon )
         {
             limLog(pMac, LOGE, FL("Unable to allocate memory in limProcessBeaconFrame") );
@@ -127,7 +127,7 @@
                (sirCompareMacAddr( psessionEntry->bssId, pHdr->sa)))
                 limParseBeaconForTim(pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry);
 
-            vos_mem_vfree(pBeacon);
+            vos_mem_free(pBeacon);
             return;
         }
         /*during scanning, when any session is active, and beacon/Pr belongs to
@@ -155,15 +155,10 @@
         if ((pMac->lim.gLimMlmState  == eLIM_MLM_WT_PROBE_RESP_STATE) ||
             (pMac->lim.gLimMlmState  == eLIM_MLM_PASSIVE_SCAN_STATE))
         {
-            //If we are scanning for P2P, only accept probe rsp
-            if((pMac->lim.gLimHalScanState != eLIM_HAL_SCANNING_STATE) || (NULL == pMac->lim.gpLimMlmScanReq)
-               || !pMac->lim.gpLimMlmScanReq->p2pSearch )
-            {
-                limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo,
-                       ((pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE) ? eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE),
-                       eANI_BOOLEAN_FALSE);
-
-            }
+            limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo,
+                  ((pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE) ?
+                    eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE),
+                    eANI_BOOLEAN_FALSE);
             /* Calling dfsChannelList which will convert DFS channel
              * to Active channel for x secs if this channel is DFS channel */
              limSetDFSChannelList(pMac, pBeacon->channelNumber,
@@ -196,7 +191,7 @@
              // STA in WT_JOIN_BEACON_STATE (IBSS)
             limCheckAndAnnounceJoinSuccess(pMac, pBeacon, pHdr,psessionEntry);
         } // if (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE)
-        vos_mem_vfree(pBeacon);
+        vos_mem_free(pBeacon);
     } // if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || ...
     else
     {
@@ -219,9 +214,9 @@
         }
         else
         {
-            limLog(pMac, LOG1, FL("Received Beacon in unexpected state %d"),
+            PELOG1(limLog(pMac, LOG1, FL("Received Beacon in unexpected state %d"),
                    psessionEntry->limMlmState);
-            limPrintMlmState(pMac, LOG1, psessionEntry->limMlmState);
+            limPrintMlmState(pMac, LOG1, psessionEntry->limMlmState);)
 #ifdef WLAN_DEBUG                    
             pMac->lim.gLimUnexpBcnCnt++;
 #endif
@@ -269,7 +264,7 @@
         (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) ||
         (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE))
     {
-        pBeacon = vos_mem_vmalloc(sizeof(tSchBeaconStruct));
+        pBeacon = vos_mem_malloc(sizeof(tSchBeaconStruct));
         if ( NULL == pBeacon )
         {
             limLog(pMac, LOGE, FL("Unable to allocate memory in limProcessBeaconFrameNoSession") );
@@ -281,19 +276,15 @@
             // Received wrongly formatted/invalid Beacon. Ignore and move on. 
             limLog(pMac, LOGW, FL("Received invalid Beacon in global MLM state %d"), pMac->lim.gLimMlmState);
             limPrintMlmState(pMac, LOGW,  pMac->lim.gLimMlmState);
-            vos_mem_vfree(pBeacon);
+            vos_mem_free(pBeacon);
             return;
         }
 
         if ( (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) ||
              (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) )
         {
-            //If we are scanning for P2P, only accept probe rsp
-            if((pMac->lim.gLimHalScanState != eLIM_HAL_SCANNING_STATE) || (NULL == pMac->lim.gpLimMlmScanReq)
-               || !pMac->lim.gpLimMlmScanReq->p2pSearch )
-            {
-                limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE);
-            }
+            limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo,
+                                         eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE);
             /* Calling dfsChannelList which will convert DFS channel
              * to Active channel for x secs if this channel is DFS channel */
             limSetDFSChannelList(pMac, pBeacon->channelNumber,
@@ -302,7 +293,7 @@
         else if (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE)
         {
         }  // end of eLIM_MLM_LEARN_STATE)       
-        vos_mem_vfree(pBeacon);
+        vos_mem_free(pBeacon);
     } // end of (eLIM_MLM_WT_PROBE_RESP_STATE) || (eLIM_MLM_PASSIVE_SCAN_STATE)
     else
     {
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c
index 3e3cc37..4abb196 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -37,7 +37,7 @@
 
 #include "aniGlobal.h"
 
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "sirMacProtDef.h"
 #include "cfgApi.h"
 #include "limTypes.h"
@@ -649,7 +649,7 @@
 {
     tANI_U32          val=0, phyMode;
 
-    limLog(pMac, LOG2, FL("Applying config"));
+    PELOG2(limLog(pMac, LOG2, FL("Applying config"));)
 
     limInitWdsInfoParams(pMac);
 
@@ -691,10 +691,9 @@
         return;
     }
 
+    PELOG1(limLog(pMac, LOG1, FL("pMac->lim.gScanInPowersave = %hu"),
+                pMac->lim.gScanInPowersave);)
     pMac->lim.gScanInPowersave = (tANI_U8) val;
-    limLog(pMac, LOG1, FL("pMac->lim.gScanInPowersave = %hu"),
-                pMac->lim.gScanInPowersave);
-
 
 } /*** end limApplyConfiguration() ***/
 
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c
index a7d4df8..f0ad865 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c
@@ -264,8 +264,8 @@
             MAC_ADDR_ARRAY(pHdr->sa));)
             if (limSearchPreAuthList(pMac, pHdr->sa))
             {
-                limLog(pMac, LOG1, FL("Preauth entry exist. "
-                "Deleting... "));
+                PELOG1(limLog(pMac, LOG1, FL("Preauth entry exist. "
+                "Deleting... "));)
                 limDeletePreAuthNode(pMac, pHdr->sa);
             }
             return;
@@ -289,11 +289,11 @@
                          */
 
                         // Log error
-                        limLog(pMac, LOG1,
+                        PELOG1(limLog(pMac, LOG1,
                            FL("received Deauth frame state %d with failure "
                            "code %d from "MAC_ADDRESS_STR),
                            psessionEntry->limMlmState, reasonCode,
-                           MAC_ADDR_ARRAY(pHdr->sa));
+                           MAC_ADDR_ARRAY(pHdr->sa));)
 
                         limRestoreFromAuthState(pMac, eSIR_SME_DEAUTH_WHILE_JOIN,
                                                 reasonCode,psessionEntry);
@@ -463,18 +463,13 @@
          */
         PELOGE(limLog(pMac, LOGE,
            FL("received Deauth frame from peer that is in state %d, addr "
-           MAC_ADDRESS_STR", isDisassocDeauthInProgress : %d\n"),
-           pStaDs->mlmStaContext.mlmState,MAC_ADDR_ARRAY(pHdr->sa),
-           pStaDs->isDisassocDeauthInProgress);)
+           MAC_ADDRESS_STR),
+           pStaDs->mlmStaContext.mlmState,MAC_ADDR_ARRAY(pHdr->sa));)
         return;
     } 
     pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes)reasonCode;
     pStaDs->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DEAUTH;
 
-
-    /* send the LOST_LINK_PARAMS_IND to SME*/
-    limUpdateLostLinkParams(pMac, psessionEntry, pRxPacketInfo);
-
     /// Issue Deauth Indication to SME.
     vos_mem_copy((tANI_U8 *) &mlmDeauthInd.peerMacAddr,
                   pStaDs->staAddr,
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c
index 6483854..e3242b6 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,7 +39,7 @@
 #include "wniApi.h"
 #include "sirApi.h"
 #include "aniGlobal.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 
 #include "utilsApi.h"
 #include "limTypes.h"
@@ -124,12 +124,11 @@
     // Get reasonCode from Disassociation frame body
     reasonCode = sirReadU16(pBody);
 
-    limLog(pMac, LOGE,
-        FL("Received Disassoc frame for Addr: "MAC_ADDRESS_STR
-        "(mlm state=%s, sme state=%d),"
+    PELOG2(limLog(pMac, LOGE,
+        FL("Received Disassoc frame for Addr: "MAC_ADDRESS_STR"(mlm state=%s, sme state=%d),"
         "with reason code %d from "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->da),
-        limMlmStateStr(psessionEntry->limMlmState), psessionEntry->limSmeState,
-        reasonCode, MAC_ADDR_ARRAY(pHdr->sa));
+        limMlmStateStr(psessionEntry->limMlmState), psessionEntry->limSmeState, reasonCode,
+        MAC_ADDR_ARRAY(pHdr->sa));)
 
     /**
    * Extract 'associated' context for STA, if any.
@@ -229,7 +228,6 @@
             case eSIR_MAC_RSN_IE_MISMATCH_REASON:
             case eSIR_MAC_1X_AUTH_FAILURE_REASON:
             case eSIR_MAC_PREV_AUTH_NOT_VALID_REASON:
-            case eSIR_MAC_PEER_REJECT_MECHANISIM_REASON:
                 // Valid reasonCode in received Disassociation frame
                 break;
 
@@ -253,7 +251,7 @@
                        FL("received Disassoc frame with invalid reasonCode "
                        "%d from "MAC_ADDRESS_STR), reasonCode,
                        MAC_ADDR_ARRAY(pHdr->sa));)
-                break;
+                return;
         }
     }
     else
@@ -277,10 +275,8 @@
          * and received Disassociation frame. Log and Ignore.
          */
         PELOGE(limLog(pMac, LOGE,
-               FL("received Disassoc frame in state %d from "MAC_ADDRESS_STR
-               ",isDisassocDeauthInProgress : %d\n"),
-               pStaDs->mlmStaContext.mlmState, MAC_ADDR_ARRAY(pHdr->sa),
-               pStaDs->isDisassocDeauthInProgress);)
+               FL("received Disassoc frame in state %d from "MAC_ADDRESS_STR),
+               pStaDs->mlmStaContext.mlmState, MAC_ADDR_ARRAY(pHdr->sa));)
 
         return;
     } 
@@ -333,7 +329,7 @@
         limRestorePreReassocState(pMac,eSIR_SME_REASSOC_REFUSED, reasonCode,psessionEntry);
         return;
     }
-    limUpdateLostLinkParams(pMac, psessionEntry, pRxPacketInfo);
+
     limPostSmeMessage(pMac, LIM_MLM_DISASSOC_IND,
                       (tANI_U32 *) &mlmDisassocInd);
 
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessLmmMessages.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessLmmMessages.c
index 3b17bf8..353f1b1 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessLmmMessages.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessLmmMessages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,7 +38,7 @@
 
 #include "aniGlobal.h"
 #include "wniApi.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "cfgApi.h"
 #include "sirApi.h"
 #include "schApi.h"
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessMessageQueue.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
index d7cb4b1..4f9339d 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -44,7 +44,7 @@
 #include "wlan_qct_pal_packet.h"
 #include "wlan_qct_wda.h"
 
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "cfgApi.h"
 #include "sirCommon.h"
 #include "utilsApi.h"
@@ -75,23 +75,17 @@
 #include "wmmApsd.h"
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-#include "limRMC.h"
-#endif
-
 #include "vos_types.h"
 #include "vos_packet.h"
 #include "vos_memory.h"
 
 /* This value corresponds to 500 ms */
-#define MAX_PROBEREQ_TIME 50
+#define MAX_PROBEREQ_TIME 5000
 
 #ifdef WLAN_FEATURE_EXTSCAN
 #define  SIZE_OF_FIXED_PARAM 12
 #endif
 
-#define CHECK_BIT(value, mask)    ((value) & (1 << (mask)))
-
 void limLogSessionStates(tpAniSirGlobal pMac);
 
 /** -------------------------------------------------------------
@@ -156,25 +150,7 @@
 #ifdef FEATURE_OEM_DATA_SUPPORT
         (limMsg->type != WDA_START_OEM_DATA_RSP) &&
 #endif
-        (limMsg->type != WDA_ADD_TS_RSP) &&
-
-        /* LIM won't process any defer queue commands if gLimAddtsSent is set to
-           TRUE. gLimAddtsSent will be set TRUE to while sending ADDTS REQ. Say,
-           when deferring is enabled, if SIR_LIM_ADDTS_RSP_TIMEOUT is posted
-           (because of not receiving ADDTS RSP) then this command will be added
-           to defer queue and as gLimAddtsSent is set TRUE LIM will never
-           process any commands from defer queue, including
-           SIR_LIM_ADDTS_RSP_TIMEOUT. Hence allowing SIR_LIM_ADDTS_RSP_TIMEOUT
-           command to be processed with deferring enabled, so that this will be
-           processed immediately and sets gLimAddtsSent to FALSE.
-         */
-        (limMsg->type != SIR_LIM_ADDTS_RSP_TIMEOUT) &&
-        (limMsg->type != WDA_LOST_LINK_PARAMS_IND) &&
-        /* Allow processing of RX frames while awaiting reception of
-           ADD TS response over the air. This logic particularly handles the
-           case when host sends ADD BA request to FW after ADD TS request
-           is sent over the air and ADD TS response received over the air */
-        !(limMsg->type == SIR_BB_XPORT_MGMT_MSG && pMac->lim.gLimAddtsSent))
+        (limMsg->type != WDA_ADD_TS_RSP))
     {
         PELOG1(limLog(pMac, LOG1, FL("Defer the current message %s , gLimProcessDefdMsgs is false and system is not in scan/learn mode"),
                limMsgStr(limMsg->type));)
@@ -382,8 +358,8 @@
 
         if (limIsGroupAddr(pMacHdr->addr2))
         {
-            limLog(pMac, LOG1, FL("Ignoring A2 Invalid Packet received for MC/BC:"));
-                    limPrintMacAddr(pMac, pMacHdr->addr2, LOG1);
+            PELOG2(limLog(pMac, LOG2, FL("Ignoring A2 Invalid Packet received for MC/BC:"));
+                    limPrintMacAddr(pMac, pMacHdr->addr2, LOG2);)
 
                 return;
         }
@@ -596,7 +572,7 @@
         if ( DOT11F_FAILED( status ) )
         {
             limLog(pMac, LOGE, FL("Failed to parse a Beacons"
-                        "(%d)"), status);
+                        "(%d):\n"), status);
             vos_mem_free(pBeacon);
             return;
         }
@@ -634,7 +610,7 @@
         if ( DOT11F_FAILED( status ) )
         {
             limLog(pMac, LOGE, FL("Failed to parse a Probe"
-                        "Response (%d"), status);
+                        "Response (%d:\n"), status);
             vos_mem_free(pProbeResponse);
             return;
         }
@@ -651,7 +627,7 @@
         tEXTScanFullScanResult.ap.capability =
                             *(((tANI_U16 *)&pProbeResponse->Capabilities));
 
-        vos_mem_free(pProbeResponse);
+        vos_mem_free(pBeacon);
     }
     else
     {
@@ -701,7 +677,6 @@
  */
 
 static void 
-
 limHandle80211Frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pDeferMsg)
 {
     tANI_U8          *pRxPacketInfo = NULL;
@@ -741,63 +716,14 @@
         if ((fc.type == SIR_MAC_MGMT_FRAME) &&
                 (fc.subType != SIR_MAC_MGMT_BEACON))
         {
-            limLog(pMac, LOG1, FL("RX MGMT - Type %hu, SubType %hu,"
-                                  "Seq.no %d, Source mac-addr "
-                                  MAC_ADDRESS_STR), fc.type, fc.subType,
-                                  ((pHdr->seqControl.seqNumHi << 4) |
-                                   (pHdr->seqControl.seqNumLo)),
-                                  MAC_ADDR_ARRAY(pHdr->sa));
+            limLog(pMac, LOG1, FL("RX MGMT - Type %hu, SubType %hu, Seq.no %d"),
+                    fc.type, fc.subType,
+                    ((pHdr->seqControl.seqNumHi << 4) | (pHdr->seqControl.seqNumLo)));
         }
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-    if (WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
+    if ( WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
     {
-        limLog( pMac, LOGW, FL("Notify SME with candidate ind"));
-
-        if (WDA_IF_PER_ROAMCANDIDATEIND(pRxPacketInfo) &&
-            IS_FEATURE_SUPPORTED_BY_FW(PER_BASED_ROAMING) &&
-            pMac->roam.configParam.isPERRoamEnabled)
-        {
-            tSirPerRoamScanResult *candidateChanInfo =
-                (tSirPerRoamScanResult *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
-            int chanInfoLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo)
-                                      - sizeof(tANI_U32);
-
-            /* Translate network buffer into system buffer */
-            vos_buff_to_hl_buff((v_U8_t *)candidateChanInfo,
-                          WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo));
-
-            /* Max candidates allowed */
-            if (candidateChanInfo->candidateCount > SIR_PER_ROAM_MAX_AP_CNT)
-            {
-                limLog(pMac, LOGE,
-                       FL("Got maximum candidates as %d setting default"),
-                       candidateChanInfo->candidateCount);
-                candidateChanInfo->candidateCount = SIR_PER_ROAM_MAX_AP_CNT;
-            }
-
-            vos_mem_set(&pMac->candidateChannelInfo,
-                        sizeof(tSirCandidateChanInfo) *
-                        SIR_PER_ROAM_MAX_CANDIDATE_CNT, 0);
-
-            vos_mem_copy(&pMac->candidateChannelInfo,
-                         candidateChanInfo->channelInfo,
-                         (sizeof(tSirCandidateChanInfo) *
-                         SIR_PER_ROAM_MAX_CANDIDATE_CNT) < chanInfoLen ?
-                         (sizeof(tSirCandidateChanInfo) *
-                         SIR_PER_ROAM_MAX_CANDIDATE_CNT):
-                         chanInfoLen);
-
-            limLog(pMac, LOG1,
-                   FL("PER based Roam candidates %d"),
-                   candidateChanInfo->candidateCount);
-
-            pMac->PERroamCandidatesCnt = candidateChanInfo->candidateCount;
-        } else
-        {
-            /* Normal RSSI based roaming */
-            pMac->PERroamCandidatesCnt = 0;
-        }
-
+        limLog( pMac, LOG2, FL("Notify SME with candidate ind"));
         //send a session 0 for now - TBD
         limSendSmeCandidateFoundInd(pMac, 0);
         goto end;
@@ -853,21 +779,6 @@
 
     } else
 #endif
-
-    if ((fc.type == SIR_MAC_MGMT_FRAME) &&
-        (fc.subType == SIR_MAC_MGMT_PROBE_RSP) &&
-        pMac->lim.isSpoofingEnabled)
-    {
-        limLog( pMac, LOG2, FL("Probe Rsp recieved with DA: "MAC_ADDRESS_STR
-            " and selfMac Addr:"MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->da),
-                            MAC_ADDR_ARRAY(pMac->lim.gSelfMacAddr));
-        if (VOS_TRUE == vos_mem_compare((v_VOID_t*) pHdr->da,
-               (v_VOID_t*) pMac->lim.spoofMacAddr, VOS_MAC_ADDRESS_LEN))
-        {
-            vos_mem_copy(pHdr->da, pMac->lim.gSelfMacAddr, VOS_MAC_ADDRESS_LEN);
-        }
-    }
-
     /* Added For BT-AMP Support */
     if((psessionEntry = peFindSessionByBssid(pMac,pHdr->bssId,&sessionId))== NULL)
     {
@@ -881,7 +792,8 @@
 #endif
             if (limProcessAuthFrameNoSession(pMac, pRxPacketInfo, limMsg->bodyptr) == eSIR_SUCCESS)
             {
-                goto end;
+                limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
+                return;
             }
         }
 #endif
@@ -895,7 +807,8 @@
             if((psessionEntry = peFindSessionByPeerSta(pMac,pHdr->sa,&sessionId))== NULL) 
             {
                limLog(pMac, LOG1, FL("session does not exist for given bssId"));
-               goto end;
+               limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
+               return;
             }
             else
                limLog(pMac,LOG1,"SessionId:%d Session Exist for given Bssid",
@@ -914,7 +827,8 @@
     if(limCheckMgmtRegisteredFrames(pMac, pRxPacketInfo, psessionEntry))
     {        
         limLog( pMac, LOG1, FL("Received frame is passed to SME"));
-        goto end;
+        limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
+        return;
     }
 
 
@@ -923,10 +837,11 @@
     {   // Received Frame with non-zero Protocol Version
         limLog(pMac, LOGE, FL("Unexpected frame with protVersion %d received"),
            fc.protVer);
+        limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
 #ifdef WLAN_DEBUG            
         pMac->lim.numProtErr++;
 #endif
-        goto end;
+        return;
     }
 
     if (!pMac->fScanOffload)
@@ -1058,6 +973,27 @@
         break;
         case SIR_MAC_DATA_FRAME:
         {
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+            /*
+             * if we reach here, following cases are possible. 
+             * Possible cases: a) if frame translation is disabled.
+             *                 b) Some frame with ADRR2 filter enabled may come
+             *                    here.
+             */ 
+            tANI_U8 *dataOffset = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+            tANI_U8 *rfc1042Hdr = (tANI_U8 *)(dataOffset + RFC1042_HDR_LENGTH) ;
+            tANI_U16 ethType = GET_BE16(rfc1042Hdr) ;
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                                ("TDLS frame with 80211 Header")) ;
+            if(ETH_TYPE_89_0d == ethType)
+            {
+                tANI_U8 payloadType = (rfc1042Hdr + ETH_TYPE_LEN)[0] ;
+                if(PAYLOAD_TYPE_TDLS == payloadType)
+                {
+                    limProcessTdlsFrame(pMac, (tANI_U32*)pRxPacketInfo) ;
+                }
+            }     
+#endif
 #if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
              /* We accept data frame (IAPP frame) only if Session is
               * present and ese connection is established on that
@@ -1075,7 +1011,9 @@
 
     } // switch (fc.type)
 
+#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
 end:
+#endif
     limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr) ;
     return;
 } /*** end limHandle80211Frames() ***/
@@ -1148,7 +1086,7 @@
      * SME should send WNI_CFG_BACKGROUND_SCAN_PERIOD indication 
      * to start the background scan again
      */
-    limLog(pMac, LOG1, FL("Processing AbortScan Ind"));
+    PELOG2(limLog(pMac, LOG2, FL("Processing AbortScan Ind"));)
 
     limAbortBackgroundScan(pMac);
 
@@ -1307,6 +1245,7 @@
     return match;
 }
 
+
 /**
  * limProcessMessages
  *
@@ -1356,29 +1295,8 @@
       limMsgStr(limMsg->type), limSmeStateStr(pMac->lim.gLimSmeState),
       limMlmStateStr(pMac->lim.gLimMlmState));)
 
-   /*
-    * MTRACE logs not captured for events received from SME
-    * SME enums (eWNI_SME_START_REQ) starts with 0x16xx.
-    * Compare received SME events with SIR_SME_MODULE_ID
-    */
+    MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
 
-    if (SIR_SME_MODULE_ID == (tANI_U8)MAC_TRACE_GET_MODULE_ID(limMsg->type))
-    {
-       MTRACE(macTrace(pMac, TRACE_CODE_RX_SME_MSG, NO_SESSION, limMsg->type));
-    }
-    else
-    {
-       /* Omitting below message types as these are too frequent and when crash
-        * happens we loose critical trace logs if these are also logged
-        */
-       if (limMsg->type != SIR_LIM_MAX_CHANNEL_TIMEOUT &&
-           limMsg->type != SIR_LIM_MIN_CHANNEL_TIMEOUT &&
-           limMsg->type != SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT &&
-           limMsg->type != SIR_CFG_PARAM_UPDATE_IND &&
-           limMsg->type != SIR_BB_XPORT_MGMT_MSG)
-              MTRACE(macTraceMsgRx(pMac, NO_SESSION,
-                      LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
-    }
     switch (limMsg->type)
     {
 
@@ -1452,11 +1370,18 @@
 #ifdef WLAN_DEBUG                
             pMac->lim.numBbt++;
 #endif
+            vos_spin_lock_acquire( &pMac->sys.lock );
+            pMac->sys.gSysBbtPendingMgmtCount--;
+            vos_spin_lock_release( &pMac->sys.lock );
             {
                 v_U16_t     pktLen = 0;
                 vos_pkt_t  *pVosPkt;
                 VOS_STATUS  vosStatus;
                 tSirMsgQ    limMsgNew;
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+                tANI_U32    *pBD = NULL ;
+#endif 
+
                 /* The original limMsg which we were deferring have the 
                  * bodyPointer point to 'BD' instead of 'Vos pkt'. If we don't make a copy
                  * of limMsg, then vos_pkt_peek_data will overwrite the limMsg->bodyPointer. 
@@ -1472,22 +1397,11 @@
 
                 if( !VOS_IS_STATUS_SUCCESS(vosStatus) )
                 {
-                    limDecrementPendingMgmtCount(pMac);
                     vos_pkt_return_packet(pVosPkt);
                     break;
 
                 }
 
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-                if (WDA_GET_ROAMCANDIDATEIND(limMsgNew.bodyptr))
-                    limLog(pMac, LOG1, FL("roamCandidateInd %d"),
-                           WDA_GET_ROAMCANDIDATEIND(limMsgNew.bodyptr));
-
-                if (WDA_GET_OFFLOADSCANLEARN(limMsgNew.bodyptr))
-                    limLog(pMac, LOG1, FL("offloadScanLearn %d"),
-                           WDA_GET_OFFLOADSCANLEARN(limMsgNew.bodyptr));
-#endif
-
                 /*
                 * putting a check for age out probe request frames
                 * such that any probe req more than 0.5 sec old can directly
@@ -1496,17 +1410,33 @@
 
                 if( limAgeOutProbeReq ( pMac, &limMsgNew, pVosPkt ))
                 {
-                   limDecrementPendingMgmtCount(pMac);
                    break;
                 }
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+                /* 
+                 * TDLS frames comes as translated frames as well as
+                 * MAC 802.11 data frames..
+                 */
+                limGetBDfromRxPacket(pMac, limMsgNew.bodyptr, &pBD);
+                if(0 != WDA_GET_RX_FT_DONE(pBD))
+                {
+                    /*
+                     * TODO: check for scanning state and set deferMesg flag
+                     * accordingly..
+                     */
+                    deferMsg = false ;
+
+                    limProcessTdlsFrame(pMac, pBD) ;
+                }
+                else
+#endif
 
                 limHandle80211Frames(pMac, &limMsgNew, &deferMsg);
 
                 if ( deferMsg == true )
                 {
-                        limLog(pMac, LOG2, FL("Defer message type=%X "),
-                                                            limMsg->type);
+                    PELOG1(limLog(pMac, LOG1, FL("Defer message type=%X "), limMsg->type);)
                         if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
                         {
                             PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)"),
@@ -1514,7 +1444,6 @@
                                 pMac->lim.gLimSystemRole,  pMac->lim.gLimMlmState,  pMac->lim.gLimPrevMlmState);)
                             limLogSessionStates(pMac);
                             limPrintMsgName(pMac, LOGE, limMsg->type);
-                            limDecrementPendingMgmtCount(pMac);
                             vos_pkt_return_packet(pVosPkt);
                         }
                 }
@@ -1524,11 +1453,11 @@
                      * Asumption here is when Rx mgmt frame processing is done,
                      * voss packet could be freed here.
                      */
-                    limDecrementPendingMgmtCount(pMac);
                     vos_pkt_return_packet(pVosPkt);
                 }
             }
             break;
+
         case eWNI_SME_SCAN_REQ:
         case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
         case eWNI_SME_DISASSOC_REQ:
@@ -1545,6 +1474,11 @@
 // tdlsoffchan
         case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
 #endif
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+        case eWNI_SME_TDLS_DISCOVERY_START_REQ:
+        case eWNI_SME_TDLS_LINK_START_REQ:
+        case eWNI_SME_TDLS_TEARDOWN_REQ:
+#endif
         case eWNI_SME_RESET_AP_CAPS_CHANGED:
             // These messages are from HDD
             limProcessNormalHddMsg(pMac, limMsg, true);  //need to response to hdd
@@ -1621,7 +1555,6 @@
         case eWNI_SME_GET_TSM_STATS_REQ:
 #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
         case eWNI_SME_MAC_SPOOF_ADDR_IND:
-        case eWNI_SME_REGISTER_MGMT_FRAME_CB:
             // These messages are from HDD
             limProcessNormalHddMsg(pMac, limMsg, false);   //no need to response to hdd
             break;
@@ -1660,17 +1593,6 @@
             limMsg->bodyptr = NULL;
             break;
 
-#ifdef WLAN_FEATURE_RMC
-        case eWNI_SME_ENABLE_RMC_REQ:
-        case eWNI_SME_DISABLE_RMC_REQ:
-            /*
-             * These messages are from HDD
-             * No need to response to hdd
-             */
-            limProcessSmeReqMessages(pMac,limMsg);
-            break;
-#endif /* WLAN_FEATURE_RMC */
-
         case SIR_HAL_P2P_NOA_START_IND:
         {
             tpPESession psessionEntry = &pMac->lim.gpSession[0];
@@ -1834,11 +1756,7 @@
            limMsg->bodyptr = NULL;
            break;
     
-        case WDA_LOST_LINK_PARAMS_IND:
-            limProcessLostLinkParamsInd(pMac,limMsg);
-            vos_mem_free(limMsg->bodyptr);
-            limMsg->bodyptr = NULL;
-            break;
+
 
         case SIR_LIM_ADDTS_RSP_TIMEOUT:
             limProcessSmeReqMessages(pMac,limMsg);
@@ -1903,7 +1821,6 @@
         case SIR_LIM_DISASSOC_ACK_TIMEOUT:
         case SIR_LIM_DEAUTH_ACK_TIMEOUT:
         case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
-        case SIR_LIM_AUTH_RETRY_TIMEOUT:
             // These timeout messages are handled by MLM sub module
 
             limProcessMlmReqMessages(pMac,
@@ -2029,6 +1946,80 @@
             limProcessWPSOverlapTimeout(pMac);
             break;
 #endif
+
+
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+        /*
+         * Here discovery timer expires, now we can go ahead and collect all
+         * the dicovery responses PE has process till now and send this
+         * responses to SME..
+         */
+        case SIR_LIM_TDLS_DISCOVERY_RSP_WAIT:
+        {
+            //fetch the sessionEntry based on the sessionId
+            tpPESession psessionEntry = peFindSessionBySessionId(pMac, 
+                         pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId) ;
+            if(NULL == psessionEntry) 
+            {
+              limLog(pMac, LOGP,FL("Session Does not exist for given sessionID %d"), pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId);
+              return;
+            }
+            
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, 
+                                ("Discovery Rsp timer expires ")) ;
+#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet 
+            /* restore RXP filters */
+            limSetLinkState(pMac, eSIR_LINK_FINISH_TDLS_DISCOVERY_STATE,
+                                            psessionEntry->bssId) ;
+#endif
+            limSendSmeTdlsDisRsp(pMac, eSIR_SUCCESS, 
+                                eWNI_SME_TDLS_DISCOVERY_START_RSP) ;
+            break ;
+        }
+
+        /*
+         * we initiated link setup and did not receive TDLS setup rsp
+         * from TDLS peer STA, send failure RSP to SME.
+         */
+        case SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT:
+        {
+            tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
+            tLimTdlsLinkSetupPeer *setupPeer = NULL ;
+ 
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                                ("TDLS setup rsp timer expires ")) ;
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+                      ("TDLS setup rsp timer expires for peer:"
+                      MAC_ADDRESS_STR), MAC_ADDR_ARRAY(peerMac));
+
+            limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
+            if(NULL != setupPeer)
+            {
+                limTdlsDelLinkPeer( pMac, peerMac) ;
+            }
+
+            limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, peerMac, 
+                                            eWNI_SME_TDLS_LINK_START_RSP) ;
+            break ;
+        }
+        case SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT:
+        {
+            tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
+            tLimTdlsLinkSetupPeer *setupPeer = NULL ;
+
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                                ("TDLS setup CNF timer expires ")) ;
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+                      ("TDLS setup CNF timer expires for peer: "
+                       MAC_ADDRESS_STR), MAC_ADDR_ARRAY(peerMac));
+            limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
+            if(NULL != setupPeer)
+            {
+                limTdlsDelLinkPeer( pMac, peerMac) ;
+            }
+            break ;
+        }
+#endif   /* FEATURE_WLAN_TDLS TIMER */
         case WDA_ADD_BSS_RSP:
             limProcessMlmAddBssRsp( pMac, limMsg );
             break;
@@ -2162,11 +2153,8 @@
         {
 #ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
             tpPESession     psessionEntry;
-            tANI_U8 sessionId;
-            tSirSetActiveModeSetBncFilterReq *bcnFilterReq =
-                (tSirSetActiveModeSetBncFilterReq *)limMsg->bodyptr;
-            psessionEntry = peFindSessionByBssid(pMac, bcnFilterReq->bssid,
-                                                 &sessionId);
+            tANI_U8 sessionId = (tANI_U8)limMsg->bodyval ;
+            psessionEntry = &pMac->lim.gpSession[sessionId];
             if(psessionEntry != NULL && IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
             {
                // sending beacon filtering information down to HAL
@@ -2222,38 +2210,23 @@
     case eWNI_SME_HT40_STOP_OBSS_SCAN_IND:
         {
            tpPESession     psessionEntry = NULL;
-           tANI_U8 sessionId;
-           tSirSmeHT40OBSSStopScanInd *ht40StopScanInd =
-               (tSirSmeHT40OBSSStopScanInd *)limMsg->bodyptr;
+           tANI_U8 sessionId = (tANI_U8)limMsg->bodyval ;
 
-           psessionEntry = peFindSessionByBssid(pMac,
-                   ht40StopScanInd->bssid, &sessionId);;
+           psessionEntry = &pMac->lim.gpSession[sessionId];
            /* Sending LIM STOP OBSS SCAN Indication
                      Stop command support is only for debugging purpose */
-           if (psessionEntry && IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
+           if ( IS_HT40_OBSS_SCAN_FEATURE_ENABLE )
               limSendHT40OBSSStopScanInd(pMac, psessionEntry);
            else
               VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_ERROR,
                    "OBSS Scan Stop not started ");
         }
-        vos_mem_free(limMsg->bodyptr);
-        limMsg->bodyptr = NULL;
         break;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    case eWNI_SME_SET_HT_2040_MODE:
-        limProcessSmeReqMessages(pMac, limMsg);
-        vos_mem_free((v_VOID_t*)limMsg->bodyptr);
-        limMsg->bodyptr = NULL;
-        break;
-#endif
-
 #ifdef FEATURE_WLAN_TDLS
         case WDA_SET_TDLS_LINK_ESTABLISH_REQ_RSP:
         {
             tpPESession     psessionEntry;
             tANI_U8         sessionId;
-            tDphHashNode   *pStaDs = NULL;
-            int i, aid;
             tTdlsLinkEstablishParams *pTdlsLinkEstablishParams;
             pTdlsLinkEstablishParams = (tTdlsLinkEstablishParams*) limMsg->bodyptr;
 
@@ -2261,7 +2234,7 @@
                                                      pTdlsLinkEstablishParams->staIdx,
                                                      &sessionId))== NULL)
             {
-                limLog(pMac, LOGE, FL("session %u  does not exist"), sessionId);
+                limLog(pMac, LOGE, FL("session %u  does not exist.\n"), sessionId);
                 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP message to SME
                    with session id as zero and status as FAILURE so, that message
                    queued in SME queue can be freed to prevent the SME cmd buffer leak */
@@ -2273,32 +2246,10 @@
             }
             else
             {
-                for (i = 0;
-                     i < sizeof(psessionEntry->peerAIDBitmap)/sizeof(tANI_U32);
-                                                                i++) {
-                    for (aid = 0; aid < (sizeof(tANI_U32) << 3); aid++) {
-                        if (CHECK_BIT(psessionEntry->peerAIDBitmap[i], aid)) {
-                            pStaDs = dphGetHashEntry(pMac,
-                                           (aid + i*(sizeof(tANI_U32) << 3)),
-                                            &psessionEntry->dph.dphHashTable);
-                              if ((NULL != pStaDs) &&
-                                   (pTdlsLinkEstablishParams->staIdx ==
-                                                       pStaDs->staIndex))
-                                  goto send_link_resp;
-                        }
-                    }
-                }
-send_link_resp:
-                if (pStaDs)
-                   limSendSmeTdlsLinkEstablishReqRsp(pMac,
+                limSendSmeTdlsLinkEstablishReqRsp(pMac,
                                                   psessionEntry->smeSessionId,
-                                                  pStaDs->staAddr,
-                                                  pStaDs,
-                                                  pTdlsLinkEstablishParams->status) ;
-                else
-                   limSendSmeTdlsLinkEstablishReqRsp(pMac,
-                                                  psessionEntry->smeSessionId,
-                                                  NULL, NULL,
+                                                  NULL,
+                                                  NULL,
                                                   pTdlsLinkEstablishParams->status) ;
             }
             vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
@@ -2310,8 +2261,6 @@
         {
             tpPESession     psessionEntry;
             tANI_U8         sessionId;
-            tDphHashNode   *pStaDs = NULL;
-            int i, aid;
             tTdlsChanSwitchParams *pTdlsChanSwitchParams;
             pTdlsChanSwitchParams = (tTdlsChanSwitchParams*) limMsg->bodyptr;
 
@@ -2319,7 +2268,7 @@
                                                      pTdlsChanSwitchParams->staIdx,
                                                      &sessionId))== NULL)
             {
-                limLog(pMac, LOGE, FL("session %u  does not exist"), sessionId);
+                limLog(pMac, LOGE, FL("session %u  does not exist.\n"), sessionId);
                 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP message to SME
                    with session id as zero and status as FAILURE so, that message
                    queued in SME queue can be freed to prevent the SME cmd buffer leak */
@@ -2331,33 +2280,11 @@
             }
             else
             {
-                for (i = 0;
-                     i < sizeof(psessionEntry->peerAIDBitmap)/sizeof(tANI_U32);
-                                                                i++) {
-                    for (aid = 0; aid < (sizeof(tANI_U32) << 3); aid++) {
-                        if (CHECK_BIT(psessionEntry->peerAIDBitmap[i], aid)) {
-                            pStaDs = dphGetHashEntry(pMac,
-                                           (aid + i*(sizeof(tANI_U32) << 3)),
-                                            &psessionEntry->dph.dphHashTable);
-                              if ((NULL != pStaDs) &&
-                                   (pTdlsChanSwitchParams->staIdx ==
-                                                       pStaDs->staIndex))
-                                  goto send_chan_switch_resp;
-                        }
-                    }
-                }
-send_chan_switch_resp:
-                if (pStaDs)
-                    limSendSmeTdlsChanSwitchReqRsp(pMac,
+                limSendSmeTdlsChanSwitchReqRsp(pMac,
                                                   psessionEntry->smeSessionId,
-                                                  pStaDs->staAddr,
-                                                  pStaDs,
-                                                  pTdlsChanSwitchParams->status);
-               else
-                    limSendSmeTdlsChanSwitchReqRsp(pMac,
-                                                  psessionEntry->smeSessionId,
-                                                  NULL, NULL,
-                                                  pTdlsChanSwitchParams->status);
+                                                  NULL,
+                                                  NULL,
+                                                  pTdlsChanSwitchParams->status) ;
             }
             vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
             limMsg->bodyptr = NULL;
@@ -2376,44 +2303,6 @@
        limMsg->bodyptr = NULL;
        break;
     }
-#ifdef WLAN_FEATURE_RMC
-    case WDA_RMC_BECOME_RULER:
-        limProcessRMCMessages(pMac, eLIM_RMC_BECOME_RULER_RESP,
-                          (void *)limMsg->bodyptr);
-        vos_mem_free((v_VOID_t*)limMsg->bodyptr);
-        limMsg->bodyptr = NULL;
-        break ;
-
-    case WDA_RMC_RULER_SELECT_RESP:
-        limProcessRMCMessages(pMac, eLIM_RMC_RULER_SELECT_RESP,
-                          (void *)limMsg->bodyptr);
-        vos_mem_free((v_VOID_t*)limMsg->bodyptr);
-        limMsg->bodyptr = NULL;
-        break ;
-
-    case WDA_RMC_UPDATE_IND:
-        limProcessRMCMessages(pMac, eLIM_RMC_RULER_PICK_NEW,
-                          (void *)limMsg->bodyptr);
-        vos_mem_free((v_VOID_t*)limMsg->bodyptr);
-        limMsg->bodyptr = NULL;
-        break ;
-#endif /* WLAN_FEATURE_RMC */
-
-    case WDA_SPOOF_MAC_ADDR_RSP:
-       limProcessMlmSpoofMacAddrRsp(pMac, (tSirRetStatus)limMsg->bodyval);
-       break;
-
-    case eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ:
-         limProcessSmeSetTdls2040BSSCoexReq(pMac, limMsg->bodyptr);
-         vos_mem_free((v_VOID_t*)limMsg->bodyptr);
-         limMsg->bodyptr = NULL;
-        break;
-
-    case eWNI_SME_DEL_ALL_TDLS_PEERS:
-         limProcessSmeDelAllTdlsPeers(pMac, limMsg->bodyptr);
-         vos_mem_free((v_VOID_t*)limMsg->bodyptr);
-         limMsg->bodyptr = NULL;
-         break;
 
     default:
         vos_mem_free((v_VOID_t*)limMsg->bodyptr);
@@ -2478,7 +2367,7 @@
             limProcessMessages(pMac, &limMsg);
 
             if((limIsSystemInScanState(pMac)) || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) ||
-                 (pMac->lim.gLimSystemInScanLearnMode) || pMac->lim.gLimAddtsSent)
+                 (pMac->lim.gLimSystemInScanLearnMode))
                 break;
         }
     }
@@ -2663,13 +2552,10 @@
     {
         if(pMac->lim.gpSession[i].valid)
         {
-            limLog(pMac, LOG1, FL("Session[%d] sysRole(%d) limSmeState %d "
-                    "(prev sme state %d) mlm state %d (prev mlm state %d)"),
-                   i, pMac->lim.gpSession[i].limSystemRole,
-                   pMac->lim.gpSession[i].limSmeState,
-                   pMac->lim.gpSession[i].limPrevSmeState,
-                   pMac->lim.gpSession[i].limMlmState,
-                   pMac->lim.gpSession[i].limPrevMlmState);
+            PELOG1(limLog(pMac, LOG1, FL("Session[%d] sysRole(%d) limSmeState %d (prev sme state %d) mlm state %d (prev mlm state %d)"),
+                   i, pMac->lim.gpSession[i].limSystemRole,  pMac->lim.gpSession[i].limSmeState,  
+                   pMac->lim.gpSession[i].limPrevSmeState,   pMac->lim.gpSession[i].limMlmState,  
+                   pMac->lim.gpSession[i].limPrevMlmState);)
         }
     }
 #endif //ifdef WLAN_DEBUG
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
index fcf5a01..853f5b5 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,7 +36,7 @@
  *
  */
 #include "palTypes.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "aniGlobal.h"
 #include "sirApi.h"
 #include "sirParams.h"
@@ -88,8 +88,6 @@
 static void limProcessAuthRspTimeout(tpAniSirGlobal, tANI_U32);
 static void limProcessAssocFailureTimeout(tpAniSirGlobal, tANI_U32);
 static void limProcessPeriodicJoinProbeReqTimer(tpAniSirGlobal);
-static void limProcessAuthRetryTimer(tpAniSirGlobal);
-
 
 static void limProcessMlmRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
 void 
@@ -160,9 +158,6 @@
                                             limProcessInsertSingleShotNOATimeout(pMac); break;
         case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
                                             limConvertActiveChannelToPassiveChannel(pMac); break;
-        case SIR_LIM_AUTH_RETRY_TIMEOUT:
-                                            limProcessAuthRetryTimer(pMac);
-                                            break;
         case SIR_LIM_DISASSOC_ACK_TIMEOUT:  limProcessDisassocAckTimeout(pMac); break;
         case SIR_LIM_DEAUTH_ACK_TIMEOUT:    limProcessDeauthAckTimeout(pMac); break;
         case LIM_MLM_ADDBA_REQ:             limProcessMlmAddBAReq( pMac, Msg->bodyptr ); break;
@@ -212,7 +207,7 @@
     else
         checkTraffic = eSIR_CHECK_ROAMING_SCAN;
 
-    limLog(pMac, LOG1, FL("Calling limSendHalInitScanReq"));
+    PELOG1(limLog(pMac, LOG1, FL("Calling limSendHalInitScanReq"));)
     limSendHalInitScanReq(pMac, eLIM_HAL_INIT_SCAN_WAIT_STATE, checkTraffic);
 
     return ;
@@ -271,12 +266,9 @@
       return;
    }
 
-   if( pMac->lim.gpLimSuspendCallback ||
-       pMac->lim.gLimSystemInScanLearnMode )
+   if( pMac->lim.gpLimSuspendCallback )
    {
-      limLog( pMac, LOGE, FL("Something is wrong, SuspendLinkCbk:%p "
-              "IsSystemInScanLearnMode:%d"), pMac->lim.gpLimSuspendCallback,
-               pMac->lim.gLimSystemInScanLearnMode );
+      limLog( pMac, LOGE, "%s:%d: gLimSuspendLink callback is not NULL...something is wrong", __func__, __LINE__ );
       callback( pMac, eHAL_STATUS_FAILURE, data ); 
       return;
    }
@@ -407,9 +399,10 @@
 void limContinuePostChannelScan(tpAniSirGlobal pMac)
 {
     tANI_U8 channelNum;
+    tANI_U8 handleError = 0;
     tANI_U8 i = 0;
     tSirRetStatus status = eSIR_SUCCESS;
-
+    
     if( pMac->lim.abortScan || (NULL == pMac->lim.gpLimMlmScanReq ) ||
         (pMac->lim.gLimCurrentScanChannelId >
             (tANI_U32)(pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1)))
@@ -437,36 +430,19 @@
         (limActiveScanAllowed(pMac, channelNum)))
     {
         TX_TIMER *periodicScanTimer;
+        PELOG2(limLog(pMac, LOG2, FL("ACTIVE Scan chan %d, sending probe"), channelNum);)
 
         pMac->lim.probeCounter++;
-        /* Prepare and send Probe Request frame for all
-         * the SSIDs present in the saved MLM
-         */
         do
         {
-            tSirMacAddr         gSelfMacAddr;
-
-            /* Send self MAC as src address if
-             * MAC spoof is not enabled OR
-             * spoofMacAddr is all 0 OR
-             * disableP2PMacSpoof is enabled and scan is P2P scan
-             * else use the spoofMac as src address
-             */
-            if ((pMac->lim.isSpoofingEnabled != TRUE) ||
-                (TRUE ==
-                vos_is_macaddr_zero((v_MACADDR_t *)&pMac->lim.spoofMacAddr)) ||
-                (pMac->roam.configParam.disableP2PMacSpoofing &&
-                pMac->lim.gpLimMlmScanReq->p2pSearch)) {
-                vos_mem_copy(gSelfMacAddr, pMac->lim.gSelfMacAddr, VOS_MAC_ADDRESS_LEN);
-            } else {
-                vos_mem_copy(gSelfMacAddr, pMac->lim.spoofMacAddr, VOS_MAC_ADDRESS_LEN);
-            }
-            limLog(pMac, LOG1,
-                 FL(" Mac Addr "MAC_ADDRESS_STR " used in sending ProbeReq number %d, for SSID %s on channel: %d"),
-                      MAC_ADDR_ARRAY(gSelfMacAddr) ,i, pMac->lim.gpLimMlmScanReq->ssId[i].ssId, channelNum);
+            /* Prepare and send Probe Request frame for all the SSIDs present in the saved MLM 
+                    */
+       
+            PELOGE(limLog(pMac, LOG1, FL("sending ProbeReq number %d, for SSID %s on channel: %d"),
+                                                i, pMac->lim.gpLimMlmScanReq->ssId[i].ssId, channelNum);)
             // include additional IE if there is
             status = limSendProbeReqMgmtFrame( pMac, &pMac->lim.gpLimMlmScanReq->ssId[i],
-               pMac->lim.gpLimMlmScanReq->bssId, channelNum, gSelfMacAddr,
+               pMac->lim.gpLimMlmScanReq->bssId, channelNum, pMac->lim.gSelfMacAddr, 
                pMac->lim.gpLimMlmScanReq->dot11mode,
                pMac->lim.gpLimMlmScanReq->uIEFieldLen,
                (tANI_U8 *)(pMac->lim.gpLimMlmScanReq)+pMac->lim.gpLimMlmScanReq->uIEFieldOffset);
@@ -495,18 +471,17 @@
             limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
 
 #ifdef GEN6_TODO
-            /* revisit this piece of code to assign the appropriate sessionId
-             * below priority - LOW/might not be needed
-             */
+            /* revisit this piece of code to assign the appropriate sessionId below
+             * priority - LOW/might not be needed
+             */ 
             pMac->lim.limTimers.gLimMinChannelTimer.sessionId = sessionId;
-#endif
-            if (tx_timer_activate(&pMac->lim.limTimers.gLimMinChannelTimer) !=
-                                                                     TX_SUCCESS)
+#endif            
+            
+            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_MIN_CHANNEL_TIMER));
+
+            if (tx_timer_activate(&pMac->lim.limTimers.gLimMinChannelTimer) != TX_SUCCESS)
             {
-                limLog(pMac, LOGE, FL("could not start min channel timer"));
-                limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
-                limSendHalEndScanReq(pMac, channelNum,
-                                   eLIM_HAL_END_SCAN_WAIT_STATE);
+                limLog(pMac, LOGP, FL("could not start min channel timer"));
                 return;
             }
 
@@ -521,16 +496,14 @@
 #endif
               //No Need to start Min channel timer. Start Max Channel timer.
               limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
+              MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimMaxChannelTimer.sessionId, eLIM_MAX_CHANNEL_TIMER));
               if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer)
                     == TX_TIMER_ERROR)
               {
                  /// Could not activate max channel timer.
                  // Log error
-                 limLog(pMac,LOGE, FL("could not start max channel timer"));
-                 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
-                 limSendHalEndScanReq(pMac,
-                    channelNum, eLIM_HAL_END_SCAN_WAIT_STATE);
-                 return;
+                 limLog(pMac,LOGP, FL("could not start max channel timer"));
+                 return; 
               }
 
     }
@@ -542,28 +515,31 @@
         limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_PROBE_REQ_TIMER);
         if (tx_timer_activate(periodicScanTimer) != TX_SUCCESS)
         {
-             limLog(pMac, LOGE, FL("could not start periodic probe req "
+             limLog(pMac, LOGP, FL("could not start periodic probe req "
                                                                   "timer"));
+             return;
         }
         periodicScanTimer->sessionId = channelNum;
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, periodicScanTimer->sessionId, eLIM_PERIODIC_PROBE_REQ_TIMER));
     }
     else
     {
         tANI_U32 val;
-        limLog(pMac, LOG1, FL("START PASSIVE Scan chan %d"), channelNum);
+        PELOG2(limLog(pMac, LOG2, FL("START PASSIVE Scan chan %d"), channelNum);)
 
         /// Passive Scanning. Activate maxChannelTimer
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_MAX_CHANNEL_TIMER));
         if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
                                       != TX_SUCCESS)
         {
             // Could not deactivate max channel timer.
             // Log error
-            limLog(pMac, LOGE, FL("Unable to deactivate max channel timer"));
-            limSendHalEndScanReq(pMac, channelNum,
-                                 eLIM_HAL_END_SCAN_WAIT_STATE);
+            limLog(pMac, LOGP, FL("Unable to deactivate max channel timer"));
+            return;
         }
         else
         {
+            tANI_U32 val1 = 0;
             if (pMac->miracast_mode)
             {
                 val = DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST +
@@ -576,38 +552,70 @@
                  * Could not get max channel value
                  * from CFG. Log error.
                  */
-                limLog(pMac, LOGE,
-                 FL("could not retrieve passive max chan value, Use Def val"));
-                val= WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STADEF;
+                limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
+                return;
             }
 
             val = SYS_MS_TO_TICKS(val);
+            //TODO: consider sessions.
+#if 0
+            // If a background was triggered via Quiet BSS,
+            // then we need to adjust the MIN and MAX channel
+            // timer's accordingly to the Quiet duration that
+            // was specified
+            if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
+                    pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
+            {
+                // gLimQuietDuration is already cached in units of
+                // system ticks. No conversion is reqd...
+                val1 = pMac->lim.gLimSpecMgmt.quietDuration;
+            }
+            else
+            {
+                val1 = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
+            }
+#endif
+            //Pick the longer stay time
+            val = (val > val1) ? val : val1;
+            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_MAX_CHANNEL_TIMER));
             if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
                         val, 0) != TX_SUCCESS)
             {
                 // Could not change max channel timer.
                 // Log error
-                limLog(pMac, LOGE, FL("Unable to change max channel timer"));
-                limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
-                limSendHalEndScanReq(pMac, channelNum,
-                                  eLIM_HAL_END_SCAN_WAIT_STATE);
+                limLog(pMac, LOGP, FL("Unable to change max channel timer"));
                 return;
             }
-            else if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer)
-                                                                  != TX_SUCCESS)
+            else if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer) != TX_SUCCESS)
             {
-
-                limLog(pMac, LOGE, FL("could not start max channel timer"));
-                limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
-                limSendHalEndScanReq(pMac, channelNum,
-                                 eLIM_HAL_END_SCAN_WAIT_STATE);
+                limLog(pMac, LOGP, FL("could not start max channel timer"));
                 return;
             }
         }
         // Wait for Beacons to arrive
     } // if (pMac->lim.gLimMlmScanReq->scanType == eSIR_ACTIVE_SCAN)
 
-    limAddScanChannelInfo(pMac, channelNum);
+    if( handleError )
+    {
+        //
+        // FIXME - With this, LIM/SoftMAC will try and recover
+        // state, but eWNI_SME_SCAN_CNF maybe reporting an
+        // incorrect status back to the SME. Some of the possible
+        // errors are:
+        // eSIR_SME_HAL_SCAN_INIT_FAILED
+        // eSIR_SME_RESOURCES_UNAVAILABLE
+        //
+        //Set the resume channel to Any valid channel (invalid). 
+        //This will instruct HAL to set it to any previous valid channel.
+        peSetResumeChannel(pMac, 0, 0);
+        limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
+        //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
+    }
+    else
+    {
+        limAddScanChannelInfo(pMac, channelNum);
+    }
+
     return;
 }
 
@@ -643,7 +651,6 @@
     tANI_U32 i;
     tANI_U8  channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
     tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
-
     if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
                     != eSIR_SUCCESS)
     {
@@ -655,27 +662,21 @@
         limLog(pMac, LOGE, FL("Invalid scan control list length:%d"), len);
         return ;
     }
-    if (pMac->fActiveScanOnDFSChannels)
-    {
-        limLog(pMac, LOG1, FL("DFS feature triggered,"
-                              "block scan type conversion"));
-        return ;
-    }
     for (i=0; (i+1) < len; i+=2)
     {
         if (channelPair[i] == channelNum)
         {
              if ((eSIR_PASSIVE_SCAN == channelPair[i+1]) && TRUE == passiveToActive)
              {
-                 limLog(pMac, LOG1, FL("Channel %d changed from Passive to Active"),
-                                 channelNum);
+                 PELOG1(limLog(pMac, LOG1, FL("Channel %d changed from Passive to Active"),
+                                 channelNum);)
                  channelPair[i+1] = eSIR_ACTIVE_SCAN;
                  break ;
              }
              if ((eSIR_ACTIVE_SCAN == channelPair[i+1]) && FALSE == passiveToActive)
              {
-                 limLog(pMac, LOG1, FL("Channel %d changed from Active to Passive"),
-                                 channelNum);
+                 PELOG1(limLog(pMac, LOG1, FL("Channel %d changed from Active to Passive"),
+                                 channelNum);)
                  channelPair[i+1] = eSIR_PASSIVE_SCAN;
                  break ;
              }
@@ -714,16 +715,6 @@
 {
 
     tANI_BOOLEAN passiveToActive = TRUE;
-    tANI_U32 cfgVal;
-
-    if (eSIR_SUCCESS == wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_PASSIVE_CON,
-                                        &cfgVal))
-    {
-        limLog(pMac, LOG1,  FL("WNI_CFG_ACTIVE_PASSIVE_CON: %d"), cfgVal);
-        if (!cfgVal)
-           return;
-    }
-
     if ((1 <= channelNum) && (165 >= channelNum))
     {
        if (eANI_BOOLEAN_TRUE == limIsconnectedOnDFSChannel(channelNum))
@@ -731,13 +722,14 @@
           if (dfsChannelList->timeStamp[channelNum] == 0)
           {
              //Received first beacon; Convert DFS channel to Active channel.
-             limLog(pMac, LOG1, FL("Received first beacon on DFS channel: %d"), channelNum);
+             PELOG1(limLog(pMac, LOG1, FL("Received first beacon on DFS channel: %d"), channelNum);)
              limCovertChannelScanType(pMac,channelNum, passiveToActive);
           }
           dfsChannelList->timeStamp[channelNum] = vos_timer_get_system_time();
        }
        else
        {
+          PELOG1(limLog(pMac, LOG1, FL("Channel %d is Active"), channelNum);)
           return;
        }
        if (!tx_timer_running(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer))
@@ -946,7 +938,6 @@
     switch(nextState)
     {
         case eLIM_HAL_START_SCAN_WAIT_STATE:
-        case eLIM_HAL_INIT_SCAN_WAIT_STATE:
             limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
             break;
 
@@ -1001,6 +992,7 @@
         SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
 
         MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
+        limLog(pMac, LOG1, FL("Channel %d"), channelNum);
 
             rc = wdaPostCtrlMsg(pMac, &msg);
         if (rc == eSIR_SUCCESS) {
@@ -1101,27 +1093,6 @@
     return;
 }
 
-
-void limSendTLPauseInd(tpAniSirGlobal pMac, uint16_t staId)
-{
-    tSirMsgQ            msg;
-    tSirRetStatus       rc = eSIR_SUCCESS;
-
-    msg.type = WDA_PAUSE_TL_IND;
-    msg.bodyval = staId;
-
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
-
-    rc = wdaPostCtrlMsg(pMac, &msg);
-    if (rc == eSIR_SUCCESS) {
-            return;
-    }
-
-    limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d"), rc);
-
-    return;
-}
-
 /**
  * limSendHalFinishScanReq()
  *
@@ -1270,6 +1241,10 @@
 {
     tANI_U8                channelNum;
 
+    PELOG1(limLog(pMac, LOG1, FL("Continue SCAN : chan %d tot %d"),
+           pMac->lim.gLimCurrentScanChannelId,
+           pMac->lim.gpLimMlmScanReq->channelList.numChannels);)
+
     if (pMac->lim.gLimCurrentScanChannelId >
         (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1) 
         || pMac->lim.abortScan)
@@ -1324,8 +1299,8 @@
     }
 
     channelNum = limGetCurrentScanChannel(pMac);
-    limLog(pMac, LOG1, FL("Current Channel to be scanned is %d"),
-           channelNum);
+    PELOG2(limLog(pMac, LOG2, FL("Current Channel to be scanned is %d"),
+           channelNum);)
 
     limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_SCAN_WAIT_STATE);
     return;
@@ -1386,8 +1361,7 @@
     //limCleanupMsgQ(pMac);
 
     pMac->lim.gLimSystemInScanLearnMode = 0;
-    limLog(pMac, LOG1, FL("Scan ended, took %ld tu"),
-              (tx_time_get() - pMac->lim.scanStartTime));
+    PELOG1(limLog(pMac, LOG1, FL("Scan ended, took %d tu"), (tx_time_get() - pMac->lim.scanStartTime));)
 } /*** limRestorePreScanState() ***/
 
 #ifdef FEATURE_OEM_DATA_SUPPORT
@@ -1532,18 +1506,18 @@
     if(status != eHAL_STATUS_SUCCESS)
     {
         limLog(pMac, LOGE, FL("OEM_DATA: failed in suspend link"));
-        /* If failed to suspend the link, there is no need
-         * to resume link. Return failure.
-         */
-        limSetOemDataReqModeFailed(pMac, status, data);
+        goto error;
     }
     else
     {
         PELOGE(limLog(pMac, LOGE, FL("OEM_DATA: Calling limSendHalOemDataReq"));)
         limSendHalOemDataReq(pMac);
+        return;
     }
 
-    return;
+error:
+    limResumeLink(pMac, limSetOemDataReqModeFailed, NULL);
+    return ;
 } /*** end limSendHalOemDataReq() ***/
 
 #endif //FEATURE_OEM_DATA_SUPPORT
@@ -2007,8 +1981,8 @@
         /// Hold onto SCAN REQ criteria
         pMac->lim.gpLimMlmScanReq = (tLimMlmScanReq *) pMsgBuf;
 
-       limLog(pMac, LOG1, FL("Number of channels to scan are %d "),
-               pMac->lim.gpLimMlmScanReq->channelList.numChannels);
+       PELOG3(limLog(pMac, LOG3, FL("Number of channels to scan are %d "),
+               pMac->lim.gpLimMlmScanReq->channelList.numChannels);)
 
         pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
 
@@ -2031,10 +2005,10 @@
              * Could not get max channel value
              * from CFG. Log error.
              */
-            limLog(pMac, LOGP,
-             FL("could not retrieve passive max channel value use def"));
-            /* use a default value */
-            val= WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STADEF;
+            limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
+
+            /* use a default value of 110ms */
+            val = 110;
         }
 
         for (i = 0; i < pMac->lim.gpLimMlmScanReq->channelList.numChannels; i++) {
@@ -2217,12 +2191,6 @@
 #if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
     psessionEntry->pLimMlmReassocRetryReq = NULL;
 #endif
-
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-    limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
-                       psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_JOIN);
-#endif
-
     limLog(pMac, LOG1, FL("[limProcessMlmJoinReq]: suspend link success(%d) "
              "on sessionid: %d setting channel to: %d with secChanOffset:%d "
              "and maxtxPower: %d"), status, psessionEntry->peSessionId,
@@ -2305,20 +2273,20 @@
         
         if( isLimSessionOffChannel(pMac, sessionId) )
         {
+          limLog(pMac,LOG1,"SessionId:%d LimSession is on OffChannel",
+                 sessionId);
           //suspend link
           limLog(pMac, LOG1, FL("Suspend link as LimSession on sessionid %d"
           "is off channel"),sessionId);
-          if (limIsLinkSuspended(pMac))
-          {
-            limLog(pMac, LOGE, FL("Link is already suspended for some other"
-                   " reason. Return failure on sessionId:%d"), sessionId);
-            goto error;
-          }
           limSuspendLink(pMac, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN, 
                    limProcessMlmPostJoinSuspendLink, (tANI_U32*)psessionEntry );
         }
         else
         {
+          limLog(pMac, LOG1, FL("No need to Suspend link as LimSession on "
+              "sessionid %d is not off channel, calling "
+              "limProcessMlmPostJoinSuspendLink with status as SUCCESS"),
+              sessionId);
           //No need to suspend link.
           limLog(pMac,LOG1,"SessionId:%d Join request on current channel",
                  sessionId);
@@ -2331,26 +2299,31 @@
     else
     {
         /**
-         * Should not have received JOIN req in states other than
-         * Idle state or on AP.
-         * Return join confirm with invalid parameters code.
-         */
+              * Should not have received JOIN req in states other than
+              * Idle state or on AP.
+              * Return join confirm with invalid parameters code.
+              */
+        PELOGE(limLog(pMac, LOGE,
+               FL("Unexpected Join request for role %d state %d"),
+               psessionEntry->limSystemRole,
+               psessionEntry->limMlmState);)
+        limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
+        
         limLog(pMac, LOGE,
                FL("SessionId:%d Unexpected Join request for role %d state %d "),
                psessionEntry->peSessionId,psessionEntry->limSystemRole,
                psessionEntry->limMlmState);
-        limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
     }
 
 error: 
-    vos_mem_free(pMsgBuf);
-    if (psessionEntry != NULL)
-        psessionEntry->pLimMlmJoinReq = NULL;
 
-    mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
-    mlmJoinCnf.sessionId = sessionId;
-    mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
-    limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
+        
+        mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+        mlmJoinCnf.sessionId = sessionId;
+        mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+        limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
+
+
 } /*** limProcessMlmJoinReq() ***/
 
 
@@ -2510,17 +2483,14 @@
                                   (tANI_U8) pMac->lim.gpLimMlmAuthReq->authType;
         authFrameBody.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
         authFrameBody.authStatusCode = 0;
-        pMac->authAckStatus = LIM_AUTH_ACK_NOT_RCD;
         limSendAuthMgmtFrame(pMac,
                              &authFrameBody,
                              pMac->lim.gpLimMlmAuthReq->peerMacAddr,
-                             LIM_NO_WEP_IN_FC, psessionEntry, eSIR_TRUE);
+                             LIM_NO_WEP_IN_FC,psessionEntry);
 
         //assign appropriate sessionId to the timer object
         pMac->lim.limTimers.gLimAuthFailureTimer.sessionId = sessionId;
-        /* assign appropriate sessionId to the timer object */
-        pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId = sessionId;
-        limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER);
+ 
         // Activate Auth failure timer
         MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_AUTH_FAIL_TIMER));
         if (tx_timer_activate(&pMac->lim.limTimers.gLimAuthFailureTimer)
@@ -2533,17 +2503,7 @@
             // Cleanup as if auth timer expired
             limProcessAuthFailureTimeout(pMac);
         }
-        else
-        {
-            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
-                    psessionEntry->peSessionId, eLIM_AUTH_RETRY_TIMER));
-            // Activate Auth Retry timer
-            if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer)
-                                                                   != TX_SUCCESS)
-            {
-               limLog(pMac, LOGP, FL("could not activate Auth Retry timer"));
-            }
-        }
+
         return;
     }
     else
@@ -2648,11 +2608,6 @@
  
         /// Prepare and send Association request frame
         limSendAssocReqMgmtFrame(pMac, pMlmAssocReq,psessionEntry);
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-        limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_REQ_EVENT, psessionEntry,
-                           eSIR_SUCCESS, eSIR_SUCCESS);
-#endif
-
 
   //Set the link state to postAssoc, so HW can start receiving frames from AP.
     if ((psessionEntry->bssType == eSIR_BTAMP_STA_MODE)||
@@ -2830,12 +2785,6 @@
         psessionEntry->channelChangeReasonCode = LIM_SWITCH_CHANNEL_REASSOC;
 
         /** Switch channel to the new Operating channel for Reassoc*/
-
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-        limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
-                   psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_REASSOC);
-#endif
-
         limSetChannel(pMac, chanNum, secChannelOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
 
         return;
@@ -2885,9 +2834,6 @@
     tLimMlmDisassocCnf       mlmDisassocCnf;
     tpPESession              psessionEntry;
     extern tANI_BOOLEAN     sendDisassocFrame;
-    tSirSmeDisassocRsp      *pSirSmeDisassocRsp;
-    tANI_U32                *pMsg;
-    tANI_U8                 *pBuf;
 
     if(eHAL_STATUS_SUCCESS != suspendStatus)
     {
@@ -2978,45 +2924,16 @@
          * have context or in some transit state.
          * Log error
          */
-        limLog(pMac, LOGE,
+        PELOGW(limLog(pMac, LOGW,
            FL("received MLM_DISASSOC_REQ for STA that either has no context "
            "or in some transit state, Addr= "
-           MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMlmDisassocReq->peerMacAddr));
-        if (pStaDs != NULL)
-            limLog(pMac, LOGE, FL("Sta MlmState : %d"),
-                    pStaDs->mlmStaContext.mlmState);
+           MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMlmDisassocReq->peerMacAddr));)
 
-        /*
-         * Disassociation response due to
-         * host triggered disassociation
-         */
+        /// Prepare and Send LIM_MLM_DISASSOC_CNF
 
-         pSirSmeDisassocRsp = vos_mem_malloc(sizeof(tSirSmeDisassocRsp));
-         if ( NULL == pSirSmeDisassocRsp )
-         {
-            // Log error
-             limLog(pMac, LOGP,
-                FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_RSP"));
-             return;
-         }
-         limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_RSP with "
-                "retCode: %d for "MAC_ADDRESS_STR),eSIR_SME_DEAUTH_STATUS,
-                 MAC_ADDR_ARRAY(pMlmDisassocReq->peerMacAddr));
-         pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP;
-         pSirSmeDisassocRsp->length      = sizeof(tSirSmeDisassocRsp);
-         pSirSmeDisassocRsp->sessionId = pMlmDisassocReq->sessionId;
-         pSirSmeDisassocRsp->transactionId = 0;
-         pSirSmeDisassocRsp->statusCode = eSIR_SME_DEAUTH_STATUS;
+        mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
 
-         pBuf  = (tANI_U8 *) pSirSmeDisassocRsp->peerMacAddr;
-         vos_mem_copy( pBuf, pMlmDisassocReq->peerMacAddr, sizeof(tSirMacAddr));
-
-         pMsg = (tANI_U32*) pSirSmeDisassocRsp;
-
-         limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
-                                                (tANI_U32*) pMsg );
-         return;
-
+        goto end;
     }
 
     //pStaDs->mlmStaContext.rxPurgeReq = 1;
@@ -3033,17 +2950,28 @@
     if (sendDisassocFrame && (pMlmDisassocReq->reasonCode != eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON))
     {
         pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = pMlmDisassocReq;
-        if (IS_FW_IN_TX_PATH_FEATURE_ENABLE)
+
+
+        /* If the reason for disassociation is inactivity of STA, then
+           dont wait for acknowledgement. Also, if FW_IN_TX_PATH feature
+           is enabled do not wait for ACK */
+        if (((pMlmDisassocReq->reasonCode == eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON) &&
+            (psessionEntry->limSystemRole == eLIM_AP_ROLE)) ||
+            IS_FW_IN_TX_PATH_FEATURE_ENABLE )
         {
-            limSendDisassocMgmtFrame(pMac, pMlmDisassocReq->reasonCode,
+
+             limSendDisassocMgmtFrame(pMac,
+                                 pMlmDisassocReq->reasonCode,
                                  pMlmDisassocReq->peerMacAddr,
                                  psessionEntry, FALSE);
-            /* Send Disassoc CNF and receive path cleanup */
-            limSendDisassocCnf(pMac);
+
+             /* Send Disassoc CNF and receive path cleanup */
+             limSendDisassocCnf(pMac);
         }
         else
         {
-            limSendDisassocMgmtFrame(pMac, pMlmDisassocReq->reasonCode,
+             limSendDisassocMgmtFrame(pMac,
+                                 pMlmDisassocReq->reasonCode,
                                  pMlmDisassocReq->peerMacAddr,
                                  psessionEntry, TRUE);
         }
@@ -3188,7 +3116,13 @@
 static void
 limProcessMlmDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
+//    tANI_U16                 aid;
+//    tSirMacAddr              currentBssId;
+//    tpDphHashNode            pStaDs;
     tLimMlmDisassocReq       *pMlmDisassocReq;
+//    tLimMlmDisassocCnf       mlmDisassocCnf;
+    tpPESession              psessionEntry;
+//    extern tANI_BOOLEAN     sendDisassocFrame;
 
     if(pMsgBuf == NULL)
     {
@@ -3197,11 +3131,18 @@
     }
 
     pMlmDisassocReq = (tLimMlmDisassocReq *) pMsgBuf;
-
     limLog(pMac, LOG1,FL("Process DisAssoc Req on sessionID %d "
     "from: "MAC_ADDRESS_STR), pMlmDisassocReq->sessionId,
     MAC_ADDR_ARRAY(pMlmDisassocReq->peerMacAddr));
 
+    if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocReq->sessionId))== NULL)
+    {
+    
+        limLog(pMac, LOGE,
+                  FL("session does not exist for given sessionId %d"),
+                  pMlmDisassocReq->sessionId);
+        return;
+    }
     limProcessMlmDisassocReqNtf( pMac, eHAL_STATUS_SUCCESS, (tANI_U32*) pMsgBuf );
     
 } /*** limProcessMlmDisassocReq() ***/
@@ -3216,9 +3157,6 @@
     tLimMlmDeauthReq        *pMlmDeauthReq;
     tLimMlmDeauthCnf        mlmDeauthCnf;
     tpPESession             psessionEntry;
-    tSirSmeDeauthRsp        *pSirSmeDeauthRsp;
-    tANI_U8                 *pBuf;
-    tANI_U32                *pMsg;
 
 
     if(eHAL_STATUS_SUCCESS != suspendStatus)
@@ -3334,10 +3272,10 @@
             break;
 
         case eLIM_STA_IN_IBSS_ROLE:
-            limLog(pMac, LOGE,
-                       FL("received MLM_DEAUTH_REQ IBSS Mode "));
-            mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
-            goto end;
+            vos_mem_free(pMlmDeauthReq);
+
+            return;
+
         default: // eLIM_AP_ROLE
             break;
 
@@ -3400,38 +3338,11 @@
            FL("received MLM_DEAUTH_REQ for STA that either has no context or in some transit state, Addr="
            MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMlmDeauthReq->peerMacAddr));)
 
-        /*
-         * Deauthentication response to host triggered
-         * deauthentication.
-         */
-        pSirSmeDeauthRsp = vos_mem_malloc(sizeof(tSirSmeDeauthRsp));
-        if ( NULL == pSirSmeDeauthRsp )
-        {
-            // Log error
-            limLog(pMac, LOGP,
-                   FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP"));
+        /// Prepare and Send LIM_MLM_DEAUTH_CNF
 
-            return;
-        }
-        limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with "
-               "retCode: %d for"MAC_ADDRESS_STR),eSIR_SME_DEAUTH_STATUS,
-               MAC_ADDR_ARRAY(pMlmDeauthReq->peerMacAddr));
-        pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
-        pSirSmeDeauthRsp->length  = sizeof(tSirSmeDeauthRsp);
-        pSirSmeDeauthRsp->statusCode = eSIR_SME_DEAUTH_STATUS;
-        pSirSmeDeauthRsp->sessionId = pMlmDeauthReq->sessionId;
-        pSirSmeDeauthRsp->transactionId = 0;
+        mlmDeauthCnf.resultCode    = eSIR_SME_INVALID_PARAMETERS;
 
-        pBuf  = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr;
-        vos_mem_copy( pBuf, pMlmDeauthReq->peerMacAddr, sizeof(tSirMacAddr));
-
-        pMsg = (tANI_U32*)pSirSmeDeauthRsp;
-
-        limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
-                                            (tANI_U32*) pMsg );
-
-        return;
-
+        goto end;
     }
 
     //pStaDs->mlmStaContext.rxPurgeReq     = 1;
@@ -3924,6 +3835,8 @@
     if (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE &&
         pMac->lim.gLimHalScanState != eLIM_HAL_FINISH_SCAN_WAIT_STATE)
     {
+        PELOG1(limLog(pMac, LOG1, FL("Scanning : min channel timeout occurred"));)
+
         /// Min channel timer timed out
         pMac->lim.limTimers.gLimPeriodicProbeReqTimer.sessionId = 0xff;
         limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
@@ -3997,7 +3910,7 @@
         pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) &&
         pMac->lim.gLimHalScanState != eLIM_HAL_FINISH_SCAN_WAIT_STATE)
     {
-        limLog(pMac, LOG1, FL("Scanning : Max channel timed out"));
+        PELOG1(limLog(pMac, LOG1, FL("Scanning : Max channel timed out"));)
         /**
          * MAX channel timer timed out
          * Continue channel scan.
@@ -4071,7 +3984,7 @@
     if(vos_timer_getCurrentState(&pPeriodicProbeReqTimer->vosTimer)
          != VOS_TIMER_STATE_STOPPED)
     {
-       limLog(pMac, LOG1, FL("Invalid state of timer"));
+       PELOG1(limLog(pMac, LOG1, FL("Invalid state of timer"));)
        return;
     }
 
@@ -4079,37 +3992,19 @@
         (pPeriodicProbeReqTimer->sessionId != 0xff) && (pMac->lim.probeCounter < pMac->lim.maxProbe))
     {
         tLimMlmScanReq *pLimMlmScanReq = pMac->lim.gpLimMlmScanReq;
+        PELOG1(limLog(pMac, LOG1, FL("Scanning : Periodic scanning"));)
         pMac->lim.probeCounter++;
         /**
          * Periodic channel timer timed out
          * to send probe request.
          */
         channelNum = limGetCurrentScanChannel(pMac);
-        /* Prepare and send Probe Request frame for all the SSIDs
-         * present in the saved MLM
-         */
         do
         {
-            tSirMacAddr         gSelfMacAddr;
-
-            /* Send self MAC as src address if
-             * MAC spoof is not enabled OR
-             * spoofMacAddr is all 0 OR
-             * disableP2PMacSpoof is enabled and scan is P2P scan
-             * else use the spoofMac as src address
+            /* Prepare and send Probe Request frame for all the SSIDs
+             * present in the saved MLM
              */
-            if ((pMac->lim.isSpoofingEnabled != TRUE) ||
-                (TRUE ==
-                vos_is_macaddr_zero((v_MACADDR_t *)&pMac->lim.spoofMacAddr)) ||
-                (pMac->roam.configParam.disableP2PMacSpoofing &&
-                pMac->lim.gpLimMlmScanReq->p2pSearch)) {
-                vos_mem_copy(gSelfMacAddr, pMac->lim.gSelfMacAddr, VOS_MAC_ADDRESS_LEN);
-            } else {
-                vos_mem_copy(gSelfMacAddr, pMac->lim.spoofMacAddr, VOS_MAC_ADDRESS_LEN);
-            }
-            limLog( pMac, LOG1, FL("Mac Addr used in Probe Req is :"MAC_ADDRESS_STR),
-                                   MAC_ADDR_ARRAY(gSelfMacAddr));
-
+             
             /*
              * PELOGE(limLog(pMac, LOGW, FL("sending ProbeReq number %d,"
              *                            " for SSID %s on channel: %d"),
@@ -4117,7 +4012,7 @@
              *                                                channelNum);)
              */
             status = limSendProbeReqMgmtFrame( pMac, &pLimMlmScanReq->ssId[i],
-                     pLimMlmScanReq->bssId, channelNum, gSelfMacAddr,
+                     pLimMlmScanReq->bssId, channelNum, pMac->lim.gSelfMacAddr,
                      pLimMlmScanReq->dot11mode, pLimMlmScanReq->uIEFieldLen,
                (tANI_U8 *)(pLimMlmScanReq) + pLimMlmScanReq->uIEFieldOffset);
 
@@ -4134,6 +4029,7 @@
         } while (i < pLimMlmScanReq->numSsid);
 
         /* Activate timer again */
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pPeriodicProbeReqTimer->sessionId, eLIM_PERIODIC_PROBE_REQ_TIMER));
         if (tx_timer_activate(pPeriodicProbeReqTimer) != TX_SUCCESS)
         {
              limLog(pMac, LOGP, FL("could not start periodic probe"
@@ -4316,75 +4212,6 @@
     return;
 } /*** limProcessPeriodicJoinProbeReqTimer() ***/
 
-/**
- * limProcessAuthRetryTimer()
- *
- *FUNCTION:
- * This function is called to process Auth Retry request
- *  send during joining process.
- *
- *LOGIC:
- *
- *ASSUMPTIONS:
- *
- *NOTE:
- *
- * @param  pMac      Pointer to Global MAC structure
- * @return None
- */
-
-static void limProcessAuthRetryTimer(tpAniSirGlobal pMac)
-{
-    tpPESession  psessionEntry;
-    limLog(pMac, LOG1, FL(" ENTER "));
-    if ((psessionEntry =
-         peFindSessionBySessionId(pMac,
-            pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId)) == NULL)
-    {
-        limLog(pMac, LOGE,FL("session does not exist for given SessionId : %d"),
-                     pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId);
-        return;
-    }
-
-    if ((VOS_TRUE ==
-            tx_timer_running(&pMac->lim.limTimers.gLimAuthFailureTimer)) &&
-           (psessionEntry->limMlmState == eLIM_MLM_WT_AUTH_FRAME2_STATE) &&
-                      (LIM_AUTH_ACK_RCD_SUCCESS != pMac->authAckStatus))
-    {
-        tSirMacAuthFrameBody    authFrameBody;
-
-        /* Send the auth retry only in case we have received ack failure
-         * else just restart the retry timer.
-         */
-        if (LIM_AUTH_ACK_RCD_FAILURE == pMac->authAckStatus)
-        {
-          /// Prepare & send Authentication frame
-          authFrameBody.authAlgoNumber =
-                 (tANI_U8) pMac->lim.gpLimMlmAuthReq->authType;
-          authFrameBody.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
-          authFrameBody.authStatusCode = 0;
-          limLog(pMac, LOGW, FL("Retry Auth "));
-          pMac->authAckStatus = LIM_AUTH_ACK_NOT_RCD;
-          limSendAuthMgmtFrame(pMac,
-                        &authFrameBody,
-                        pMac->lim.gpLimMlmAuthReq->peerMacAddr,
-                        LIM_NO_WEP_IN_FC, psessionEntry, eSIR_TRUE);
-        }
-
-        limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER);
-
-        // Activate Auth Retry timer
-        if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer)
-                                                                != TX_SUCCESS)
-        {
-            limLog(pMac, LOGE,
-               FL("could not activate Auth Retry failure timer"));
-            return;
-        }
-    }
-    return;
-} /*** limProcessAuthRetryTimer() ***/
-
 
 /**
  * limProcessAuthFailureTimeout()
@@ -4458,8 +4285,6 @@
 
             break;
     }
-    /* Reinit scan results to remove the unreachable BSS */
-    limReInitScanResults(pMac);
 } /*** limProcessAuthFailureTimeout() ***/
 
 
@@ -4522,9 +4347,9 @@
             // timedout for an STA.
             pAuthNode->mlmState = eLIM_MLM_AUTH_RSP_TIMEOUT_STATE;
             pAuthNode->fTimerStarted = 0;
-            limLog(pMac, LOG1,
+            PELOG1( limLog(pMac, LOG1,
                         FL("AUTH rsp timedout for MAC address "MAC_ADDRESS_STR),
-                        MAC_ADDR_ARRAY(pAuthNode->peerMacAddr));
+                        MAC_ADDR_ARRAY(pAuthNode->peerMacAddr));)
 
             // Change timer to reactivate it in future
             limDeactivateAndChangePerStaIdTimer(pMac,
@@ -4599,36 +4424,17 @@
 
 
 
-    /*
-     * CR: vos packet memory is leaked when assoc rsp timeouted/failed.
-     * notify TL that association is failed so that TL can flush the
-     * cached frame
-     */
+    /* CR: vos packet memory is leaked when assoc rsp timeouted/failed. */
+    /* notify TL that association is failed so that TL can flush the cached frame  */
     WLANTL_AssocFailed (psessionEntry->staId);
 
-    /* Log error */
-    limLog(pMac, LOG1,
-       FL("Re/Association Response not received before timeout "));
+    // Log error
+    PELOG1(limLog(pMac, LOG1,
+       FL("Re/Association Response not received before timeout "));)
 
-    /*
-     * Send Deauth to handle the scenareo where association timeout happened
-     * when device has missed the assoc resp sent by peer.
-     * By sending deauth try to clear the session created on peer device.
-     */
-    limLog(pMac, LOGE,
-           FL("Sessionid: %d try sending Send deauth on channel %d to BSSID: "
-           MAC_ADDRESS_STR ), psessionEntry->peSessionId,
-           psessionEntry->currentOperChannel,
-           MAC_ADDR_ARRAY(psessionEntry->bssId));
-
-    limSendDeauthMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_REASON,
-                 psessionEntry->bssId,
-                 psessionEntry, FALSE);
-
-    if (((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
-          (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )||
-        ((psessionEntry->limMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE) &&
-          (psessionEntry->limMlmState != eLIM_MLM_WT_REASSOC_RSP_STATE)  &&
+    if (( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )||
+        ( (psessionEntry->limMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE) &&
+          (psessionEntry->limMlmState != eLIM_MLM_WT_REASSOC_RSP_STATE)  && 
           (psessionEntry->limMlmState != eLIM_MLM_WT_FT_REASSOC_RSP_STATE)))
     {
         /**
@@ -4667,8 +4473,8 @@
             //To remove the preauth node in case of fail to associate
             if (limSearchPreAuthList(pMac, psessionEntry->bssId))
             {
-                limLog(pMac, LOG1, FL(" delete pre auth node for "
-                       MAC_ADDRESS_STR), MAC_ADDR_ARRAY(psessionEntry->bssId));
+                PELOG1(limLog(pMac, LOG1, FL(" delete pre auth node for "
+                       MAC_ADDRESS_STR), MAC_ADDR_ARRAY(psessionEntry->bssId));)
                 limDeletePreAuthNode(pMac, psessionEntry->bssId);
             }
 
@@ -4702,8 +4508,6 @@
                 eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry);
         }
     }
-    /* Reinit scan results to remove the unreachable BSS */
-    limReInitScanResults(pMac);
 } /*** limProcessAssocFailureTimeout() ***/
 
 
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
index 20b68ad..4cc1320 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,7 +36,7 @@
  *
  */
 #include "wniApi.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "cfgApi.h"
 #include "sirApi.h"
 #include "schApi.h"
@@ -59,7 +59,10 @@
 #include <limFT.h>
 #endif
 #include "wlan_qct_wda.h"
+
+#ifdef DEBUG_ROAM_DELAY
 #include "vos_utils.h"
+#endif
 
 static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession);
 static void limHandleSmeReaasocResult(tpAniSirGlobal, tSirResultCodes, tANI_U16, tpPESession);
@@ -405,7 +408,7 @@
              limLog(pMac, LOG1, FL("*** Started BSS in INFRA AP SIDE***"));
         }
         else
-            limLog(pMac, LOG1, FL("*** Started BSS ***"));
+            PELOG1(limLog(pMac, LOG1, FL("*** Started BSS ***"));)
     }
     else
     {
@@ -413,6 +416,7 @@
         peDeleteSession(pMac,psessionEntry);
         psessionEntry = NULL;
         PELOGE(limLog(pMac, LOGE,FL("Start BSS Failed "));)
+        return;
     }
     /// Send response to Host
     limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP,
@@ -471,8 +475,8 @@
     /// Process Join confirm from MLM
     if (resultCode ==  eSIR_SME_SUCCESS)
     {
-        limLog(pMac, LOG1, FL("***SessionId: %d Joined ESS ***"),
-                         pLimMlmJoinCnf->sessionId);
+        PELOG1(limLog(pMac, LOG1, FL("***SessionId:%d Joined ESS ***"),
+                         pLimMlmJoinCnf->sessionId);)
             //Setup hardware upfront
            //Done: 7-27-2009. JIM_FIX_ME   sessionize the following function
             if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
@@ -547,14 +551,8 @@
                psessionEntry->peSessionId,psessionEntry->limSmeState);)
         return;
     }
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-    limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_COMP_EVENT, psessionEntry,
-                       pMlmAuthCnf->resultCode,
-                       pMlmAuthCnf->protStatusCode);
-#endif
-
     /// Process AUTH confirm from MLM
-    if (pMlmAuthCnf->resultCode != eSIR_SME_SUCCESS)
+    if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
     {
         if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
                 {
@@ -573,16 +571,14 @@
             cfgAuthType = pMac->lim.gLimPreAuthType;
         
         if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
-             (pMlmAuthCnf->authType == eSIR_SHARED_KEY)
-             && ((eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS ==
-             pMlmAuthCnf->protStatusCode) ||
-             (pMlmAuthCnf->resultCode == eSIR_SME_AUTH_TIMEOUT_RESULT_CODE)))
+                (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM)
+                && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode))
         {
             /**
-             * When Shared authentication fails with reason code "13" and
-             * authType set to 'auto switch', Try with Open Authentication
+             * When Open authentication fails with reason code "13" and
+             * authType set to 'auto switch', Try with Shared Authentication
              */
-            authMode = eSIR_OPEN_SYSTEM;
+            authMode = eSIR_SHARED_KEY;
             // Trigger MAC based Authentication
             pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
             if ( NULL == pMlmAuthReq )
@@ -636,8 +632,8 @@
                  * Need to send Join response with
                  * auth failure to Host.
                  */
-                limHandleSmeJoinResult(pMac, pMlmAuthCnf->resultCode,
-                              pMlmAuthCnf->protStatusCode, psessionEntry);
+                limHandleSmeJoinResult(pMac,
+                              ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
             }
             else
             {
@@ -648,11 +644,11 @@
                 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
                 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
                 limSendSmeAuthRsp(
-                            pMac, pMlmAuthCnf->resultCode,
-                            pMlmAuthCnf->peerMacAddr, pMlmAuthCnf->authType,
-                            pMlmAuthCnf->protStatusCode, psessionEntry,
-                            psessionEntry->smeSessionId,
-                            psessionEntry->transactionId);
+                            pMac,
+                            ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
+                            ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
+                            ((tLimMlmAuthCnf *) pMsgBuf)->authType,
+                            ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
             }
         } // end if (cfgAuthType == eAUTO_SWITCH)
     } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
@@ -664,9 +660,9 @@
              * Successful MAC based authentication
              * Trigger Association with BSS
              */
-            limLog(pMac, LOG1,
-                   FL("SessionId: %d Authenticated with BSS"),
-                   psessionEntry->peSessionId);
+            PELOG1(limLog(pMac, LOG1,
+                   FL("SessionId:%d Authenticated with BSS"),
+                   psessionEntry->peSessionId);)
             pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq));
             if ( NULL == pMlmAssocReq )
             {
@@ -795,11 +791,12 @@
              */
             psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
             MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
-            limSendSmeAuthRsp(pMac, pMlmAuthCnf->resultCode,
-                            pMlmAuthCnf->peerMacAddr, pMlmAuthCnf->authType,
-                            pMlmAuthCnf->protStatusCode, psessionEntry,
-                            psessionEntry->smeSessionId,
-                            psessionEntry->transactionId);
+            limSendSmeAuthRsp(
+                        pMac,
+                        ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
+                        ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
+                        ((tLimMlmAuthCnf *) pMsgBuf)->authType,
+                        ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
         }
     } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
 } /*** end limProcessMlmAuthCnf() ***/
@@ -856,11 +853,11 @@
     if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
     {
         // Association failure
-        limLog(pMac, LOG1,
-               FL("SessionId: %d Association failure resultCode: %d"
-                   "limSmeState: %d"), psessionEntry->peSessionId,
+        PELOG1(limLog(pMac, LOG1,
+               FL("SessionId:%d Association failure resultCode: resultCode:%d"
+                   "limSmeState:%d"), psessionEntry->peSessionId,
                    ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
-                    psessionEntry->limSmeState);
+                    psessionEntry->limSmeState);)
 
         /* If driver gets deauth when its waiting for ADD_STA_RSP then we need
          * to do DEL_STA followed by DEL_BSS. So based on below reason-code here
@@ -884,8 +881,8 @@
     else
     {
         // Successful Association
-        limLog(pMac, LOG1, FL("SessionId: %d Associated with BSS"),
-                     psessionEntry->peSessionId);
+        PELOG1(limLog(pMac, LOG1, FL("SessionId:%d Associated with BSS"),
+                     psessionEntry->peSessionId);)
         psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
         MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
         /**
@@ -951,27 +948,10 @@
         psessionEntry->pLimReAssocReq = NULL;
     }
 
-    /* Upon Reassoc success or failure, freeup the cached
-     * preauth request, to ensure that channel switch is now
-     * allowed following any change in HT params.
-     */
-    if (pMac->ft.ftPEContext.pFTPreAuthReq)
-    {
-        limLog(pMac, LOG1, "%s: Freeing pFTPreAuthReq= %p", __func__,
-               pMac->ft.ftPEContext.pFTPreAuthReq);
-        if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
-        {
-            vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
-            pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
-        }
-        vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
-        pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
-    }
-
     PELOGE(limLog(pMac, LOG1, FL("Rcv MLM_REASSOC_CNF with result code %d"), pLimMlmReassocCnf->resultCode);)
     if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
         // Successful Reassociation
-        limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));
+        PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));)
 
         psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
         MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
@@ -1080,7 +1060,7 @@
     msgQ.type = eWNI_SME_REASSOC_IND;
     msgQ.bodyptr = pSirSmeReassocInd;
     msgQ.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
     limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -1094,8 +1074,8 @@
     }
 
     limSysProcessMmhMsgApi(pMac, &msgQ,  ePROT);
-    limLog(pMac, LOG1,
-       FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));
+    PELOG1(limLog(pMac, LOG1,
+       FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));)
     /*
      ** turn on a timer to detect the loss of REASSOC CNF
      **/
@@ -1138,7 +1118,6 @@
         // Log error
         limLog(pMac, LOGP,
            FL("call to AllocateMemory failed for eWNI_SME_AUTH_IND"));
-        return;
     }
     limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
     limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
@@ -1146,7 +1125,7 @@
     msgQ.type = eWNI_SME_AUTH_IND;
     msgQ.bodyptr = pSirSmeAuthInd;
     msgQ.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
     limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -1209,13 +1188,6 @@
     }
     // Fill in WmmInfo
     pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    pSirSmeAssocInd->HT40MHzIntoEnabledSta = pAssocInd->HT40MHzIntoPresent;
-    limLog(pMac, LOGW, FL("HT40MHzIntoPresent: %d"),
-                 pSirSmeAssocInd->HT40MHzIntoEnabledSta);
-#endif
-    // Fill in rate flags
-    pSirSmeAssocInd->rate_flags = pAssocInd->rate_flags;
 } /*** end limAssocIndSerDes() ***/
 
 
@@ -1284,15 +1256,14 @@
     }
     pSirSmeAssocInd->staId = pStaDs->staIndex;
    pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
-   MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
-                                                             msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
     limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
     limSysProcessMmhMsgApi(pMac, &msgQ,  ePROT);
 
-    limLog(pMac, LOG1,
-       FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));
+    PELOG1(limLog(pMac, LOG1,
+       FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));)
     /*
      ** turn on a timer to detect the loss of ASSOC CNF
      **/
@@ -1367,9 +1338,9 @@
             MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
             break;
         default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
-                limLog(pMac, LOG1,
-                       FL("*** Peer staId = %d Disassociated ***"),
-                        pMlmDisassocInd->aid);
+                PELOG1(limLog(pMac, LOG1,
+                       FL("*** Peer staId=%d Disassociated ***"),
+                        pMlmDisassocInd->aid);)
             // Send SME_DISASOC_IND after Polaris cleanup
             // (after receiving LIM_MLM_PURGE_STA_IND)
             break;
@@ -1489,8 +1460,7 @@
     pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
     if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
     {
-         PELOGE(limLog(pMac, LOGE,FL("session does not exist for Addr:" MAC_ADDRESS_STR),
-                                      MAC_ADDR_ARRAY(pMlmDeauthInd->peerMacAddr));)
+         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
          return;
     }
     switch (psessionEntry->limSystemRole)
@@ -1504,9 +1474,9 @@
 
         default: // eLIM_AP_ROLE
             {
-                limLog(pMac, LOG1,
+                PELOG1(limLog(pMac, LOG1,
                    FL("*** Received Deauthentication from staId=%d ***"),
-                   pMlmDeauthInd->aid);
+                   pMlmDeauthInd->aid);)
             }
             // Send SME_DEAUTH_IND after Polaris cleanup
             // (after receiving LIM_MLM_PURGE_STA_IND)
@@ -1562,8 +1532,7 @@
     if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
     {
         // Deauth Confirm from MLM
-        if ((psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
-            (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
+        if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
         {
             /**
              * Should not have received Deauth confirm
@@ -1578,8 +1547,8 @@
         if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
         {
             psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
-            limLog(pMac, LOG1,
-                   FL("*** Deauthenticated with BSS ***"));
+            PELOG1(limLog(pMac, LOG1,
+                   FL("*** Deauthenticated with BSS ***"));)
         }
         else
             psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
@@ -1836,20 +1805,12 @@
             pStaDs->mlmStaContext.protStatusCode = protStatusCode;
             //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
             limCleanupRxPath(pMac, pStaDs, psessionEntry);
-            /* Cleanup if add bss failed */
-            if(psessionEntry->addBssfailed)
-            {
-              dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,
-                                   &psessionEntry->dph.dphHashTable);
-              goto error;
-            }
             vos_mem_free(psessionEntry->pLimJoinReq);
             psessionEntry->pLimJoinReq = NULL;
             return;
         }
     }
 
-error:
     vos_mem_free(psessionEntry->pLimJoinReq);
     psessionEntry->pLimJoinReq = NULL;
     //Delete teh session if JOIN failure occurred.
@@ -1913,17 +1874,10 @@
             pStaDs->mlmStaContext.resultCode = resultCode;
             pStaDs->mlmStaContext.protStatusCode = protStatusCode;
             limCleanupRxPath(pMac, pStaDs, psessionEntry);
-            /* Cleanup if add bss failed */
-            if(psessionEntry->addBssfailed)
-            {
-              dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,
-                                   &psessionEntry->dph.dphHashTable);
-              goto error;
-            }
             return;
         }
     }
-error:
+
     //Delete teh session if REASSOC failure occurred.
     if(resultCode != eSIR_SME_SUCCESS)
     {
@@ -2002,7 +1956,6 @@
           //either assoc cnf or reassoc cnf handler.
           mlmAssocCnf.resultCode =
               (tSirResultCodes) eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA;
-          mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
           psessionEntry->staId = pAddStaParams->staIdx;
           goto end;
       }
@@ -2072,15 +2025,8 @@
     {
         limLog( pMac, LOGE, FL( "ADD_STA failed!"));
         if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
-        {
            mesgType = LIM_MLM_REASSOC_CNF;
-           mlmAssocCnf.resultCode = (tSirResultCodes)eSIR_SME_FT_REASSOC_FAILURE;
-        }
-        else
-        {
-           mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
-        }
-        mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
+        mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
     }
 end:
     if( 0 != limMsgQ->bodyptr )
@@ -2175,20 +2121,17 @@
             statusCode = eSIR_SME_REFUSED;
             goto end;
         }
-        limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
-        limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
+        PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
+        limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
     }
     else
     {
-        /* If DelBSS response is failure, go ahead and
-         * post response to SME
-         */
-        limLog( pMac, LOGE, FL( "DEL BSS failed! Status:%d" ),
-                pDelBssParams->status );
-        statusCode = eSIR_SME_REFUSED;
+        limLog( pMac, LOGE, FL( "DEL BSS failed!" ) );
+        vos_mem_free(pDelBssParams);
+        limMsgQ->bodyptr = NULL;
+        return;
     }
-
-end:
+   end:
      if( 0 != limMsgQ->bodyptr )
      {
         vos_mem_free(pDelBssParams);
@@ -2327,28 +2270,24 @@
     tSirResultCodes statusCode = eSIR_SME_SUCCESS;
     if(limMsgQ->bodyptr == NULL)
     {
-        limLog( pMac, LOGE,
-             FL( "limMsgQ->bodyptry NULL"));
-        return;
+      return;
     }
+
     pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
     if(pStaDs == NULL)
     {
         limLog( pMac, LOGE,
-             FL( "DPH Entry for STA %d missing."), pDelStaParams->assocId);
+             FL( "DPH Entry for STA %X missing."), pDelStaParams->assocId);
         statusCode = eSIR_SME_REFUSED;
         vos_mem_free(pDelStaParams);
         limMsgQ->bodyptr = NULL;
 
         return;
     }
-    limLog( pMac, LOG1,
-            FL( "Received del Sta Rsp in StaD MlmState : %d"),
-                 pStaDs->mlmStaContext.mlmState);
     if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
     {
         limLog( pMac, LOGW,
-                   FL( "AP received the DEL_STA_RSP for assocID: %d."), pDelStaParams->assocId);
+                   FL( "AP received the DEL_STA_RSP for assocID: %X."), pDelStaParams->assocId);
 
         if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
            ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
@@ -2417,56 +2356,47 @@
     tSirResultCodes   statusCode    = eSIR_SME_SUCCESS;
     tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
     tpDphHashNode     pStaDs        = NULL;
-
     if(NULL == pDelStaParams )
     {
         limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
         goto end;
     }
-
-    limLog(pMac, LOG1, FL("Del STA RSP received. Status:%d AssocID:%d"),
-           pDelStaParams->status, pDelStaParams->assocId);
-
-    if (eHAL_STATUS_SUCCESS != pDelStaParams->status)
+    if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
     {
-        limLog(pMac, LOGE, FL("Del STA failed! Status:%d, still proceeding"
-               "with Del BSS"), pDelStaParams->status);
+        pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+        if (pStaDs == NULL)
+        {
+            //TODO: any response to be sent out here ?
+            limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
+                    pDelStaParams->assocId);
+            statusCode = eSIR_SME_REFUSED;
+            goto end;
+        }
+        if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
+        {
+            //TODO: any response to be sent out here ?
+            limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
+                  limMlmStateStr(psessionEntry->limMlmState));
+            statusCode = eSIR_SME_REFUSED;
+            goto end;
+        }
+        PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
+        limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+        limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X"), pDelStaParams->assocId);
+        //we must complete all cleanup related to delSta before calling limDelBSS.
+        if( 0 != limMsgQ->bodyptr )
+        {
+            vos_mem_free(pDelStaParams);
+            limMsgQ->bodyptr = NULL;
+        }
+        statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
+        return;
     }
-
-    pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
-
-    if (pStaDs == NULL)
+    else
     {
-        //TODO: any response to be sent out here ?
-        limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
-                pDelStaParams->assocId);
+        limLog( pMac, LOGE, FL( "DEL_STA failed for sta Id %d" ), pDelStaParams->staIdx);
         statusCode = eSIR_SME_REFUSED;
-        goto end;
     }
-
-    if (eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
-    {
-        //TODO: any response to be sent out here ?
-        limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
-                limMlmStateStr(psessionEntry->limMlmState));
-        statusCode = eSIR_SME_REFUSED;
-        goto end;
-    }
-
-    limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
-    limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
-
-    //we must complete all cleanup related to delSta before calling limDelBSS.
-    if (0 != limMsgQ->bodyptr )
-    {
-        vos_mem_free(pDelStaParams);
-        limMsgQ->bodyptr = NULL;
-    }
-
-    // Proceed to do DelBSS even if DelSta resulted in failure
-    statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
-    return;
-
 end:
     if( 0 != limMsgQ->bodyptr )
     {
@@ -2524,7 +2454,7 @@
     pStaDs->valid = 1;
     pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
     limLog( pMac, LOG1,
-            FL("AddStaRsp Success.STA AssocID %d staId %d MAC "),
+            FL("STA AssocID %d staId %d MAC "),
             pStaDs->assocId,
             pStaDs->staIndex);
     limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
@@ -2607,7 +2537,7 @@
     mlmStartCnf.sessionId = pAddBssParams->sessionId;
     if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
     {
-        limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
+        PELOG2(limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
         if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
               psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
             goto end;
@@ -2721,7 +2651,7 @@
     }
     if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
     {
-        limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
+        PELOG1(limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
         if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
              psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
             goto end;
@@ -2826,7 +2756,7 @@
                        FL("could not retrieve AuthType"));
             }
             if (cfgAuthType == eSIR_AUTO_SWITCH) 
-                authMode = eSIR_SHARED_KEY; // Try Shared Authentication first
+                authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
             else
                 authMode = cfgAuthType;
 
@@ -2914,10 +2844,6 @@
     tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
     tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
     tANI_U32 selfStaDot11Mode = 0;
-#ifdef FEATURE_WLAN_ESE
-    tLimMlmReassocReq       *pMlmReassocReq;
-    tANI_U32 val = 0;
-#endif
 
     /* Sanity Checks */
 
@@ -2944,45 +2870,11 @@
         limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
         goto end;
     }
-    if (pMac->roam.configParam.roamDelayStatsEnabled)
-    {
-        vos_record_roam_event(e_LIM_ADD_BS_RSP, NULL, 0);
-    }
+#ifdef DEBUG_ROAM_DELAY
+    vos_record_roam_event(e_LIM_ADD_BS_RSP, NULL, 0);
+#endif
     // Prepare and send Reassociation request frame
     // start reassoc timer.
-
-
-#ifdef FEATURE_WLAN_ESE
-    /*
-     * In case of Ese Reassociation, change the reassoc timer
-     * value.
-     */
-    pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
-    if (pMlmReassocReq == NULL)
-    {
-        limLog(pMac, LOGE,
-          FL("Invalid pMlmReassocReq"));
-        goto end;
-    }
-    val = pMlmReassocReq->reassocFailureTimeout;
-    if (psessionEntry->isESEconnection)
-    {
-        val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
-    }
-    if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
-                                                TX_SUCCESS)
-    {
-        limLog(pMac, LOGP,
-          FL("unable to deactivate Reassoc failure timer"));
-    }
-    val = SYS_MS_TO_TICKS(val);
-    if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
-                                val, 0) != TX_SUCCESS)
-    {
-        limLog(pMac, LOGP,
-          FL("unable to change Reassociation failure timer"));
-    }
-#endif
     pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
     /// Start reassociation failure timer
     MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
@@ -3017,10 +2909,9 @@
     pMac->lim.reAssocRetryAttempt = 0;
 #endif
     limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
-    if (pMac->roam.configParam.roamDelayStatsEnabled)
-    {
-        vos_record_roam_event(e_LIM_SEND_REASSOC_REQ, NULL, 0);
-    }
+#ifdef DEBUG_ROAM_DELAY
+    vos_record_roam_event(e_LIM_SEND_REASSOC_REQ, NULL, 0);
+#endif
     psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
     psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
     MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
@@ -3296,13 +3187,11 @@
     {
         limLog( pMac, LOGP, FL( "SessionId:%d ADD_BSS failed! mlmState = %d" ),
                 psessionEntry->peSessionId,  psessionEntry->limMlmState);
-        mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
         // Return Assoc confirm to SME with failure
         if(eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState)
             mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_FT_REASSOC_FAILURE;
         else
             mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
-        psessionEntry->addBssfailed = true;
     }
 
     if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
@@ -3533,43 +3422,48 @@
 }
 void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
 {
+    tANI_U8 respReqd = 1;
     tLimMlmSetKeysCnf mlmSetKeysCnf;
     tANI_U16          resultCode;
     tANI_U8           sessionId = 0;
     tpPESession  psessionEntry;
-    tpLimMlmSetKeysReq lpLimMlmSetKeysReq;
-
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
     vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
-    if ( NULL == limMsgQ->bodyptr )
+   //BTAMP
+    if( NULL == limMsgQ->bodyptr )
     {
         PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
         return;
     }
     sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
-    if ((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
+    if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
     {
-        limLog(pMac, LOGE,FL("session does not exist for sessionId %d"),
-                                                                 sessionId);
+        PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
         vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
         vos_mem_free( limMsgQ->bodyptr );
         limMsgQ->bodyptr = NULL;
         return;
     }
-    if ( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
+    if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
         resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
     else
-        /* BCAST key also uses tpSetStaKeyParams. Done this way for readabilty */
-        resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
+        resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
 
+    //
+    // TODO & FIXME_GEN4
+    // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
+    //
+  // Validate SME/LIM state - Read the above "ASSUMPTIONS"
+  //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
+  //{
+    // Validate MLME state
     if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
         eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
     {
-        /* Mesg received from HAL in Invalid state! */
-        limLog( pMac, LOGW,
-                 FL( "Received unexpected [Mesg Id - %d] in state %d" ),
-                 limMsgQ->type, psessionEntry->limMlmState );
-        mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_STATE;
+        // Mesg received from HAL in Invalid state!
+        limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %d" ), limMsgQ->type, psessionEntry->limMlmState );
+        // There's not much that MLME can do at this stage...
+        respReqd = 0;
     }
     else
       mlmSetKeysCnf.resultCode = resultCode;
@@ -3580,24 +3474,26 @@
     // Restore MLME state
     psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
-           psessionEntry->peSessionId, psessionEntry->limMlmState));
-    lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
-    mlmSetKeysCnf.sessionId = sessionId;
-
-    /* Prepare and Send LIM_MLM_SETKEYS_CNF */
-    if( NULL != lpLimMlmSetKeysReq )
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    if( respReqd )
     {
-        vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
-                     (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
-                      sizeof(tSirMacAddr));
-        /* Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq */
-        vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
-                        sizeof(tLimMlmSetKeysReq));
-        vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
-        pMac->lim.gpLimMlmSetKeysReq = NULL;
+        tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
+        mlmSetKeysCnf.sessionId = sessionId;
+
+        // Prepare and Send LIM_MLM_SETKEYS_CNF
+        if( NULL != lpLimMlmSetKeysReq )
+        {
+            vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
+                         (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
+                         sizeof(tSirMacAddr));
+            // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
+            vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
+                          sizeof(tLimMlmSetKeysReq));
+            vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
+            pMac->lim.gpLimMlmSetKeysReq = NULL;
+        }
+        limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
     }
-    limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
 }
 /**
  * limProcessMlmRemoveKeyRsp()
@@ -3822,9 +3718,6 @@
 {
     tLimMlmReassocCnf       mlmReassocCnf;
     tLimMlmReassocReq       *pMlmReassocReq;
-#ifdef FEATURE_WLAN_ESE
-    tANI_U32                val = 0;
-#endif
     pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
     if(pMlmReassocReq == NULL)
     {
@@ -3839,32 +3732,6 @@
         mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
         goto end;
     }
-
-#ifdef FEATURE_WLAN_ESE
-    /*
-     * In case of Ese Reassociation, change the reassoc timer
-     * value.
-     */
-    val = pMlmReassocReq->reassocFailureTimeout;
-    if (psessionEntry->isESEconnection)
-    {
-        val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
-    }
-    if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
-                                                TX_SUCCESS)
-    {
-        limLog(pMac, LOGP,
-           FL("unable to deactivate Reassoc failure timer"));
-    }
-    val = SYS_MS_TO_TICKS(val);
-    if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
-                                val, 0) != TX_SUCCESS)
-    {
-        limLog(pMac, LOGP,
-          FL("unable to change Reassociation failure timer"));
-    }
-#endif
-    pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
     /// Start reassociation failure timer
     MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
     if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
@@ -4115,7 +3982,7 @@
              */
             if (pMac->lim.gpchangeChannelCallback)
             {
-                limLog( pMac, LOG1, "Channel changed hence invoke registered call back");
+                PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back");)
                 if (eHAL_CHANNEL_SWITCH_SOURCE_CSA == pChnlParams->channelSwitchSrc )
                 {
                     if (IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
@@ -4328,13 +4195,7 @@
     switch(pMac->lim.gLimHalScanState)
     {
         case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-            limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_COMP_EVENT, NULL,
-                               status, eSIR_SUCCESS);
-#endif
             pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
-            if (pMac->lim.abortScan)
-                pMac->lim.abortScan = 0;
             limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
             if (limIsChanSwitchRunning(pMac))
             {
@@ -4419,6 +4280,9 @@
         limMsgQ->bodyptr = NULL;
         return;
     }
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
+    limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
 
     // Allocate for LIM_MLM_ADDBA_CNF
     pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
@@ -4444,12 +4308,6 @@
         pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
      else
         pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
-
-#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
-    limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry,
-                       pAddBAParams->status, pMlmAddBACnf->addBAResultCode);
-#endif //FEATURE_WLAN_DIAG_SUPPORT
-
      vos_mem_free(limMsgQ->bodyptr);
      limMsgQ->bodyptr = NULL;
      // Send ADDBA CNF to LIM
@@ -4780,23 +4638,13 @@
     psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
    /* Update PE session Id*/
     mlmReassocCnf.sessionId = psessionEntry->peSessionId;
-    switch (psessionEntry->limSmeState) {
+    switch (psessionEntry->limMlmState) {
         case eLIM_SME_WT_REASSOC_STATE :
         {
             tpSirAssocRsp assocRsp;
             tpDphHashNode   pStaDs;
             tSirRetStatus       retStatus = eSIR_SUCCESS;
-            tpSchBeaconStruct pBeaconStruct;
-            pBeaconStruct = vos_mem_vmalloc(sizeof(tSchBeaconStruct));
-            if (NULL == pBeaconStruct)
-            {
-                limLog(pMac, LOGE, FL("beaconStruct allocation failed"));
-                mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
-                mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
-                limDeleteDphHashEntry(pMac, psessionEntry->bssId,
-                                      DPH_STA_HASH_INDEX_PEER, psessionEntry);
-                goto Error;
-            }
+            tSchBeaconStruct beaconStruct;
             /** Delete the older STA Table entry */
             limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
        /**
@@ -4810,7 +4658,6 @@
                 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
                 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
                 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
-                vos_mem_vfree(pBeaconStruct);
                 goto Error;
             }
             /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
@@ -4822,17 +4669,17 @@
             limExtractApCapabilities( pMac,
                   (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
                   limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
-                    pBeaconStruct );
+                    &beaconStruct );
             if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
-                limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
-                if(pBeaconStruct->erpPresent) {
-                if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
+                limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
+                if(beaconStruct.erpPresent) {
+                if (beaconStruct.erpIEInfo.barkerPreambleMode)
                     psessionEntry->beaconParams.fShortPreamble = 0;
                 else
                     psessionEntry->beaconParams.fShortPreamble = 1;
             }
             //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
-            if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
+            if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
                                                     &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry))  {
                 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
                 retStatus = eSIR_FAILURE;
@@ -4842,12 +4689,10 @@
                 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
                 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
                 vos_mem_free(assocRsp);
-                vos_mem_vfree(pBeaconStruct);
                 pMac->lim.gLimAssocResponseData = NULL;
                 goto Error;
             }
             vos_mem_free(assocRsp);
-            vos_mem_vfree(pBeaconStruct);
             psessionEntry->limAssocResponseData = NULL;
         }
         break;
@@ -5238,31 +5083,6 @@
     }
 }
 
-void limProcessMlmSpoofMacAddrRsp(tpAniSirGlobal pMac, tSirRetStatus rspStatus)
-{
-    tANI_U32 val;
-
-    if (wlan_cfgGetInt(pMac, WNI_CFG_ENABLE_MAC_ADDR_SPOOFING, &val)
-                        != eSIR_SUCCESS)
-    {
-        limLog(pMac, LOGP, FL("fail to Get WNI_CFG_ENABLE_MAC_ADDR_SPOOFING"));
-        /*If we here means mac spoofing is enable. So enable both Host and
-          FW spoofing */
-        val = 1;
-    }
-    if ((rspStatus != eSIR_SUCCESS) || (val != 1) ||
-       (TRUE == vos_is_macaddr_zero((v_MACADDR_t *)&pMac->lim.spoofMacAddr)))
-    {
-        limLog(pMac, LOG1, FL(" LIM Disabling Spoofing %d"), val);
-        pMac->lim.isSpoofingEnabled = FALSE;
-    } else {
-        limLog(pMac, LOG1, FL(" LIM Enabling Spoofing"));
-        pMac->lim.isSpoofingEnabled = TRUE;
-    }
-
-    return;
-}
-
 void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
                          eHalStatus status,
                          tANI_U32* mlmAddBssRsp)
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c
index 81b112e..52f8649 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,7 +36,7 @@
  *
  */
 
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "aniGlobal.h"
 #include "cfgApi.h"
 
@@ -550,8 +550,7 @@
                         pSirSmeProbeReq->sessionId = psessionEntry->smeSessionId;
                         vos_mem_copy(pSirSmeProbeReq->peerMacAddr, pHdr->sa, sizeof(tSirMacAddr));
                         pSirSmeProbeReq->devicePasswdId = probeReq.probeReqWscIeInfo.DevicePasswordID.id;
-                        MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
-                            psessionEntry->peSessionId, msgQ.type));
+                        MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
                        if (limSysProcessMmhMsgApi(pMac, &msgQ,  ePROT) != eSIR_SUCCESS){
                             PELOG3(limLog(pMac, LOG3, FL("couldnt send the probe req to wsm "));)
                         }
@@ -604,10 +603,6 @@
             else
             {
                 {
-                    if ((VOS_P2P_GO_MODE == psessionEntry->pePersona) &&
-                                                        pMac->miracastVendorConfig)
-                        return;
-
                     // Broadcast SSID in the Probe Request.
                     // Reply with SSID we're configured with.
                     //Turn off the SSID length to 0 if hidden SSID feature is present
@@ -665,7 +660,7 @@
 limIndicateProbeReqToHDD(tpAniSirGlobal pMac, tANI_U8 *pBd,
                          tpPESession psessionEntry)
 {
-    limLog( pMac, LOG1, FL("Received a probe request frame"));
+    limLog( pMac, LOG1, "Received a probe request frame");
 
     //send the probe req to SME.
     limSendSmeMgmtFrameInd( pMac, psessionEntry->smeSessionId, pBd,
@@ -796,8 +791,7 @@
     vos_mem_copy(pSirSmeProbeReqInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
     vos_mem_copy(pSirSmeProbeReqInd->WPSPBCProbeReq.peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
 
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
-                                                               msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
     pSirSmeProbeReqInd->WPSPBCProbeReq.probeReqIELen = (tANI_U16)ProbeReqIELen;
     vos_mem_copy(pSirSmeProbeReqInd->WPSPBCProbeReq.probeReqIE, pProbeReqIE, ProbeReqIELen);
     
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c
index 528ce8b..a80bc37 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,7 +38,7 @@
  */
 
 #include "wniApi.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "aniGlobal.h"
 #include "schApi.h"
 #include "utilsApi.h"
@@ -127,7 +127,7 @@
                 psessionEntry->peSessionId);
 
 
-    pProbeRsp = vos_mem_vmalloc(sizeof(tSirProbeRespBeacon));
+    pProbeRsp = vos_mem_malloc(sizeof(tSirProbeRespBeacon));
     if ( NULL == pProbeRsp )
     {
         limLog(pMac, LOGE, FL("Unable to allocate memory in limProcessProbeRspFrame") );
@@ -142,16 +142,16 @@
     pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
 
 
-   limLog(pMac, LOG2,
+   PELOG2(limLog(pMac, LOG2,
              FL("Received Probe Response frame with length=%d from "),
              WDA_GET_RX_MPDU_LEN(pRxPacketInfo));
-    limPrintMacAddr(pMac, pHdr->sa, LOG2);
+    limPrintMacAddr(pMac, pHdr->sa, LOG2);)
 
    if (!pMac->fScanOffload)
    {
        if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS)
        {
-           vos_mem_vfree(pProbeRsp);
+           vos_mem_free(pProbeRsp);
            return;
        }
    }
@@ -162,7 +162,7 @@
    {
        PELOG1(limLog(pMac, LOG1,
                  FL("Parse error ProbeResponse, length=%d"), frameLen);)
-       vos_mem_vfree(pProbeRsp);
+       vos_mem_free(pProbeRsp);
        return;
    }
 
@@ -212,7 +212,7 @@
             PELOG1(limLog(pMac, LOG1,
                FL("Parse error ProbeResponse, length=%d"),
                frameLen);)
-            vos_mem_vfree(pProbeRsp);
+            vos_mem_free(pProbeRsp);
             return;
         }
 
@@ -279,7 +279,7 @@
 
             if ( !vos_mem_compare(currentBssId, pHdr->bssId, sizeof(tSirMacAddr)) )
             {
-                vos_mem_vfree(pProbeRsp);
+                vos_mem_free(pProbeRsp);
                 return;
             }
 
@@ -357,7 +357,7 @@
                 limHandleIBSScoalescing(pMac, pProbeRsp, pRxPacketInfo,psessionEntry);
     } // if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || ...
 
-    vos_mem_vfree(pProbeRsp);
+    vos_mem_free(pProbeRsp);
     // Ignore Probe Response frame in all other states
     return;
 } /*** end limProcessProbeRspFrame() ***/
@@ -371,7 +371,7 @@
     tpSirMacMgmtHdr         pHdr;
     tSirProbeRespBeacon    *pProbeRsp;
 
-    pProbeRsp = vos_mem_vmalloc(sizeof(tSirProbeRespBeacon));
+    pProbeRsp = vos_mem_malloc(sizeof(tSirProbeRespBeacon));
     if ( NULL == pProbeRsp )
     {
         limLog(pMac, LOGE, FL("Unable to allocate memory in limProcessProbeRspFrameNoSession") );
@@ -400,7 +400,7 @@
         {
             if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS)
             {
-                vos_mem_vfree(pProbeRsp);
+                vos_mem_free(pProbeRsp);
                 return;
             }
         }
@@ -413,7 +413,7 @@
     {
        PELOG1(limLog(pMac, LOG1,FL("Parse error ProbeResponse, length=%d"),
               frameLen);)
-       vos_mem_vfree(pProbeRsp);
+       vos_mem_free(pProbeRsp);
        return;
     }
     /*  Since there is no psessionEntry, PE cannot be in the following states:
@@ -445,7 +445,7 @@
         if (sirConvertProbeFrame2Struct(pMac, pBody, frameLen, pProbeRsp) == eSIR_FAILURE)
         {
             limLog(pMac, LOG1, FL("Parse error ProbeResponse, length=%d\n"), frameLen);
-            vos_mem_vfree(pProbeRsp);
+            vos_mem_free(pProbeRsp);
             return;
         }
         limLog( pMac, LOG2, FL("Save this probe rsp in LFR cache"));
@@ -466,7 +466,7 @@
         {
             limLog(pMac, LOG1,
                     FL("Parse error ProbeResponse, length=%d\n"), frameLen);
-            vos_mem_vfree(pProbeRsp);
+            vos_mem_free(pProbeRsp);
             return;
         }
         limCheckAndAddBssDescription(pMac, pProbeRsp, pRxPacketInfo,
@@ -492,7 +492,7 @@
         if (sirConvertProbeFrame2Struct(pMac, pBody, frameLen, pProbeRsp) == eSIR_FAILURE)
         {
             limLog(pMac, LOG1, FL("Parse error ProbeResponse, length=%d"), frameLen);
-            vos_mem_vfree(pProbeRsp);
+            vos_mem_free(pProbeRsp);
             return;
         }
 
@@ -503,6 +503,6 @@
         {
         }
     } 
-    vos_mem_vfree(pProbeRsp);
+    vos_mem_free(pProbeRsp);
     return;
 } /*** end limProcessProbeRspFrameNew() ***/
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
index 9227d6e..6a7cf54 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -41,7 +41,7 @@
 
 #include "palTypes.h"
 #include "wniApi.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "cfgApi.h"
 #include "sirApi.h"
 #include "schApi.h"
@@ -59,10 +59,6 @@
 #include "limApi.h"
 #include "wmmApsd.h"
 
-#ifdef WLAN_FEATURE_RMC
-#include "limRMC.h"
-#endif
-
 #include "sapApi.h"
 
 #if defined WLAN_FEATURE_VOWIFI
@@ -84,7 +80,6 @@
 
 #endif
 
-#define JOIN_FAILURE_TIMEOUT   1000   // in msecs
 /* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK 
  * in case of P2P Client and starting actual scanning with init scan req/rsp plus in case of concurrency,
  * taking care of sending null data and receiving ACK to/from AP/Also SetChannel with calibration is taking
@@ -154,8 +149,6 @@
 
     if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
     {
-        limLog(pMac, LOG1, FL("setting fresh scan as false. sme state is %d"),
-               pMac->lim.gLimSmeState);
         return FALSE;
     }
     for(i =0; i < pMac->lim.maxBssId; i++)
@@ -178,11 +171,6 @@
              ))
                 {
                 validState = FALSE;
-                limLog(pMac, LOG1, FL("setting fresh scan as false."
-                      "bssType is %d system role is %d, smestate is %d"),
-                      pMac->lim.gpSession[i].bssType,
-                      pMac->lim.gpSession[i].limSystemRole,
-                      pMac->lim.gpSession[i].limSmeState);
                 break;
               }
             
@@ -364,7 +352,7 @@
     tANI_U16         smetransactionId;
     
 
-    limLog(pMac, LOG1, FL("Received SME_START_REQ"));
+   PELOG1(limLog(pMac, LOG1, FL("Received START_REQ"));)
 
     limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
     
@@ -544,7 +532,7 @@
     limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
     
-    limLog(pMac, LOG1, FL("Received SME_START_BSS_REQ"));
+    PELOG1(limLog(pMac, LOG1, FL("Received START_BSS_REQ"));)
 
     /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */
     if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
@@ -633,14 +621,6 @@
 
         psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac, 
             psessionEntry->currentOperChannel );
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        /*Store Overlapping BSS Scan Parameters IEs to session table */
-        if (pSmeStartBssReq->apHT40_24GEnabled)
-        {
-            limInitOBSSScanParams(pMac, psessionEntry);
-        }
-#endif
         /* Store the dot 11 mode in to the session Table*/
 
         psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
@@ -1227,7 +1207,7 @@
     tpSirSmeScanReq     pScanReq;
     tANI_U8             i = 0;
 
-#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
     
@@ -1262,12 +1242,11 @@
     /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/
     sirCopyMacAddr(pMac->lim.gSelfMacAddr,  pScanReq->selfMacAddr);
 
-   /* Check if scan req is not valid or link is already suspended*/
-    if (!limIsSmeScanReqValid(pMac, pScanReq) || limIsLinkSuspended(pMac))
+   /* This routine should return the sme sessionId and SME transaction Id */
+       
+    if (!limIsSmeScanReqValid(pMac, pScanReq))
     {
-        limLog(pMac, LOGE,
-         FL("Received SME_SCAN_REQ with invalid params or link is suspended %d"),
-          limIsLinkSuspended(pMac));
+        limLog(pMac, LOGE, FL("Received SME_SCAN_REQ with invalid parameters"));
 
         if (pMac->lim.gLimRspReqd)
         {
@@ -1376,16 +1355,6 @@
                 limLog(pMac, LOGP,
                        FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
 
-                if (pMac->lim.gLimRspReqd)
-                {
-                  pMac->lim.gLimRspReqd = false;
-
-                  limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
-                                    eSIR_SME_RESOURCES_UNAVAILABLE,
-                                    pScanReq->sessionId,
-                                    pScanReq->transactionId);
-                }
-
                   return;
                }
 
@@ -1403,59 +1372,8 @@
                    */
                   limLog(pMac, LOGP,
                           FL("could not retrieve Valid channel list"));
-
-                  if (pMac->lim.gLimRspReqd)
-                  {
-                      pMac->lim.gLimRspReqd = false;
-
-                      limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
-                                        eSIR_SME_INVALID_PARAMETERS,
-                                        pScanReq->sessionId,
-                                        pScanReq->transactionId);
-                  }
-                  vos_mem_free(pMlmScanReq);
-                  return;
               }
               pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
-
-              //Ignore DFS channels if DFS scan is disabled
-              if(pMac->scan.fEnableDFSChnlScan == DFS_CHNL_SCAN_DISABLED)
-              {
-                  tANI_U8 numChan = 0;
-                  tANI_U8 channel_state;
-                  tANI_U8 *chan_ptr = pMlmScanReq->channelList.channelNumber;
-
-                  limLog(pMac, LOG1,
-                     FL("Ignore DFS channels from valid channel list"));
-
-                  VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
-                                pMlmScanReq->channelList.channelNumber,
-                                pMlmScanReq->channelList.numChannels);
-
-                  //Filter DFS channels
-                  for (i = 0; i < cfg_len; i++)
-                  {
-                       channel_state =
-                              vos_nv_getChannelEnabledState(*(chan_ptr + i));
-
-                       //Allow channel if not DFS
-                       if(channel_state != NV_CHANNEL_DFS)
-                       {
-                          *(chan_ptr + numChan) = *(chan_ptr + i);
-                          numChan++;
-                       }
-                  }
-                  pMlmScanReq->channelList.numChannels = (tANI_U8) numChan;
-
-                  limLog(pMac, LOG1, FL("No of valid channels %d, No of"
-                         "channels after filtering %d"), cfg_len, numChan);
-
-                  limLog(pMac, LOG1, FL("Channel list after filtering: "));
-
-                  VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
-                                pMlmScanReq->channelList.channelNumber,
-                                pMlmScanReq->channelList.numChannels);
-              }
           }
           else
           {
@@ -1470,16 +1388,6 @@
                 limLog(pMac, LOGP,
                     FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
 
-                if (pMac->lim.gLimRspReqd)
-                {
-                  pMac->lim.gLimRspReqd = false;
-
-                  limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
-                                    eSIR_SME_RESOURCES_UNAVAILABLE,
-                                    pScanReq->sessionId,
-                                    pScanReq->transactionId);
-                }
-
                   return;
                }
 
@@ -1708,8 +1616,8 @@
     tANI_U16            nSize;
     tANI_U8             sessionId;
     tpPESession         psessionEntry = NULL;
-    tANI_U8             smesessionId = 0;
-    tANI_U16            smetransactionId = 0;
+    tANI_U8             smesessionId;
+    tANI_U16            smetransactionId;
     tPowerdBm           localPowerConstraint = 0, regMax = 0;
     tANI_U16            ieLen;
     v_U8_t              *vendorIE;
@@ -1719,7 +1627,7 @@
     limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
 
-    limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));
+    PELOG1(limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));)
 
 #ifdef WLAN_FEATURE_VOWIFI
     /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
@@ -1823,14 +1731,8 @@
             else
                 limLog(pMac,LOG1,FL("SessionId:%d New session created"),
                        sessionId);
-        }
-
-        if(psessionEntry != NULL && pSmeJoinReq->operationalRateSet.numRates > 0 ){
-            if(!limCheck11BRateBitmap(pSmeJoinReq->rateBitMap)){
-                psessionEntry->is11Gonly = true;
-            }
-        }
-
+        }   
+        handleHTCapabilityandHTInfo(pMac, psessionEntry);
         psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
 
         /* Store Session related parameters */
@@ -1857,8 +1759,6 @@
         psessionEntry->statypeForBss = STA_ENTRY_PEER;
         psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled;
         psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled;
-        psessionEntry->bOSENAssociation = pSmeJoinReq->bOSENAssociation;
-        psessionEntry->bWPSAssociation = pSmeJoinReq->bWPSAssociation;
 
         /* Store vendor specfic IE for CISCO AP */
         ieLen = (pSmeJoinReq->bssDescription.length +
@@ -1896,16 +1796,16 @@
                 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
                 psessionEntry->txBFIniFeatureEnabled);
 
-            if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP,
-                       psessionEntry->txBFIniFeatureEnabled) != eSIR_SUCCESS)
-            {
-                limLog(pMac, LOGP, FL("could not set  "
-                                "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
-                retCode = eSIR_LOGP_EXCEPTION;
-                goto end;
-            }
             if( psessionEntry->txBFIniFeatureEnabled )
             {
+                if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
+                                                             != eSIR_SUCCESS)
+                {
+                    limLog(pMac, LOGP, FL("could not set  "
+                                  "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
+                    retCode = eSIR_LOGP_EXCEPTION;
+                    goto end;
+                }
                 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
                     "***__limProcessSmeJoinReq: txBFCsnValue=%d****",
                     pSmeJoinReq->txBFCsnValue);
@@ -1943,7 +1843,6 @@
         /*Phy mode*/
         psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
 
-        handleHTCapabilityandHTInfo(pMac, psessionEntry);
         /* Copy The channel Id to the session Table */
         psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
         psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
@@ -2030,8 +1929,7 @@
         {
             limLog(pMac, LOGP, FL("call to AllocateMemory "
                                 "failed for mlmJoinReq"));
-            retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
-            goto end;
+            return;
         }
         (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
 
@@ -2040,11 +1938,7 @@
         
         if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
             != eSIR_SUCCESS)
-        {
-            limLog(pMac, LOGE, FL("could not retrieve JoinFailureTimer value "
-                                   "setting it to default value"));
-            pMlmJoinReq->joinFailureTimeout = JOIN_FAILURE_TIMEOUT;
-        }
+            limLog(pMac, LOGP, FL("could not retrieve JoinFailureTimer value"));
 
         /* copy operational rate from psessionEntry*/
         vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
@@ -2083,14 +1977,6 @@
 #else
             psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
 #endif
-        if (!psessionEntry->maxTxPower)
-        {
-            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("Tx power"
-                                    "is zero. Setting it to default value %d"),
-                                     TX_POWER_DEFAULT);
-            psessionEntry->maxTxPower = TX_POWER_DEFAULT;
-        }
-
         VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
                         "Regulatory max = %d, local power constraint = %d,"
                         " max tx = %d", regMax, localPowerConstraint,
@@ -2113,12 +1999,8 @@
         if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
         {
             if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
-            {
                 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
-                psessionEntry->lim11hEnable = 1;
-            }
-            else
-                psessionEntry->lim11hEnable = val;
+            psessionEntry->lim11hEnable = val;
         }
         else
             psessionEntry->lim11hEnable = 0;
@@ -2147,8 +2029,8 @@
             psessionEntry->spectrumMgtEnabled = TRUE;
         }
 
-        limLog(pMac,LOG1,FL("SessionId: %d LIM_MLM_JOIN_REQ is posted to MLM "
-                      "SM"), pMlmJoinReq->sessionId);
+        PELOG1(limLog(pMac,LOG1,FL("SessionId:%d MLM_JOIN_REQ is posted to MLM"
+                      "SM"),pMlmJoinReq->sessionId));
         /* Issue LIM_MLM_JOIN_REQ to MLM */
         limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
         return;
@@ -2245,7 +2127,7 @@
     tANI_U16            nSize;
 
 
-    limLog(pMac, LOG1, FL("Received SME_REASSOC_REQ"));
+    PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ"));)
     
     nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
     pReassocReq = vos_mem_malloc(nSize);
@@ -2281,9 +2163,8 @@
         goto end;
     }
 
-#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
-    limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry,
-            eSIR_SUCCESS, eSIR_SUCCESS);
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
+    limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
     //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
 
@@ -2362,13 +2243,6 @@
               );
 
     psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
-    if (!psessionEntry->maxTxPower)
-    {
-        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("Tx power "
-                               "is zero. Setting it to default value %d"),
-                                TX_POWER_DEFAULT);
-        psessionEntry->maxTxPower = TX_POWER_DEFAULT;
-    }
 #if defined WLAN_VOWIFI_DEBUG
             limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
                         "= %d, max tx = %d", regMax, localPowerConstraint,
@@ -2439,12 +2313,6 @@
         limLog(pMac, LOGP,
                FL("could not retrieve Capabilities value"));
     }
-
-    lim_update_caps_info_for_bss(pMac, &caps,
-                        pReassocReq->bssDescription.capabilityInfo);
-
-    limLog(pMac, LOG1, FL("Capabilities info Reassoc: 0x%X"), caps);
-
     pMlmReassocReq->capabilityInfo = caps;
     
     /* Update PE sessionId*/
@@ -2632,9 +2500,6 @@
             {
                 case eLIM_SME_ASSOCIATED_STATE:
                 case eLIM_SME_LINK_EST_STATE:
-                    limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
-                      "limSmeState: %d "),psessionEntry->limSmeState);
-
                     psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
                     psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
 #ifdef FEATURE_WLAN_TDLS
@@ -2642,6 +2507,8 @@
                     limDeleteTDLSPeers(pMac, psessionEntry);
 #endif
                     MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+                    limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
+                      "limSmeState: %d "),psessionEntry->limSmeState);
                     break;
 
                 case eLIM_SME_WT_DEAUTH_STATE:
@@ -2722,8 +2589,18 @@
             goto sendDisassoc;
     } // end switch (pMac->lim.gLimSystemRole)
 
-    disassocTrigger = eLIM_HOST_DISASSOC;
-    reasonCode      = smeDisassocReq.reasonCode;
+    if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
+    {
+        /// Disassociation is triggered by Link Monitoring
+        limLog(pMac, LOG1, FL("**** Lost link with AP ****"));
+        disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
+        reasonCode      = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
+    }
+    else
+    {
+        disassocTrigger = eLIM_HOST_DISASSOC;
+        reasonCode      = smeDisassocReq.reasonCode;
+    }
 
     if (smeDisassocReq.doNotSendOverTheAir)
     {
@@ -2731,9 +2608,7 @@
         sendDisassocFrame = 0;     
     }
     // Trigger Disassociation frame to peer MAC entity
-    limLog(pMac, LOG1, FL("Sending Disasscoc with disassoc Trigger"
-                          " : %d, reasonCode : %d"),
-                          disassocTrigger, reasonCode);
+
     pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
     if ( NULL == pMlmDisassocReq )
     {
@@ -2797,7 +2672,7 @@
     tANI_U8             sessionId;
 
 
-    limLog(pMac, LOG1, FL("received SME_DISASSOC_CNF message"));
+    PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_CNF message"));)
 
     status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
 
@@ -2869,29 +2744,6 @@
                      MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
             return;
         }
-
-       if(aid != smeDisassocCnf.assocId)
-        {
-            PELOGE(limLog(pMac, LOGE, FL("same peerMacAddr but assocId is different "
-                     "aid=%d, assocId=%d, addr= "MAC_ADDRESS_STR),
-                      aid, smeDisassocCnf.assocId, MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
-            return;
-        }
-        /*
-         * If MlM state is either of del_sta or del_bss state, then no need to
-         * go ahead and clean up further as there must be some cleanup in
-         * progress from upper layer disassoc/deauth request.
-         */
-        if((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
-           (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE))
-        {
-            limLog(pMac, LOGE, FL("No need to cleanup for addr:"MAC_ADDRESS_STR
-                   "as Mlm state is %d"),
-                   MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr),
-                   pStaDs->mlmStaContext.mlmState);
-           return;
-        }
-
         /* Delete FT session if there exists one */
         limFTCleanup(pMac);
         limCleanupRxPath(pMac, pStaDs, psessionEntry);
@@ -2950,13 +2802,17 @@
 
     if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
     {
-        PELOGE(limLog(pMac, LOGE,FL
-                   ("received invalid SME_DEAUTH_REQ message"));)
-        pMac->lim.gLimRspReqd = false;
+        PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message"));)
+        if (pMac->lim.gLimRspReqd)
+        {
+            pMac->lim.gLimRspReqd = false;
 
-        retCode       = eSIR_SME_INVALID_PARAMETERS;
-        deauthTrigger = eLIM_HOST_DEAUTH;
-        goto sendDeauth;
+            retCode       = eSIR_SME_INVALID_PARAMETERS;
+            deauthTrigger = eLIM_HOST_DEAUTH;
+            goto sendDeauth;
+        }
+
+        return;
     }
     limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
       "Systemrole %d with reasoncode %u in limSmestate %d from "
@@ -3004,15 +2860,6 @@
                     limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
                        "SME_WT_DEAUTH_STATE. "));
                     break;
-                case eLIM_SME_WT_DISASSOC_STATE:
-                     /*
-                      * PE Recieved a Disassoc frame. Normally it gets
-                      * DISASSOC_CNF but it received DEAUTH_REQ. This means
-                      * host is also trying to disconnect.
-                      */
-                      limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
-                             "SME_WT_DISASSOC_STATE. "));
-                      break;
                 default:
                     /**
                      * STA is not in a state to deauthenticate with
@@ -3052,14 +2899,7 @@
             break;
 
         case eLIM_STA_IN_IBSS_ROLE:
-            limLog(pMac, LOGE,FL("Deauth not allowed in IBSS"));
-            if (pMac->lim.gLimRspReqd)
-            {
-                   pMac->lim.gLimRspReqd = false;
-                   retCode = eSIR_SME_INVALID_PARAMETERS;
-                   deauthTrigger = eLIM_HOST_DEAUTH;
-                   goto sendDeauth;
-            }
+
             return;
 
         case eLIM_AP_ROLE:
@@ -3071,27 +2911,14 @@
             limLog(pMac, LOGE,
                FL("received unexpected SME_DEAUTH_REQ for role %d"),
                 psessionEntry->limSystemRole);
-            if (pMac->lim.gLimRspReqd)
-            {
-                   pMac->lim.gLimRspReqd = false;
 
-                   retCode = eSIR_SME_INVALID_PARAMETERS;
-                   deauthTrigger = eLIM_HOST_DEAUTH;
-                   goto sendDeauth;
-            }
             return;
-
     } // end switch (pMac->lim.gLimSystemRole)
 
     if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
     {
         /// Deauthentication is triggered by Link Monitoring
-        limLog(pMac, LOG1,
-            FL("Deauthentication is triggered by Link Monitoring"));
-        limLog(pMac, LOG1,
-            FL("Set Trigger to eLIM_LINK_MONITORING_DEAUTH"));
-        limLog(pMac, LOG1,
-            FL("and Reason to eSIR_MAC_UNSPEC_FAILURE_REASON"));
+        PELOG1(limLog(pMac, LOG1, FL("**** Lost link with AP ****"));)
         deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
         reasonCode    = eSIR_MAC_UNSPEC_FAILURE_REASON;
     }
@@ -3106,15 +2933,9 @@
     if ( NULL == pMlmDeauthReq )
     {
         // Log error
-        limLog(pMac, LOGE,
+        limLog(pMac, LOGP,
                FL("call to AllocateMemory failed for mlmDeauthReq"));
-        if (pMac->lim.gLimRspReqd)
-        {
-            pMac->lim.gLimRspReqd = false;
-            retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
-            deauthTrigger = eLIM_HOST_DEAUTH;
-            goto sendDeauth;
-        }
+
         return;
     }
 
@@ -3242,7 +3063,7 @@
             limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
             goto end;
         }
-        vos_mem_zero(pMlmSetKeysReq,sizeof(tLimMlmSetKeysReq));
+
         pMlmSetKeysReq->edType  = pSetContextReq->keyMaterial.edType;
         pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
         if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
@@ -3337,8 +3158,8 @@
     tANI_U8                 smesessionId;  
     tANI_U16                smetransactionId;
 
-    limLog(pMac, LOG1,
-           FL("received SME_REMOVEKEY_REQ message"));
+    PELOG1(limLog(pMac, LOG1,
+           FL("received REMOVEKEY_REQ message"));)
 
     if(pMsgBuf == NULL)
     {
@@ -3461,9 +3282,9 @@
         pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
     }
 
-    limLog(pMac, LOG1,
+    PELOG2(limLog(pMac, LOG2,
            FL("Sending message %s with number of channels %d"),
-           limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);
+           limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);)
 
     len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
     pSirSmeRsp = vos_mem_malloc(len);
@@ -3502,14 +3323,14 @@
     mmhMsg.bodyval = 0;
   
     pMac->lim.gLimRspReqd = false;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 }
 
 
 void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
-    tSirSmeGetAssocSTAsReq  getAssocSTAsReq = {0};
+    tSirSmeGetAssocSTAsReq  getAssocSTAsReq;
     tpDphHashNode           pStaDs = NULL;
     tpPESession             psessionEntry = NULL;
     tSap_Event              sapEvent;
@@ -3567,7 +3388,7 @@
     {
         pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
 
-        if ((NULL == pStaDs) || (NULL == pAssocStasTemp))
+        if (NULL == pStaDs)
             continue;
 
         if (pStaDs->valid)
@@ -3688,9 +3509,7 @@
   
 limGetWPSPBCSessionsEnd:
     pSapEventCallback   = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
-
-    if (NULL != pSapEventCallback)
-      pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
+    pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
 }
 
 
@@ -3979,10 +3798,9 @@
     
     if (pStaDs == NULL)
     {        
-        limLog(pMac, LOGE,
-            FL("Received invalid message %X due to no STA context, "
-               "for aid %d, peer "),
-               msgType, assocCnf.aid);
+        limLog(pMac, LOG1,
+            FL("Received invalid message %X due to no STA context, for aid %d, peer "),
+            msgType, assocCnf.aid);
         limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);     
 
         /*
@@ -4003,11 +3821,9 @@
           ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
            (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
     {
-        limLog(pMac, LOGE,
-           FL("Received invalid message %X due to peerMacAddr mismatched "
-              "or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "
-              "StaD mlmState : %d"),
-               msgType, assocCnf.aid, pStaDs->mlmStaContext.mlmState);
+        limLog(pMac, LOG1,
+           FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
+           msgType, assocCnf.aid);
         limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
         goto end;
     }
@@ -4037,8 +3853,6 @@
         /*Since the HAL sta entry is created for denied STA we need to remove this HAL entry.So to do that set updateContext to 1*/
         if(!pStaDs->mlmStaContext.updateContext)
            pStaDs->mlmStaContext.updateContext = 1;
-        limLog(pMac, LOG1, FL("Receive Assoc Cnf with status Code : %d(assoc id=%d) "),
-                           assocCnf.statusCode, pStaDs->assocId);
         limRejectAssociation(pMac, pStaDs->staAddr,
                              pStaDs->mlmStaContext.subType,
                              true, pStaDs->mlmStaContext.authType,
@@ -4108,10 +3922,10 @@
      *  - wait for addts response from ap
      * if ap, just ignore with error log
      */
-    limLog(pMac, LOG1,
+    PELOG1(limLog(pMac, LOG1,
            FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
            pSirAddts->req.tspec.tsinfo.traffic.tsid,
-           pSirAddts->req.tspec.tsinfo.traffic.userPrio);
+           pSirAddts->req.tspec.tsinfo.traffic.userPrio);)
 
     if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
     {
@@ -4121,6 +3935,16 @@
         return;
     }
 
+    //Ignore the request if STA is in 11B mode.
+    if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
+    {
+        PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
+        limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec, 
+                smesessionId,smetransactionId);
+        return;
+    }
+
+
     pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
 
     if(pStaDs == NULL)
@@ -4198,7 +4022,7 @@
     // ship out the message now
     limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
             psessionEntry);
-    limLog(pMac, LOG1, FL("Sent ADDTS request"));
+    PELOG1(limLog(pMac, LOG1, "Sent ADDTS request");)
 
     // start a timer to wait for the response
     if (pSirAddts->timeout) 
@@ -4271,9 +4095,9 @@
         return;
     }
 
-    limLog(pMac, LOG1, FL("Sent DELTS request to station with "
-                  "assocId = %d MacAddr = "MAC_ADDRESS_STR),
-                  pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
+    PELOG1(limLog(pMac, LOG1, FL("Sent DELTS request to station with "
+           "assocId = %d MacAddr = "MAC_ADDRESS_STR),
+           pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
 
     limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
               psessionEntry);
@@ -4624,8 +4448,8 @@
     tpSirUpdateParams       pUpdateParams;
     tpPESession             psessionEntry;
 
-    limLog(pMac, LOG1,
-           FL("received SME_HIDE_SSID message"));
+    PELOG1(limLog(pMac, LOG1,
+           FL("received HIDE_SSID message")););
     
     if(pMsgBuf == NULL)
     {
@@ -4758,118 +4582,7 @@
     return;
 } /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
 
-/** -------------------------------------------------------------
-\fn
-\brief handles indication message from HDD to update HT mode
-\param   tpAniSirGlobal pMac
-\param   tANI_U32 pMsgBuf
-\return None
--------------------------------------------------------------*/
-#ifdef WLAN_FEATURE_AP_HT40_24G
-static void __limProcessSmeSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
-{
-    tpSirSetHT2040Mode     pSetHT2040Mode;
-    tpPESession            psessionEntry;
-    tANI_U8                sessionId = 0;
-    tUpdateVHTOpMode       *pHtOpMode = NULL;
-    vos_msg_t              msg;
 
-    PELOG1(limLog(pMac, LOGRW,
-           FL("received Set HT 20/40 mode message")););
-
-    if(pMsgBuf == NULL)
-    {
-        limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
-        return;
-    }
-
-    pSetHT2040Mode = (tpSirSetHT2040Mode)pMsgBuf;
-
-    if((psessionEntry = peFindSessionByBssid(pMac, pSetHT2040Mode->bssId,
-                                                   &sessionId)) == NULL)
-    {
-        limLog(pMac, LOGE, FL("Session does not exist for given BSSID "));
-        limPrintMacAddr(pMac, pSetHT2040Mode->bssId, LOGE);
-        return;
-    }
-
-    limLog(pMac, LOGW, FL("Update session entry for cbMod=%d"),
-                           pSetHT2040Mode->cbMode);
-
-    /*Update sessionEntry HT related fields*/
-    switch(pSetHT2040Mode->cbMode)
-    {
-    case PHY_SINGLE_CHANNEL_CENTERED:
-        psessionEntry->htSecondaryChannelOffset = PHY_SINGLE_CHANNEL_CENTERED;
-        psessionEntry->htRecommendedTxWidthSet = 0;
-        break;
-    case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
-        psessionEntry->htSecondaryChannelOffset =
-                                         PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
-        psessionEntry->htRecommendedTxWidthSet = 1;
-        break;
-    case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
-        psessionEntry->htSecondaryChannelOffset =
-                                         PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
-        psessionEntry->htRecommendedTxWidthSet = 1;
-        break;
-    default:
-        limLog(pMac, LOGE,FL("Invalid cbMode"));
-        return;
-    }
-
-    limLog(pMac, LOGW, FL("Channel Bonding mode : %d"
-                          " htSecondaryChannelOffset: %d"
-                          " htRecommendedTxWidthSet :%d"),
-                          pSetHT2040Mode->cbMode,
-                          psessionEntry->htSecondaryChannelOffset,
-                          psessionEntry->htRecommendedTxWidthSet);
-
-    limLog(pMac, LOGW, FL("Update Beacon IEs"));
-
-    /* Update beacon */
-    schSetFixedBeaconFields(pMac, psessionEntry);
-    limSendBeaconInd(pMac, psessionEntry);
-
-    /* Update OP Mode */
-    pHtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode));
-    if ( NULL == pHtOpMode )
-    {
-        limLog(pMac, LOGE,
-           FL("Not able to allocate memory for setting OP mode"));
-        return;
-    }
-
-    pHtOpMode->opMode = (psessionEntry->htSecondaryChannelOffset ==
-                      PHY_SINGLE_CHANNEL_CENTERED)?
-                      eHT_CHANNEL_WIDTH_20MHZ:eHT_CHANNEL_WIDTH_40MHZ;
-
-    /* Pass Self STA ID to FW. Based on Self STA ID FW will update the
-     * operating mode for all connected STA.
-     */
-
-    pHtOpMode->staId = psessionEntry->staId;
-
-    msg.type     = WDA_UPDATE_OP_MODE;
-    msg.reserved = 0;
-    msg.bodyptr  = pHtOpMode;
-
-    if (!VOS_IS_STATUS_SUCCESS(
-             vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
-    {
-        limLog(pMac, LOGE,
-               FL("Not able to post WDA_UPDATE_OP_MODE message to WDA"));
-        vos_mem_free(pHtOpMode);
-        return;
-    }
-
-    limLog(pMac, LOGW,
-           FL("Notifed FW about OP mode: %d for staId=%d"),
-           pHtOpMode->opMode, pHtOpMode->staId);
-
-    return;
-}
-#endif
 
 /** -------------------------------------------------------------
 \fn limProcessSmeDelBaPeerInd
@@ -4944,7 +4657,6 @@
          tpSirBeaconReportXmitInd pBcnReport=NULL;
          tpPESession psessionEntry=NULL;
          tANI_U8 sessionId;
-         tpEsePEContext pEseContext = NULL;
 
          if(pMsg->bodyptr == NULL)
          {
@@ -4957,10 +4669,7 @@
             limLog(pMac, LOGE, "Session Does not exist for given bssId");
             return;
          }
-
-         pEseContext = &psessionEntry->eseContext;
-
-         if (psessionEntry->isESEconnection && pEseContext->curMeasReq.isValid)
+         if (psessionEntry->isESEconnection)
              eseProcessBeaconReportXmit( pMac, pMsg->bodyptr);
          else
 #endif
@@ -5009,12 +4718,11 @@
 
    }
 #if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE)
-  limLog( pMac, LOG1,
-       FL(" Allocated memory for pMaxTxParams, which will be freed in other module"));
+   PELOG1(limLog( pMac, LOG1, "%s:%d: Allocated memory for pMaxTxParams...will be freed in other module", __func__, __LINE__ );)
 #endif
    if( pMaxTxParams == NULL )
    {
-      limLog( pMac, LOGE, FL("pMaxTxParams is NULL"));
+      limLog( pMac, LOGE, "%s:%d: pMaxTxParams is NULL", __func__, __LINE__);
       return eSIR_FAILURE;
    }
    pMaxTxParams->power = txPower;
@@ -5024,7 +4732,7 @@
    msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
    msgQ.bodyptr = pMaxTxParams;
    msgQ.bodyval = 0;
-   limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));
+   PELOG1(limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));)
    MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
    retCode = wdaPostCtrlMsg(pMac, &msgQ);
    if (eSIR_SUCCESS != retCode)
@@ -5125,7 +4833,7 @@
    msg.bodyptr =  pDelStaSelfParams;
    msg.bodyval = 0;
 
-   PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_DEL_STA_SELF_REQ msg to HAL"));)
+   PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
       MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
 
    if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
@@ -5160,9 +4868,9 @@
     tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
     tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
     tANI_BOOLEAN match = VOS_FALSE;
-    limLog(pMac, LOG1,
+    PELOG1(limLog(pMac, LOG1, 
            FL("registerFrame %d, frameType %d, matchLen %d"),
-            pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);
+            pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
 
     /* First check whether entry exists already*/
 
@@ -5438,6 +5146,305 @@
     }
 }
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/*
+ * Process Discovery request recieved from SME and transmit to AP.
+ */
+static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac, 
+                                                           tANI_U32 *pMsgBuf)
+{
+    /* get all discovery request parameters */
+    tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
+    tpPESession psessionEntry;
+    tANI_U8      sessionId;
+
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+                                  ("Discovery Req Recieved")) ;
+
+    if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId)) 
+                                                                        == NULL)
+    {
+         VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                    "PE Session does not exist for given sme sessionId %d",
+                                                            disReq->sessionId);
+         goto lim_tdls_dis_start_error;
+    }
+    
+    /* check if we are in proper state to work as TDLS client */ 
+    if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                         "dis req received in wrong system Role %d",
+                                             psessionEntry->limSystemRole);
+        goto lim_tdls_dis_start_error;
+    }
+
+    /*
+     * if we are still good, go ahead and check if we are in proper state to
+     * do TDLS discovery procedure.
+     */
+     if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
+                (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
+     {
+     
+         limLog(pMac, LOGE, "dis req received in invalid LIMsme \
+                               state (%d)", psessionEntry->limSmeState);
+         goto lim_tdls_dis_start_error;
+     }
+    
+    /*
+     * if we are still good, go ahead and transmit TDLS discovery request,
+     * and save Dis Req info for future reference.
+     */
+
+#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet 
+    /* 
+     * send message to HAL to set RXP filters to receieve frame on 
+     * direct link..
+     */
+     //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE, 
+     //                                    psessionEntry->bssId) ;
+#endif
+
+     /* save dis request message for matching dialog token */
+     vos_mem_copy((tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
+                  (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
+
+     VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+                             "Transmit Discovery Request Frame") ;
+     /* format TDLS discovery request frame and transmit it */
+     limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog, 
+                                                       psessionEntry) ;
+
+     /* prepare for response */
+     pMac->lim.gLimTdlsDisStaCount = 0 ;
+     pMac->lim.gLimTdlsDisResultList = NULL ;
+
+    /*
+     * start TDLS discovery request timer to wait for discovery responses
+     * from all TDLS enabled clients in BSS.
+     */
+
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+                                ("Start Discovery request Timeout Timer")) ;
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, 
+                                             eLIM_TDLS_DISCOVERY_RSP_WAIT));
+
+    /* assign appropriate sessionId to the timer object */
+    pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId = 
+                                            psessionEntry->peSessionId;
+
+    if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
+                                                               != TX_SUCCESS)
+    {
+        limLog(pMac, LOGP, FL("TDLS discovery response timer \
+                                                  activation failed!"));
+        goto lim_tdls_dis_start_error;
+    }
+    /* 
+     * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent 
+     *  back to SME 
+     */
+    return (eSIR_SUCCESS) ; 
+lim_tdls_dis_start_error:
+   /* in error case, PE has to sent the response SME immediately with error code */
+   limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE, 
+                                     eWNI_SME_TDLS_DISCOVERY_START_RSP);
+   return eSIR_FAILURE;
+}
+/*
+ * Process link start request recieved from SME and transmit to AP.
+ */
+eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+    /* get all discovery request parameters */
+    tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
+    tLimTdlsLinkSetupInfo *linkSetupInfo; 
+    //tLimTdlsLinkSetupPeer *setupPeer;
+    tpPESession psessionEntry;
+    tANI_U8      sessionId;
+    eHalStatus   status;
+    
+    if((psessionEntry = peFindSessionByBssid(pMac, 
+                                    setupReq->bssid, &sessionId)) == NULL)
+    {
+         VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                     "PE Session does not exist for given sme sessionId %d",
+                                                          setupReq->sessionId);
+         goto lim_tdls_link_start_error;
+    }
+    
+    /* check if we are in proper state to work as TDLS client */ 
+    if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                      "TDLS link setup req received in wrong system Role %d",
+                                                psessionEntry->limSystemRole);
+        goto lim_tdls_link_start_error;
+    }
+
+    /*
+     * if we are still good, go ahead and check if we are in proper state to
+     * do TDLS setup procedure.
+     */
+    if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
+            (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
+    {
+        limLog(pMac, LOGE, "Setup request in invalid LIMsme \
+                              state (%d)", pMac->lim.gLimSmeState);
+        goto lim_tdls_link_start_error;
+    }
+    
+    /*
+     * Now, go ahead and transmit TDLS discovery request, and save setup Req 
+     * info for future reference.
+     */
+     /* create node for Link setup */
+    linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
+    //setupPeer = NULL ;
+   
+    status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog, 
+                                          setupReq->peerMac, psessionEntry) ; 
+    if(eHAL_STATUS_SUCCESS == status)
+    /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when 
+    TDLS setup cnf TX complete is successful. */
+        return eSIR_SUCCESS;
+#if 0
+
+    /*
+    * we allocate the TDLS setup Peer Memory here, we will free'd this
+    * memory after teardown, if the link is successfully setup or
+    * free this memory if any timeout is happen in link setup procedure
+    */
+    setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
+    if ( NULL == setupPeer )
+    {
+     limLog( pMac, LOGP, 
+                  FL( "Unable to allocate memory during ADD_STA" ));
+     VOS_ASSERT(0) ;
+     return eSIR_MEM_ALLOC_FAILED;
+    }
+    setupPeer->dialog = setupReq->dialog ;
+    setupPeer->tdls_prev_link_state =  setupPeer->tdls_link_state ;
+    setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
+    /* TDLS_sessionize: remember sessionId for future */
+    setupPeer->tdls_sessionId = psessionEntry->peSessionId;
+    setupPeer->tdls_bIsResponder = 1;
+
+    /* 
+    * we only populate peer MAC, so it can assit us to find the
+    * TDLS peer after response/or after response timeout
+    */
+    vos_mem_copy(setupPeer->peerMac, setupReq->peerMac,
+                                              sizeof(tSirMacAddr)) ;
+    /* format TDLS discovery request frame and transmit it */
+    limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac, 
+                                       setupReq->dialog, psessionEntry, NULL, 0) ;
+
+    limStartTdlsTimer(pMac, psessionEntry->peSessionId, 
+                        &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
+     (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
+                            SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
+    /* update setup peer list */
+    setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
+    linkSetupInfo->tdlsLinkSetupList = setupPeer ;
+    /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when 
+    TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
+    return eSIR_SUCCESS ; 
+#endif
+lim_tdls_link_start_error:    
+    /* in case of error, return immediately to SME */
+    limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac, 
+                                         eWNI_SME_TDLS_LINK_START_RSP);
+    return eSIR_FAILURE ;
+}
+
+/*
+ * Process link teardown request recieved from SME and transmit to AP.
+ */
+eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+    /* get all discovery request parameters */
+    tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
+    tLimTdlsLinkSetupPeer *setupPeer;
+    tpPESession psessionEntry;
+    tANI_U8      sessionId;
+    
+    if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
+    {
+         VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                        "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
+         goto lim_tdls_teardown_req_error;
+    }
+    
+    /* check if we are in proper state to work as TDLS client */ 
+    if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                          "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
+        goto lim_tdls_teardown_req_error;
+    }
+
+    /*
+     * if we are still good, go ahead and check if we are in proper state to
+     * do TDLS setup procedure.
+     */
+    if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
+            (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
+    {
+        limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
+                               state (%d)", psessionEntry->limSmeState);
+        goto lim_tdls_teardown_req_error;
+    }
+    
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+            "Teardown for peer = " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(teardownReq->peerMac));
+    /*
+     * Now, go ahead and transmit TDLS teardown request, and save teardown info
+     * info for future reference.
+     */
+     /* Verify if this link is setup */
+    setupPeer = NULL ;
+    limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
+    if(NULL == setupPeer)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+                                ("invalid Peer on teardown ")) ;
+        goto lim_tdls_teardown_req_error;
+    }
+
+
+    (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
+    (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
+    /* TDLS_sessionize: check sessionId in case */
+    if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId) 
+    {
+        limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
+            (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
+        (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
+    }
+    
+    /* format TDLS teardown request frame and transmit it */
+    if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac, 
+                                eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+                                ("couldn't send teardown frame ")) ;
+        goto lim_tdls_teardown_req_error;
+    }
+    /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when 
+    TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
+    return eSIR_SUCCESS;
+lim_tdls_teardown_req_error:    
+    /* in case of error, return immediately to SME */
+    limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac, 
+                                     eWNI_SME_TDLS_TEARDOWN_RSP);
+    return eSIR_FAILURE;
+}
+
+
+#endif
+
 static void
 __limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
@@ -5472,17 +5479,12 @@
    pSpoofMacAddrParams = vos_mem_malloc(sizeof( tSpoofMacAddrReqParams));
    if ( NULL == pSpoofMacAddrParams )
    {
-      limLog( pMac, LOGE, FL("Unable to allocate memory for tDelStaSelfParams") );
+      limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
       return;
    }
 
    vos_mem_copy( pSpoofMacAddrParams->macAddr, pSmeReq->macAddr, sizeof(tSirMacAddr) );
 
-   vos_mem_copy(pMac->lim.spoofMacAddr, pSmeReq->macAddr, VOS_MAC_ADDRESS_LEN);
-
-   limLog( pMac, LOG1, FL("Recieved Spoofed Mac Addr request with Addr:"
-                MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pMac->lim.spoofMacAddr) );
-
    msg.type = WDA_SPOOF_MAC_ADDR_REQ;
    msg.reserved = 0;
    msg.bodyptr =  pSpoofMacAddrParams;
@@ -5493,42 +5495,13 @@
 
    if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
    {
-      limLog(pMac, LOGE, FL("wdaPostCtrlMsg failed for SIR_HAL_SPOOF_MAC_ADDR_REQ"));
+      limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed for SIR_HAL_SPOOF_MAC_ADDR_REQ"));
       vos_mem_free(pSpoofMacAddrParams);
    }
    return;
 }
 
 /**
- * lim_register_mgmt_frame_ind_cb() - Save the Management frame
- * indication callback in PE.
- * @pMac: Mac pointer
- * @pMsgBuf: Msg pointer containing the callback
- *
- * This function is used save the Management frame
- * indication callback in PE.
- *
- * Return: None
- */
-static void lim_register_mgmt_frame_ind_cb(tpAniSirGlobal pMac,
-                                                 tANI_U32 *msg_buf)
-{
-  struct sir_sme_mgmt_frame_cb_req *sme_req =
-             (struct sir_sme_mgmt_frame_cb_req *)msg_buf;
-
-  if (NULL == msg_buf)
-  {
-      limLog(pMac, LOGE, FL("msg_buf is null"));
-      return;
-  }
-  if (sme_req->callback)
-      pMac->mgmt_frame_ind_cb =
-             (sir_mgmt_frame_ind_callback)sme_req->callback;
-  else
-      limLog(pMac, LOGE, FL("sme_req->callback is null"));
-}
-
-/**
  * limProcessSmeReqMessages()
  *
  *FUNCTION:
@@ -5712,24 +5685,24 @@
         case eWNI_SME_ASSOC_CNF:
         case eWNI_SME_REASSOC_CNF:
             if (pMsg->type == eWNI_SME_ASSOC_CNF)
-                limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));
+                PELOG1(limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));)
             else
-                limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));
+                PELOG1(limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));)
             __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
             break;
 
         case eWNI_SME_ADDTS_REQ:
-            limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));
+            PELOG1(limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));)
             __limProcessSmeAddtsReq(pMac, pMsgBuf);
             break;
 
         case eWNI_SME_DELTS_REQ:
-            limLog(pMac, LOG1, FL("Received DELTS_REQ message"));
+            PELOG1(limLog(pMac, LOG1, FL("Received DELTS_REQ message"));)
             __limProcessSmeDeltsReq(pMac, pMsgBuf);
             break;
 
         case SIR_LIM_ADDTS_RSP_TIMEOUT:
-            limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));
+            PELOG1(limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));)
             limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
             break;
 
@@ -5790,12 +5763,6 @@
              //Update the beaconInterval
              __limProcessSmeChangeBI(pMac, pMsgBuf );
              break;
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        case eWNI_SME_SET_HT_2040_MODE:
-             __limProcessSmeSetHT2040Mode(pMac, pMsgBuf);
-             break;
-#endif
             
 #if defined WLAN_FEATURE_VOWIFI 
         case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
@@ -5850,6 +5817,17 @@
             limProcesSmeTdlsChanSwitchReq(pMac, pMsgBuf);
             break;
 #endif
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+        case eWNI_SME_TDLS_DISCOVERY_START_REQ:
+            limProcessSmeDisStartReq(pMac,  pMsgBuf);
+            break ;
+        case eWNI_SME_TDLS_LINK_START_REQ:
+            limProcessSmeLinkStartReq(pMac,  pMsgBuf);
+            break ;
+        case eWNI_SME_TDLS_TEARDOWN_REQ:
+            limProcessSmeTeardownReq(pMac,  pMsgBuf);
+            break ;
+#endif
         case eWNI_SME_RESET_AP_CAPS_CHANGED:
             __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
             break;
@@ -5858,22 +5836,10 @@
             limSendSetTxPowerReq(pMac,  pMsgBuf);
             break ;
 
-#ifdef WLAN_FEATURE_RMC
-        case eWNI_SME_ENABLE_RMC_REQ:
-            limProcessRMCMessages(pMac, eLIM_RMC_ENABLE_REQ, pMsgBuf);
-            break ;
-
-        case eWNI_SME_DISABLE_RMC_REQ:
-            limProcessRMCMessages(pMac, eLIM_RMC_DISABLE_REQ, pMsgBuf);
-            break ;
-#endif /* WLAN_FEATURE_RMC */
-
         case eWNI_SME_MAC_SPOOF_ADDR_IND:
             __limProcessSmeSpoofMacAddrRequest(pMac,  pMsgBuf);
             break ;
-        case eWNI_SME_REGISTER_MGMT_FRAME_CB:
-            lim_register_mgmt_frame_ind_cb(pMac, pMsgBuf);
-            break;
+
         default:
             vos_mem_free((v_VOID_t*)pMsg->bodyptr);
             pMsg->bodyptr = NULL;
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limProcessTdls.c b/wlan/prima/CORE/MAC/src/pe/lim/limProcessTdls.c
index c254dab..7f5e6a3 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limProcessTdls.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limProcessTdls.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -92,7 +92,32 @@
 #define MIN_IEEE_8023_SIZE              46
 #define MIN_VENDOR_SPECIFIC_IE_SIZE     5
 #endif
+#ifdef WLAN_FEATURE_TDLS_DEBUG
+#define TDLS_DEBUG_LOG_LEVEL VOS_TRACE_LEVEL_ERROR
+#else
+#define TDLS_DEBUG_LOG_LEVEL VOS_TRACE_LEVEL_INFO
+#endif
 
+
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/* forword declarations */
+static tSirRetStatus limTdlsDisAddSta(tpAniSirGlobal pMac, tSirMacAddr peerMac,
+                   tSirTdlsPeerInfo *peerInfo, tpPESession psessionEntry) ;
+static eHalStatus limSendSmeTdlsLinkSetupInd(tpAniSirGlobal pMac, 
+                                   tSirMacAddr peerMac, tANI_U8 status);
+static eHalStatus limSendSmeTdlsDelPeerInd(tpAniSirGlobal pMac, 
+                 tANI_U8 sessionId, tDphHashNode   *pStaDs, tANI_U8 status) ;
+static tSirTdlsPeerInfo *limTdlsFindDisPeerByState(tpAniSirGlobal pMac, 
+                                                            tANI_U8 state);
+static tANI_U8 limTdlsFindSetupPeerByState(tpAniSirGlobal pMac, tANI_U8 state, 
+                                     tLimTdlsLinkSetupPeer **setupPeer) ;
+static tSirRetStatus limTdlsLinkEstablish(tpAniSirGlobal pMac, tSirMacAddr peer_mac);
+
+static tSirRetStatus limTdlsLinkTeardown(tpAniSirGlobal pMac, tSirMacAddr peer_mac);
+static tpDphHashNode limTdlsDelSta(tpAniSirGlobal pMac, tSirMacAddr peerMac, 
+                                                 tpPESession psessionEntry) ;
+
+#endif
 static tSirRetStatus limTdlsSetupAddSta(tpAniSirGlobal pMac,
                                         tSirTdlsAddStaReq *pAddStaReq,
                                         tpPESession psessionEntry) ;
@@ -134,9 +159,6 @@
     {125, 20, BW20,      {149, 153, 157, 161, 165, 169}},
     {126, 40, BW40PLUS,  {149, 157}},
     {127, 40, BW40MINUS, {153, 161}},
-    {128, 80, BW80,      {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112,
-                          116, 120, 124, 128, 132, 136, 140, 144,
-                          149, 153, 157, 161}},
     {0, 0, 0, {0}},
 
 };/*end global_op_class*/
@@ -144,22 +166,18 @@
 op_class_map_t us_op_class[] = {
     {1, 20,  BW20,       {36, 40, 44, 48}},
     {2, 20,  BW20,       {52, 56, 60, 64}},
-    {4, 20,  BW20,   {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144}},
+    {4, 20,  BW20,   {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}},
     {5, 20,  BW20,       {149, 153, 157, 161, 165}},
-    {12, 25, BW20,      {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}},
     {22, 40, BW40PLUS,  {36, 44}},
     {23, 40, BW40PLUS,  {52, 60}},
-    {24, 40, BW40PLUS,  {100, 108, 116, 124, 132, 140}},
+    {24, 40, BW40PLUS,  {100, 108, 116, 124, 132}},
     {26, 40, BW40PLUS,  {149, 157}},
     {27, 40, BW40MINUS, {40, 48}},
     {28, 40, BW40MINUS, {56, 64}},
-    {29, 40, BW40MINUS, {104, 112, 120, 128, 136, 144}},
+    {29, 40, BW40MINUS, {104, 112, 120, 128, 136}},
     {31, 40, BW40MINUS, {153, 161}},
     {32, 40, BW40PLUS,  {1, 2, 3, 4, 5, 6, 7}},
     {33, 40, BW40MINUS, {5, 6, 7, 8, 9, 10, 11}},
-    {128, 80, BW80,     {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112,
-                         116, 120, 124, 128, 132, 136, 140, 144,
-                         149, 153, 157, 161}},
     {0, 0, 0, {0}},
 };/*end us_op_class*/
 
@@ -177,8 +195,6 @@
     {11, 40, BW40PLUS,  {1, 2, 3, 4, 5, 6, 7, 8, 9}},
     {12, 40, BW40MINUS, {5, 6, 7, 8, 9, 10, 11, 12, 13}},
     {17, 20, BW20,      {149, 153, 157, 161, 165, 169}},
-    {128, 80, BW80,     {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112,
-                         116, 120, 124, 128}},
     {0, 0, 0, {0}},
 };/*end euro_op_class*/
 
@@ -194,8 +210,6 @@
     {41, 40, BW40MINUS, {40, 48}},
     {42, 40, BW40MINUS, {56, 64}},
     {44, 40, BW40MINUS, {104, 112, 120, 128, 136}},
-    {128, 80, BW80,     {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112,
-                         116, 120, 124, 128}},
     {0, 0, 0, {0}},
 };/*end japan_op_class*/
 
@@ -209,12 +223,6 @@
     0x00, 0x00, 0x89, 0x0d,
 } ;
 
-/* store tdls self supported channels
- * which are non passive */
-#define LIM_TDLS_MAX_NON_DFS_CHANNELS 50
-static tANI_U8 tdlsSelfNumChans = 0;
-static tANI_U8 tdlsSelfSupportedChannels[LIM_TDLS_MAX_NON_DFS_CHANNELS] = {0};
-
 /*
  * type of links used in TDLS 
  */
@@ -346,6 +354,19 @@
  */
 void limInitTdlsData(tpAniSirGlobal pMac, tpPESession pSessionEntry)
 {
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+    pMac->lim.gLimTdlsDisResultList = NULL ;
+    pMac->lim.gLimTdlsDisStaCount = 0 ;
+    vos_mem_set(&pMac->lim.gLimTdlsDisReq, sizeof(tSirTdlsDisReq), 0);
+    vos_mem_set(&pMac->lim.gLimTdlsLinkSetupInfo, sizeof(tLimTdlsLinkSetupInfo), 0);
+    pMac->lim.gAddStaDisRspWait = 0 ;
+
+#ifdef FEATURE_WLAN_TDLS_NEGATIVE
+    /* when reassociated, negative behavior will not be kept */
+    /* you have to explicitly enable negative behavior per (re)association */
+    pMac->lim.gLimTdlsNegativeBehavior = 0;
+#endif
+#endif
     limInitPeerIdxpool(pMac, pSessionEntry) ;
 
     return ;
@@ -434,16 +455,13 @@
     tANI_U32 header_offset = 0 ;
     tANI_U8 *addr1 = NULL ;
     tANI_U8 *addr3 = NULL ;
-    tpDphHashNode pStaDs = NULL;
-    tANI_U16      aid = 0;
-    tANI_U8       qosMode = 0;
-
     tANI_U8 toDs = (tdlsLinkType == TDLS_LINK_AP) 
                                        ? ANI_TXDIR_TODS :ANI_TXDIR_IBSS  ;
     tANI_U8 *peerMac = (reqType == TDLS_INITIATOR) 
                                        ? link_iden->RespStaAddr : link_iden->InitStaAddr; 
     tANI_U8 *staMac = (reqType == TDLS_INITIATOR) 
                                        ? link_iden->InitStaAddr : link_iden->RespStaAddr; 
+   
     pMacHdr = (tpSirMacDataHdr3a) (pFrame);
 
     /* 
@@ -460,18 +478,7 @@
      */ 
     pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION;
     pMacHdr->fc.type    = SIR_MAC_DATA_FRAME ;
-
-    pStaDs = dphLookupHashEntry(pMac, peerMac, &aid,
-                                     &psessionEntry->dph.dphHashTable);
-    if (pStaDs)
-    {
-        qosMode = pStaDs->qosMode;
-    }
-
-    pMacHdr->fc.subType = ((IS_QOS_ENABLED(psessionEntry) &&
-                           (tdlsLinkType == TDLS_LINK_AP)) ||
-                           ((tdlsLinkType == TDLS_LINK_DIRECT) && qosMode))
-                           ? SIR_MAC_DATA_QOS_DATA : SIR_MAC_DATA_DATA;
+    pMacHdr->fc.subType = IS_QOS_ENABLED(psessionEntry) ? SIR_MAC_DATA_QOS_DATA : SIR_MAC_DATA_DATA;
 
     /*
      * TL is not setting up below fields, so we are doing it here
@@ -492,19 +499,17 @@
                   (tANI_U8 *) (addr3),
                   sizeof( tSirMacAddr ));
 
-    limLog(pMac, LOG1,
-           FL("Preparing TDLS frame header to %s A1:"MAC_ADDRESS_STR", A2:"MAC_ADDRESS_STR", A3:"MAC_ADDRESS_STR),
-           (tdlsLinkType == TDLS_LINK_AP) ? "AP" : "DIRECT",
-           MAC_ADDR_ARRAY(pMacHdr->addr1),
-           MAC_ADDR_ARRAY(pMacHdr->addr2),
-           MAC_ADDR_ARRAY(pMacHdr->addr3));
+    LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN, ("Preparing TDLS frame header to %s\n%02x:%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x:%02x"),
+       (tdlsLinkType == TDLS_LINK_AP) ? "AP" : "TD",
+        pMacHdr->addr1[0], pMacHdr->addr1[1], pMacHdr->addr1[2], pMacHdr->addr1[3], pMacHdr->addr1[4], pMacHdr->addr1[5],
+        pMacHdr->addr2[0], pMacHdr->addr2[1], pMacHdr->addr2[2], pMacHdr->addr2[3], pMacHdr->addr2[4], pMacHdr->addr2[5],
+        pMacHdr->addr3[0], pMacHdr->addr3[1], pMacHdr->addr3[2], pMacHdr->addr3[3], pMacHdr->addr3[4], pMacHdr->addr3[5]));
 
     //printMacAddr(pMacHdr->bssId) ;
     //printMacAddr(pMacHdr->sa) ;
     //printMacAddr(pMacHdr->da) ;
 
-    if (((tdlsLinkType == TDLS_LINK_AP) && (IS_QOS_ENABLED(psessionEntry))) ||
-        ((tdlsLinkType == TDLS_LINK_DIRECT) && qosMode))
+    if (IS_QOS_ENABLED(psessionEntry))
     {
         pMacHdr->qosControl.tid = tid;
         header_offset += sizeof(tSirMacDataHdr3a);
@@ -530,34 +535,20 @@
  * TX Complete for Management frames
  */
  eHalStatus limMgmtTXComplete(tpAniSirGlobal pMac,
-                                   void *pData)
+                                   tANI_U32 txCompleteSuccess)
 {
-    tANI_U32 txCompleteSuccess = 0;
-    tpSirTxBdStatus pTxBdStatus = NULL;
-
-    if (!pData)
-    {
-        limLog(pMac, LOGE, FL("pData is NULL"));
-        return eHAL_STATUS_SUCCESS;
-    }
-
-    if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
-    {
-        pTxBdStatus = (tpSirTxBdStatus) pData;
-        txCompleteSuccess = pTxBdStatus->txCompleteStatus;
-        limLog(pMac, LOG1, FL("txCompleteSuccess %u, token %u"),
-                txCompleteSuccess, pTxBdStatus->txBdToken);
-    }
-    else
-    {
-        txCompleteSuccess = *((tANI_U32*) pData);
-        limLog(pMac, LOG1, FL("txCompleteSuccess %u"), txCompleteSuccess);
-    }
+    tpPESession psessionEntry = NULL ;
 
     if (0xff != pMac->lim.mgmtFrameSessionId)
     {
-        limSendSmeMgmtTXCompletion(pMac, pMac->lim.mgmtFrameSessionId,
-                                   txCompleteSuccess);
+        psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.mgmtFrameSessionId);
+        if (NULL == psessionEntry)
+        {
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                      ("%s: sessionID %d is not found"), __func__, pMac->lim.mgmtFrameSessionId);
+            return eHAL_STATUS_FAILURE;
+        }
+        limSendSmeMgmtTXCompletion(pMac, psessionEntry, txCompleteSuccess);
         pMac->lim.mgmtFrameSessionId = 0xff;
     }
     return eHAL_STATUS_SUCCESS;
@@ -610,17 +601,16 @@
     status = dot11fGetPackedTDLSDisReqSize( pMac, &tdlsDisReq, &nPayload);
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to calculate the packed size for a discovery Request (0x%08x)."),
-               status);
+        limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+                               "or a discovery Request (0x%08x)."), status );
         /* We'll fall back on the worst case scenario: */
         nPayload = sizeof( tDot11fTDLSDisReq );
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog(pMac, LOGW,
-               FL("There were warnings while calculating the packed size for a discovery Request (0x%08x)."),
-               status);
+        limLog( pMac, LOGW, FL("There were warnings while calculating "
+                               "the packed size for a discovery Request ("
+                               "0x%08x)."), status );
     }
 
     /*
@@ -659,9 +649,8 @@
                              ( void** ) &pPacket );
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to allocate %d bytes for a TDLS Discovery Request."),
-               nBytes);
+        limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TDLS"
+                               "Discovery Request."), nBytes );
         return eSIR_MEM_ALLOC_FAILED;
     }
 
@@ -693,16 +682,16 @@
 
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE, FL("Failed to pack a TDLS discovery req (0x%08x)."),
-               status);
+        limLog( pMac, LOGE, FL("Failed to pack a TDLS discovery req "
+                               "(0x%08x)."), status );
         palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, 
                                    ( void* ) pFrame, ( void* ) pPacket );
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog(pMac, LOGW, FL("There were warnings while packing TDLS Discovery Request (0x%08x)."),
-               status);
+        limLog( pMac, LOGW, FL("There were warnings while packing TDLS "
+                               "Discovery Request (0x%08x)."), status );
     }
 
 #ifndef NO_PAD_TDLS_MIN_8023_SIZE
@@ -717,7 +706,8 @@
         padVendorSpecific[3] = 0xA0;
         padVendorSpecific[4] = 0xC6;
 
-        limLog(pMac, LOG1, FL("Padding Vendor Specific Ie Len = %d"), padLen);
+        LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, ("Padding Vendor Specific Ie Len = %d"),
+                padLen ));
 
         /* padding zero if more than 5 bytes are required */
         if (padLen > MIN_VENDOR_SPECIFIC_IE_SIZE)
@@ -726,11 +716,8 @@
     }
 #endif
 
-    limLog(pMac, LOG1,
-           FL("[TDLS] action %d (%s) -AP-> OTA peer="MAC_ADDRESS_STR),
-           SIR_MAC_TDLS_DIS_REQ,
-           limTraceTdlsActionString(SIR_MAC_TDLS_DIS_REQ),
-           MAC_ADDR_ARRAY(peer_mac));
+    LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, ("[TDLS] action %d (%s) -AP-> OTA "),
+            SIR_MAC_TDLS_DIS_REQ, limTraceTdlsActionString(SIR_MAC_TDLS_DIS_REQ) ));
 
     halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
                             HAL_TXRX_FRM_802_11_DATA,
@@ -738,21 +725,267 @@
                             TID_AC_VI,
                             limTxComplete, pFrame,
                             limMgmtTXComplete,
-                            HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME |
-                                HAL_USE_PEER_STA_REQUESTED_MASK,
-                            pMac->lim.txBdToken++);
+                            HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME);
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
         pMac->lim.mgmtFrameSessionId = 0xff;
-        limLog(pMac, LOGE, FL("could not send TDLS Discovery Request frame"));
+        limLog( pMac, LOGE, FL("could not send TDLS Dis Request frame!" ));
         return eSIR_FAILURE;
     }
-    pMac->lim.mgmtFrameSessionId = psessionEntry->smeSessionId;
+    pMac->lim.mgmtFrameSessionId = psessionEntry->peSessionId;
 
     return eSIR_SUCCESS;
 
 }
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/*
+ * Once Discovery response is sent successfully (or failure) on air, now send
+ * response to PE and send del STA to HAL.
+ */
+eHalStatus limTdlsDisRspTxComplete(tpAniSirGlobal pMac, 
+                                           tANI_U32 txCompleteSuccess)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS ;
+    tpDphHashNode pStaDs = NULL ;
+    tSirTdlsPeerInfo *peerInfo = 0 ;
+
+    /* find peer by looking into the list by expected state */
+    peerInfo = limTdlsFindDisPeerByState(pMac, TDLS_DIS_RSP_SENT_WAIT_STATE) ;
+
+    if(NULL == peerInfo)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                                       ("DisRspTxComplete: No TDLS state machine waits for this event"));
+        VOS_ASSERT(0) ;
+        return eHAL_STATUS_FAILURE;
+    }
+
+    peerInfo->tdlsPeerState = TDLS_DIS_RSP_SENT_DONE_STATE ;
+
+    if(peerInfo->delStaNeeded)
+    {
+        tpPESession psessionEntry;
+        
+        peerInfo->delStaNeeded = false ;
+        psessionEntry = peFindSessionBySessionId (pMac, peerInfo->sessionId);
+
+        if(NULL == psessionEntry) 
+        {
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                                           ("DisRspTxComplete: sessionID %d is not found"), peerInfo->sessionId);
+            return eHAL_STATUS_FAILURE;
+        }
+        /* send del STA to remove context for this TDLS STA */
+        pStaDs = limTdlsDelSta(pMac, peerInfo->peerMac, psessionEntry) ;
+
+        /* now send indication to SME-->HDD->TL to remove STA from TL */
+        if(pStaDs)
+        {
+            limSendSmeTdlsDelPeerInd(pMac, psessionEntry->smeSessionId, 
+                                                     pStaDs, eSIR_SUCCESS) ;
+        }
+        else
+        {
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                           ("DisRspTxComplete: staDs not found for " MAC_ADDRESS_STR),
+                           MAC_ADDR_ARRAY((peerInfo)->peerMac));
+            VOS_ASSERT(0) ;
+            return eHAL_STATUS_FAILURE;
+        }
+    }
+ 
+    if(!txCompleteSuccess)
+     {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                                       ("TX complete failure for Dis RSP"));
+        limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE, 
+                                     eWNI_SME_TDLS_DISCOVERY_START_IND) ;
+        status = eHAL_STATUS_FAILURE;
+    }
+    else
+    {
+        limSendSmeTdlsDisRsp(pMac, eSIR_SUCCESS, 
+                                     eWNI_SME_TDLS_DISCOVERY_START_IND) ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                                       ("TX complete Success for Dis RSP"));
+        status = eHAL_STATUS_SUCCESS ;
+    }
+    //pMac->hal.pCBackFnTxComp = NULL ;
+    return status ;
+
+}
+#endif
+
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/*
+ * Once setup CNF is sent successfully (or failure) on air, now send
+ * response to PE and send del STA to HAL.
+ */
+eHalStatus limTdlsSetupCnfTxComplete(tpAniSirGlobal pMac,
+                                           tANI_U32 txCompleteSuccess)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS ;
+    tLimTdlsLinkSetupPeer *peerInfo = 0 ;
+    /* find peer by looking into the list by expected state */
+    limTdlsFindSetupPeerByState(pMac, 
+                             TDLS_LINK_SETUP_RSP_WAIT_STATE, &peerInfo) ;
+  
+    if(NULL == peerInfo)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                                       ("limTdlsSetupCnfTxComplete: No TDLS state machine waits for this event"));
+        VOS_ASSERT(0) ;
+        return eHAL_STATUS_FAILURE;
+    }
+ 
+    (peerInfo)->tdls_prev_link_state = (peerInfo)->tdls_link_state ;
+    (peerInfo)->tdls_link_state = TDLS_LINK_SETUP_DONE_STATE ; 
+
+    if(!txCompleteSuccess)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                                   ("TX complete Failure for setup CNF"));
+        limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, (peerInfo)->peerMac,
+                                               eWNI_SME_TDLS_LINK_START_RSP) ;
+        status = eHAL_STATUS_FAILURE;
+    }
+    else
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+              ("RSP-->SME peer MAC = " MAC_ADDRESS_STR),
+               MAC_ADDR_ARRAY((peerInfo)->peerMac));
+    
+        limSendSmeTdlsLinkStartRsp(pMac, eSIR_SUCCESS, (peerInfo)->peerMac,
+                                               eWNI_SME_TDLS_LINK_START_RSP) ;
+
+        /* tdls_hklee: prepare PTI template and send it to HAL */
+        limTdlsLinkEstablish(pMac, (peerInfo)->peerMac);
+
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                                 ("TX complete Success for setup CNF"));
+        status = eHAL_STATUS_SUCCESS ;
+    }
+    //pMac->hal.pCBackFnTxComp = NULL ;
+    return status ;
+}
+#endif
+
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/*
+ * Tx Complete for Teardown frame
+ */
+eHalStatus limTdlsTeardownTxComplete(tpAniSirGlobal pMac,
+                                           tANI_U32 txCompleteSuccess)  
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS ;
+    tpDphHashNode pStaDs = NULL ;
+    tLimTdlsLinkSetupPeer *peerInfo = 0 ;
+    tpPESession psessionEntry = NULL ;
+    //tANI_U16 msgType = 0 ;
+
+    //tSirMacAddr peerMac = {0} ;
+    /* find peer by looking into the list by expected state */
+    limTdlsFindSetupPeerByState(pMac, 
+                             TDLS_LINK_TEARDOWN_START_STATE, &peerInfo) ;
+  
+    if(NULL == peerInfo)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                                       ("limTdlsTeardownTxComplete: No TDLS state machine waits for this event"));
+        VOS_ASSERT(0) ;
+        return eHAL_STATUS_FAILURE;
+    }
+
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+                  ("teardown peer Mac = " MAC_ADDRESS_STR),
+                   MAC_ADDR_ARRAY((peerInfo)->peerMac));
+             
+
+    //pMac->hal.pCBackFnTxComp = NULL ;
+
+    psessionEntry = peFindSessionBySessionId(pMac, (peerInfo)->tdls_sessionId);
+
+    if(NULL == psessionEntry)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                                       ("limTdlsTeardownTxComplete: sessionID %d is not found"), (peerInfo)->tdls_sessionId);
+        VOS_ASSERT(0) ;
+        return eHAL_STATUS_FAILURE;
+    }
+
+    if(!txCompleteSuccess)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                         ("TX complete failure for Teardown  ")) ;
+
+        /* 
+         * we should be sending Teradown to AP with status code 
+         * eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE, we are not worried if 
+         * that is delivered or not, any way we removing this peer STA from our
+         * list
+         */
+        if(NULL != psessionEntry)
+        {
+            limSendTdlsTeardownFrame(pMac, (peerInfo)->peerMac, 
+                     eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE, psessionEntry, NULL, 0) ;
+        }
+    }
+
+    if(TDLS_LINK_SETUP_WAIT_STATE != (peerInfo)->tdls_prev_link_state)
+    {
+        (peerInfo)->tdls_prev_link_state = (peerInfo)->tdls_link_state ;
+        (peerInfo)->tdls_link_state = TDLS_LINK_TEARDOWN_DONE_STATE ; 
+        /* send del STA to remove context for this TDLS STA */
+        if(NULL != psessionEntry)
+        {
+            /* tdls_hklee: send message to HAL before it is deleted */
+            limTdlsLinkTeardown(pMac, (peerInfo)->peerMac) ;
+
+            pStaDs = limTdlsDelSta(pMac, (peerInfo)->peerMac, psessionEntry) ;
+        }
+
+        /* now send indication to SME-->HDD->TL to remove STA from TL */
+        if(!pStaDs)
+        {
+            VOS_ASSERT(0) ;
+            return eSIR_FAILURE ;
+        }
+        limSendSmeTdlsDelPeerInd(pMac, psessionEntry->smeSessionId, 
+                                                pStaDs, eSIR_SUCCESS) ;
+ 
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                      ("TX complete SUCCESS for Teardown")) ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                      ("Prev State = %d"), (peerInfo)->tdls_prev_link_state) ;
+        limSendSmeTdlsTeardownRsp(pMac, eSIR_SUCCESS, (peerInfo)->peerMac,
+                                                     eWNI_SME_TDLS_TEARDOWN_RSP) ;
+        /* Delete Peer for Link Peer List */
+        limTdlsDelLinkPeer(pMac, (peerInfo)->peerMac) ;
+    }
+    else
+    {
+        (peerInfo)->tdls_prev_link_state = (peerInfo)->tdls_link_state ;
+        (peerInfo)->tdls_link_state = TDLS_LINK_TEARDOWN_DONE_STATE ; 
+        limSendSmeTdlsTeardownRsp(pMac, eSIR_SUCCESS, (peerInfo)->peerMac,
+                                                eWNI_SME_TDLS_TEARDOWN_IND) ;
+    }
+
+
+#if 0
+    /* if previous state is link restart, then restart link setup again */
+    if(TDLS_LINK_SETUP_RESTART_STATE == (peerInfo)->tdls_prev_link_state)
+    {
+        tLimTdlsLinkSetupInfo *setupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
+        limTdlsPrepareSetupReqFrame(pMac, setupInfo, 37, 
+                                                   peerMac, psessionEntry) ;
+    }
+#endif  
+    status = eHAL_STATUS_SUCCESS ;
+    return status ;
+}
+#endif
+
 /*
  * This static function is consistent with any kind of TDLS management
  * frames we are sending. Currently it is being used by limSendTdlsDisRspFrame,
@@ -766,42 +999,45 @@
     {
         /* Include HT Capability IE */
         PopulateDot11fHTCaps( pMac, NULL, htCap );
-        /* Advertize ht capability and max supported channel
-         * bandwidth when populating HT IE in TDLS Setup Request/
-         * Setup Response/Setup Confirmation frames.
-         * 11.21.6.2 Setting up a 40 MHz direct link: A 40 MHz off-channel
-         * direct link may be started if both TDLS peer STAs indicated
-         * 40 MHz support in the Supported Channel Width Set field of the
-         * HT Capabilities element (which is included in the TDLS Setup Request
-         * frame and the TDLS Setup Response frame). Switching to a 40 MHz
-         * off-channel direct link is achieved by including the following
-         * information in the TDLS Channel Switch Request
-         * 11.21.1 General: The channel width of the TDLS direct link on the
-         * base channel shall not exceed the channel width of the BSS to which
-         * the TDLS peer STAs are associated.*/
         htCap->present = 1;
-        htCap->supportedChannelWidthSet = 1; // hardcode it to max
+        if (psessionEntry->currentOperChannel <= SIR_11B_CHANNEL_END)
+        {
+            /* hardcode NO channel bonding in 2.4Ghz */
+            htCap->supportedChannelWidthSet = 0;
+        }
+        else
+        {
+            //Placeholder to support different channel bonding mode of TDLS than AP.
+            //wlan_cfgGetInt(pMac,WNI_CFG_TDLS_CHANNEL_BONDING_MODE,&tdlsChannelBondingMode);
+            //htCap->supportedChannelWidthSet = tdlsChannelBondingMode ? 1 : 0;
+            htCap->supportedChannelWidthSet = 1; // hardcode it to max
+        }
     }
     else
     {
         htCap->present = 0;
     }
-    limLog(pMac, LOG1, FL("HT present = %hu, Chan Width = %hu"),
-            htCap->present, htCap->supportedChannelWidthSet);
 #ifdef WLAN_FEATURE_11AC
-    if (IS_DOT11_MODE_VHT(selfDot11Mode) &&
-        IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
+    if (((psessionEntry->currentOperChannel <= SIR_11B_CHANNEL_END) &&
+          pMac->roam.configParam.enableVhtFor24GHz) ||
+         (psessionEntry->currentOperChannel >= SIR_11B_CHANNEL_END))
     {
-        /* Include VHT Capability IE */
-        PopulateDot11fVHTCaps( pMac, vhtCap,
-                 psessionEntry->currentOperChannel, eSIR_FALSE );
+        if (IS_DOT11_MODE_VHT(selfDot11Mode) &&
+            IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
+        {
+            /* Include VHT Capability IE */
+            PopulateDot11fVHTCaps( pMac, vhtCap, eSIR_FALSE );
+        }
+        else
+        {
+            vhtCap->present = 0;
+        }
     }
     else
     {
+        /* Vht Disable from ini in 2.4 GHz */
         vhtCap->present = 0;
     }
-    limLog(pMac, LOG1, FL("VHT present = %hu"),
-            vhtCap->present);
 #endif
 }
 
@@ -815,7 +1051,7 @@
                      tANI_U16 addIeLen)
 {
     tDot11fTDLSDisRsp   tdlsDisRsp ;
-    tANI_U16            caps = 0 ;
+    tANI_U16            caps = 0 ;            
     tANI_U32            status = 0 ;
     tANI_U32            nPayload = 0 ;
     tANI_U32            nBytes = 0 ;
@@ -829,7 +1065,7 @@
 //  As of now, we hardcoded to max channel bonding of dot11Mode (i.e HT80 for 11ac/HT40 for 11n)
 //  uint32 tdlsChannelBondingMode;
 
-    /*
+    /* 
      * The scheme here is to fill out a 'tDot11fProbeRequest' structure
      * and then hand it off to 'dot11fPackProbeRequest' (for
      * serialization).  We start by zero-initializing the structure:
@@ -844,7 +1080,7 @@
     tdlsDisRsp.Action.action     = SIR_MAC_TDLS_DIS_RSP ;
     tdlsDisRsp.DialogToken.token = dialog ;
 
-    PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsDisRsp.LinkIdentifier,
+    PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsDisRsp.LinkIdentifier, 
                                            peerMac, TDLS_RESPONDER) ;
 
     if (cfgGetCapabilityInfo(pMac, &caps, psessionEntry) != eSIR_SUCCESS)
@@ -853,17 +1089,20 @@
          * Could not get Capabilities value
          * from CFG. Log error.
          */
-         limLog(pMac, LOGP, FL("could not retrieve Capabilities value"));
+         limLog(pMac, LOGP,
+                   FL("could not retrieve Capabilities value"));
     }
     swapBitField16(caps, ( tANI_U16* )&tdlsDisRsp.Capabilities );
 
-    /* populate supported rate and ext supported rate IE */
-    if (eSIR_FAILURE == PopulateDot11fRatesTdls(pMac, &tdlsDisRsp.SuppRates,
-                               &tdlsDisRsp.ExtSuppRates,
-                               psessionEntry->currentOperChannel))
-        limLog(pMac, LOGE, FL("could not populate supported data rates"));
+    /* populate supported rate IE */
+    PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, 
+                                     &tdlsDisRsp.SuppRates, psessionEntry );
+   
+    /* Populate extended supported rates */
+    PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+                                &tdlsDisRsp.ExtSuppRates, psessionEntry );
 
-    /* Populate extended capability IE */
+    /* Populate extended supported rates */
     PopulateDot11fTdlsExtCapability( pMac, &tdlsDisRsp.ExtCap );
 
     wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfDot11Mode);
@@ -877,14 +1116,11 @@
                                             &tdlsDisRsp.SuppChannels,
                                             &tdlsDisRsp.SuppOperatingClasses);
 
-    if (TRUE == pMac->lim.EnableTdls2040BSSCoexIE)
+    if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled &&
+         ( pMac->roam.configParam.bandCapability != eCSR_BAND_24) )
     {
-        if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled &&
-            ( pMac->roam.configParam.bandCapability != eCSR_BAND_24) )
-        {
-            tdlsDisRsp.HT2040BSSCoexistence.present = 1;
-            tdlsDisRsp.HT2040BSSCoexistence.infoRequest = 1;
-        }
+        tdlsDisRsp.HT2040BSSCoexistence.present = 1;
+        tdlsDisRsp.HT2040BSSCoexistence.infoRequest = 1;
     }
     /* 
      * now we pack it.  First, how much space are we going to need?
@@ -892,17 +1128,16 @@
     status = dot11fGetPackedTDLSDisRspSize( pMac, &tdlsDisRsp, &nPayload);
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to calculate the packed size for a Discovery Response (0x%08x)."),
-               status);
+        limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+                               "or a discovery Request (0x%08x)."), status );
         /* We'll fall back on the worst case scenario: */
         nPayload = sizeof( tDot11fProbeRequest );
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog(pMac, LOGW,
-               FL("There were warnings while calculating the packed size for a Discovery Response (0x%08x)."),
-               status);
+        limLog( pMac, LOGW, FL("There were warnings while calculating "
+                               "the packed size for a discovery Request ("
+                               "0x%08x)."), status );
     }
 
     /*
@@ -921,9 +1156,8 @@
                              ( void** ) &pPacket );
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to allocate %d bytes for a TDLS Discovery Response."),
-               nBytes);
+        limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TDLS"
+                               "Discovery Request."), nBytes );
         return eSIR_MEM_ALLOC_FAILED;
     }
 
@@ -969,18 +1203,16 @@
 
     if ( DOT11F_FAILED( status ) )
     {
-        limLog( pMac, LOGE,
-                FL("Failed to pack a TDLS Discovery Response (0x%08x)."),
-                status);
+        limLog( pMac, LOGE, FL("Failed to pack a TDLS discovery req "
+                               "(0x%08x)."), status );
         palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, 
                                    ( void* ) pFrame, ( void* ) pPacket );
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog( pMac, LOGW,
-                FL("There were warnings while packing TDLS Discovery Request (0x%08x)."),
-                status);
+        limLog( pMac, LOGW, FL("There were warnings while packing TDLS "
+                               "Discovery Request (0x%08x)."), status );
     }
 
 #if 0
@@ -998,15 +1230,17 @@
 #endif
     if (0 != addIeLen)
     {
-        limLog(pMac, LOG1, FL("Copy Additional Ie Len = %d"), addIeLen);
+        LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                     ("Copy Additional Ie Len = %d"), addIeLen ));
         vos_mem_copy(pFrame + sizeof(tSirMacMgmtHdr) + nPayload, addIe,
                                                               addIeLen);
     }
-    limLog(pMac, LOG1,
-           FL("[TDLS] action %d (%s) -DIRECT-> OTA peer="MAC_ADDRESS_STR),
-           SIR_MAC_TDLS_DIS_RSP,
-           limTraceTdlsActionString(SIR_MAC_TDLS_DIS_RSP),
-           MAC_ADDR_ARRAY(peerMac));
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                 ("transmitting Discovery response on direct link")) ;
+
+    LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, ("[TDLS] action %d (%s) -DIRECT-> OTA"),
+            SIR_MAC_TDLS_DIS_RSP, limTraceTdlsActionString(SIR_MAC_TDLS_DIS_RSP) ));
+
 
     /*
      * Transmit Discovery response and watch if this is delivered to
@@ -1018,15 +1252,14 @@
                             0,
                             limTxComplete, pFrame, 
                             limMgmtTXComplete,
-                            HAL_USE_SELF_STA_REQUESTED_MASK,
-                            pMac->lim.txBdToken++);
+                            HAL_USE_SELF_STA_REQUESTED_MASK );
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
         pMac->lim.mgmtFrameSessionId = 0xff;
-        limLog(pMac, LOGE, FL("could not send TDLS Discovery Response frame!"));
+        limLog( pMac, LOGE, FL("could not send TDLS Dis Request frame!" ));
         return eSIR_FAILURE;
     }
-    pMac->lim.mgmtFrameSessionId = psessionEntry->smeSessionId;
+    pMac->lim.mgmtFrameSessionId = psessionEntry->peSessionId;
 
     return eSIR_SUCCESS;
 
@@ -1060,15 +1293,15 @@
             else
             {
                 Aid->present = 0;
-                limLog(pMac, LOGE, FL("pStaDs is NULL for " MAC_ADDRESS_STR),
-                                   MAC_ADDR_ARRAY(peerMac));
+                limLog( pMac, LOGE, FL("pStaDs is NULL for " MAC_ADDRESS_STR ),
+                        MAC_ADDR_ARRAY(peerMac));
             }
         }
     }
     else
     {
         Aid->present = 0;
-        limLog(pMac, LOGW, FL("Vht not enable from ini for 2.4GHz."));
+        limLog( pMac, LOGW, FL("Vht not enable from ini for 2.4GHz."));
     }
 }
 
@@ -1117,7 +1350,8 @@
          * Could not get Capabilities value
          * from CFG. Log error.
          */
-         limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
+         limLog(pMac, LOGP,
+                   FL("could not retrieve Capabilities value"));
     }
 
     pCapInfo = (tpSirMacCapabilityInfo) &caps;
@@ -1126,38 +1360,21 @@
 
     swapBitField16(caps, ( tANI_U16* )&tdlsSetupReq.Capabilities );
 
-    limLog(pMac, LOG1, FL("Sending operating channel %d and dotl11mode %d\n"),
-           psessionEntry->currentOperChannel,
-           psessionEntry->dot11mode);
+    /* populate supported rate IE */
+    PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+                              &tdlsSetupReq.SuppRates, psessionEntry );
 
-    /* populate supported rate and ext supported rate IE */
-    PopulateDot11fRatesTdls(pMac, &tdlsSetupReq.SuppRates,
-                               &tdlsSetupReq.ExtSuppRates,
-                               psessionEntry->currentOperChannel);
+    /* Populate extended supported rates */
+    PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+                                &tdlsSetupReq.ExtSuppRates, psessionEntry );
 
-    /* Populate extended capability IE */
+    /* Populate extended supported rates */
     PopulateDot11fTdlsExtCapability( pMac, &tdlsSetupReq.ExtCap );
 
     if ( 1 == pMac->lim.gLimTDLSWmmMode )
     {
-        tANI_U32  val = 0;
-
         /* include WMM IE */
-        tdlsSetupReq.WMMInfoStation.version = SIR_MAC_OUI_VERSION_1;
-        tdlsSetupReq.WMMInfoStation.acvo_uapsd =
-                     (pMac->lim.gLimTDLSUapsdMask & 0x01);
-        tdlsSetupReq.WMMInfoStation.acvi_uapsd =
-                     ((pMac->lim.gLimTDLSUapsdMask & 0x02) >> 1);
-        tdlsSetupReq.WMMInfoStation.acbk_uapsd =
-                     ((pMac->lim.gLimTDLSUapsdMask & 0x04) >> 2);
-        tdlsSetupReq.WMMInfoStation.acbe_uapsd =
-                     ((pMac->lim.gLimTDLSUapsdMask & 0x08) >> 3);
-
-        if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
-           limLog(pMac, LOGE, FL("could not retrieve Max SP Length"));
-
-        tdlsSetupReq.WMMInfoStation.max_sp_length = (tANI_U8)val;
-        tdlsSetupReq.WMMInfoStation.present = 1;
+        PopulateDot11fWMMInfoStation( pMac, &tdlsSetupReq.WMMInfoStation );
     }
     else
     {
@@ -1170,7 +1387,6 @@
         /* Populate QOS info, needed for Peer U-APSD session */
         /* TODO: Now hardcoded, because PopulateDot11fQOSCapsStation() depends on AP's capability, and
          TDLS doesn't want to depend on AP's capability */
-        limLog(pMac, LOG1, FL("populate QOS IE in Setup Request Frame"));
         tdlsSetupReq.QOSCapsStation.present = 1;
         tdlsSetupReq.QOSCapsStation.max_sp_length = 0;
         tdlsSetupReq.QOSCapsStation.qack = 0;
@@ -1201,14 +1417,11 @@
                                             &tdlsSetupReq.SuppChannels,
                                             &tdlsSetupReq.SuppOperatingClasses);
 
-    if (TRUE == pMac->lim.EnableTdls2040BSSCoexIE)
+    if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled &&
+         ( pMac->roam.configParam.bandCapability != eCSR_BAND_24))
     {
-        if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled &&
-            ( pMac->roam.configParam.bandCapability != eCSR_BAND_24))
-        {
-            tdlsSetupReq.HT2040BSSCoexistence.present = 1;
-            tdlsSetupReq.HT2040BSSCoexistence.infoRequest = 1;
-        }
+        tdlsSetupReq.HT2040BSSCoexistence.present = 1;
+        tdlsSetupReq.HT2040BSSCoexistence.infoRequest = 1;
     }
 
     /*
@@ -1218,17 +1431,16 @@
                                                               &nPayload);
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to calculate the packed size for a Setup Request (0x%08x)."),
-               status);
+        limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+                               "or a discovery Request (0x%08x)."), status );
         /* We'll fall back on the worst case scenario: */
         nPayload = sizeof( tDot11fProbeRequest );
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog(pMac, LOGW,
-               FL("There were warnings while calculating the packed size for a Setup Request (0x%08x)."),
-               status);
+        limLog( pMac, LOGW, FL("There were warnings while calculating "
+                               "the packed size for a discovery Request ("
+                               "0x%08x)."), status );
     }
 
 
@@ -1252,9 +1464,8 @@
                              ( void** ) &pPacket );
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to allocate %d bytes for a TDLS Setup Request."),
-               nBytes);
+        limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TDLS"
+                               "Discovery Request."), nBytes );
         return eSIR_MEM_ALLOC_FAILED;
     }
 
@@ -1269,9 +1480,7 @@
     /* fill out the buffer descriptor */
 
     header_offset = limPrepareTdlsFrameHeader(pMac, pFrame,
-                          LINK_IDEN_ADDR_OFFSET(tdlsSetupReq),
-                          TDLS_LINK_AP, TDLS_INITIATOR,
-                          TID_AC_VI, psessionEntry) ;
+                     LINK_IDEN_ADDR_OFFSET(tdlsSetupReq), TDLS_LINK_AP, TDLS_INITIATOR, TID_AC_BK, psessionEntry) ;
 
 #ifdef FEATURE_WLAN_TDLS_NEGATIVE
     if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_SETUP_REQ)
@@ -1283,29 +1492,25 @@
          MAC_ADDR_ARRAY(tdlsSetupReq.LinkIdentifier.bssid));
     }
 #endif
-    limLog( pMac, LOGW, FL("SupportedChnlWidth %x rxMCSMap %x rxMCSMap %x txSupDataRate %x"),
-            tdlsSetupReq.VHTCaps.supportedChannelWidthSet,
-            tdlsSetupReq.VHTCaps.rxMCSMap,
-            tdlsSetupReq.VHTCaps.txMCSMap,
-            tdlsSetupReq.VHTCaps.txSupDataRate);
+    limLog( pMac, LOGW, FL("%s: SupportedChnlWidth %x rxMCSMap %x rxMCSMap %x txSupDataRate %x"),
+            __func__, tdlsSetupReq.VHTCaps.supportedChannelWidthSet, tdlsSetupReq.VHTCaps.rxMCSMap,
+            tdlsSetupReq.VHTCaps.txMCSMap, tdlsSetupReq.VHTCaps.txSupDataRate );
 
     status = dot11fPackTDLSSetupReq( pMac, &tdlsSetupReq, pFrame
                                + header_offset, nPayload, &nPayload );
 
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to pack a TDLS Setup Request (0x%08x)."),
-                   status);
+        limLog( pMac, LOGE, FL("Failed to pack a TDLS discovery req "
+                               "(0x%08x)."), status );
         palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, 
                                    ( void* ) pFrame, ( void* ) pPacket );
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog(pMac, LOGW,
-               FL("There were warnings while packing TDLS Setup Request (0x%08x)."),
-               status);
+        limLog( pMac, LOGW, FL("There were warnings while packing TDLS "
+                               "Discovery Request (0x%08x)."), status );
     }
 
     //Copy the additional IE.
@@ -1314,33 +1519,29 @@
     //if there is any IOT issue.
     if( addIeLen != 0 )
     {
-        limLog(pMac, LOG1, FL("Copy Additional Ie Len = %d"),
-                           addIeLen);
-        vos_mem_copy( pFrame + header_offset + nPayload, addIe, addIeLen );
+    LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, ("Copy Additional Ie Len = %d"),
+            addIeLen ));
+       vos_mem_copy( pFrame + header_offset + nPayload, addIe, addIeLen );
     }
 
-    limLog(pMac, LOG1, FL("[TDLS] action %d (%s) -AP-> OTA peer="MAC_ADDRESS_STR),
-                       SIR_MAC_TDLS_SETUP_REQ,
-                       limTraceTdlsActionString(SIR_MAC_TDLS_SETUP_REQ),
-                       MAC_ADDR_ARRAY(peerMac));
+    LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, ("[TDLS] action %d (%s) -AP-> OTA"),
+            SIR_MAC_TDLS_SETUP_REQ, limTraceTdlsActionString(SIR_MAC_TDLS_SETUP_REQ) ));
 
     halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
                             HAL_TXRX_FRM_802_11_DATA,
                             ANI_TXDIR_TODS,
-                            TID_AC_VI,
+                            TID_AC_BK,
                             limTxComplete, pFrame,
                             limMgmtTXComplete,
-                            HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME |
-                                HAL_USE_PEER_STA_REQUESTED_MASK,
-                            pMac->lim.txBdToken++);
+                            HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME );
 
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
         pMac->lim.mgmtFrameSessionId = 0xff;
-        limLog(pMac, LOGE, FL("could not send TDLS Setup Request frame!"));
+        limLog( pMac, LOGE, FL("could not send TDLS Dis Request frame!" ));
         return eSIR_FAILURE;
     }
-    pMac->lim.mgmtFrameSessionId = psessionEntry->smeSessionId;
+    pMac->lim.mgmtFrameSessionId = psessionEntry->peSessionId;
 
     return eSIR_SUCCESS;
 
@@ -1364,11 +1565,6 @@
 #ifndef NO_PAD_TDLS_MIN_8023_SIZE
     tANI_U32            padLen = 0;
 #endif
-    tpDphHashNode       pStaDs = NULL;
-    tANI_U16            aid = 0;
-    tANI_U8             qosMode = 0;
-    tANI_U8             tdlsLinkType = 0;
-
     /*
      * The scheme here is to fill out a 'tDot11fProbeRequest' structure
      * and then hand it off to 'dot11fPackProbeRequest' (for
@@ -1381,40 +1577,35 @@
 
     PopulateDot11fLinkIden( pMac, psessionEntry, &teardown.LinkIdentifier,
                                                 peerMac, (responder == TRUE) ? TDLS_RESPONDER : TDLS_INITIATOR) ;
+
+
     /*
      * now we pack it.  First, how much space are we going to need?
      */
     status = dot11fGetPackedTDLSTeardownSize( pMac, &teardown, &nPayload);
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to calculate the packed size for Teardown frame (0x%08x)."),
-               status);
+        limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+                               "or a discovery Request (0x%08x)."), status );
         /* We'll fall back on the worst case scenario: */
         nPayload = sizeof( tDot11fProbeRequest );
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog(pMac, LOGW,
-               FL("There were warnings while calculating the packed size for Teardown frame (0x%08x)."),
-               status);
+        limLog( pMac, LOGW, FL("There were warnings while calculating "
+                               "the packed size for a discovery Request ("
+                               "0x%08x)."), status );
     }
+
+
     /*
      * This frame is going out from PE as data frames with special ethertype
      * 89-0d.
      * 8 bytes of RFC 1042 header
      */
-    pStaDs = dphLookupHashEntry(pMac, peerMac, &aid,
-                                     &psessionEntry->dph.dphHashTable);
-    if (pStaDs)
-    {
-        qosMode = pStaDs->qosMode;
-    }
-    tdlsLinkType = (reason == eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE)
-                              ? TDLS_LINK_AP : TDLS_LINK_DIRECT;
-    nBytes = nPayload + (((IS_QOS_ENABLED(psessionEntry) &&
-                          (tdlsLinkType == TDLS_LINK_AP)) ||
-                          ((tdlsLinkType == TDLS_LINK_DIRECT) && qosMode))
+
+
+    nBytes = nPayload + ((IS_QOS_ENABLED(psessionEntry))
                               ? sizeof(tSirMacDataHdr3a) : sizeof(tSirMacMgmtHdr))
                       + sizeof( eth_890d_header )
                       + PAYLOAD_TYPE_TDLS_SIZE
@@ -1444,9 +1635,8 @@
                              ( void** ) &pPacket );
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to allocate %d bytes for a TDLS Teardown Frame."),
-               nBytes);
+        limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TDLS"
+                               "Discovery Request."), nBytes );
         return eSIR_MEM_ALLOC_FAILED;
     }
 
@@ -1457,7 +1647,7 @@
      * IE formation, memory allocation is completed, Now form TDLS discovery
      * request frame
      */
-    limLog(pMac, LOGE, FL("Reason of TDLS Teardown: %d"), reason);
+
     /* fill out the buffer descriptor */
 
     header_offset = limPrepareTdlsFrameHeader(pMac, pFrame,
@@ -1473,15 +1663,15 @@
     if ( DOT11F_FAILED( status ) )
     {
         limLog( pMac, LOGE, FL("Failed to pack a TDLS Teardown req (0x%08x)."),
-                status);
+                status );
         palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
                                    ( void* ) pFrame, ( void* ) pPacket );
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog(pMac, LOGW, FL("There were warnings while packing TDLS Teardown frame (0x%08x)."),
-               status);
+        limLog( pMac, LOGW, FL("There were warnings while packing TDLS "
+                               "Teardown Request (0x%08x)."), status );
     }
 #if 0
     if(pMac->hal.pCBackFnTxComp == NULL)
@@ -1503,8 +1693,9 @@
 
     if( addIeLen != 0 )
     {
-        limLog(pMac, LOG1, FL("Copy Additional Ie Len = %d"), addIeLen);
-        vos_mem_copy( pFrame + header_offset + nPayload, addIe, addIeLen );
+    LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, ("Copy Additional Ie Len = %d"),
+            addIeLen ));
+       vos_mem_copy( pFrame + header_offset + nPayload, addIe, addIeLen );
     }
 
 #ifndef NO_PAD_TDLS_MIN_8023_SIZE
@@ -1519,7 +1710,8 @@
         padVendorSpecific[3] = 0xA0;
         padVendorSpecific[4] = 0xC6;
 
-        limLog(pMac, LOG1, FL("Padding Vendor Specific Ie Len = %d"), padLen);
+        LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, ("Padding Vendor Specific Ie Len = %d"),
+                padLen ));
 
         /* padding zero if more than 5 bytes are required */
         if (padLen > MIN_VENDOR_SPECIFIC_IE_SIZE)
@@ -1527,12 +1719,9 @@
                          padLen - MIN_VENDOR_SPECIFIC_IE_SIZE, 0);
     }
 #endif
-    limLog(pMac, LOG1, FL("[TDLS] action %d (%s) -%s-> OTA peer="MAC_ADDRESS_STR),
-                       SIR_MAC_TDLS_TEARDOWN,
-                       limTraceTdlsActionString(SIR_MAC_TDLS_TEARDOWN),
-                       ((reason == eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE) ?
-                       "AP": "DIRECT"),
-                       MAC_ADDR_ARRAY(peerMac));
+    LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, ("[TDLS] action %d (%s) -%s-> OTA"),
+         SIR_MAC_TDLS_TEARDOWN, limTraceTdlsActionString(SIR_MAC_TDLS_TEARDOWN),
+         (reason == eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE) ? "AP": "DIRECT" ));
 
     halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
                             HAL_TXRX_FRM_802_11_DATA,
@@ -1540,17 +1729,15 @@
                             TID_AC_VI,
                             limTxComplete, pFrame,
                             limMgmtTXComplete,
-                            HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME |
-                                HAL_USE_PEER_STA_REQUESTED_MASK,
-                            pMac->lim.txBdToken++);
+                            HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME );
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
         pMac->lim.mgmtFrameSessionId = 0xff;
-        limLog(pMac, LOGE, FL("could not send TDLS Teardown frame"));
+        limLog( pMac, LOGE, FL("could not send TDLS Dis Request frame!" ));
         return eSIR_FAILURE;
 
     }
-    pMac->lim.mgmtFrameSessionId = psessionEntry->smeSessionId;
+    pMac->lim.mgmtFrameSessionId = psessionEntry->peSessionId;
     return eSIR_SUCCESS;
 
 }
@@ -1558,13 +1745,13 @@
 /*
  * Send Setup RSP frame on AP link.
  */
-static tSirRetStatus limSendTdlsSetupRspFrame(tpAniSirGlobal pMac,
-                    tSirMacAddr peerMac, tANI_U8 dialog, tpPESession psessionEntry,
+static tSirRetStatus limSendTdlsSetupRspFrame(tpAniSirGlobal pMac, 
+                    tSirMacAddr peerMac, tANI_U8 dialog, tpPESession psessionEntry, 
                     etdlsLinkSetupStatus setupStatus, tANI_U8 *addIe, tANI_U16 addIeLen )
 {
     tDot11fTDLSSetupRsp  tdlsSetupRsp ;
     tANI_U32            status = 0 ;
-    tANI_U16            caps = 0 ;
+    tANI_U16            caps = 0 ;            
     tANI_U32            nPayload = 0 ;
     tANI_U32            header_offset = 0 ;
     tANI_U32            nBytes = 0 ;
@@ -1579,7 +1766,7 @@
 //  As of now, we hardcoded to max channel bonding of dot11Mode (i.e HT80 for 11ac/HT40 for 11n)
 //  uint32 tdlsChannelBondingMode;
 
-    /*
+    /* 
      * The scheme here is to fill out a 'tDot11fProbeRequest' structure
      * and then hand it off to 'dot11fPackProbeRequest' (for
      * serialization).  We start by zero-initializing the structure:
@@ -1602,7 +1789,8 @@
          * Could not get Capabilities value
          * from CFG. Log error.
          */
-         limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
+         limLog(pMac, LOGP,
+                   FL("could not retrieve Capabilities value"));
     }
 
     pCapInfo = (tpSirMacCapabilityInfo) &caps;
@@ -1611,34 +1799,21 @@
 
     swapBitField16(caps, ( tANI_U16* )&tdlsSetupRsp.Capabilities );
 
-    /* populate supported rate and ext supported rate IE */
-    PopulateDot11fRatesTdls(pMac, &tdlsSetupRsp.SuppRates,
-                                &tdlsSetupRsp.ExtSuppRates,
-                                psessionEntry->currentOperChannel);
+    /* ipopulate supported rate IE */
+    PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, 
+                                &tdlsSetupRsp.SuppRates, psessionEntry );
+   
+    /* Populate extended supported rates */
+    PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+                                &tdlsSetupRsp.ExtSuppRates, psessionEntry );
 
-    /* Populate extended capability IE */
+    /* Populate extended supported rates */
     PopulateDot11fTdlsExtCapability( pMac, &tdlsSetupRsp.ExtCap );
 
     if ( 1 == pMac->lim.gLimTDLSWmmMode )
     {
-        tANI_U32  val = 0;
-
         /* include WMM IE */
-        tdlsSetupRsp.WMMInfoStation.version = SIR_MAC_OUI_VERSION_1;
-        tdlsSetupRsp.WMMInfoStation.acvo_uapsd =
-                     (pMac->lim.gLimTDLSUapsdMask & 0x01);
-        tdlsSetupRsp.WMMInfoStation.acvi_uapsd =
-                     ((pMac->lim.gLimTDLSUapsdMask & 0x02) >> 1);
-        tdlsSetupRsp.WMMInfoStation.acbk_uapsd =
-                     ((pMac->lim.gLimTDLSUapsdMask & 0x04) >> 2);
-        tdlsSetupRsp.WMMInfoStation.acbe_uapsd =
-                     ((pMac->lim.gLimTDLSUapsdMask & 0x08) >> 3);
-
-        if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
-           limLog(pMac, LOGE, FL("could not retrieve Max SP Length"));
-
-        tdlsSetupRsp.WMMInfoStation.max_sp_length = (tANI_U8)val;
-        tdlsSetupRsp.WMMInfoStation.present = 1;
+        PopulateDot11fWMMInfoStation( pMac, &tdlsSetupRsp.WMMInfoStation );
     }
     else
     {
@@ -1651,7 +1826,6 @@
         /* Populate QOS info, needed for Peer U-APSD session */
         /* TODO: Now hardcoded, because PopulateDot11fQOSCapsStation() depends on AP's capability, and
          TDLS doesn't want to depend on AP's capability */
-        limLog(pMac, LOG1, FL("populate QOS IE in Setup Response frame"));
         tdlsSetupRsp.QOSCapsStation.present = 1;
         tdlsSetupRsp.QOSCapsStation.max_sp_length = 0;
         tdlsSetupRsp.QOSCapsStation.qack = 0;
@@ -1678,14 +1852,11 @@
 
     tdlsSetupRsp.Status.status = setupStatus ;
 
-    if (TRUE == pMac->lim.EnableTdls2040BSSCoexIE)
+    if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled &&
+         ( pMac->roam.configParam.bandCapability != eCSR_BAND_24))
     {
-        if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled &&
-            ( pMac->roam.configParam.bandCapability != eCSR_BAND_24))
-        {
-            tdlsSetupRsp.HT2040BSSCoexistence.present = 1;
-            tdlsSetupRsp.HT2040BSSCoexistence.infoRequest = 1;
-        }
+        tdlsSetupRsp.HT2040BSSCoexistence.present = 1;
+        tdlsSetupRsp.HT2040BSSCoexistence.infoRequest = 1;
     }
     /* 
      * now we pack it.  First, how much space are we going to need?
@@ -1694,17 +1865,16 @@
                                                      &nPayload);
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to calculate the packed size for a Setup Response (0x%08x)."),
-               status);
+        limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+                               "or a discovery Request (0x%08x)."), status );
         /* We'll fall back on the worst case scenario: */
         nPayload = sizeof( tDot11fProbeRequest );
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog(pMac, LOGW,
-               FL("There were warnings while calculating the packed size for Setup Response (0x%08x)."),
-               status);
+        limLog( pMac, LOGW, FL("There were warnings while calculating "
+                               "the packed size for a discovery Request ("
+                               "0x%08x)."), status );
     }
 
     /*
@@ -1727,9 +1897,8 @@
                              ( void** ) &pPacket );
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to allocate %d bytes for a TDLS Setup Response."),
-               nBytes);
+        limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TDLS"
+                               "Discovery Request."), nBytes );
         return eSIR_MEM_ALLOC_FAILED;
     }
 
@@ -1746,7 +1915,7 @@
     header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, 
                                  LINK_IDEN_ADDR_OFFSET(tdlsSetupRsp), 
                                        TDLS_LINK_AP, TDLS_RESPONDER,
-                                       TID_AC_VI, psessionEntry) ;
+                                       TID_AC_BK, psessionEntry) ;
 
 #ifdef FEATURE_WLAN_TDLS_NEGATIVE
     if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_SETUP_RSP)
@@ -1758,28 +1927,24 @@
          MAC_ADDR_ARRAY(tdlsSetupRsp.LinkIdentifier.bssid));
     }
 #endif
-    limLog(pMac, LOG1,
-           FL("SupportedChnlWidth %x rxMCSMap %x rxMCSMap %x txSupDataRate %x"),
-           tdlsSetupRsp.VHTCaps.supportedChannelWidthSet,
-           tdlsSetupRsp.VHTCaps.rxMCSMap,
-           tdlsSetupRsp.VHTCaps.txMCSMap,
-           tdlsSetupRsp.VHTCaps.txSupDataRate);
+    limLog( pMac, LOGW, FL("%s: SupportedChnlWidth %x rxMCSMap %x rxMCSMap %x txSupDataRate %x"),
+            __func__, tdlsSetupRsp.VHTCaps.supportedChannelWidthSet, tdlsSetupRsp.VHTCaps.rxMCSMap,
+            tdlsSetupRsp.VHTCaps.txMCSMap, tdlsSetupRsp.VHTCaps.txSupDataRate );
     status = dot11fPackTDLSSetupRsp( pMac, &tdlsSetupRsp, pFrame 
                                + header_offset, nPayload, &nPayload );
 
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE, FL("Failed to pack a TDLS Setup Response (0x%08x)."),
-               status);
+        limLog( pMac, LOGE, FL("Failed to pack a TDLS discovery req "
+                               "(0x%08x)."), status );
         palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, 
                                    ( void* ) pFrame, ( void* ) pPacket );
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog(pMac, LOGW,
-               FL("There were warnings while packing TDLS Setup Response (0x%08x)."),
-               status);
+        limLog( pMac, LOGW, FL("There were warnings while packing TDLS "
+                               "Discovery Request (0x%08x)."), status );
     }
 
     //Copy the additional IE. 
@@ -1791,29 +1956,24 @@
        vos_mem_copy( pFrame + header_offset + nPayload, addIe, addIeLen );
     }
 
-    limLog(pMac, LOG1,
-           FL("[TDLS] action %d (%s) -AP-> OTA peer="MAC_ADDRESS_STR),
-           SIR_MAC_TDLS_SETUP_RSP,
-           limTraceTdlsActionString(SIR_MAC_TDLS_SETUP_RSP),
-           MAC_ADDR_ARRAY(peerMac));
+    LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, ("[TDLS] action %d (%s) -AP-> OTA"),
+         SIR_MAC_TDLS_SETUP_RSP, limTraceTdlsActionString(SIR_MAC_TDLS_SETUP_RSP) ));
 
     halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
                             HAL_TXRX_FRM_802_11_DATA,
                             ANI_TXDIR_TODS,
                             //ANI_TXDIR_IBSS,
-                            TID_AC_VI,
+                            TID_AC_BK,
                             limTxComplete, pFrame,
                             limMgmtTXComplete,
-                            HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME |
-                                HAL_USE_PEER_STA_REQUESTED_MASK,
-                            pMac->lim.txBdToken++);
+                            HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME );
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
         pMac->lim.mgmtFrameSessionId = 0xff;
-        limLog(pMac, LOGE, FL("could not send TDLS Setup Response"));
+        limLog( pMac, LOGE, FL("could not send TDLS Dis Request frame!" ));
         return eSIR_FAILURE;
     }
-    pMac->lim.mgmtFrameSessionId = psessionEntry->smeSessionId;
+    pMac->lim.mgmtFrameSessionId = psessionEntry->peSessionId;
 
     return eSIR_SUCCESS;
 
@@ -1852,8 +2012,13 @@
     tdlsSetupCnf.Action.action     = SIR_MAC_TDLS_SETUP_CNF ;
     tdlsSetupCnf.DialogToken.token = dialog ;
 
+#if 1
     PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsSetupCnf.LinkIdentifier,
                       peerMac, TDLS_INITIATOR) ;
+#else
+    vos_mem_copy( (tANI_U8 *)&tdlsSetupCnf.LinkIdentifier,
+                  (tANI_U8 *)&setupRsp->LinkIdentifier, sizeof(tDot11fIELinkIdentifier)) ;
+#endif
 
     /* 
      * TODO: we need to see if we have to support conditions where we have
@@ -1865,15 +2030,13 @@
     /* Check self and peer WMM capable */
     if ((1 == pMac->lim.gLimTDLSWmmMode) && (CHECK_BIT(peerCapability, TDLS_PEER_WMM_CAP)))
     {
-       limLog(pMac, LOG1, FL("populate WMM praram in Setup Confirm"));
        PopulateDot11fWMMParams(pMac, &tdlsSetupCnf.WMMParams, psessionEntry);
     }
 
      /* Check peer is VHT capable*/
     if (CHECK_BIT(peerCapability, TDLS_PEER_VHT_CAP))
     {
-       PopulateDot11fVHTOperation( pMac, &tdlsSetupCnf.VHTOperation,
-                                      psessionEntry->currentOperChannel);
+       PopulateDot11fVHTOperation( pMac, &tdlsSetupCnf.VHTOperation);
        PopulateDot11fHTInfo( pMac, &tdlsSetupCnf.HTInfo, psessionEntry );
     }
     else if (CHECK_BIT(peerCapability, TDLS_PEER_HT_CAP)) /* Check peer is HT capable */
@@ -1881,14 +2044,11 @@
        PopulateDot11fHTInfo( pMac, &tdlsSetupCnf.HTInfo, psessionEntry );
     }
 
-    if (TRUE == pMac->lim.EnableTdls2040BSSCoexIE)
+    if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled &&
+         ( pMac->roam.configParam.bandCapability != eCSR_BAND_24))
     {
-        if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled &&
-            ( pMac->roam.configParam.bandCapability != eCSR_BAND_24))
-        {
-            tdlsSetupCnf.HT2040BSSCoexistence.present = 1;
-            tdlsSetupCnf.HT2040BSSCoexistence.infoRequest = 1;
-        }
+        tdlsSetupCnf.HT2040BSSCoexistence.present = 1;
+        tdlsSetupCnf.HT2040BSSCoexistence.infoRequest = 1;
     }
 
     /* 
@@ -1898,17 +2058,16 @@
                                                      &nPayload);
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to calculate the packed size for Setup Confirm (0x%08x)."),
-               status);
+        limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+                               "or a discovery Request (0x%08x)."), status );
         /* We'll fall back on the worst case scenario: */
         nPayload = sizeof( tDot11fProbeRequest );
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog(pMac, LOGW,
-               FL("There were warnings while calculating the packed size for Setup Confirm (0x%08x)."),
-               status);
+        limLog( pMac, LOGW, FL("There were warnings while calculating "
+                               "the packed size for a discovery Request ("
+                               "0x%08x)."), status );
     }
 
     /*
@@ -1949,9 +2108,8 @@
                              ( void** ) &pPacket );
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to allocate %d bytes for a TDLS Setup Confirm."),
-               nBytes);
+        limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TDLS"
+                               "Discovery Request."), nBytes );
         return eSIR_MEM_ALLOC_FAILED;
     }
 
@@ -1981,18 +2139,16 @@
 
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE,
-               FL("Failed to pack a TDLS Setup Confirm (0x%08x)."),
-               status);
+        limLog( pMac, LOGE, FL("Failed to pack a TDLS discovery req "
+                               "(0x%08x)."), status );
         palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, 
                                    ( void* ) pFrame, ( void* ) pPacket );
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog(pMac, LOGW,
-               FL("There were warnings while packing TDLS Setup Confirm (0x%08x)."),
-               status);
+        limLog( pMac, LOGW, FL("There were warnings while packing TDLS "
+                               "Discovery Request (0x%08x)."), status );
     }
 #if 0
     if(pMac->hal.pCBackFnTxComp == NULL) 
@@ -2032,7 +2188,8 @@
         padVendorSpecific[3] = 0xA0;
         padVendorSpecific[4] = 0xC6;
 
-        limLog(pMac, LOG1, FL("Padding Vendor Specific Ie Len = %d"), padLen);
+        LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, ("Padding Vendor Specific Ie Len = %d"),
+                padLen ));
 
         /* padding zero if more than 5 bytes are required */
         if (padLen > MIN_VENDOR_SPECIFIC_IE_SIZE)
@@ -2042,11 +2199,8 @@
 #endif
 
 
-    limLog(pMac, LOG1,
-           FL("[TDLS] action %d (%s) -AP-> OTA peer="MAC_ADDRESS_STR),
-           SIR_MAC_TDLS_SETUP_CNF,
-           limTraceTdlsActionString(SIR_MAC_TDLS_SETUP_CNF),
-           MAC_ADDR_ARRAY(peerMac));
+    LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, ("[TDLS] action %d (%s) -AP-> OTA"),
+         SIR_MAC_TDLS_SETUP_CNF, limTraceTdlsActionString(SIR_MAC_TDLS_SETUP_CNF) ));
 
     halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
                             HAL_TXRX_FRM_802_11_DATA,
@@ -2054,23 +2208,194 @@
                             TID_AC_VI,
                             limTxComplete, pFrame, 
                             limMgmtTXComplete,
-                            HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME |
-                                HAL_USE_PEER_STA_REQUESTED_MASK,
-                            pMac->lim.txBdToken++);
+                            HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME );
 
 
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
         pMac->lim.mgmtFrameSessionId = 0xff;
-        limLog(pMac, LOGE, FL("could not send TDLS Setup Confirm frame"));
+        limLog( pMac, LOGE, FL("could not send TDLS Dis Request frame!" ));
         return eSIR_FAILURE;
 
     }
-    pMac->lim.mgmtFrameSessionId = psessionEntry->smeSessionId;
+    pMac->lim.mgmtFrameSessionId = psessionEntry->peSessionId;
 
     return eSIR_SUCCESS;
 }
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/*
+ * Convert HT caps to lim based HT caps 
+ */
+static void limTdlsCovertHTCaps(tpAniSirGlobal pMac,
+                         tSirTdlsPeerInfo *peerInfo, tDot11fIEHTCaps *HTCaps)
+{
+
+    /* HT Capability Info */
+    peerInfo->tdlsPeerHtCaps.advCodingCap = HTCaps->advCodingCap ;
+    peerInfo->tdlsPeerHtCaps.supportedChannelWidthSet = 
+                                            HTCaps->supportedChannelWidthSet ;
+    peerInfo->tdlsPeerHtCaps.mimoPowerSave = HTCaps->mimoPowerSave ;
+    peerInfo->tdlsPeerHtCaps.greenField = HTCaps->greenField ;
+    peerInfo->tdlsPeerHtCaps.shortGI20MHz = HTCaps->shortGI20MHz ;
+    peerInfo->tdlsPeerHtCaps.shortGI40MHz = HTCaps->shortGI40MHz ;
+    peerInfo->tdlsPeerHtCaps.txSTBC = HTCaps->txSTBC ;
+    peerInfo->tdlsPeerHtCaps.rxSTBC = HTCaps->rxSTBC ;
+    peerInfo->tdlsPeerHtCaps.delayedBA = HTCaps->delayedBA;
+    peerInfo->tdlsPeerHtCaps.maximalAMSDUsize = HTCaps->maximalAMSDUsize ;
+    peerInfo->tdlsPeerHtCaps.dsssCckMode40MHz = HTCaps->dsssCckMode40MHz ;
+    peerInfo->tdlsPeerHtCaps.psmp = HTCaps->stbcControlFrame ;
+    peerInfo->tdlsPeerHtCaps.stbcControlFrame = HTCaps->stbcControlFrame ;
+    peerInfo->tdlsPeerHtCaps.lsigTXOPProtection = 
+                                                 HTCaps->lsigTXOPProtection ;
+
+    /* HT Capa parameters */
+    peerInfo->tdlsPeerHtParams.maxRxAMPDUFactor = HTCaps->maxRxAMPDUFactor ;
+    peerInfo->tdlsPeerHtParams.mpduDensity = HTCaps->mpduDensity ;
+    peerInfo->tdlsPeerHtParams.reserved = HTCaps->reserved1 ;
+    
+    /* Extended HT caps */
+    peerInfo->tdlsPeerHtExtCaps.pco = HTCaps->pco ;
+    peerInfo->tdlsPeerHtExtCaps.transitionTime = HTCaps->transitionTime ;
+    peerInfo->tdlsPeerHtExtCaps.mcsFeedback = HTCaps->mcsFeedback ;
+    vos_mem_copy( peerInfo->supportedMCSSet,
+                      HTCaps->supportedMCSSet, SIZE_OF_SUPPORTED_MCS_SET) ;
+
+    return ;
+}
+
+/*
+ * update capability info..
+ */
+void tdlsUpdateCapInfo(tSirMacCapabilityInfo *capabilityInfo, 
+                                tDot11fFfCapabilities *Capabilities)
+{
+
+    capabilityInfo->ess            = Capabilities->ess;
+    capabilityInfo->ibss           = Capabilities->ibss;
+    capabilityInfo->cfPollable     = Capabilities->cfPollable;
+    capabilityInfo->cfPollReq      = Capabilities->cfPollReq;
+    capabilityInfo->privacy        = Capabilities->privacy;
+    capabilityInfo->shortPreamble  = Capabilities->shortPreamble;
+    capabilityInfo->pbcc           = Capabilities->pbcc;
+    capabilityInfo->channelAgility = Capabilities->channelAgility;
+    capabilityInfo->spectrumMgt    = Capabilities->spectrumMgt;
+    capabilityInfo->qos            = Capabilities->qos;
+    capabilityInfo->shortSlotTime  = Capabilities->shortSlotTime;
+    capabilityInfo->apsd           = Capabilities->apsd;
+    capabilityInfo->rrm            = Capabilities->rrm;
+    capabilityInfo->dsssOfdm       = Capabilities->dsssOfdm;
+    capabilityInfo->immediateBA    = Capabilities->immediateBA;
+
+    return ;
+}
+
+/*
+ * update Peer info from the link request frame recieved from Peer..
+ * in list of STA participating in TDLS link setup
+ */
+void limTdlsUpdateLinkReqPeerInfo(tpAniSirGlobal pMac, 
+                                 tLimTdlsLinkSetupPeer *setupPeer, 
+                                             tDot11fTDLSSetupReq *setupReq)
+{
+
+    /* Populate peer info of tdls discovery result */
+
+    tdlsUpdateCapInfo(&setupPeer->capabilityInfo, &setupReq->Capabilities) ;
+
+    if(setupReq->SuppRates.present)
+    {
+        ConvertSuppRates( pMac, &setupPeer->supportedRates, 
+                                            &setupReq->SuppRates );
+    }
+
+    /* update QOS info, needed for Peer U-APSD session */
+    if(setupReq->QOSCapsStation.present)
+    {
+       ConvertQOSCapsStation(pMac->hHdd, &setupPeer->qosCaps, 
+                   &setupReq->QOSCapsStation) ;
+       LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,("setupReq->SPLen=%d (be %d %d %d %d vo) more %d qack %d."),
+         setupReq->QOSCapsStation.max_sp_length, setupReq->QOSCapsStation.acbe_uapsd,
+         setupReq->QOSCapsStation.acbk_uapsd, setupReq->QOSCapsStation.acvi_uapsd,
+         setupReq->QOSCapsStation.acvo_uapsd, setupReq->QOSCapsStation.more_data_ack,
+         setupReq->QOSCapsStation.qack));
+    }
+    
+    if (setupReq->ExtSuppRates.present)
+    {
+        setupPeer->ExtRatesPresent = 1;
+        ConvertExtSuppRates( pMac, &setupPeer->extendedRates,
+                                                &setupReq->ExtSuppRates );
+    }
+    /* update HT caps */
+    if (setupReq->HTCaps.present)
+    {
+        vos_mem_copy( &setupPeer->tdlsPeerHTCaps,
+                    &setupReq->HTCaps, sizeof(tDot11fIEHTCaps)) ;
+    }
+    /* Update EXT caps */
+    if (setupReq->ExtCap.present)
+    {
+        vos_mem_copy( &setupPeer->tdlsPeerExtCaps,
+                    &setupReq->ExtCap, sizeof(tDot11fIEExtCap)) ;
+    }    
+
+    return ;
+}
+
+/*
+ * update peer Info recieved with TDLS setup RSP 
+ */
+void limTdlsUpdateLinkRspPeerInfo(tpAniSirGlobal pMac, 
+                                   tLimTdlsLinkSetupPeer *setupPeer, 
+                                             tDot11fTDLSSetupRsp *setupRsp)
+{
+
+    /* Populate peer info of tdls discovery result */
+    tdlsUpdateCapInfo(&setupPeer->capabilityInfo, &setupRsp->Capabilities) ;
+
+    if(setupRsp->SuppRates.present)
+    {
+        tDot11fIESuppRates *suppRates = &setupRsp->SuppRates ;
+        ConvertSuppRates( pMac, &setupPeer->supportedRates, suppRates);
+    }
+
+    /* update QOS info, needed for Peer U-APSD session */
+    if(setupRsp->QOSCapsStation.present)
+    {
+       ConvertQOSCapsStation(pMac->hHdd, &setupPeer->qosCaps, 
+                   &setupRsp->QOSCapsStation) ;
+       LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, ("setupRsp->SPLen=%d (be %d %d %d %d vo) more %d qack %d."),
+         setupRsp->QOSCapsStation.max_sp_length, setupRsp->QOSCapsStation.acbe_uapsd,
+         setupRsp->QOSCapsStation.acbk_uapsd, setupRsp->QOSCapsStation.acvi_uapsd,
+         setupRsp->QOSCapsStation.acvo_uapsd, setupRsp->QOSCapsStation.more_data_ack,
+         setupRsp->QOSCapsStation.qack));
+    }
+    
+    if(setupRsp->ExtSuppRates.present)
+    {
+        setupPeer->ExtRatesPresent = 1;
+        ConvertExtSuppRates( pMac, &setupPeer->extendedRates,
+                                                &setupRsp->ExtSuppRates );
+    }
+    /* update HT caps */
+    if (setupRsp->HTCaps.present)
+    {
+        vos_mem_copy(&setupPeer->tdlsPeerHTCaps,
+                    &setupRsp->HTCaps, sizeof(tDot11fIEHTCaps)) ;
+    }
+
+    /* update EXT caps */
+    if (setupRsp->ExtCap.present)
+    {
+        vos_mem_copy( &setupPeer->tdlsPeerExtCaps,
+                    &setupRsp->ExtCap, sizeof(tDot11fIEExtCap)) ;
+    }
+
+    return ;
+}
+#endif
+
 /* This Function is similar to PopulateDot11fHTCaps, except that the HT Capabilities
  * are considered from the AddStaReq rather from the cfg.dat as in PopulateDot11fHTCaps
  */
@@ -2124,14 +2449,9 @@
        pDot11f->shortGI40MHz = 0;
     }
 
-    limLog(pMac, LOG1,
-           FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, shortGI20:%d, shortGI40: %d, dsssCck: %d"),
-           pDot11f->supportedChannelWidthSet,
-           pDot11f->mimoPowerSave,
-           pDot11f->greenField,
-           pDot11f->shortGI20MHz,
-           pDot11f->shortGI40MHz,
-           pDot11f->dsssCckMode40MHz);
+    dot11fLog(pMac, LOG2, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, shortGI20:%d, shortGI40: %d, dsssCck: %d"),
+                                            pDot11f->supportedChannelWidthSet, pDot11f->mimoPowerSave,  pDot11f->greenField,
+                                            pDot11f->shortGI20MHz, pDot11f->shortGI40MHz, pDot11f->dsssCckMode40MHz);
 
     nCfgValue = pTdlsAddStaReq->htCap.ampduParamsInfo;
 
@@ -2142,7 +2462,7 @@
     pDot11f->mpduDensity      = pHTParametersInfo->mpduDensity;
     pDot11f->reserved1        = pHTParametersInfo->reserved;
 
-    limLog(pMac, LOG1, FL("AMPDU Param: %x"), nCfgValue);
+    dot11fLog( pMac, LOG2, FL( "AMPDU Param: %x" ), nCfgValue);
 
     vos_mem_copy( pDot11f->supportedMCSSet, pTdlsAddStaReq->htCap.suppMcsSet,
                   SIZE_OF_SUPPORTED_MCS_SET);
@@ -2284,7 +2604,7 @@
                                           &val) != eSIR_SUCCESS)
     {
         /// Could not get rateset from CFG. Log error.
-        limLog(pMac, LOGE, FL("could not retrieve rateset"));
+        limLog(pMac, LOGP, FL("could not retrieve rateset"));
         val = 0;
     }
     tempRateSet.numRates = val;
@@ -2302,7 +2622,7 @@
 
     if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
     {
-        limLog(pMac, LOGE, FL("more than 12 rates in CFG"));
+        PELOGE(limLog(pMac, LOGE, FL("more than 12 rates in CFG"));)
         goto error;
     }
 
@@ -2347,9 +2667,9 @@
      */
     if (supporteRatesLength > SIR_MAC_RATESET_EID_MAX)
     {
-       limLog(pMac, LOGW,
-              FL("Supported rates length %d more than the Max limit, reset to Max"),
-              supporteRatesLength);
+       limLog( pMac, LOGW, FL("Supported rates length %d more than "
+                              "the Max limit, reset to Max"),
+                               supporteRatesLength);
        supporteRatesLength = SIR_MAC_RATESET_EID_MAX;
     }
     for (i = 0; i < supporteRatesLength; i++)
@@ -2369,21 +2689,23 @@
             for (j = 0;j < tempRateSet.numRates; j++)
             {
                 if ((tempRateSet2.rate[i] & 0x7F) ==
-                        (tempRateSet.rate[j] & 0x7F))
+                    (tempRateSet.rate[j] & 0x7F))
                 {
+#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
+                    if ((bRateIndex > HAL_NUM_11B_RATES) || (aRateIndex > HAL_NUM_11A_RATES))
+                    {
+                        limLog(pMac, LOGE, FL("Invalid number of rates (11b->%d, 11a->%d)"),
+                               bRateIndex, aRateIndex);
+                        return eSIR_FAILURE;
+                    }
+#endif
                     if (sirIsArate(tempRateSet2.rate[i] & 0x7f))
                     {
                         isArate=1;
-                        if (aRateIndex < SIR_NUM_11A_RATES)
-                            rates->llaRates[aRateIndex++] =
-                                tempRateSet2.rate[i];
+                        rates->llaRates[aRateIndex++] = tempRateSet2.rate[i];
                     }
                     else
-                    {
-                        if (bRateIndex < SIR_NUM_11B_RATES)
-                            rates->llbRates[bRateIndex++] =
-                                tempRateSet2.rate[i];
-                    }
+                        rates->llbRates[bRateIndex++] = tempRateSet2.rate[i];
                     break;
                 }
             }
@@ -2412,12 +2734,10 @@
         for (i=0; i<val; i++)
             pStaDs->supportedRates.supportedMCSSet[i] = mcsSet[i] & pSupportedMCSSet[i];
 
-        limLog(pMac, LOG1, FL("MCS Rate Set Bitmap from CFG and DPH:"));
+        PELOG2(limLog(pMac, LOG2, FL("limPopulateMatchingRateSet: MCS Rate Set Bitmap from CFG and DPH :"));)
         for (i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
         {
-            limLog(pMac, LOG1, FL("%x %x"),
-                               mcsSet[i],
-                               pStaDs->supportedRates.supportedMCSSet[i]);
+            PELOG2(limLog(pMac, LOG2,FL("%x %x "), mcsSet[i], pStaDs->supportedRates.supportedMCSSet[i]);)
         }
     }
 
@@ -2524,25 +2844,7 @@
     {
         pStaDs->mlmStaContext.htCapability = 1 ;
         pStaDs->htGreenfield = htCaps->greenField ;
-        /* pStaDs->htSupportedChannelWidthSet should have the base channel
-         * capability. The htSupportedChannelWidthSet of the TDLS link on
-         * base channel should be less than or equal to channel width of
-         * STA-AP link. So take this setting from the psessionEntry.
-         */
-        limLog(pMac, LOG1,
-               FL("supportedChannelWidthSet %x htSupportedChannelWidthSet %x"),
-               htCaps->supportedChannelWidthSet,
-               psessionEntry->htSupportedChannelWidthSet);
-
-        pStaDs->htSupportedChannelWidthSet =
-                (htCaps->supportedChannelWidthSet <
-                  psessionEntry->htSupportedChannelWidthSet) ?
-                      htCaps->supportedChannelWidthSet :
-                      psessionEntry->htSupportedChannelWidthSet;
-
-        limLog(pMac, LOG1, FL("pStaDs->htSupportedChannelWidthSet %x"),
-               pStaDs->htSupportedChannelWidthSet);
-
+        pStaDs->htSupportedChannelWidthSet =  htCaps->supportedChannelWidthSet ;
         pStaDs->htMIMOPSState =             htCaps->mimoPowerSave ;
         pStaDs->htMaxAmsduLength =  htCaps->maximalAMSDUsize;
         pStaDs->htAMpduDensity =    htCaps->mpduDensity;
@@ -2568,11 +2870,17 @@
     {
         pStaDs->mlmStaContext.vhtCapability = 1 ;
 
-        pStaDs->vhtSupportedChannelWidthSet =
-                    psessionEntry->vhtTxChannelWidthSet;
-
-        limLog(pMac, LOG1, FL("Vht supported channel width is set to = %d"),
-               pStaDs->vhtSupportedChannelWidthSet);
+        if ((psessionEntry->currentOperChannel <= SIR_11B_CHANNEL_END) &&
+            pMac->roam.configParam.enableVhtFor24GHz)
+        {
+            pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
+            pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
+        }
+        else
+        {
+            pStaDs->vhtSupportedChannelWidthSet =  WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
+            pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ ;
+        }
 
         pStaDs->vhtLdpcCapable = pVhtCaps->ldpcCodingCap;
         pStaDs->vhtBeamFormerCapable= pVhtCaps->suBeamFormerCap;
@@ -2596,13 +2904,12 @@
         pStaDs->htSecondaryChannelOffset = limGetHTCBState(cbMode);
     }
 #endif
-
+    
     pSessStaDs = dphLookupHashEntry(pMac, psessionEntry->bssId, &aid, 
                                           &psessionEntry->dph.dphHashTable) ;
 
     /* Lets enable QOS parameter */
-    pStaDs->qosMode = (pTdlsAddStaReq->capability & CAPABILITIES_QOS_OFFSET) ||
-                       pTdlsAddStaReq->htcap_present;
+    pStaDs->qosMode    = 1;
     pStaDs->wmeEnabled = 1;
     pStaDs->lleEnabled = 0;
     /*  TDLS Dummy AddSTA does not have qosInfo , is it OK ??
@@ -2626,9 +2933,1337 @@
     return ; 
 }
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
 /*
- * Add STA for TDLS setup procedure
+ * find Peer in setup link list.
  */
+ 
+tANI_U8 limTdlsFindLinkPeer(tpAniSirGlobal pMac, tSirMacAddr peerMac, 
+                                            tLimTdlsLinkSetupPeer  **setupPeer)
+{
+    tLimTdlsLinkSetupInfo *setupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
+    tLimTdlsLinkSetupPeer *linkSetupList = setupInfo->tdlsLinkSetupList ;
+    tANI_U8 checkNode = TDLS_NODE_NOT_FOUND ; 
+
+    while (linkSetupList != NULL)
+    {
+        if (vos_mem_compare((tANI_U8 *) peerMac,
+                            (tANI_U8 *) linkSetupList->peerMac,
+                            sizeof(tSirMacAddr)) )
+        {
+            checkNode = TDLS_NODE_FOUND ;
+            *setupPeer = linkSetupList ;
+            break ;
+        }
+        linkSetupList = linkSetupList->next;
+    }
+
+    return ((TDLS_NODE_FOUND ==  checkNode) ? eSIR_SUCCESS : eSIR_FAILURE ) ;
+}
+
+/*
+ * find peer in Discovery list.
+ * Dicovery list get populated in two instances, a) Recieved responses in reply
+ * to discovery request b) If discover request is received from TDLS peer STA
+ */
+tSirTdlsPeerInfo *limTdlsFindDisPeer(tpAniSirGlobal pMac, tSirMacAddr peerMac)
+{
+    tLimDisResultList *discoveryList = pMac->lim.gLimTdlsDisResultList ;
+    tSirTdlsPeerInfo *peerInfo = NULL ;
+
+    while (discoveryList != NULL)
+    {
+        peerInfo = &discoveryList->tdlsDisPeerInfo ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+         ("Peer in discovery list = " MAC_ADDRESS_STR),
+          MAC_ADDR_ARRAY(peerInfo->peerMac));
+
+        if (vos_mem_compare((tANI_U8 *) peerMac,
+                       (tANI_U8 *) &peerInfo->peerMac, sizeof(tSirMacAddr)) )
+        {
+            break ;
+        }
+        discoveryList = discoveryList->next;
+    }
+
+    return peerInfo ;
+}
+
+/*
+ * find peer in Discovery list by looking into peer state.
+ * Dicovery list get populated in two instances, a) Recieved responses in reply
+ * to discovery request b) If discover request is received from TDLS peer STA
+ */
+static tSirTdlsPeerInfo *limTdlsFindDisPeerByState(tpAniSirGlobal pMac, 
+                                                                tANI_U8 state)
+{
+    tLimDisResultList *discoveryList = pMac->lim.gLimTdlsDisResultList ;
+    tSirTdlsPeerInfo *peerInfo = NULL ;
+
+    while (discoveryList != NULL)
+    {
+        peerInfo = &discoveryList->tdlsDisPeerInfo ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                     ("peerInfo Mac = " MAC_ADDRESS_STR),
+                      MAC_ADDR_ARRAY(peerInfo->peerMac));
+
+        if (peerInfo->tdlsPeerState == state)
+        {
+            break ;
+        }
+        discoveryList = discoveryList->next;
+    }
+
+    return peerInfo ;
+}
+
+/*
+ * find peer in Setup list by looking into peer state.
+ * setup list get populated in two instances, a) Recieved responses in reply
+ * to setup request b) If discover request is received from TDLS peer STA
+ */
+static tANI_U8 limTdlsFindSetupPeerByState(tpAniSirGlobal pMac, tANI_U8 state, 
+                                              tLimTdlsLinkSetupPeer **setupPeer)
+{    
+
+    tLimTdlsLinkSetupInfo *setupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
+    tLimTdlsLinkSetupPeer *linkSetupList = setupInfo->tdlsLinkSetupList ;
+    tANI_U8 checkNode = TDLS_NODE_NOT_FOUND ; 
+
+    while (linkSetupList != NULL)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                 ("peer state = %02x"), (linkSetupList)->tdls_link_state) ;
+        if((linkSetupList)->tdls_link_state == state) 
+        {
+            checkNode = TDLS_NODE_FOUND ;
+            *setupPeer = linkSetupList ;
+            break ;
+        }
+        linkSetupList = (linkSetupList)->next;
+    }
+
+    return ((TDLS_NODE_FOUND == checkNode) ? eSIR_SUCCESS: eSIR_FAILURE) ;
+}
+
+
+/*
+ * delete Peer from Setup Link
+ */
+void limTdlsDelLinkPeer(tpAniSirGlobal pMac, tSirMacAddr peerMac)
+{
+    tLimTdlsLinkSetupInfo *setupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
+    tLimTdlsLinkSetupPeer **linkSetupList = &setupInfo->tdlsLinkSetupList ;
+    tLimTdlsLinkSetupPeer *currentNode = NULL ;
+    tLimTdlsLinkSetupPeer *prevNode = NULL ;
+
+    for(currentNode = *linkSetupList ; currentNode != NULL ;
+                    prevNode = currentNode, currentNode = currentNode->next)
+    {
+        if (vos_mem_compare( (tANI_U8 *) peerMac,
+                        (tANI_U8 *) currentNode->peerMac, 
+                                                 sizeof(tSirMacAddr)) )
+        {
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                    ("Del Node for Peer = " MAC_ADDRESS_STR),
+                     MAC_ADDR_ARRAY(currentNode->peerMac));
+            /* if it's first Node */
+            if(NULL == prevNode)
+            {
+                *linkSetupList = currentNode->next ;
+            }
+            else
+            {
+                prevNode->next = currentNode->next ;
+            }
+            vos_mem_free(currentNode) ;
+            return ;
+        }
+    }
+        
+    return ;
+}
+   
+
+
+/*
+ * TDLS discovery request frame received from TDLS peer STA..
+ */
+static tSirRetStatus limProcessTdlsDisReqFrame(tpAniSirGlobal pMac, 
+                                    tANI_U8 *pBody, tANI_U32 frmLen )
+{
+    tDot11fTDLSDisReq tdlsDisReq = {{0}} ;
+    tANI_U32 status = 0 ;
+    tLimDisResultList *tdlsDisResult = NULL ; 
+    tLimDisResultList **disResultList = &pMac->lim.gLimTdlsDisResultList ;
+    tSirMacAddr peerMac = {0} ;
+    tLimTdlsLinkSetupPeer *setupPeer = NULL ;
+    tSirTdlsPeerInfo *peerInfo = NULL ;
+    tpPESession psessionEntry = NULL ;
+    tANI_U8 sessionId = 0 ;
+
+    status = dot11fUnpackTDLSDisReq(pMac, pBody, frmLen, &tdlsDisReq) ;
+
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN, 
+            ("TDLS dis request dialog = %d"), tdlsDisReq.DialogToken.token);
+
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse TDLS discovery Request "
+                              "frame (0x%08x, %d bytes):"),status, frmLen);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+        limLog( pMac, LOGW, FL("There were warnings while unpacking a TDLS "
+                               "discovery Request frame (0x%08x, %d bytes):"),
+                   status, frmLen );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);)
+    }
+
+    /*
+     * find session entry using BSSID in link identifier, not using MAC
+     * header beacuse, there is cases in TDLS, there may be BSSID will not
+     * be present in header
+     */
+    psessionEntry = peFindSessionByBssid(pMac, 
+                         &tdlsDisReq.LinkIdentifier.bssid[0], &sessionId) ;
+    if(NULL == psessionEntry)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                 ("no Session entry for TDLS session (bssid "MAC_ADDR_ARRAY")"),
+                  MAC_ADDR_ARRAY(tdlsDisReq.LinkIdentifier.bssid));
+
+        //VOS_ASSERT(0) ;
+        return eSIR_FAILURE;
+    }
+ 
+    /* varify BSSID */
+    status = vos_mem_compare( &psessionEntry->bssId[0],
+                    &tdlsDisReq.LinkIdentifier.bssid[0], sizeof(tSirMacAddr)) ;
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+            ("lim BSSID "MAC_ADDRESS_STR),
+             MAC_ADDR_ARRAY( psessionEntry->bssId));
+
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+            ("Dis req from BSSID "MAC_ADDRESS_STR),
+             MAC_ADDR_ARRAY(tdlsDisReq.LinkIdentifier.bssid));
+    if(!status)
+    {
+        limLog( pMac, LOGE, FL("TDLS discovery request frame from other BSS -> something wrong. Check RXP filter")) ;
+
+        return eSIR_FAILURE ; 
+    }
+
+    /*
+     * check if this is echo of our transmitted discovery request
+     * drop it here, TODO: better to drop this in TL.
+     */    
+    status = vos_mem_compare( psessionEntry->selfMacAddr,
+                    &tdlsDisReq.LinkIdentifier.InitStaAddr[0],
+                                                     sizeof(tSirMacAddr)) ;
+    if(status)
+    {
+        limLog( pMac, LOGE, FL("Echo of our TDLS discovery request frame")) ;
+        return eSIR_FAILURE ; 
+    }
+
+    /*
+     * while processing Discovery request from Peer,
+     * STA_MAC--> MAC of TDLS discovery initiator
+     * STA_PEER_MAC--> MAC of TDLS discovery responder.
+     */
+    vos_mem_copy( peerMac,
+                        &tdlsDisReq.LinkIdentifier.InitStaAddr[0], 
+                                                     sizeof(tSirMacAddr)) ;
+    /* TODO, do more validation */
+    
+    /* see if discovery is already in progress */
+    peerInfo = limTdlsFindDisPeer(pMac, peerMac) ;
+
+    if(NULL == peerInfo)
+    {    
+        /*
+         * we are allocating peer info for individual peers found in TDLS
+         * discovery, we need to keep adding TDLS peers till we have timed
+         * out. We are freeing this memory at the time we are sending this
+         * collected peer info to SME.
+         */
+        tdlsDisResult = vos_mem_malloc(sizeof(tLimDisResultList));
+        if ( NULL == tdlsDisResult )
+        {
+            limLog(pMac, LOGP, FL("alloc fail for TDLS discovery "
+                                  "reponse info")) ;
+            return eSIR_FAILURE ;
+        }
+
+ 
+        peerInfo = &tdlsDisResult->tdlsDisPeerInfo ;
+        peerInfo->tdlsPeerState = TDLS_DIS_REQ_PROCESS_STATE ;
+        peerInfo->dialog = tdlsDisReq.DialogToken.token ;
+
+        peerInfo->sessionId = psessionEntry->peSessionId;
+        
+        /* Populate peer info of tdls discovery result */
+        vos_mem_copy( peerInfo->peerMac, peerMac, sizeof(tSirMacAddr)) ;
+
+         /*
+         * Now, as per D13, there will not be any Supp rates, ext Supp rates
+         * info in Discovery request frames, so we are populating this info
+         * locally to pass it to ADD STA.
+         */
+        do
+        {
+            tDot11fIESuppRates suppRates = {0} ;
+            tDot11fIEExtSuppRates extSuppRates = {0} ;
+            tANI_U16 caps = 0 ;
+            tDot11fFfCapabilities capsInfo = {0} ;
+            tDot11fIEHTCaps HTCaps = {0} ;
+            /* populate supported rate IE */
+            PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, 
+                                                  &suppRates, psessionEntry );
+            ConvertSuppRates( pMac, &peerInfo->tdlsPeerSuppRates, 
+                                                            &suppRates);
+            /* Populate extended supported rates */
+            PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
+                                &extSuppRates, psessionEntry );
+
+            peerInfo->ExtRatesPresent = 1;
+            ConvertExtSuppRates( pMac, &peerInfo->tdlsPeerExtRates, 
+                                                          &extSuppRates);
+ 
+            if(cfgGetCapabilityInfo(pMac, &caps, psessionEntry) != eSIR_SUCCESS)
+            {
+                /*
+                 * Could not get Capabilities value
+                 * from CFG. Log error.
+                 */
+                 limLog(pMac, LOGP,
+                   FL("could not retrieve Capabilities value"));
+            }
+            swapBitField16(caps, ( tANI_U16* )&capsInfo );
+            /* update Caps Info */
+            tdlsUpdateCapInfo(&peerInfo->capabilityInfo, &capsInfo) ;
+
+            PopulateDot11fHTCaps( pMac, psessionEntry, &HTCaps );
+            limTdlsCovertHTCaps(pMac, peerInfo, &HTCaps) ;
+
+        } while (0) ;
+    
+        /* now add this new found discovery node into tdls discovery list */
+        tdlsDisResult->next = *disResultList ;
+        *disResultList = tdlsDisResult ;
+        pMac->lim.gLimTdlsDisStaCount++ ; 
+
+        /* See if for this peer already entry in setup Link */ 
+        limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
+
+        /* 
+         * if there is no entry for this peer in setup list, we need to 
+         * do add sta for this peer to transmit discovery rsp.
+         */ 
+        if(NULL == setupPeer)
+        {
+            /* To start with, send add STA request to HAL */
+            pMac->lim.gLimAddStaTdls = true ;
+            peerInfo->delStaNeeded = true ;
+
+            if(eSIR_FAILURE == limTdlsDisAddSta(pMac, peerMac, 
+                                                     peerInfo, psessionEntry))
+            {
+                VOS_ASSERT(0) ;
+                limLog(pMac, LOGE, "Add STA for dis response is failed ") ;
+                return eSIR_FAILURE ;
+            }
+        } /* use setup link sta ID for discovery rsp */
+        else
+        {
+            peerInfo->delStaNeeded = false ;
+            limSendTdlsDisRspFrame(pMac, peerInfo->peerMac, peerInfo->dialog,
+                                   psessionEntry, NULL, 0);
+            peerInfo->tdlsPeerState = TDLS_DIS_RSP_SENT_WAIT_STATE ;
+        }
+
+    }
+    else
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                    ("discovery procedure in progress for this peer")) ;
+    } 
+
+    return eSIR_SUCCESS ;
+}
+
+/* Process TDLS setup Request Frame */
+
+static tSirRetStatus limProcessTdlsSetupReqFrame(tpAniSirGlobal pMac, 
+                                         tANI_U8 *pBody, tANI_U32 frmLen)
+{
+
+    tDot11fTDLSSetupReq tdlsSetupReq = {{0}} ;
+    tANI_U32 status = 0 ;
+    tpPESession psessionEntry = NULL ;
+    tANI_U8 sessionId = 0 ;
+    tANI_U8 currentState = TDLS_LINK_SETUP_WAIT_STATE ;
+    tANI_U8 previousState = TDLS_LINK_IDLE_STATE ;
+    /* create node for Link setup */
+    tLimTdlsLinkSetupInfo *linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
+    tLimTdlsLinkSetupPeer *setupPeer = NULL ;
+    tLimTdlsLinkSetupPeer *tmpSetupPeer = NULL ;
+
+    status = dot11fUnpackTDLSSetupReq(pMac, pBody, frmLen, &tdlsSetupReq) ;
+
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse TDLS discovery Request "
+                              "frame (0x%08x, %d bytes):"),status, frmLen);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+        limLog( pMac, LOGW, FL("There were warnings while unpacking a TDLS "
+                      "setup Request frame (0x%08x, %d bytes):"),
+                   status, frmLen );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);)
+    }
+    /*
+     * find session entry using BSSID in link identifier, not using MAC
+     * header beacuse, there is cases in TDLS, there may be BSSID will not
+     * be present in header
+     */
+    psessionEntry = peFindSessionByBssid(pMac, 
+                         &tdlsSetupReq.LinkIdentifier.bssid[0], &sessionId) ;
+    if(NULL == psessionEntry)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                 ("no Session entry for TDLS session (bssid "
+                  MAC_ADDRESS_STR")"),
+                  MAC_ADDR_ARRAY(tdlsSetupReq.LinkIdentifier.bssid));
+
+        //VOS_ASSERT(0) ;
+        return eSIR_FAILURE ;
+    }
+    /* TODO: we don;t need this check now, varify BSSID */
+    status = vos_mem_compare( psessionEntry->bssId,
+                    &tdlsSetupReq.LinkIdentifier.bssid[0], 
+                                                     sizeof(tSirMacAddr)) ;
+     
+    if(!status)
+    {
+        limLog( pMac, LOGE, FL("TDLS setup request frame from other BSS -> something wrong. Check RXP filter")) ;
+
+        limSendTdlsSetupRspFrame(pMac, tdlsSetupReq.LinkIdentifier.InitStaAddr,
+                                 tdlsSetupReq.DialogToken.token, psessionEntry,
+                                 TDLS_SETUP_STATUS_FAILURE, NULL, 0 ) ;
+        return eSIR_FAILURE ; 
+    }
+
+#ifdef FEATURE_WLAN_TDLS_NEGATIVE
+    if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_RSP_TIMEOUT_TO_SETUP_REQ) 
+    {
+        /* simply ignore this setup request packet */
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+        ("TDLS negative running: ignore TDLS Setup Req packet"));
+        return eSIR_SUCCESS ;
+    }
+    if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_SEND_REQ_TO_SETUP_REQ)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+        ("TDLS negative running: send TDLS Setup Req to peer TDLS Setup Req"));
+        /* format TDLS discovery request frame and transmit it */
+        limSendTdlsLinkSetupReqFrame(pMac, tdlsSetupReq.LinkIdentifier.InitStaAddr, tdlsSetupReq.DialogToken.token, psessionEntry,
+            NULL, 0) ;
+    }    
+#endif
+    /* TODO, do more validation */
+    
+    if(!limTdlsFindLinkPeer(pMac, 
+                  &tdlsSetupReq.LinkIdentifier.InitStaAddr[0],
+                                                  &tmpSetupPeer))
+    {
+        tANI_U32 tdlsStateStatus = TDLS_LINK_SETUP_START_STATE ;
+
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                        ("Link is already setup with this peer" )) ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                        ("state = %d"), tmpSetupPeer->tdls_link_state) ;
+        //return eSIR_FAILURE ; 
+
+        if(tmpSetupPeer == NULL)
+        {
+            VOS_ASSERT(0) ;
+            return eSIR_FAILURE ; 
+            
+        }
+        switch(tmpSetupPeer->tdls_link_state)
+        {
+
+            case TDLS_LINK_SETUP_START_STATE:
+            {
+                v_SINT_t macCompare = 0 ;
+                macCompare= vos_mem_compare2(tmpSetupPeer->peerMac, 
+                           psessionEntry->selfMacAddr, sizeof(tSirMacAddr)) ;
+                VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                        ("MAC comparison Rslt = %d"), macCompare ) ;
+                if(0 > macCompare)
+                {
+                    /* 
+                     * Delete our Setup Request/Peer info and honour Peer 
+                     * Setup Request, go ahead and respond for this 
+                     */
+                    /* Deactivate the timer */
+                    tx_timer_deactivate(&tmpSetupPeer->gLimTdlsLinkSetupRspTimeoutTimer) ;
+#ifdef FEATURE_WLAN_TDLS_NEGATIVE
+                    if((pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_SEND_REQ_TO_SETUP_REQ) 
+                        != LIM_TDLS_NEGATIVE_SEND_REQ_TO_SETUP_REQ)
+#endif
+                    limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, 
+                            tmpSetupPeer->peerMac, eWNI_SME_TDLS_LINK_START_RSP);
+
+                    limTdlsDelLinkPeer(pMac, tmpSetupPeer->peerMac) ;
+                    tdlsStateStatus = TDLS_LINK_IDLE_STATE ;
+                }
+                else if(0 < macCompare)
+                {
+                    /* 
+                     * Go ahead with current setup as peer is going to 
+                     * respond for setup request 
+                     */
+                    tdlsStateStatus = TDLS_LINK_SETUP_START_STATE ;
+                }
+                else
+                {
+                    /* same MAC, not possible */
+                    VOS_ASSERT(0) ;
+                }
+            
+                break ;
+            }
+#if 1
+            case TDLS_LINK_SETUP_DONE_STATE:
+            {
+                tpDphHashNode pStaDs = NULL ;
+
+                previousState = TDLS_LINK_SETUP_WAIT_STATE ;
+                currentState = TDLS_LINK_TEARDOWN_START_STATE ;
+                VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                        ("link Setup Done state "  )) ;
+                tmpSetupPeer->tdls_prev_link_state =  previousState ;
+                tmpSetupPeer->tdls_link_state = currentState ;
+                setupPeer = tmpSetupPeer ;
+#if 0                
+                /* Send Teardown to this Peer and Initiate new TDLS Setup */
+                limSendTdlsTeardownFrame(pMac, 
+                      &tdlsSetupReq.LinkIdentifier.InitStaAddr[0], 
+                        eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry) ;
+#else
+                
+                /* tdls_hklee: send message to HAL before it is deleted, cause  */
+                limTdlsLinkTeardown(pMac, (setupPeer)->peerMac) ;
+
+                /* send del STA to remove context for this TDLS STA */
+                pStaDs = limTdlsDelSta(pMac, (setupPeer)->peerMac, psessionEntry) ;
+
+                /* now send indication to SME-->HDD->TL to remove STA from TL */
+
+                if(pStaDs)
+                {
+                    limSendSmeTdlsDelPeerInd(pMac, psessionEntry->smeSessionId,
+                                                           pStaDs, eSIR_SUCCESS) ;
+
+                    /* send Teardown Ind to SME */
+                    limSendSmeTdlsTeardownRsp(pMac, eSIR_SUCCESS, (setupPeer)->peerMac,
+                                                  eWNI_SME_TDLS_TEARDOWN_IND) ;
+                    /* remove node from setup list */
+                    limTdlsDelLinkPeer(pMac, (setupPeer)->peerMac) ;
+                }
+#endif
+                //setupPeer->tdls_prev_link_state = TDLS_LINK_SETUP_RESTART_STATE;
+                tdlsStateStatus = TDLS_LINK_IDLE_STATE ;
+                break ;
+
+            }
+            default:
+            {
+                VOS_ASSERT(0) ;
+                VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                        ("link Setup is Recieved in unknown state" )) ;
+                break ;
+            }
+#endif
+        }
+        if(tdlsStateStatus == TDLS_LINK_SETUP_START_STATE) 
+            return eSIR_FAILURE ;
+    }
+
+    if(currentState != TDLS_LINK_TEARDOWN_START_STATE)
+    {  
+        /* 
+         * Now we are sure to send discovery response frame to TDLS discovery 
+         * initiator, we don't care, if this request is unicast ro broadcast,
+         * we simply, send discovery response frame on direct link.
+         */
+        setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
+        if ( NULL == setupPeer )
+        {
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                                 ( "Unable to allocate memory during ADD_STA" ));
+            return eSIR_MEM_ALLOC_FAILED;
+        }
+
+        setupPeer->dialog = tdlsSetupReq.DialogToken.token ;
+        //setupPeer->tdls_prev_link_state =  setupPeer->tdls_link_state ;
+        //setupPeer->tdls_link_state = TDLS_LINK_SETUP_WAIT_STATE ;
+        setupPeer->tdls_prev_link_state =  previousState ;
+        setupPeer->tdls_link_state = currentState ;
+        /* TDLS_sessionize: remember sessionId for future */
+        setupPeer->tdls_sessionId = psessionEntry->peSessionId;
+        setupPeer->tdls_bIsResponder = 0;
+
+        vos_mem_copy(setupPeer->peerMac,
+                     &tdlsSetupReq.LinkIdentifier.InitStaAddr[0], 
+                                                     sizeof(tSirMacAddr)) ;
+
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                   ("Setup REQ MAC = " MAC_ADDRESS_STR),
+                    MAC_ADDR_ARRAY(setupPeer->peerMac));
+ 
+        limTdlsUpdateLinkReqPeerInfo(pMac, setupPeer, &tdlsSetupReq) ;
+        pMac->lim.gLimAddStaTdls = true ;
+
+        /* To start with, send add STA request to HAL */
+        if(eSIR_FAILURE == limTdlsSetupAddSta(pMac, setupPeer->peerMac, 
+                                                  setupPeer, psessionEntry))
+        {
+            VOS_ASSERT(0) ;
+            vos_mem_free((void **) &setupPeer) ;
+            return eSIR_FAILURE ;
+        }
+
+        limSendTdlsSetupRspFrame(pMac, tdlsSetupReq.LinkIdentifier.InitStaAddr,
+                                  tdlsSetupReq.DialogToken.token, psessionEntry,
+                                  TDLS_SETUP_STATUS_SUCCESS, NULL, 0) ;
+
+        limStartTdlsTimer(pMac, psessionEntry->peSessionId, 
+                                  &setupPeer->gLimTdlsLinkSetupCnfTimeoutTimer,
+                               (tANI_U32)setupPeer->peerMac,
+                                 WNI_CFG_TDLS_LINK_SETUP_CNF_TIMEOUT,
+                                   SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT) ;
+
+        /* update setup peer list */
+        setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
+        linkSetupInfo->tdlsLinkSetupList = setupPeer ;
+    }
+    else
+    {
+        setupPeer->dialog = tdlsSetupReq.DialogToken.token ;
+        //setupPeer->tdls_prev_link_state =  setupPeer->tdls_link_state ;
+        //setupPeer->tdls_link_state = TDLS_LINK_SETUP_WAIT_STATE ;
+        setupPeer->tdls_prev_link_state =  previousState ;
+        setupPeer->tdls_link_state = currentState ;
+        /* TDLS_sessionize: remember sessionId for future */
+        setupPeer->tdls_sessionId = psessionEntry->peSessionId;
+        setupPeer->tdls_bIsResponder = 0;
+
+        vos_mem_copy( setupPeer->peerMac,
+                     &tdlsSetupReq.LinkIdentifier.InitStaAddr[0], 
+                                                     sizeof(tSirMacAddr)) ;
+
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                   ("Setup REQ MAC = "MAC_ADDRESS_STR),
+                    MAC_ADDR_ARRAY(setupPeer->peerMac));
+ 
+        limTdlsUpdateLinkReqPeerInfo(pMac, setupPeer, &tdlsSetupReq) ;
+        limSendTdlsSetupRspFrame(pMac, tdlsSetupReq.LinkIdentifier.InitStaAddr, 
+                                 tdlsSetupReq.DialogToken.token, psessionEntry,
+                                 TDLS_SETUP_STATUS_SUCCESS, NULL, 0) ;
+
+        limStartTdlsTimer(pMac, psessionEntry->peSessionId, 
+                                  &setupPeer->gLimTdlsLinkSetupCnfTimeoutTimer,
+                               (tANI_U32)setupPeer->peerMac,
+                                 WNI_CFG_TDLS_LINK_SETUP_CNF_TIMEOUT,
+                                   SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT) ;
+    }
+ 
+   
+    return eSIR_SUCCESS ;
+
+}
+
+/*
+ * TDLS discovery request frame received from TDLS peer STA..
+ */
+static tSirRetStatus limProcessTdlsSetupRspFrame(tpAniSirGlobal pMac, 
+                                            tANI_U8 *pBody, tANI_U32 frmLen )
+{
+    tDot11fTDLSSetupRsp tdlsSetupRsp = {{0}} ;
+    tANI_U32 status = 0 ;
+    tSirMacAddr peerMac = {0} ;
+    tLimTdlsLinkSetupPeer *setupPeer = NULL ;
+    tpPESession psessionEntry = NULL ;
+    tANI_U8 sessionId = 0 ;
+
+    status = dot11fUnpackTDLSSetupRsp(pMac, pBody, frmLen, &tdlsSetupRsp) ;
+
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse TDLS discovery Request "
+                              "frame (0x%08x, %d bytes):"),status, frmLen);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+        limLog( pMac, LOGW, FL("There were warnings while unpacking a TDLS "
+                               "discovery Request frame (0x%08x, %d bytes):"),
+                   status, frmLen );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);)
+    }
+
+    /*
+     * find session entry using BSSID in link identifier, not using MAC
+     * header beacuse, there is cases in TDLS, there may be BSSID will not
+     * be present in header
+     */
+    psessionEntry = peFindSessionByBssid(pMac, 
+                         &tdlsSetupRsp.LinkIdentifier.bssid[0], &sessionId) ;
+    if(NULL == psessionEntry)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                  ("no Session entry for TDLS session (bssid "
+                  MAC_ADDRESS_STR")"),
+                  MAC_ADDR_ARRAY(tdlsSetupRsp.LinkIdentifier.bssid));
+
+        //VOS_ASSERT(0) ;
+        return eSIR_FAILURE;
+    }
+  
+    /* varify BSSID */
+    status = vos_mem_compare( psessionEntry->bssId,
+                    &tdlsSetupRsp.LinkIdentifier.bssid[0], 
+                                                  sizeof(tSirMacAddr)) ;
+     
+    if(!status)
+    {
+        limLog( pMac, LOGE, FL("TDLS discovery request frame from other BSS -> something wrong. Check RXP filter")) ;
+
+        VOS_ASSERT(0) ;
+        return eSIR_FAILURE ; 
+    }
+    vos_mem_copy( peerMac,
+                      &tdlsSetupRsp.LinkIdentifier.RespStaAddr[0], 
+                                                     sizeof(tSirMacAddr)) ;
+
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+             ("TDLS setup RSP peer = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(peerMac));
+    limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
+
+    if(NULL == setupPeer)
+    {
+        limLog( pMac, LOGE, FL("unknown setup Response frame other BSS")) ;
+        return eSIR_FAILURE ;
+    }
+                                                
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                                      ("deactivating Setup RSP timer")) ;
+
+    /* Deactivate the timer */
+    tx_timer_deactivate(&(setupPeer)->gLimTdlsLinkSetupRspTimeoutTimer) ;
+
+    /*
+     * TDLS Setup RSP is recieved with Failure, Delete this STA entry
+     * don't respond with TDLS CNF frame.
+     */
+    if(TDLS_SETUP_STATUS_SUCCESS != tdlsSetupRsp.Status.status)
+    {
+        limTdlsDelLinkPeer(pMac, (setupPeer)->peerMac) ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                                    ("setup RSP with Failure Code")) ;
+        return eSIR_FAILURE ;
+    }    
+    
+    /* update Link Info */
+    limTdlsUpdateLinkRspPeerInfo(pMac, setupPeer, &tdlsSetupRsp) ;
+ 
+    /* TODO, do more validation */
+    
+
+    /* 
+     * Now we are sure to send link setup CNF  frame to TDLS link setup 
+     * reponded, now we will create dph hash entry and send add STA to HAL
+     */
+
+    pMac->lim.gLimAddStaTdls = true ;
+    if(eSIR_FAILURE == limTdlsSetupAddSta(pMac, peerMac,  
+                                                 setupPeer, psessionEntry))
+    {
+       /* through error */
+       VOS_ASSERT(0) ;
+       return eSIR_FAILURE ;
+    } 
+    /* TDLS_HKLEE_FIXME: now we add some delay for AddSta_Rsp comes */
+    
+         
+    /* send TDLS confim frame to TDLS Peer STA */           
+    limSendTdlsLinkSetupCnfFrame(pMac, peerMac, tdlsSetupRsp.DialogToken.token, 0, psessionEntry, NULL, 0) ;
+
+    /* 
+     * set the tdls_link_state to TDLS_LINK_SETUP_RSP_WAIT_STATE, and
+     * wait for Setup CNF transmission on air, once we receive tx complete
+     * message, we will change the peer state and send message to SME 
+     * callback..
+     */
+    (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
+    (setupPeer)->tdls_link_state = TDLS_LINK_SETUP_RSP_WAIT_STATE ;
+
+    return eSIR_SUCCESS ;
+}
+/*
+ * TDLS setup CNF  frame processing ..
+ */
+
+static tSirRetStatus limProcessTdlsSetupCnfFrame(tpAniSirGlobal pMac, 
+                                            tANI_U8 *pBody, tANI_U32 frmLen)
+{
+    tDot11fTDLSSetupCnf tdlsSetupCnf = {{0}} ;
+    tANI_U32 status = 0 ;
+    tLimTdlsLinkSetupPeer *setupPeer = NULL ;
+    tpPESession psessionEntry = NULL ;
+    tANI_U8 sessionId = 0 ;
+
+    status = dot11fUnpackTDLSSetupCnf(pMac, pBody, frmLen, &tdlsSetupCnf) ;
+
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse an TDLS discovery Response "
+                              "frame (0x%08x, %d bytes):"),status, frmLen);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+        limLog( pMac, LOGW, FL("There were warnings while unpacking a TDLS "
+                               "discovery Response frame (0x%08x, %d bytes):"),
+                   status, frmLen );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);)
+    }
+    /*
+     * find session entry using BSSID in link identifier, not using MAC
+     * header beacuse, there is cases in TDLS, there may be BSSID will not
+     * be present in header
+     */
+    psessionEntry = peFindSessionByBssid(pMac, 
+                         &tdlsSetupCnf.LinkIdentifier.bssid[0], &sessionId) ;
+    if(NULL == psessionEntry)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                  ("no Session entry for TDLS session (bssid "
+                  MAC_ADDRESS_STR")"),
+                  MAC_ADDR_ARRAY(tdlsSetupCnf.LinkIdentifier.bssid));
+
+        //VOS_ASSERT(0) ;
+        return eSIR_FAILURE;
+    }
+ 
+    /* varify BSSID */
+    status = vos_mem_compare( psessionEntry->bssId,
+                    &tdlsSetupCnf.LinkIdentifier.bssid[0], 
+                                                     sizeof(tSirMacAddr)) ;
+
+    if(!status)
+    {
+        limLog( pMac, LOGE, FL("TDLS setup CNF frame other BSS -> something wrong. Check RXP filter")) ;
+
+        VOS_ASSERT(0) ;
+        return eSIR_FAILURE ; 
+    }
+    /* TODO, do more validation */
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+               ("setup Cnf peer MAc = "MAC_ADDRESS_STR),
+                MAC_ADDR_ARRAY(tdlsSetupCnf.LinkIdentifier.InitStaAddr));
+    
+    limTdlsFindLinkPeer(pMac, 
+                   &tdlsSetupCnf.LinkIdentifier.InitStaAddr[0],
+                            &setupPeer) ;
+
+    if(NULL == setupPeer)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                                          (" unknown setup CNF frame")) ;
+        VOS_ASSERT(0) ;
+        return eSIR_FAILURE ;
+    }
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                   ("setup CNF peer MAC = "MAC_ADDRESS_STR),
+                    MAC_ADDR_ARRAY((setupPeer)->peerMac));
+    /*T match dialog token, before proceeding further */
+    if((setupPeer)->dialog != tdlsSetupCnf.DialogToken.token)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                          ("setup CNF frame not matching with setup RSP")) ;
+        VOS_ASSERT(0) ;
+        return eSIR_FAILURE ;
+    }
+
+    /* 
+     * Now we are sure that, this set CNF is for us, now stop 
+     * the running timer..
+     */
+    tx_timer_deactivate(&(setupPeer)->gLimTdlsLinkSetupCnfTimeoutTimer) ;
+
+    /* change TDLS peer State */
+    (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
+    (setupPeer)->tdls_link_state = TDLS_LINK_SETUP_DONE_STATE ; 
+
+    /* send indication to SME that, new link is setup */
+    limSendSmeTdlsLinkSetupInd(pMac, (setupPeer)->peerMac, eSIR_SUCCESS) ;
+
+    /* tdls_hklee: prepare PTI template and send it to HAL */
+    limTdlsLinkEstablish(pMac, (setupPeer)->peerMac);
+
+    return eSIR_SUCCESS ; 
+
+}
+
+/*
+ * TDLS discovery response frame processing ..
+ */
+
+static tSirRetStatus limProcessTdlsDisRspFrame(tpAniSirGlobal pMac, 
+                              tANI_U8 *pBody, tANI_U32 frmLen, 
+                                 tANI_S8 rssi, tpPESession psessionEntry)
+{
+    tDot11fTDLSDisRsp tdlsDisRsp = {{0}} ;
+    tANI_U32 status = 0 ;
+    tLimDisResultList *tdlsDisResult = NULL ; 
+    tLimDisResultList **disResultList = &pMac->lim.gLimTdlsDisResultList ;
+    tSirTdlsDisReq *prevDisReq = &pMac->lim.gLimTdlsDisReq ;
+
+    status = dot11fUnpackTDLSDisRsp(pMac, pBody, frmLen, &tdlsDisRsp) ;
+
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse an TDLS discovery Response "
+                              "frame (0x%08x, %d bytes):"),status, frmLen);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+        limLog( pMac, LOGW, FL("There were warnings while unpacking a TDLS "
+                               "discovery Response frame (0x%08x, %d bytes):"),
+                   status, frmLen );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
+    }
+    /*TODO:  match dialog token, before proceeding further */
+
+    /* varify BSSID */
+    status = vos_mem_compare( psessionEntry->bssId,
+                    &tdlsDisRsp.LinkIdentifier.bssid[0], 
+                                                     sizeof(tSirMacAddr)) ;
+
+    if(!status)
+    {
+        limLog( pMac, LOGW, FL(" TDLS discovery Response frame other BSS")) ;
+        return eSIR_FAILURE ; 
+    }
+    /* TODO, do more validation */
+  
+    if(tdlsDisRsp.DialogToken.token != prevDisReq->dialog)
+    {
+        limLog( pMac, LOGW, FL(" wrong TDLS discovery Response frame")) ;
+        return eSIR_FAILURE ;
+    } 
+
+    pMac->lim.gLimTdlsDisStaCount++ ;
+
+    /*
+     * we are allocating peer info for individual peers found in TDLS
+     * discovery, we need to keep adding TDLS peers till we have timed
+     * out. We are freeing this memory at the time we are sending this
+     * collected peer info to SME.
+     */
+    tdlsDisResult = vos_mem_malloc(sizeof(tLimDisResultList));
+    if ( NULL == tdlsDisResult )
+    {
+        limLog(pMac, LOGP, FL("alloc fail for TDLS discovery reponse info")) ;
+        return eSIR_FAILURE ;
+    }
+
+    do
+    {
+        tSirTdlsPeerInfo *peerInfo = &tdlsDisResult->tdlsDisPeerInfo ;
+
+        /* Populate peer info of tdls discovery result */
+        peerInfo->sessionId = psessionEntry->peSessionId;
+        /*
+         * When we receive DIS RSP from peer MAC,
+         * STA_MAC_OFFSET will carry peer MAC address and PEER MAC OFFSET
+         * will carry our MAC.
+         */
+        vos_mem_copy( peerInfo->peerMac,
+                    &tdlsDisRsp.LinkIdentifier.RespStaAddr[0], 
+                                                     sizeof(tSirMacAddr)) ;
+
+        /* update RSSI for this TDLS peer STA */
+        peerInfo->tdlsPeerRssi = rssi ;
+
+        /* update Caps Info */
+        tdlsUpdateCapInfo(&peerInfo->capabilityInfo,
+                                          &tdlsDisRsp.Capabilities) ;
+
+        /* update Supp rates */
+        if(tdlsDisRsp.SuppRates.present)
+        { 
+            ConvertSuppRates( pMac, &peerInfo->tdlsPeerSuppRates, 
+                                             &tdlsDisRsp.SuppRates );
+        }
+
+        /* update EXT supp rates */
+        if(tdlsDisRsp.ExtSuppRates.present) 
+        {
+            peerInfo->ExtRatesPresent = 1;
+            ConvertExtSuppRates( pMac, &peerInfo->tdlsPeerExtRates, 
+                                                    &tdlsDisRsp.ExtSuppRates );
+        }
+        /* update HT caps */
+        if (tdlsDisRsp.HTCaps.present)
+        {
+            vos_mem_copy( &peerInfo->tdlsPeerHtCaps, &tdlsDisRsp.HTCaps,
+                                               sizeof( tDot11fIEHTCaps ) );
+        }
+    } while(0) ;
+
+    /* now add this new found discovery node into tdls discovery list */
+    tdlsDisResult->next = *disResultList ;
+    *disResultList = tdlsDisResult ; 
+
+    return eSIR_SUCCESS ; 
+}
+
+/* 
+ * Process TDLS Teardown request frame from TDLS peer STA
+ */
+static tSirRetStatus limProcessTdlsTeardownFrame(tpAniSirGlobal pMac, 
+                                      tANI_U8 *pBody, tANI_U32 frmLen )
+{
+    tDot11fTDLSTeardown tdlsTeardown = {{0}} ;
+    tANI_U32 status = 0 ;
+    tLimTdlsLinkSetupPeer *setupPeer = NULL ;
+    tpPESession psessionEntry = NULL ;
+    tANI_U8 sessionId = 0 ;
+
+    status = dot11fUnpackTDLSTeardown(pMac, pBody, frmLen, &tdlsTeardown) ;
+
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog(pMac, LOGE, FL("Failed to parse an TDLS discovery Response "
+                              "frame (0x%08x, %d bytes):"),status, frmLen);
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);)
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+        limLog( pMac, LOGW, FL("There were warnings while unpacking a TDLS "
+                               "discovery Response frame (0x%08x, %d bytes):"),
+                   status, frmLen );
+        PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);)
+    }
+
+    /*
+     * find session entry using BSSID in link identifier, not using MAC
+     * header beacuse, there is cases in TDLS, there may be BSSID will not
+     * be present in header
+     */
+    psessionEntry = peFindSessionByBssid(pMac, 
+                         &tdlsTeardown.LinkIdentifier.bssid[0], &sessionId) ;
+    if(NULL == psessionEntry)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                  ("no Session entry for TDLS session (bssid "
+                  MAC_ADDRESS_STR")"),
+                  MAC_ADDR_ARRAY(tdlsTeardown.LinkIdentifier.bssid));
+
+        //VOS_ASSERT(0) ;
+        return eSIR_FAILURE;
+    }
+ 
+    /* varify BSSID */
+    status = vos_mem_compare( psessionEntry->bssId,
+                                  &tdlsTeardown.LinkIdentifier.bssid[0], 
+                                                     sizeof(tSirMacAddr)) ;
+
+
+    if(!status)
+    {
+        limLog( pMac, LOGE, FL("Teardown from other BSS -> something wrong. Check RXP filter")) ;
+        VOS_ASSERT(0) ;
+        return eSIR_FAILURE ; 
+    }
+    
+    limTdlsFindLinkPeer(pMac, 
+                     &tdlsTeardown.LinkIdentifier.InitStaAddr[0],
+                                            &setupPeer) ;
+
+    if(NULL == setupPeer)
+    {
+        //ignore
+        //VOS_ASSERT(0) ;
+        limLog( pMac, LOGE, FL("Teardown from unknown peer. --> ignored") );
+        
+        return eSIR_FAILURE ;
+    }
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                     ("teardown for peer "MAC_ADDRESS_STR),
+                          MAC_ADDR_ARRAY((setupPeer)->peerMac));
+
+    switch(tdlsTeardown.Reason.code)
+    {
+        case eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON:
+        {
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                                 ("teardown with unspecified reason")) ;
+            break ;
+        }
+        case eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE:
+        {
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                       (" Teardown from AP, TDLS peer unreachable")) ;
+            break ;
+        }
+        default:
+        {
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                                            (" unknown teardown")) ;
+            break ;
+        }
+    }
+
+    /* change TDLS peer State */
+    (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
+    (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ; 
+
+    do
+    {
+        tpDphHashNode pStaDs = NULL ;
+
+        /* tdls_hklee: send message to HAL before it is deleted, cause  */
+        limTdlsLinkTeardown(pMac, (setupPeer)->peerMac) ;
+
+        /* send del STA to remove context for this TDLS STA */
+        pStaDs = limTdlsDelSta(pMac, (setupPeer)->peerMac, psessionEntry) ;
+
+        /* now send indication to SME-->HDD->TL to remove STA from TL */
+
+        if(pStaDs)
+        {
+            limSendSmeTdlsDelPeerInd(pMac, psessionEntry->smeSessionId,
+                                                   pStaDs, eSIR_SUCCESS) ;
+      
+            /* send Teardown Ind to SME */
+            limSendSmeTdlsTeardownRsp(pMac, eSIR_SUCCESS, (setupPeer)->peerMac,
+                                          eWNI_SME_TDLS_TEARDOWN_IND) ;
+            /* remove node from setup list */
+            limTdlsDelLinkPeer(pMac, (setupPeer)->peerMac) ;
+        }
+
+    }while(0) ;
+    
+    return status ;
+}
+
+/*
+ * Common processing of TDLS action frames recieved 
+ */
+void limProcessTdlsFrame(tpAniSirGlobal pMac, tANI_U32 *pBd)
+{
+    tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd);
+    tANI_U8 pOffset = ((0 == WDA_GET_RX_FT_DONE(pBd)) 
+                         ? (( sizeof( eth_890d_header ))) :(0)) ;
+
+    tANI_U8 category   = (pBody + pOffset + PAYLOAD_TYPE_TDLS_SIZE)[0] ; 
+    tANI_U8 action     =   (pBody + pOffset + PAYLOAD_TYPE_TDLS_SIZE)[1] ; 
+    tANI_U32 frameLen  = WDA_GET_RX_PAYLOAD_LEN(pBd) ;
+    tANI_U8 *tdlsFrameBody = (pBody + pOffset + PAYLOAD_TYPE_TDLS_SIZE) ;
+    //tANI_S8 rssi = (tANI_S8)SIR_MAC_BD_TO_RSSI_DB(pBd);
+
+    if(category != SIR_MAC_ACTION_TDLS)
+    {
+        limLog( pMac, LOGE, FL("Invalid TDLS action frame=(%d). Ignored"), category );
+        return ; 
+    }
+
+    frameLen -= (pOffset + PAYLOAD_TYPE_TDLS_SIZE) ;
+    LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, ("Received TDLS action %d (%s)"),
+        action, limTraceTdlsActionString(action) ));
+
+    switch(action)
+    {
+
+        case SIR_MAC_TDLS_SETUP_REQ:
+        {
+            limProcessTdlsSetupReqFrame(pMac, tdlsFrameBody, frameLen) ;
+            break ;
+        }
+        case SIR_MAC_TDLS_SETUP_RSP:
+        {
+            limProcessTdlsSetupRspFrame(pMac, tdlsFrameBody, frameLen) ;
+            break ;
+        }
+        case SIR_MAC_TDLS_SETUP_CNF:
+        {
+            limProcessTdlsSetupCnfFrame(pMac, tdlsFrameBody, frameLen) ; 
+            break ;
+        }
+        case SIR_MAC_TDLS_TEARDOWN: 
+        {
+            limProcessTdlsTeardownFrame(pMac, tdlsFrameBody, frameLen) ; 
+            break ;
+        }
+        case SIR_MAC_TDLS_DIS_REQ:
+        {
+            limProcessTdlsDisReqFrame(pMac, tdlsFrameBody, frameLen) ;
+            break ;
+        }
+        case SIR_MAC_TDLS_PEER_TRAFFIC_IND:
+        case SIR_MAC_TDLS_CH_SWITCH_REQ:      
+        case SIR_MAC_TDLS_CH_SWITCH_RSP:    
+        case SIR_MAC_TDLS_PEER_TRAFFIC_RSP:
+        default:
+        {
+            break ;
+        }
+    }
+    
+    return ;    
+}
+
+/*
+ * ADD sta for dis response fame sent on direct link
+ */
+static tSirRetStatus limTdlsDisAddSta(tpAniSirGlobal pMac, tSirMacAddr peerMac, 
+                          tSirTdlsPeerInfo *peerInfo, tpPESession psessionEntry)
+{
+    tpDphHashNode pStaDs = NULL ;
+    tSirRetStatus status = eSIR_SUCCESS ;
+    tANI_U16 aid = 0 ;
+
+    if(NULL == peerInfo)
+    {
+        VOS_ASSERT(0) ;
+        return status ;
+
+    } 
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+               ("ADD STA peer MAC: "MAC_ADDRESS_STR),
+                MAC_ADDR_ARRAY(peerMac));
+
+
+    if(NULL != dphLookupHashEntry(pMac, peerMac, 
+                                  &aid, &psessionEntry->dph.dphHashTable))
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                    (" there is hash entry for this client")) ;
+        status = eSIR_FAILURE ;
+        VOS_ASSERT(0) ;
+        return status ;
+    }
+
+    aid = limAssignPeerIdx(pMac, psessionEntry) ;
+
+    /* Set the aid in peerAIDBitmap as it has been assigned to TDLS peer */
+    SET_PEER_AID_BITMAP(psessionEntry->peerAIDBitmap, aid);
+
+    pStaDs = dphGetHashEntry(pMac, aid, &psessionEntry->dph.dphHashTable);
+
+    if (pStaDs)
+    {
+        (void) limDelSta(pMac, pStaDs, false /*asynchronous*/, psessionEntry);
+        limDeleteDphHashEntry(pMac, pStaDs->staAddr, aid, psessionEntry);
+    }
+    pStaDs = dphAddHashEntry(pMac, peerMac, aid, 
+                                         &psessionEntry->dph.dphHashTable) ;
+
+    if(NULL == pStaDs)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                    (" add hash entry failed")) ;
+        status = eSIR_FAILURE ;
+        VOS_ASSERT(0) ;
+        return status;
+    }
+    if(eSIR_SUCCESS == status)
+    {
+#ifdef TDLS_RATE_DEBUG
+        tSirMacRateSet *suppRates = &peerInfo->tdlsPeerSuppRates ;
+        tSirMacRateSet *extRates = &peerInfo->tdlsPeerExtRates ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                                  ("pSta DS [%p] "), pStaDs) ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                   ("peerInfo->tdlsPeerSuppRates = [%p]"),
+                        (tANI_U8 *)&peerInfo->tdlsPeerSuppRates) ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+               ("peerInfo->tdlsPeerExtRates = [%p]"),
+                        (tANI_U8 *)&peerInfo->tdlsPeerExtRates) ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+              ("peerInfo->tdlsPeerPropRates = [%p]"),
+                        (tANI_U8 *)&pStaDs->mlmStaContext.propRateSet) ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+              ("peerInfo->mcs = [%p]"),
+                        (tANI_U8 *)peerInfo->supportedMCSSet) ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                  ("num of supp rates = %02x"), suppRates->numRates) ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+                      ("num of ext rates = %01x"), extRates->numRates) ;
+#endif
+
+        /* Populate matching rate set */
+#ifdef WLAN_FEATURE_11AC
+        if(eSIR_FAILURE == limPopulateMatchingRateSet(pMac, pStaDs, 
+                                    &peerInfo->tdlsPeerSuppRates,
+                                      &peerInfo->tdlsPeerExtRates, 
+                                        peerInfo->supportedMCSSet,
+                                         &pStaDs->mlmStaContext.propRateSet, 
+                                                              psessionEntry, NULL))
+#else
+        if(eSIR_FAILURE == limPopulateMatchingRateSet(pMac, pStaDs, 
+                                    &peerInfo->tdlsPeerSuppRates,
+                                      &peerInfo->tdlsPeerExtRates, 
+                                        peerInfo->supportedMCSSet,
+                                         &pStaDs->mlmStaContext.propRateSet, 
+                                                              psessionEntry))
+#endif
+        {
+            VOS_ASSERT(0) ;
+        }
+
+
+        pStaDs->mlmStaContext.capabilityInfo = peerInfo->capabilityInfo;
+        vos_mem_copy( pStaDs->staAddr, peerMac, sizeof(tSirMacAddr)) ;
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+                ("Add STA for Peer: "MAC_ADDRESS_STR),
+                 MAC_ADDR_ARRAY(pStaDs->staAddr));
+    
+
+        pStaDs->staType = STA_ENTRY_TDLS_PEER ;
+
+        status = limAddSta(pMac, pStaDs, false, psessionEntry);
+
+        if(eSIR_SUCCESS != status)
+        {
+            /* should not fail */
+            VOS_ASSERT(0) ;
+        }
+    }
+  
+    return status ;
+}
+#endif
+/*
+ * Add STA for TDLS setup procedure 
+ */ 
 static tSirRetStatus limTdlsSetupAddSta(tpAniSirGlobal pMac,
                                         tSirTdlsAddStaReq *pAddStaReq,
                                         tpPESession psessionEntry)
@@ -2645,16 +4280,18 @@
 
         if( !aid )
         {
-            limLog(pMac, LOGE, FL("No more free AID for peer " MAC_ADDRESS_STR),
-                               MAC_ADDR_ARRAY(pAddStaReq->peerMac));
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+              ("%s: No more free AID for peer " MAC_ADDRESS_STR),
+                __func__, MAC_ADDR_ARRAY(pAddStaReq->peerMac)) ;
             return eSIR_FAILURE;
         }
 
         /* Set the aid in peerAIDBitmap as it has been assigned to TDLS peer */
         SET_PEER_AID_BITMAP(psessionEntry->peerAIDBitmap, aid);
 
-        limLog(pMac, LOG1, FL("Aid = %d, for peer =" MAC_ADDRESS_STR),
-                           aid, MAC_ADDR_ARRAY(pAddStaReq->peerMac));
+        VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL,
+              ("limTdlsSetupAddSta: Aid = %d, for peer =" MAC_ADDRESS_STR),
+                aid, MAC_ADDR_ARRAY(pAddStaReq->peerMac));
         pStaDs = dphGetHashEntry(pMac, aid, &psessionEntry->dph.dphHashTable);
 
         if (pStaDs)
@@ -2668,7 +4305,8 @@
 
         if(NULL == pStaDs)
         {
-            limLog(pMac, LOGE, FL("add hash entry failed"));
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                        (" add hash entry failed")) ;
             VOS_ASSERT(0) ;
             return eSIR_FAILURE;
         }
@@ -2704,19 +4342,573 @@
     if(pStaDs)
     {
     
-        limLog(pMac, LOG1, FL("DEL STA peer MAC: "MAC_ADDRESS_STR),
-                           MAC_ADDR_ARRAY(pStaDs->staAddr));
-        limLog(pMac, LOG1, FL("STA type = %x, sta idx = %x"),
-                           pStaDs->staType,
-                           pStaDs->staIndex);
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+             ("DEL STA peer MAC: "MAC_ADDRESS_STR),
+                                  MAC_ADDR_ARRAY(pStaDs->staAddr));
+
+        VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL,
+                   ("limTdlsDelSta: STA type = %x, sta idx = %x"),pStaDs->staType,
+                                                           pStaDs->staIndex) ;
         limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS,
                             eSIR_MAC_PEER_TIMEDOUT_REASON);
         status = limDelSta(pMac, pStaDs, false, psessionEntry) ;
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+        if(eSIR_SUCCESS == status)
+        {
+            limDeleteDphHashEntry(pMac, pStaDs->staAddr, peerIdx, psessionEntry) ;
+            limReleasePeerIdx(pMac, peerIdx, psessionEntry) ;
+        }
+        else
+        {
+            VOS_ASSERT(0) ;
+        }
+#endif
     }
            
     return pStaDs ;
 }
      
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/* 
+* Prepare link establish message for HAL, construct PTI template.
+*
+*/   
+static tSirRetStatus limTdlsLinkEstablish(tpAniSirGlobal pMac, tSirMacAddr peerMac)
+{
+    tANI_U8             pFrame[64] ;
+    tDot11fTDLSPeerTrafficInd tdlsPtiTemplate ;
+    tANI_U32            status = 0 ;
+    tANI_U32            nPayload = 0 ;
+    tANI_U32            nBytes = 0 ;
+    tANI_U32            header_offset = 0 ;
+    tANI_U16            aid = 0 ;
+    tDphHashNode        *pStaDs = NULL ;
+    tLimTdlsLinkSetupPeer *setupPeer = NULL ;
+    tpPESession psessionEntry = NULL ;
+
+
+    limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
+    if(NULL == setupPeer) {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+            ("limTdlsLinkEstablish: cannot find peer mac "
+             "in tdls linksetup list: "MAC_ADDRESS_STR),
+             MAC_ADDR_ARRAY(peerMac));
+        return eSIR_FAILURE;
+    }
+
+    psessionEntry = peFindSessionBySessionId(pMac, 
+                         setupPeer->tdls_sessionId) ;
+
+    if(NULL == psessionEntry) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+             ("limTdlsLinkEstablish: sessionID %d is not found"), setupPeer->tdls_sessionId);
+        VOS_ASSERT(0) ;
+        return eHAL_STATUS_FAILURE;
+    }
+
+
+    pStaDs = dphLookupHashEntry(pMac, peerMac, &aid, &psessionEntry->dph.dphHashTable) ;
+    if(pStaDs == NULL) {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                  ("limTdlsLinkEstablish: cannot find peer mac "
+                   "in tdls linksetup list: "MAC_ADDRESS_STR),
+                   MAC_ADDR_ARRAY(peerMac));
+        return eSIR_FAILURE;
+    }
+
+    vos_mem_set( ( tANI_U8* )&tdlsPtiTemplate,
+               sizeof( tDot11fTDLSPeerTrafficInd ), 0 );
+
+    /*
+    * setup Fixed fields,
+    */
+    tdlsPtiTemplate.Category.category = SIR_MAC_ACTION_TDLS;
+    tdlsPtiTemplate.Action.action     = SIR_MAC_TDLS_PEER_TRAFFIC_IND;
+    tdlsPtiTemplate.DialogToken.token = 0 ; /* filled by firmware at the time of transmission */
+#if 1 
+    /* CHECK_PTI_LINK_IDENTIFIER_INITIATOR_ADDRESS: initator address should be TDLS link setup's initiator address, 
+    then below code makes such an way */
+    PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsPtiTemplate.LinkIdentifier,
+        peerMac, !setupPeer->tdls_bIsResponder) ;
+#else
+   /* below code will make PTI's linkIdentifier's initiator address be selfAddr */
+    PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsPtiTemplate.LinkIdentifier,
+        peerMac, TDLS_INITIATOR) ;
+#endif
+
+    /* PUBufferStatus will be filled by firmware at the time of transmission */
+    tdlsPtiTemplate.PUBufferStatus.present = 1;
+
+    /* TODO: get ExtendedCapabilities IE */
+
+    /* 
+    * now we pack it.  First, how much space are we going to need?
+    */
+    status = dot11fGetPackedTDLSPeerTrafficIndSize ( pMac, &tdlsPtiTemplate, &nPayload);
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog( pMac, LOGP, FL("Failed to calculate the packed size for a PTI template (0x%08x)."), status );
+        /* We'll fall back on the worst case scenario: */
+        nPayload = sizeof( tdlsPtiTemplate );
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+        limLog( pMac, LOGW, FL("There were warnings while calculating the packed size for a PTI template (0x%08x)."), status );
+    }
+
+    /*
+    * This frame is going out from PE as data frames with special ethertype
+    * 89-0d.
+    * 8 bytes of RFC 1042 header
+    */ 
+
+    nBytes = nPayload + sizeof( tSirMacMgmtHdr ) 
+            + sizeof( eth_890d_header ) 
+            + PAYLOAD_TYPE_TDLS_SIZE ;
+
+    if(nBytes > 64) {
+        limLog( pMac, LOGE, FL("required memory for PTI frame is %ld, but reserved only 64."), nBytes);
+        nBytes = 64;
+    }
+    /* zero out the memory */
+    vos_mem_set( pFrame, sizeof(pFrame), 0 );
+
+    /* fill out the buffer descriptor */
+
+    header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, 
+        LINK_IDEN_ADDR_OFFSET(tdlsPtiTemplate), TDLS_LINK_AP, !setupPeer->tdls_bIsResponder, psessionEntry) ;
+
+    status = dot11fPackTDLSPeerTrafficInd ( pMac, &tdlsPtiTemplate, pFrame 
+        + header_offset, nPayload, &nPayload );
+
+    if ( DOT11F_FAILED( status ) )
+    {
+        limLog( pMac, LOGE, FL("Failed to pack a PTI template (0x%08x)."),
+                status );
+        return eSIR_FAILURE;
+    }
+    else if ( DOT11F_WARNED( status ) )
+    {
+        limLog( pMac, LOGW, FL("There were warnings while packing TDLS "
+                               "Peer Traffic Indication (0x%08x)."), status );
+    }
+
+    LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, ("bIsResponder=%d, header_offset=%ld, linkIdenOffset=%d, ptiBufStatusOffset=%d "),
+        setupPeer->tdls_bIsResponder, header_offset, PTI_LINK_IDEN_OFFSET, PTI_BUF_STATUS_OFFSET));
+
+    limSendTdlsLinkEstablish(pMac, setupPeer->tdls_bIsResponder, 
+        header_offset+PTI_LINK_IDEN_OFFSET, header_offset+PTI_BUF_STATUS_OFFSET, 
+      nBytes, pFrame, (tANI_U8 *)&setupPeer->tdlsPeerExtCaps);
+
+    return eSIR_SUCCESS;
+}
+
+/* 
+* Prepare link teardown message for HAL from peer_mac
+*
+*/   
+static tSirRetStatus limTdlsLinkTeardown(tpAniSirGlobal pMac, tSirMacAddr peerMac)
+{
+    tDphHashNode        *pStaDs = NULL ;
+    tANI_U16            aid = 0 ;
+    tLimTdlsLinkSetupPeer *setupPeer = NULL ;
+    tpPESession psessionEntry = NULL ;
+
+
+    limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
+    if(NULL == setupPeer) {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                  ("limTdlsLinkTeardown: cannot find peer mac "
+                   "in tdls linksetup list: "
+                   MAC_ADDRESS_STR), MAC_ADDR_ARRAY(peerMac));
+        return eSIR_FAILURE;
+    }
+
+    psessionEntry = peFindSessionBySessionId(pMac, 
+                         setupPeer->tdls_sessionId) ;
+
+    if(NULL == psessionEntry) 
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+             ("limTdlsLinkTeardown: sessionID %d is not found"), setupPeer->tdls_sessionId);
+        VOS_ASSERT(0) ;
+        return eHAL_STATUS_FAILURE;
+    }
+
+
+
+    pStaDs = dphLookupHashEntry(pMac, peerMac, &aid, &psessionEntry->dph.dphHashTable);
+
+    if(pStaDs == NULL) {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                  ("limTdlsLinkTeardown: cannot find peer mac "
+                   "in hash table: "
+                   MAC_ADDRESS_STR), MAC_ADDR_ARRAY(peerMac));
+        return eSIR_FAILURE;
+    }
+
+    limSendTdlsLinkTeardown(pMac, pStaDs->staIndex);
+
+    return eSIR_SUCCESS;
+}
+
+/* 
+ * Prepare Discovery RSP message for SME, collect peerINfo for all the 
+ * peers discovered and delete/clean discovery lists in PE.
+ */   
+ 
+static tSirTdlsDisRsp *tdlsPrepareTdlsDisRsp(tpAniSirGlobal pMac, 
+                                 tSirTdlsDisRsp *disRsp, tANI_U8 disStaCount) 
+{
+    tANI_U32 disMsgRspSize = sizeof(tSirTdlsDisRsp);
+    tANI_U8 status = eHAL_STATUS_SUCCESS ;
+
+    /*
+     * allocate memory for tdls discovery response, allocated memory should
+     * be alloc_mem = tdlsStaCount * sizeof(peerinfo) 
+     *                              + siezeof tSirTdlsDisRsp.
+     */
+    disMsgRspSize += (disStaCount * sizeof(tSirTdlsPeerInfo));
+        
+    /* now allocate memory */
+
+    disRsp = vos_mem_malloc(disMsgRspSize);
+    if ( NULL == disRsp )
+    {
+        limLog(pMac, LOGP, FL("AllocateMemory failed for DIS RSP"));
+        return NULL ;
+    }
+        
+    if(disStaCount)
+    { 
+        tLimDisResultList *tdlsDisRspList = pMac->lim.gLimTdlsDisResultList ;
+        tSirTdlsPeerInfo *peerInfo = &disRsp->tdlsDisPeerInfo[0] ;
+            
+        tLimDisResultList *currentNode = tdlsDisRspList ;
+        while(tdlsDisRspList != NULL)
+        {
+
+            vos_mem_copy( (tANI_U8 *)peerInfo,
+                          (tANI_U8 *) &tdlsDisRspList->tdlsDisPeerInfo, 
+                                                 sizeof(tSirTdlsPeerInfo));
+        
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, 
+            ("Msg Sent to PE, peer MAC: "MAC_ADDRESS_STR),
+                                  MAC_ADDR_ARRAY(peerInfo->peerMac));
+            disStaCount-- ;
+            peerInfo++ ;
+            currentNode = tdlsDisRspList ;
+            tdlsDisRspList = tdlsDisRspList->next ;
+            vos_mem_free(currentNode) ;
+            /* boundary condition check, may be fatal */
+            if(((!disStaCount) && (tdlsDisRspList)) 
+                            || ((!tdlsDisRspList) && disStaCount))
+            {
+                limLog(pMac, LOG1, FL("mismatch in dis sta count and "
+                                      "number of nodes in list")) ;
+                VOS_ASSERT(0) ;
+                return NULL ;
+            } 
+        } /* end  of while */
+
+        /* All discovery STA processed */
+        pMac->lim.gLimTdlsDisResultList = NULL ;
+
+    } /* end of if dis STA count */
+    
+    return (disRsp) ;
+}
+
+/* Send Teardown response back to PE */
+
+void limSendSmeTdlsTeardownRsp(tpAniSirGlobal pMac, tSirResultCodes statusCode,
+                                        tSirMacAddr peerMac, tANI_U16 msgType)
+{
+    tSirMsgQ  mmhMsg = {0} ;
+    tSirTdlsTeardownRsp *teardownRspMsg = NULL ;
+    tANI_U8 status = eHAL_STATUS_SUCCESS ;
+    
+    mmhMsg.type = msgType ;
+
+    teardownRspMsg = vos_mem_malloc(sizeof(tSirTdlsTeardownRsp));
+    if ( NULL == teardownRspMsg )
+    {
+        VOS_ASSERT(0) ;
+    } 
+    vos_mem_copy( teardownRspMsg->peerMac, (tANI_U8 *)peerMac,
+                                                   sizeof(tSirMacAddr)) ;
+    teardownRspMsg->statusCode =  statusCode ;
+    mmhMsg.bodyptr = teardownRspMsg ;
+    mmhMsg.bodyval = 0;
+    limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+    return ;
+
+}
+
+/*
+ * Send Link start RSP back to SME after link is setup or failed
+ */
+void limSendSmeTdlsLinkStartRsp(tpAniSirGlobal pMac,
+                                         tSirResultCodes statusCode,
+                                          tSirMacAddr peerMac, 
+                                                 tANI_U16 msgType)
+{
+    tSirMsgQ  mmhMsg = {0} ;
+    tSirTdlsLinksetupRsp *setupRspMsg = NULL ;
+    tANI_U8 status = eHAL_STATUS_SUCCESS ;
+
+    mmhMsg.type = msgType ;
+
+    setupRspMsg = vos_mem_malloc(sizeof(tSirTdlsLinksetupRsp));
+    if ( NULL == setupRspMsg )
+    {
+        VOS_ASSERT(0) ;
+    } 
+
+    vos_mem_copy( setupRspMsg->peerMac, (tANI_U8 *)peerMac,
+                                                   sizeof(tSirMacAddr)) ;
+    setupRspMsg->statusCode =  statusCode ;
+    mmhMsg.bodyptr = setupRspMsg ;
+    mmhMsg.bodyval = 0;
+    limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+    return ;
+}
+
+/*
+ * Send TDLS discovery RSP back to SME 
+ */
+void limSendSmeTdlsDisRsp(tpAniSirGlobal pMac, tSirResultCodes statusCode,
+                                                          tANI_U16 msgType)
+{
+    tSirMsgQ  mmhMsg = {0} ;
+    tSirTdlsDisRsp *tdlsDisRsp = NULL ;
+
+    mmhMsg.type = msgType ;
+
+    if(eSIR_SME_SUCCESS == statusCode)
+    {
+        tANI_U8 tdlsStaCount = pMac->lim.gLimTdlsDisStaCount ;
+
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                    ("no of TDLS STA discovered: %d"), tdlsStaCount) ;
+        tdlsDisRsp = tdlsPrepareTdlsDisRsp(pMac, tdlsDisRsp, tdlsStaCount) ;
+
+        if(tdlsDisRsp)
+        {
+            tdlsDisRsp->numDisSta = tdlsStaCount ;
+        }
+        else
+        {
+            limLog(pMac, LOGP, FL("fatal failure for TDLS DIS RSP"));
+            VOS_ASSERT(0) ; 
+            return ;
+        }
+        /* all Discovery STA is processed */
+        pMac->lim.gLimTdlsDisStaCount = 0 ;
+    }
+    else
+    {
+        tdlsDisRsp = tdlsPrepareTdlsDisRsp(pMac, tdlsDisRsp, 0) ;
+    }
+
+    tdlsDisRsp->statusCode =  statusCode ;
+    mmhMsg.bodyptr = tdlsDisRsp ;
+    mmhMsg.bodyval = 0;
+    limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+     return ;
+}
+
+/* 
+ * Once Link is setup with PEER, send Add STA ind to SME
+ */
+static eHalStatus limSendSmeTdlsAddPeerInd(tpAniSirGlobal pMac, 
+                   tANI_U8 sessionId, tDphHashNode   *pStaDs, tANI_U8 status)
+{
+    tSirMsgQ  mmhMsg = {0} ;
+    tSirTdlsPeerInd *peerInd = NULL ;
+    mmhMsg.type = eWNI_SME_ADD_TDLS_PEER_IND ;
+
+    peerInd = vos_mem_malloc(sizeof(tSirTdlsPeerInd));
+    if ( NULL == peerInd )
+    {
+        PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
+        return eSIR_FAILURE;
+    }
+
+    vos_mem_copy( peerInd->peerMac,
+                           (tANI_U8 *) pStaDs->staAddr, sizeof(tSirMacAddr));
+    peerInd->sessionId = sessionId;
+    peerInd->staId = pStaDs->staIndex ;
+    peerInd->ucastSig = pStaDs->ucUcastSig ;
+    peerInd->bcastSig = pStaDs->ucBcastSig ;
+    peerInd->length = sizeof(tSmeIbssPeerInd) ;
+
+    mmhMsg.bodyptr = peerInd ;
+    mmhMsg.bodyval = 0;
+    limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+    return eSIR_SUCCESS ;
+
+}
+
+/*
+ * Once link is teardown, send Del Peer Ind to SME
+ */
+static eHalStatus limSendSmeTdlsDelPeerInd(tpAniSirGlobal pMac, 
+                    tANI_U8 sessionId, tDphHashNode   *pStaDs, tANI_U8 status)
+{
+    tSirMsgQ  mmhMsg = {0} ;
+    tSirTdlsPeerInd *peerInd = NULL ;
+    mmhMsg.type = eWNI_SME_DELETE_TDLS_PEER_IND ;
+
+    peerInd = vos_mem_malloc(sizeof(tSirTdlsPeerInd));
+    if ( NULL == peerInd )
+    {
+        PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
+        return eSIR_FAILURE;
+    }
+
+    vos_mem_copy( peerInd->peerMac,
+                           (tANI_U8 *) pStaDs->staAddr, sizeof(tSirMacAddr));
+    peerInd->sessionId = sessionId;
+    peerInd->staId = pStaDs->staIndex ;
+    peerInd->ucastSig = pStaDs->ucUcastSig ;
+    peerInd->bcastSig = pStaDs->ucBcastSig ;
+    peerInd->length = sizeof(tSmeIbssPeerInd) ;
+
+    mmhMsg.bodyptr = peerInd ;
+
+    //peerInd->statusCode =  status ;
+    mmhMsg.bodyval = 0;
+    limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+    return eSIR_SUCCESS ;
+
+}
+
+/*
+ * Send Link setup Ind to SME, This is the case where, link setup is 
+ * initiated by peer STA
+ */
+static eHalStatus limSendSmeTdlsLinkSetupInd(tpAniSirGlobal pMac, 
+                                   tSirMacAddr peerMac, tANI_U8 status)
+{
+    tSirMsgQ  mmhMsg = {0} ;
+    tSirTdlsLinkSetupInd *setupInd = NULL ;
+
+    mmhMsg.type = eWNI_SME_TDLS_LINK_START_IND ;
+    setupInd = vos_mem_malloc(sizeof(tSirTdlsLinkSetupInd));
+    if ( NULL == setupInd )
+    {
+        PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
+        return eSIR_FAILURE;
+    }
+
+    vos_mem_copy( setupInd->peerMac,
+                           (tANI_U8 *) peerMac, sizeof(tSirMacAddr));
+    setupInd->length = sizeof(tSirTdlsLinkSetupInd);
+    setupInd->statusCode = status ;
+    mmhMsg.bodyptr = setupInd ;
+    mmhMsg.bodyval = 0;
+    limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+    return eSIR_SUCCESS ;
+
+}
+
+/*
+ * Setup RSP timer handler 
+ */
+void limTdlsLinkSetupRspTimerHandler(void *pMacGlobal, tANI_U32 timerId)
+{
+
+    tANI_U32         statusCode;
+    tSirMsgQ    msg;
+    tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+    /* Prepare and post message to LIM Message Queue */
+
+    msg.type = SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT;
+    msg.bodyptr = NULL ;
+    msg.bodyval = timerId ;
+
+    if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
+        limLog(pMac, LOGE,
+               FL("posting message %X to LIM failed, reason=%d"),
+               msg.type, statusCode);
+    return ;
+}
+
+/*
+ * Link setup CNF timer
+ */
+void limTdlsLinkSetupCnfTimerHandler(void *pMacGlobal, tANI_U32 timerId)
+{
+
+    tANI_U32         statusCode;
+    tSirMsgQ    msg;
+    tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
+
+    // Prepare and post message to LIM Message Queue
+
+    msg.type = SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT;
+    msg.bodyptr = NULL ;
+    msg.bodyval = timerId ;
+
+    if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
+        limLog(pMac, LOGE,
+               FL("posting message %X to LIM failed, reason=%d"),
+               msg.type, statusCode);
+    return ;
+}
+
+/*
+ * start TDLS timer
+ */
+void limStartTdlsTimer(tpAniSirGlobal pMac, tANI_U8 sessionId, TX_TIMER *timer,
+                        tANI_U32 timerId, tANI_U16 timerType, tANI_U32 timerMsg)
+{
+    tANI_U32 cfgValue = (timerMsg == SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT)
+                           ? WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT
+                            : WNI_CFG_TDLS_LINK_SETUP_CNF_TIMEOUT ;
+
+    void *timerFunc = (timerMsg == SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT)
+                                ? (limTdlsLinkSetupRspTimerHandler) 
+                                    : limTdlsLinkSetupCnfTimerHandler ;
+
+    /* TODO: Read timer vals from CFG */
+
+    cfgValue = SYS_MS_TO_TICKS(cfgValue);
+    /*
+     * create TDLS discovery response wait timer and activate it
+     */
+    if (tx_timer_create(timer, "TDLS link setup timers", timerFunc,
+                        timerId, cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS)
+    {
+        limLog(pMac, LOGP,
+           FL("could not create TDLS discovery response wait timer"));
+        return;
+    }
+
+    //assign appropriate sessionId to the timer object
+    timer->sessionId = sessionId; 
+    
+     MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
+                                             eLIM_TDLS_DISCOVERY_RSP_WAIT));
+    if (tx_timer_activate(timer) != TX_SUCCESS)
+    {
+        limLog(pMac, LOGP, FL("TDLS link setup timer activation failed!"));
+        return ;
+    }
+
+    return ;
+
+}
+#endif
+
 /* 
  * Once Link is setup with PEER, send Add STA ind to SME
  */
@@ -2731,7 +4923,7 @@
     addStaRsp = vos_mem_malloc(sizeof(tSirTdlsAddStaRsp));
     if ( NULL == addStaRsp )
     {
-        limLog(pMac, LOGE, FL("Failed to allocate memory"));
+        PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
         return eSIR_FAILURE;
     }
 
@@ -2775,14 +4967,15 @@
     tANI_U16        aid = 0 ;
 
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
-    limLog(pMac, LOG1, FL("staIdx=%d, staMac="MAC_ADDRESS_STR),
-                       pAddStaParams->staIdx,
-                       MAC_ADDR_ARRAY(pAddStaParams->staMac));
+    VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL,
+            ("limTdlsAddStaRsp: staIdx=%d, staMac="MAC_ADDRESS_STR), pAddStaParams->staIdx,
+                            MAC_ADDR_ARRAY(pAddStaParams->staMac));
 
     if (pAddStaParams->status != eHAL_STATUS_SUCCESS)
     {
         VOS_ASSERT(0) ;
-        limLog(pMac, LOGE, FL("Add sta failed "));
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                                                   ("Add sta failed ")) ;
         status = eSIR_FAILURE;
         goto add_sta_error;
     }
@@ -2791,7 +4984,8 @@
                                          &psessionEntry->dph.dphHashTable);
     if(NULL == pStaDs)
     {
-        limLog(pMac, LOGE, FL("pStaDs is NULL "));
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                                                   ("pStaDs is NULL ")) ;
         status = eSIR_FAILURE;
         goto add_sta_error;
     }
@@ -2802,6 +4996,42 @@
     pStaDs->ucBcastSig             = pAddStaParams->ucBcastSig;
     pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
     pStaDs->valid                  = 1 ;
+#ifdef FEATURE_WLAN_TDLS_INTERNAL    
+    status = limSendSmeTdlsAddPeerInd(pMac, psessionEntry->smeSessionId, 
+                                                    pStaDs, eSIR_SUCCESS ) ;
+    if(eSIR_FAILURE == status)
+    {
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                                         ("Peer IND msg to SME failed")) ;
+        vos_mem_free( pAddStaParams );
+        return eSIR_FAILURE ;
+    }
+
+    /* 
+     * Now, there is two things a) ADD STA RSP for ADD STA request sent
+     * after recieving discovery request from Peer.
+     * now we have to send discovery response, if there is any pending
+     * discovery equest..
+     */
+    do
+    {
+        tSirTdlsPeerInfo *peerInfo = limTdlsFindDisPeer(pMac,
+                                            pAddStaParams->staMac) ;
+
+    
+        if(peerInfo)
+        {
+            /* 
+             * send TDLS discovery response frame on direct link, state machine
+             * is rolling.., once discovery response is get Acked, we will 
+             * send response to SME based on TxComplete callback results
+             */ 
+            limSendTdlsDisRspFrame(pMac, peerInfo->peerMac, peerInfo->dialog,
+                                   psessionEntry, NULL, 0);
+            peerInfo->tdlsPeerState = TDLS_DIS_RSP_SENT_WAIT_STATE ;
+        }
+    } while(0) ;
+#endif
 add_sta_error:
     status = limSendSmeTdlsAddStaRsp(pMac, psessionEntry->smeSessionId, 
                                         pAddStaParams->staMac, pAddStaParams->updateSta, pStaDs, status) ;
@@ -2816,7 +5046,7 @@
 {
     tANI_U32   numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN;
     tANI_U8    validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN];
-    tANI_U8    i, j;
+    tANI_U8    i;
     tANI_U8    op_class;
     if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
                           validChan, &numChans) != eSIR_SUCCESS)
@@ -2825,29 +5055,17 @@
          * Could not get Valid channel list from CFG.
          * Log error.
          */
-         limLog(pMac, LOGE, FL("could not retrieve valid channel list"));
-         return;
+         limLog(pMac, LOGP,
+                FL("could not retrieve Valid channel list"));
     }
     suppChannels->num_bands = (tANI_U8) numChans;
 
-    for ( i = 0U, j = 0U; i < suppChannels->num_bands &&
-                          j < LIM_MAX_BANDS; i++)
+    for ( i = 0U; i < suppChannels->num_bands; i++)
     {
-        /* don't populate dfs channels in supported channels ie */
-        if (!(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(validChan[i]))) {
-            suppChannels->bands[j][0] = validChan[i];
-            suppChannels->bands[j][1] = 1;
-            /* store tdls self supported channels */
-            tdlsSelfSupportedChannels[j] = validChan[i];
-            j++;
-        }
+        suppChannels->bands[i][0] = validChan[i];
+        suppChannels->bands[i][1] = 1;
     }
-    /* update the channel list with new length */
-    suppChannels->num_bands = j;
     suppChannels->present = 1 ;
-    /* store tdls self supported channels new length */
-    tdlsSelfNumChans = j;
-
     /*Get present operating class based on current operating channel*/
     op_class = limGetOPClassFromChannel(
                                      pMac->scan.countryCodeCurrent,
@@ -2855,19 +5073,14 @@
                                      psessionEntry->htSecondaryChannelOffset);
     if (op_class == 0)
     {
-        limLog(pMac, LOGE,
-               FL("Present Operating class is wrong, countryCodeCurrent: %s, currentOperChannel: %d, htSecondaryChannelOffset: %d"),
-               pMac->scan.countryCodeCurrent,
-               psessionEntry->currentOperChannel,
-               psessionEntry->htSecondaryChannelOffset);
+        PELOGE(limLog(pMac, LOGE, FL("Present Operating class is Wrong!!!"));)
     }
     else
     {
-        limLog(pMac, LOG1,
-               FL("Present Operating channel=%d offset=%d class=%d"),
-               psessionEntry->currentOperChannel,
-               psessionEntry->htSecondaryChannelOffset,
-               op_class);
+        PELOGE(limLog(pMac, LOG1, FL("Present Operating channel=%d offset=%d class=%d"),
+                      psessionEntry->currentOperChannel,
+                      psessionEntry->htSecondaryChannelOffset,
+                      op_class);)
     }
     suppOperClasses->present = 1;
     suppOperClasses->classes[0] = op_class;
@@ -2928,6 +5141,79 @@
     extCapability->present = 1 ;
     return ;
 }
+                                     
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/*
+ * Public Action frame common processing
+ * This Function will be moved/merged to appropriate place
+ * once other public action frames (particularly 802.11k)
+ * is in place
+ */
+void limProcessTdlsPublicActionFrame(tpAniSirGlobal pMac, tANI_U32 *pBd, 
+                                                  tpPESession psessionEntry)
+{
+    tANI_U32 frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd) ;
+    tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd) ;
+    tANI_S8 rssi = (tANI_S8)WDA_GET_RX_RSSI_DB(pBd) ;
+
+    limProcessTdlsDisRspFrame(pMac, pBody, frameLen, rssi, psessionEntry) ;
+    return ; 
+}
+
+eHalStatus limTdlsPrepareSetupReqFrame(tpAniSirGlobal pMac, 
+                              tLimTdlsLinkSetupInfo *linkSetupInfo,
+                                 tANI_U8 dialog, tSirMacAddr peerMac,
+                                                 tpPESession psessionEntry)
+{
+    tLimTdlsLinkSetupPeer *setupPeer = NULL ;
+
+    /*
+    * we allocate the TDLS setup Peer Memory here, we will free'd this
+    * memory after teardown, if the link is successfully setup or
+    * free this memory if any timeout is happen in link setup procedure
+    */
+
+    setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
+    if ( NULL == setupPeer )
+    {
+        limLog( pMac, LOGP, 
+                  FL( "Unable to allocate memory during ADD_STA" ));
+         VOS_ASSERT(0) ;
+         return eSIR_MEM_ALLOC_FAILED;
+    }
+    setupPeer->dialog = dialog ;
+    setupPeer->tdls_prev_link_state =  setupPeer->tdls_link_state ;
+    setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
+
+    /* TDLS_sessionize: remember sessionId for future */
+    setupPeer->tdls_sessionId = psessionEntry->peSessionId;
+    setupPeer->tdls_bIsResponder = 1;
+
+    /* 
+    * we only populate peer MAC, so it can assit us to find the
+    * TDLS peer after response/or after response timeout
+    */
+    vos_mem_copy(setupPeer->peerMac, peerMac,
+                                              sizeof(tSirMacAddr)) ;
+    /* format TDLS discovery request frame and transmit it */
+    limSendTdlsLinkSetupReqFrame(pMac, peerMac, dialog, psessionEntry, NULL, 0) ;
+
+    limStartTdlsTimer(pMac, psessionEntry->peSessionId, 
+                        &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
+                            (tANI_U32)setupPeer->peerMac, 
+                               WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
+                                 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
+    /* update setup peer list */
+    setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
+    linkSetupInfo->tdlsLinkSetupList = setupPeer ;
+
+    /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to 
+     * SME later when TDLS setup cnf TX complete is successful. --> see 
+     * limTdlsSetupCnfTxComplete() 
+     */
+    return eSIR_SUCCESS ; 
+}
+#endif
 
 /*
  * Process Send Mgmt Request from SME and transmit to AP.
@@ -2941,14 +5227,15 @@
     tANI_U8      sessionId;
     tSirResultCodes resultCode = eSIR_SME_INVALID_PARAMETERS;
 
-    limLog(pMac, LOG1, FL("Send Mgmt Recieved"));
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+            ("Send Mgmt Recieved")) ;
 
     if((psessionEntry = peFindSessionByBssid(pMac, pSendMgmtReq->bssid, &sessionId)) 
             == NULL)
     {
-        limLog(pMac, LOGE,
-               FL("PE Session does not exist for given sme sessionId %d"),
-               pSendMgmtReq->sessionId);
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                "PE Session does not exist for given sme sessionId %d",
+                pSendMgmtReq->sessionId);
         goto lim_tdls_send_mgmt_error;
     }
 
@@ -2969,18 +5256,16 @@
             (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
     {
 
-        limLog(pMac, LOGE, FL("send mgmt received in invalid LIMsme state (%d)"),
-                           psessionEntry->limSmeState);
+        limLog(pMac, LOGE, "send mgmt received in invalid LIMsme "
+                "state (%d)", psessionEntry->limSmeState);
         goto lim_tdls_send_mgmt_error;
     }
-    vos_tdls_tx_rx_mgmt_event(SIR_MAC_ACTION_TDLS,
-              SIR_MAC_ACTION_TX, SIR_MAC_MGMT_ACTION,
-              pSendMgmtReq->reqType, pSendMgmtReq->peerMac);
 
     switch( pSendMgmtReq->reqType )
     {
         case SIR_MAC_TDLS_DIS_REQ:
-            limLog(pMac, LOG1, FL("Transmit Discovery Request Frame"));
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+                    "Transmit Discovery Request Frame") ;
             /* format TDLS discovery request frame and transmit it */
             limSendTdlsDisReqFrame(pMac, pSendMgmtReq->peerMac, pSendMgmtReq->dialog, 
                     psessionEntry) ;
@@ -2988,7 +5273,6 @@
             break;
         case SIR_MAC_TDLS_DIS_RSP:
             {
-                limLog(pMac, LOG1, FL("Transmit Discovery Response Frame"));
                 //Send a response mgmt action frame
                 limSendTdlsDisRspFrame(pMac, pSendMgmtReq->peerMac,
                         pSendMgmtReq->dialog, psessionEntry,
@@ -2999,7 +5283,6 @@
             break;
         case SIR_MAC_TDLS_SETUP_REQ:
             {
-                limLog(pMac, LOG1, FL("Transmit Setup Request Frame"));
                 limSendTdlsLinkSetupReqFrame(pMac,
                         pSendMgmtReq->peerMac, pSendMgmtReq->dialog, psessionEntry,
                         &pSendMgmtReq->addIe[0], (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq))); 
@@ -3008,7 +5291,6 @@
             break;
         case SIR_MAC_TDLS_SETUP_RSP:
             {
-                limLog(pMac, LOG1, FL("Transmit Setup Response Frame"));
                 limSendTdlsSetupRspFrame(pMac, 
                         pSendMgmtReq->peerMac, pSendMgmtReq->dialog, psessionEntry, pSendMgmtReq->statusCode,
                         &pSendMgmtReq->addIe[0], (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq)));
@@ -3017,7 +5299,6 @@
             break;
         case SIR_MAC_TDLS_SETUP_CNF:
             {
-                limLog(pMac, LOG1, FL("Transmit Setup Confirm Frame"));
                 limSendTdlsLinkSetupCnfFrame(pMac, pSendMgmtReq->peerMac, pSendMgmtReq->dialog, pSendMgmtReq->peerCapability,
                         psessionEntry, &pSendMgmtReq->addIe[0], (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq)));  
                 resultCode = eSIR_SME_SUCCESS;
@@ -3025,7 +5306,6 @@
             break;
         case SIR_MAC_TDLS_TEARDOWN:
             {
-                limLog(pMac, LOG1, FL("Transmit Teardown Frame"));
                 limSendTdlsTeardownFrame(pMac,
                         pSendMgmtReq->peerMac, pSendMgmtReq->statusCode, pSendMgmtReq->responder, psessionEntry,
                         &pSendMgmtReq->addIe[0], (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq))); 
@@ -3074,21 +5354,15 @@
     pTdlsLinkEstablishReqRsp = vos_mem_malloc(sizeof(tSirTdlsLinkEstablishReqRsp));
     if ( NULL == pTdlsLinkEstablishReqRsp )
     {
-        limLog(pMac, LOGE, FL("Failed to allocate memory"));
+        PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
         return ;
     }
-
-    vos_mem_zero(pTdlsLinkEstablishReqRsp, sizeof(tSirTdlsLinkEstablishReqRsp));
-
     pTdlsLinkEstablishReqRsp->statusCode = status ;
-    if (pStaDs && peerMac)
+    if ( peerMac )
     {
         vos_mem_copy(pTdlsLinkEstablishReqRsp->peerMac, peerMac, sizeof(tSirMacAddr));
-        pTdlsLinkEstablishReqRsp->sta_idx = pStaDs->staIndex;
     }
-
     pTdlsLinkEstablishReqRsp->sessionId = sessionId;
-
     mmhMsg.type = eWNI_SME_TDLS_LINK_ESTABLISH_RSP ;
     mmhMsg.bodyptr = pTdlsLinkEstablishReqRsp;
     mmhMsg.bodyval = 0;
@@ -3115,18 +5389,12 @@
         PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
         return ;
     }
-
-    vos_mem_zero(pTdlsChanSwitchReqRsp, sizeof(tSirTdlsChanSwitchReqRsp));
-
     pTdlsChanSwitchReqRsp->statusCode = status ;
-    if (pStaDs && peerMac )
+    if ( peerMac )
     {
         vos_mem_copy(pTdlsChanSwitchReqRsp->peerMac, peerMac, sizeof(tSirMacAddr));
-        pTdlsChanSwitchReqRsp->sta_idx = pStaDs->staIndex;;
     }
-
     pTdlsChanSwitchReqRsp->sessionId = sessionId;
-
     mmhMsg.type = eWNI_SME_TDLS_CHANNEL_SWITCH_RSP ;
     mmhMsg.bodyptr = pTdlsChanSwitchReqRsp;
     mmhMsg.bodyval = 0;
@@ -3149,7 +5417,7 @@
     pDelSta = vos_mem_malloc(sizeof(tSirTdlsDelStaRsp));
     if ( NULL == pDelSta )
     {
-        limLog(pMac, LOGE, FL("Failed to allocate memory"));
+        PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
             return eSIR_FAILURE;
     }
 
@@ -3189,14 +5457,15 @@
     tpPESession psessionEntry;
     tANI_U8      sessionId;
 
-    limLog(pMac, LOG1, FL("TDLS Add STA Request Recieved"));
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+                                  ("Send Mgmt Recieved")) ;
 
     if((psessionEntry = peFindSessionByBssid(pMac, pAddStaReq->bssid, &sessionId)) 
                                                                         == NULL)
     {
-         limLog(pMac, LOGE,
-                FL("PE Session does not exist for given sme sessionId %d"),
-                pAddStaReq->sessionId);
+         VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                    "PE Session does not exist for given sme sessionId %d",
+                                                            pAddStaReq->sessionId);
          goto lim_tdls_add_sta_error;
     }
     
@@ -3217,9 +5486,8 @@
                 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
      {
      
-         limLog(pMac, LOGE,
-                FL("Add STA received in invalid LIMsme state (%d)"),
-                psessionEntry->limSmeState);
+         limLog(pMac, LOGE, "send mgmt received in invalid LIMsme "
+                "state (%d)", psessionEntry->limSmeState);
          goto lim_tdls_add_sta_error;
      }
 
@@ -3228,7 +5496,7 @@
      /* To start with, send add STA request to HAL */
      if (eSIR_FAILURE == limTdlsSetupAddSta(pMac, pAddStaReq, psessionEntry))
      {
-         limLog(pMac, LOGE, FL("Add TDLS Station request failed"));
+         limLog(pMac, LOGE, "%s: Add TDLS Station request failed ", __func__);
          goto lim_tdls_add_sta_error;
      }
      return eSIR_SUCCESS;
@@ -3251,14 +5519,15 @@
     tANI_U8      sessionId;
     tpDphHashNode pStaDs = NULL ;
 
-    limLog(pMac, LOG1, FL("TDLS Delete STA Request Recieved"));
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+            ("Send Mgmt Recieved")) ;
 
     if((psessionEntry = peFindSessionByBssid(pMac, pDelStaReq->bssid, &sessionId)) 
             == NULL)
     {
-        limLog(pMac, LOGE,
-               FL("PE Session does not exist for given sme sessionId %d"),
-               pDelStaReq->sessionId);
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, 
+                "PE Session does not exist for given sme sessionId %d",
+                pDelStaReq->sessionId);
         limSendSmeTdlsDelStaRsp(pMac, pDelStaReq->sessionId, pDelStaReq->peerMac,
              NULL, eSIR_FAILURE) ;
         return eSIR_FAILURE;
@@ -3281,8 +5550,8 @@
             (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
     {
 
-        limLog(pMac, LOGE, FL("Del Sta received in invalid LIMsme state (%d)"),
-                           psessionEntry->limSmeState);
+        limLog(pMac, LOGE, "Del Sta received in invalid LIMsme state (%d)",
+               psessionEntry->limSmeState);
         goto lim_tdls_del_sta_error;
     }
 
@@ -3358,14 +5627,15 @@
     tANI_U16 peerIdx = 0 ;
     tpDphHashNode pStaDs = NULL ;
 
-    limLog(pMac, LOG1, FL("Link Establish Request Recieved")) ;
+    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+            ("Send Mgmt Recieved")) ;
 
     if((psessionEntry = peFindSessionByBssid(pMac, pTdlsLinkEstablishReq->bssid, &sessionId))
             == NULL)
     {
-        limLog(pMac, LOGE,
-               FL("PE Session does not exist for given sme sessionId %d"),
-               pTdlsLinkEstablishReq->sessionId);
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                "PE Session does not exist for given sme sessionId %d",
+                pTdlsLinkEstablishReq->sessionId);
         limSendSmeTdlsLinkEstablishReqRsp(pMac, pTdlsLinkEstablishReq->sessionId, pTdlsLinkEstablishReq->peerMac,
              NULL, eSIR_FAILURE) ;
         return eSIR_FAILURE;
@@ -3388,9 +5658,8 @@
             (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
     {
 
-        limLog(pMac, LOGE,
-               FL("TDLS Link Establish Request received in invalid LIMsme state (%d)"),
-               psessionEntry->limSmeState);
+        limLog(pMac, LOGE, "TDLS Link Establish Request received in "
+               "invalid LIMsme state (%d)", psessionEntry->limSmeState);
         goto lim_tdls_link_establish_error;
     }
     /*TODO Sunil , TDLSPeer Entry has the STA ID , Use it */
@@ -3398,15 +5667,15 @@
                                 &psessionEntry->dph.dphHashTable) ;
     if ( NULL == pStaDs )
     {
-        limLog(pMac, LOGE, FL( "pStaDs is NULL"));
+        limLog( pMac, LOGE, FL( "pStaDs is NULL" ));
         goto lim_tdls_link_establish_error;
 
     }
     pMsgTdlsLinkEstablishReq = vos_mem_malloc(sizeof( tTdlsLinkEstablishParams ));
     if ( NULL == pMsgTdlsLinkEstablishReq )
     {
-        limLog(pMac, LOGE,
-               FL("Unable to allocate memory TDLS Link Establish Request"));
+        limLog( pMac, LOGE,
+                     FL( "Unable to allocate memory TDLS Link Establish Request" ));
         return eSIR_MEM_ALLOC_FAILED;
     }
 
@@ -3417,37 +5686,37 @@
     pMsgTdlsLinkEstablishReq->uapsdQueues = pTdlsLinkEstablishReq->uapsdQueues;
     pMsgTdlsLinkEstablishReq->maxSp = pTdlsLinkEstablishReq->maxSp;
     pMsgTdlsLinkEstablishReq->isBufsta = pTdlsLinkEstablishReq->isBufSta;
-
+    pMsgTdlsLinkEstablishReq->isOffChannelSupported =
+                                pTdlsLinkEstablishReq->isOffChannelSupported;
     if (psessionEntry->tdlsChanSwitProhibited)
     {
-        /* If channel switch is prohibited by AP then dut can either
-         * send a switch channel request with failure status or it can
-         * ignore the request without sending the response.
-         * isOffChannelSupported = 0 disables the TDLS off-channel and
-         * if off-channel support is disabled then FW ignores switch
-         * channel request sent by TDLS peer */
-        pMsgTdlsLinkEstablishReq->isOffChannelSupported = 0;
+        pMsgTdlsLinkEstablishReq->isOffChannelSupported = 3;
         limLog(pMac, LOG1, FL("Channel Switch Prohibited by AP"));
     }
     else
     {
-        pMsgTdlsLinkEstablishReq->isOffChannelSupported =
-            pTdlsLinkEstablishReq->isOffChannelSupported;
+        pMsgTdlsLinkEstablishReq->isOffChannelSupported = 1;
     }
-
     if ((pTdlsLinkEstablishReq->supportedChannelsLen > 0) &&
         (pTdlsLinkEstablishReq->supportedChannelsLen <= SIR_MAC_MAX_SUPP_CHANNELS))
     {
-        /* check self supported channels and pass them to FW */
-        if ((tdlsSelfNumChans > 0) &&
-            (tdlsSelfNumChans < LIM_TDLS_MAX_NON_DFS_CHANNELS))
+        tANI_U32   selfNumChans = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+        tANI_U8    selfSupportedChannels[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+        if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
+                          selfSupportedChannels, &selfNumChans) != eSIR_SUCCESS)
         {
-            limTdlsGetIntersection(tdlsSelfSupportedChannels, tdlsSelfNumChans,
+            /**
+             * Could not get Valid channel list from CFG.
+             * Log error.
+             */
+             limLog(pMac, LOGP,
+                    FL("could not retrieve Valid channel list"));
+        }
+        limTdlsGetIntersection(selfSupportedChannels, selfNumChans,
                                pTdlsLinkEstablishReq->supportedChannels,
                                pTdlsLinkEstablishReq->supportedChannelsLen,
                                pMsgTdlsLinkEstablishReq->validChannels,
                                &pMsgTdlsLinkEstablishReq->validChannelsLen);
-        }
     }
     vos_mem_copy(pMsgTdlsLinkEstablishReq->validOperClasses,
                         pTdlsLinkEstablishReq->supportedOperClasses, pTdlsLinkEstablishReq->supportedOperClassesLen);
@@ -3480,7 +5749,7 @@
 
     if (NULL == psessionEntry)
     {
-        limLog(pMac, LOGE, FL("NULL psessionEntry"));
+        PELOGE(limLog(pMac, LOGE, FL("NULL psessionEntry"));)
         return eSIR_FAILURE;
     }
 
@@ -3496,8 +5765,8 @@
 
                 if (NULL != pStaDs)
                 {
-                    limLog(pMac, LOGE, FL("Deleting "MAC_ADDRESS_STR),
-                                       MAC_ADDR_ARRAY(pStaDs->staAddr));
+                    PELOGE(limLog(pMac, LOGE, FL("Deleting "MAC_ADDRESS_STR),
+                           MAC_ADDR_ARRAY(pStaDs->staAddr)););
 
                     limSendDeauthMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON,
                                            pStaDs->staAddr, psessionEntry, FALSE);
@@ -3514,53 +5783,6 @@
 }
 
 
-tANI_U8 limGetOffChMaxBwOffsetFromChannel(tANI_U8 *country,
-                                          tANI_U8 channel,
-                                          tANI_U8 peerVHTCapability)
-{
-    op_class_map_t *class = NULL;
-    tANI_U16 i = 0;
-    offset_t offset = BW20, max_allowed = BW80;
-
-    if ((TRUE == peerVHTCapability) &&
-        IS_FEATURE_SUPPORTED_BY_FW(DOT11AC) &&
-        IS_FEATURE_SUPPORTED_BY_DRIVER(DOT11AC))
-        max_allowed = BW80;
-    else
-        max_allowed = BW40MINUS;
-
-    if (VOS_TRUE == vos_mem_compare(country,"US", 2))  {
-
-        class = us_op_class;
-
-    } else if (VOS_TRUE == vos_mem_compare(country,"EU", 2)) {
-
-        class = euro_op_class;
-
-    } else if (VOS_TRUE == vos_mem_compare(country,"JP", 2)) {
-
-        class = japan_op_class;
-
-    } else {
-
-        class = global_op_class;
-
-    }
-
-    while (class->op_class)
-    {
-        for (i=0; (i < 25 && class->channels[i]); i++)
-        {
-            if (channel == class->channels[i] && class->offset <= max_allowed)
-                offset = class->offset;
-        }
-        class++;
-    }
-
-    return offset;
-}
-
-
 tANI_U8 limGetOPClassFromChannel(tANI_U8 *country,
                                          tANI_U8 channel,
                                          tANI_U8 offset)
@@ -3590,7 +5812,7 @@
     {
         if ((offset == class->offset) || (offset == BWALL))
         {
-            for (i=0; (i < 25 && class->channels[i]); i++)
+            for (i=0; (i < 15 && class->channels[i]); i++)
             {
                 if (channel == class->channels[i])
                     return class->op_class;
@@ -3794,35 +6016,7 @@
         return eSIR_MEM_ALLOC_FAILED;
     }
 
-    vos_mem_set( (tANI_U8 *)pMsgTdlsChanSwitch, sizeof(*pMsgTdlsChanSwitch), 0);
-
-    /* if channel bw offset is not set,
-       send maximum supported offset in the band */
-    if (pTdlsChanSwitch->tdlsOffChBwOffset == 0)
-    {
-        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
-                  ("Set TDLS channel Bw Offset"));
-
-        if ((pTdlsChanSwitch->tdlsOffCh >= 1) &&
-            (pTdlsChanSwitch->tdlsOffCh <= 14))
-        {
-            pTdlsChanSwitch->tdlsOffChBwOffset = BW20;
-        }
-        else if ((pTdlsChanSwitch->tdlsOffCh >= 36) &&
-                 (pTdlsChanSwitch->tdlsOffCh <= 169))
-        {
-            pTdlsChanSwitch->tdlsOffChBwOffset =
-                                limGetOffChMaxBwOffsetFromChannel(
-                                              pMac->scan.countryCodeCurrent,
-                                              pTdlsChanSwitch->tdlsOffCh,
-                                              pStaDs->mlmStaContext.vhtCapability);
-        }
-    }
-    else
-    {
-        /* Channel Bandwidth Offset is set through iwpriv ioctl */
-        (pTdlsChanSwitch->tdlsOffChBwOffset)--;
-    }
+    vos_mem_set( (tANI_U8 *)pMsgTdlsChanSwitch, sizeof(tpTdlsChanSwitchParams), 0);
 
     pMsgTdlsChanSwitch->staIdx = pStaDs->staIndex;
     pMsgTdlsChanSwitch->tdlsOffCh = pTdlsChanSwitch->tdlsOffCh;
@@ -3832,7 +6026,6 @@
                                            pMac->scan.countryCodeCurrent,
                                            pTdlsChanSwitch->tdlsOffCh,
                                            pTdlsChanSwitch->tdlsOffChBwOffset);
-
     if(pMsgTdlsChanSwitch->operClass == 0)
     {
 
@@ -3845,16 +6038,13 @@
     {
 
         VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
-              "%s: TDLS Channel Switch params: staIdx %d class %d ch %d bw %d"
-              " mode %d country code %c%c",
+              "%s: TDLS Channel Switch params: staIdx %d class %d ch %d bw %d mode %d",
                __func__,
                pMsgTdlsChanSwitch->staIdx,
                pMsgTdlsChanSwitch->operClass,
                pMsgTdlsChanSwitch->tdlsOffCh,
                pMsgTdlsChanSwitch->tdlsOffChBwOffset,
-               pMsgTdlsChanSwitch->tdlsSwMode,
-               pMac->scan.countryCodeCurrent[0],
-               pMac->scan.countryCodeCurrent[1]);
+               pMsgTdlsChanSwitch->tdlsSwMode);
     }
 
     msg.type = WDA_SET_TDLS_CHAN_SWITCH_REQ;
@@ -3877,82 +6067,3 @@
     return eSIR_FAILURE;
 }
 
-/*
- * Set 20_40 BSS Coex IE in TDLS frames.
- */
-tSirRetStatus limProcessSmeSetTdls2040BSSCoexReq(tpAniSirGlobal pMac,
-                                                 tANI_U32 *pMsgBuf)
-{
-    tAniSetTdls2040BSSCoex *pmsg = NULL;
-    pmsg = (tAniSetTdls2040BSSCoex*) pMsgBuf ;
-
-    if (NULL != pmsg) {
-        pMac->lim.EnableTdls2040BSSCoexIE = pmsg->SetTdls2040BSSCoex;
-    }
-    VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
-              "%s: 20_40 BSS Coex IE in TDLS frames "
-              "pMac->lim.EnableTdls2040BSSCoexIE %d ", __func__,
-              pMac->lim.EnableTdls2040BSSCoexIE);
-
-    return eSIR_SUCCESS;
-}
-
-tSirRetStatus limProcessSmeDelAllTdlsPeers(tpAniSirGlobal pMac,
-                                                 tANI_U32 *pMsgBuf)
-{
-    tSirDelAllTdlsPeers *pMsg = NULL;
-    tpDphHashNode pStaDs = NULL ;
-    tpPESession psessionEntry = NULL;
-    uint8_t sessionId;
-    int i, aid;
-    pMsg = (tSirDelAllTdlsPeers*) pMsgBuf ;
-
-    if (pMsg == NULL) {
-        limLog(pMac, LOGE, FL("NULL pMsg"));
-        return eSIR_FAILURE;
-    }
-
-    psessionEntry = peFindSessionByBssid(pMac, pMsg->bssid, &sessionId);
-    if (NULL == psessionEntry)
-    {
-        limLog(pMac, LOGE, FL("NULL psessionEntry"));
-        return eSIR_FAILURE;
-    }
-
-    /* Check all the set bit in peerAIDBitmap and delete the
-     * peer (with that aid) entry from the hash table and add
-     * the aid in free pool
-     */
-    for (i = 0; i < sizeof(psessionEntry->peerAIDBitmap)/sizeof(tANI_U32); i++)
-    {
-        for (aid = 0; aid < (sizeof(tANI_U32) << 3); aid++)
-        {
-            if (CHECK_BIT(psessionEntry->peerAIDBitmap[i], aid))
-            {
-                pStaDs = dphGetHashEntry(pMac,
-                                         (aid + i*(sizeof(tANI_U32) << 3)),
-                                         &psessionEntry->dph.dphHashTable);
-                if (NULL != pStaDs)
-                {
-                    limLog(pMac, LOGE, FL("Deleting "MAC_ADDRESS_STR),
-                           MAC_ADDR_ARRAY(pStaDs->staAddr));
-
-                    limSendDeauthMgmtFrame(pMac,
-                                           eSIR_MAC_DEAUTH_LEAVING_BSS_REASON,
-                                           pStaDs->staAddr, psessionEntry,
-                                           FALSE);
-
-                    limTdlsDelSta(pMac, pStaDs->staAddr, psessionEntry);
-
-                    dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,
-                                       &psessionEntry->dph.dphHashTable);
-                }
-                limReleasePeerIdx(pMac, (aid + i*(sizeof(tANI_U32) << 3)),
-                                  psessionEntry) ;
-                CLEAR_BIT(psessionEntry->peerAIDBitmap[i], aid);
-            }
-        }
-    }
-
-    return eSIR_SUCCESS;
-}
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limPropExtsUtils.c b/wlan/prima/CORE/MAC/src/pe/lim/limPropExtsUtils.c
index 1345a11..80510e1 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limPropExtsUtils.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limPropExtsUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,7 +39,7 @@
  *
  */
 #include "aniGlobal.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "sirCommon.h"
 #include "sirDebug.h"
 #include "utilsApi.h"
@@ -103,8 +103,7 @@
     sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );)
     if (sirParseBeaconIE(pMac, pBeaconStruct, pIE, (tANI_U32)ieLen) == eSIR_SUCCESS)
     {
-        if (pBeaconStruct->wmeInfoPresent || pBeaconStruct->wmeEdcaPresent
-            || pBeaconStruct->HTCaps.present)
+        if (pBeaconStruct->wmeInfoPresent || pBeaconStruct->wmeEdcaPresent)
             LIM_BSS_CAPS_SET(WME, *qosCap);
         if (LIM_BSS_CAPS_GET(WME, *qosCap) && pBeaconStruct->wsmCapablePresent)
             LIM_BSS_CAPS_SET(WSM, *qosCap);
@@ -118,14 +117,11 @@
 
 #ifdef WLAN_FEATURE_11AC
         VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
-            "***beacon.VHTCaps.present*****=%d BSS_VHT_CAPABLE:%d",
-            pBeaconStruct->VHTCaps.present,
-            IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps));
+            "***beacon.VHTCaps.present*****=%d",pBeaconStruct->VHTCaps.present);
         VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
            "***beacon.SU Beamformer Capable*****=%d",pBeaconStruct->VHTCaps.suBeamFormerCap);
 
-        if (IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps)
-                          && pBeaconStruct->VHTOperation.present)
+        if ( pBeaconStruct->VHTCaps.present && pBeaconStruct->VHTOperation.present)
         {
             psessionEntry->vhtCapabilityPresentInBeacon = 1;
             psessionEntry->apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
@@ -196,12 +192,6 @@
         {
             psessionEntry->countryInfoPresent = TRUE;
         }
-        /* Check if Extended caps are present in probe resp or not */
-        if (pBeaconStruct->ExtCap.present)
-        {
-            psessionEntry->is_ext_caps_present = TRUE;
-        }
-
     }
     vos_mem_free(pBeaconStruct);
     return;
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limRMC.c b/wlan/prima/CORE/MAC/src/pe/lim/limRMC.c
deleted file mode 100644
index 86b302e..0000000
--- a/wlan/prima/CORE/MAC/src/pe/lim/limRMC.c
+++ /dev/null
@@ -1,1382 +0,0 @@
-/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * This file was originally distributed by Qualcomm Atheros, Inc.
- * under proprietary terms before Copyright ownership was assigned
- * to the Linux Foundation.
- */
-
-/*
- * This file limRMC.c contains the code
- * for processing RMC messages
- *
- */
-#include "wniApi.h"
-#include "wniCfg.h"
-#include "cfgApi.h"
-#include "sirApi.h"
-#include "schApi.h"
-#include "utilsApi.h"
-#include "limUtils.h"
-#include "limTimerUtils.h"
-#include "limSendMessages.h"
-#include "limSendMessages.h"
-#include "limSession.h"
-#include "limSessionUtils.h"
-#include "wlan_qct_wda.h"
-#include "wlan_qct_tli.h"
-#include "limRMC.h"
-
-#ifdef WLAN_FEATURE_RMC
-
-static tANI_U8
-__rmcGroupHashFunction(tSirMacAddr transmitter)
-{
-    tANI_U16 hash;
-
-    /*
-     * Generate a hash using transmitter address
-     */
-    hash = transmitter[0] + transmitter[1] + transmitter[2] +
-            transmitter[3] + transmitter[4] + transmitter[5];
-
-    return hash & (RMC_MCAST_GROUPS_HASH_SIZE - 1);
-}
-
-
-static tLimRmcGroupContext *
-__rmcGroupLookupHashEntry(tpAniSirGlobal pMac, tSirMacAddr transmitter)
-{
-    tANI_U8 index;
-    tLimRmcGroupContext *entry;
-
-    index = __rmcGroupHashFunction(transmitter);
-
-    /* Pick the correct hash table based on role */
-    entry = pMac->rmcContext.rmcGroupRxHashTable[index];
-
-    PELOG1(limLog(pMac, LOG1, FL("RMC: Hash Lookup:[%d] transmitter "
-                         MAC_ADDRESS_STR ), index,
-                         MAC_ADDR_ARRAY(transmitter));)
-    while (entry)
-    {
-        if (vos_mem_compare(transmitter, entry->transmitter,
-             sizeof(v_MACADDR_t)))
-        {
-            return entry;
-        }
-
-        entry = entry->next;
-    }
-
-    return NULL;
-}
-
-static tLimRmcGroupContext *
-__rmcGroupInsertHashEntry(tpAniSirGlobal pMac, tSirMacAddr transmitter)
-{
-    tANI_U8 index;
-    tLimRmcGroupContext *entry;
-    tLimRmcGroupContext **head;
-
-    index = __rmcGroupHashFunction(transmitter);
-
-    PELOG1(limLog(pMac, LOG1, FL("RMC: Hash Insert:[%d] group " MAC_ADDRESS_STR
-                             " transmitter " MAC_ADDRESS_STR), index,
-                             MAC_ADDR_ARRAY(mcastGroupAddr),
-                             MAC_ADDR_ARRAY(transmitter));)
-
-    head = &pMac->rmcContext.rmcGroupRxHashTable[index];
-
-    entry = __rmcGroupLookupHashEntry(pMac, transmitter);
-
-    if (entry)
-    {
-        /* If the entry exists, return it at the end */
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Hash Insert:"
-                 MAC_ADDRESS_STR "exists"), MAC_ADDR_ARRAY(transmitter));)
-    }
-    else
-    {
-        entry = (tLimRmcGroupContext *)vos_mem_malloc(sizeof(*entry));
-
-        PELOG1(limLog(pMac, LOG1, FL("RMC: Hash Insert:new entry %p"), entry);)
-
-        if (entry)
-        {
-            vos_mem_copy(entry->transmitter, transmitter, sizeof(tSirMacAddr));
-            entry->isRuler = eRMC_IS_NOT_A_RULER;
-
-            /* chain this entry */
-            entry->next = *head;
-            *head = entry;
-        }
-        else
-        {
-            PELOGE(limLog(pMac, LOGE, FL("RMC: Hash Insert:" MAC_ADDRESS_STR
-                             " alloc failed"), MAC_ADDR_ARRAY(transmitter));)
-        }
-    }
-
-    return entry;
-}
-
-/**
- *  __rmcGroupDeleteHashEntry()
- *
- *FUNCTION:
- * This function is called to delete a RMC group entry
- *
- *LOGIC:
- *
- *ASSUMPTIONS:
- *  Should be called with lkRmcLock held.
- *
- *NOTE:
- * Make sure (for the transmitter role) that the entry is
- * not in the Pending Response queue.
- *
- * @param  transmitter - address of multicast transmitter
- *
- * @return status
- */
-static tSirRetStatus
-__rmcGroupDeleteHashEntry(tpAniSirGlobal pMac, tSirMacAddr transmitter)
-{
-    tSirRetStatus status = eSIR_FAILURE;
-    tANI_U8 index;
-    tLimRmcGroupContext *entry, *prev, **head;
-
-    index = __rmcGroupHashFunction(transmitter);
-
-    head = &pMac->rmcContext.rmcGroupRxHashTable[index];
-    entry = *head;
-    prev = NULL;
-
-    while (entry)
-    {
-        if (vos_mem_compare(transmitter, entry->transmitter,
-             sizeof(v_MACADDR_t)))
-        {
-            if (*head == entry)
-            {
-                *head = entry->next;
-            }
-            else
-            {
-                prev->next = entry->next;
-            }
-
-            PELOG1(limLog(pMac, LOG1, FL("RMC: Hash Delete: entry %p "
-                         " transmitter " MAC_ADDRESS_STR), entry
-                             MAC_ADDR_ARRAY(transmitter));)
-
-            /* free the group entry */
-            vos_mem_free(entry);
-
-            status = eSIR_SUCCESS;
-            break;
-        }
-
-        prev = entry;
-        entry = entry->next;
-    }
-
-    return status;
-}
-
-static void
-__rmcGroupDeleteAllEntries(tpAniSirGlobal pMac)
-{
-    tLimRmcGroupContext *entry, **head;
-    int index;
-
-    PELOG1(limLog(pMac, LOG1, FL("RMC: Hash_Delete_All"),);)
-
-    for (index = 0; index < RMC_MCAST_GROUPS_HASH_SIZE; index++)
-    {
-        head = &pMac->rmcContext.rmcGroupRxHashTable[index];
-
-        entry = *head;
-
-        while (entry)
-        {
-            *head = entry->next;
-            /* free the group entry */
-            vos_mem_free(entry);
-            entry = *head;
-        }
-    }
-}
-
-static void
-__limPostMsgRulerReq ( tpAniSirGlobal pMac,
-                        tANI_U8 cmd,
-                        tSirMacAddr mcastTransmitter)
-{
-    tSirMsgQ msg;
-    tSirRmcRulerReq *pRulerReq;
-
-    pRulerReq = vos_mem_malloc(sizeof(*pRulerReq));
-    if (NULL == pRulerReq)
-    {
-       limLog(pMac, LOGE, FL("AllocateMemory() failed"));
-       return;
-    }
-
-    pRulerReq->cmd = cmd;
-
-    vos_mem_copy(pRulerReq->mcastTransmitter, mcastTransmitter,
-                 sizeof(tSirMacAddr));
-
-    /* Initialize black list */
-    vos_mem_zero(pRulerReq->blacklist, sizeof(pRulerReq->blacklist));
-
-    if (eRMC_SUGGEST_RULER_CMD == cmd)
-    {
-        /* TODO - Set the black list. */
-    }
-
-    msg.type = WDA_RMC_RULER_REQ;
-    msg.bodyptr = pRulerReq;
-    msg.bodyval = 0;
-
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
-    if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
-    {
-        vos_mem_free(pRulerReq);
-        limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));
-    }
-
-    return;
-}
-
-static void
-__limPostMsgUpdateInd ( tpAniSirGlobal pMac,
-                        tANI_U8 indication,
-                        tANI_U8 role,
-                        tSirMacAddr mcastTransmitter,
-                        tSirMacAddr mcastRuler)
-{
-    tSirMsgQ msg;
-    tSirRmcUpdateInd *pUpdateInd;
-
-    pUpdateInd = vos_mem_malloc(sizeof(*pUpdateInd));
-    if ( NULL == pUpdateInd )
-    {
-       limLog(pMac, LOGE, FL("AllocateMemory() failed"));
-       return;
-    }
-
-    vos_mem_zero(pUpdateInd, sizeof(*pUpdateInd));
-
-    pUpdateInd->indication = indication;
-    pUpdateInd->role = role;
-
-    vos_mem_copy(pUpdateInd->mcastTransmitter,
-            mcastTransmitter, sizeof(tSirMacAddr));
-
-    vos_mem_copy(pUpdateInd->mcastRuler,
-            mcastRuler, sizeof(tSirMacAddr));
-
-    msg.type = WDA_RMC_UPDATE_IND;
-    msg.bodyptr = pUpdateInd;
-    msg.bodyval = 0;
-
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
-    if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
-    {
-        vos_mem_free(pUpdateInd);
-        limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));
-    }
-
-    return;
-}
-
-static char *
-__limRulerMessageToString(eRmcMessageType msgType)
-{
-    switch (msgType)
-    {
-        default:
-            return "Invalid";
-        case eLIM_RMC_ENABLE_REQ:
-            return "RMC_ENABLE_REQ";
-        case eLIM_RMC_DISABLE_REQ:
-            return "RMC_DISABLE_REQ";
-        case eLIM_RMC_RULER_SELECT_RESP:
-            return "RMC_RULER_SELECT_RESP";
-        case eLIM_RMC_RULER_PICK_NEW:
-            return "RMC_RULER_PICK_NEW";
-        case eLIM_RMC_OTA_RULER_INFORM_ACK:
-            return "RMC_OTA_RULER_INFORM_ACK";
-        case eLIM_RMC_OTA_RULER_INFORM_SELECTED:
-            return "RMC_OTA_RULER_INFORM_SELECTED";
-        case eLIM_RMC_BECOME_RULER_RESP:
-            return "RMC_BECOME_RULER_RESP";
-        case eLIM_RMC_OTA_RULER_INFORM_CANCELLED:
-            return "RMC_OTA_RULER_INFORM_CANCELLED";
-    }
-}
-
-static char *
-__limRulerStateToString(eRmcRulerState state)
-{
-    switch (state)
-    {
-        default:
-            return "Invalid";
-        case eRMC_IS_NOT_A_RULER:
-            return "Device Not a Ruler";
-        case eRMC_RULER_PENDING:
-            return "Pending firmware resp";
-        case eRMC_IS_A_RULER:
-            return "Device is Ruler";
-    }
-}
-
-static char *
-__limMcastTxStateToString(eRmcMcastTxState state)
-{
-    switch (state)
-    {
-        default:
-            return "Invalid";
-        case eRMC_RULER_NOT_SELECTED:
-            return "Not Selected";
-        case eRMC_RULER_ENABLE_REQUESTED:
-            return "Enable Requested";
-        case eRMC_RULER_OTA_REQUEST_SENT:
-            return "OTA Request Sent";
-        case eRMC_RULER_ACTIVE:
-            return "Active";
-    }
-}
-
-/**
- * __rmcRulerSelectTimerHandler()
- *
- *FUNCTION:
- * This function is called upon timer expiry.
- *
- *
- *ASSUMPTIONS:
- * NA
- *
- *NOTE:
- * Only one entry is processed for every invocation if this routine.
- * This allows us to use a single timer and makes sure we do not
- * timeout a request too early.
- *
- * @param  param - Message corresponding to the timer that expired
- *
- * @return None
- */
-
-void
-__rmcRulerSelectTimerHandler(void *pMacGlobal, tANI_U32 param)
-{
-    tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
-    tSirMacAddr zeroMacAddr = { 0, 0, 0, 0, 0, 0 };
-    tSirRetStatus status;
-    tSirRMCInfo RMC;
-    tpPESession psessionEntry;
-    tANI_U32 cfgValue;
-
-    /*
-     * This API relies on a single active IBSS session.
-     */
-    psessionEntry = limIsIBSSSessionActive(pMac);
-    if (NULL == psessionEntry)
-    {
-        PELOGE(limLog(pMac, LOGE,
-             FL("RMC:__rmcRulerSelectTimerHandler:No active IBSS"));)
-        return;
-    }
-
-    if (wlan_cfgGetInt(pMac, WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY,
-                  &cfgValue) != eSIR_SUCCESS)
-    {
-        /**
-         * Could not get Action Period Frequency value
-         * from CFG. Log error.
-         */
-        limLog(pMac, LOGE, FL("could not retrieve ActionPeriodFrequency"));
-    }
-
-    cfgValue = SYS_MS_TO_TICKS(cfgValue);
-
-    if (pMac->rmcContext.rmcTimerValInTicks != cfgValue)
-    {
-        limLog(pMac, LOG1, FL("RMC RulerSelect timer value changed"));
-        if (tx_timer_change(&pMac->rmcContext.gRmcRulerSelectTimer,
-                 cfgValue, 0) != TX_SUCCESS)
-        {
-            limLog(pMac, LOGE,
-                FL("Unable to change RulerSelect Timer val"));
-        }
-        pMac->rmcContext.rmcTimerValInTicks = cfgValue;
-    }
-
-    /*
-     * If we are in the scanning state then we need to return
-     * from this function without any further processing
-     */
-    if (eLIM_HAL_SCANNING_STATE == pMac->lim.gLimHalScanState)
-    {
-        limLog(pMac, LOG1, FL("In scanning state, can't send action frm"));
-        if (tx_timer_activate(&pMac->rmcContext.gRmcRulerSelectTimer) !=
-            TX_SUCCESS)
-        {
-            limLog(pMac, LOGE, FL("In scanning state, "
-                                  "couldn't activate RMC RulerSelect timer"));
-        }
-        return;
-    }
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE,
-             FL("__rmcRulerSelectTimerHandler lock acquire failed"));
-        if (tx_timer_activate(&pMac->rmcContext.gRmcRulerSelectTimer)!= TX_SUCCESS)
-        {
-            limLog(pMac, LOGE, FL("could not activate RMC RulerSelect timer"));
-        }
-        return;
-    }
-
-    vos_mem_copy(&RMC.mcastRuler, &pMac->rmcContext.ruler,
-                     sizeof(tSirMacAddr));
-
-    if (VOS_FALSE == vos_mem_compare(&zeroMacAddr,
-                            &pMac->rmcContext.ruler, sizeof(tSirMacAddr)))
-    {
-        limLog(pMac, LOG1,
-               FL("RMC Periodic Ruler_Select Ruler " MAC_ADDRESS_STR),
-                   MAC_ADDR_ARRAY(pMac->rmcContext.ruler));
-        /*
-         * Re-arm timer
-         */
-        if (tx_timer_activate(&pMac->rmcContext.gRmcRulerSelectTimer)!=
-            TX_SUCCESS)
-        {
-            limLog(pMac, LOGE, FL("could not activate RMC Response timer"));
-        }
-
-        if (!VOS_IS_STATUS_SUCCESS
-                (vos_lock_release(&pMac->rmcContext.lkRmcLock)))
-        {
-            limLog(pMac, LOGE,
-                FL("RMC: __rmcRulerSelectTimerHandler lock release failed"));
-        }
-    }
-    else
-    {
-        limLog(pMac, LOGE,
-               FL("RMC Deactivating timer because no ruler was selected"));
-
-        if (!VOS_IS_STATUS_SUCCESS
-                (vos_lock_release(&pMac->rmcContext.lkRmcLock)))
-        {
-            limLog(pMac, LOGE,
-                FL("RMC: __rmcRulerSelectTimerHandler lock release failed"));
-        }
-
-        return;
-    }
-
-    RMC.dialogToken = 0;
-    RMC.action = SIR_MAC_RMC_RULER_INFORM_SELECTED;
-
-    status = limSendRMCActionFrame(pMac,
-                          SIR_MAC_RMC_MCAST_ADDRESS,
-                          &RMC,
-                          psessionEntry);
-
-    if (eSIR_FAILURE == status)
-    {
-        PELOGE(limLog(pMac, LOGE,
-         FL("RMC:__rmcRulerSelectTimerHandler Action frame send failed"));)
-    }
-
-    return;
-}
-
-static void
-__limProcessRMCEnableRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
-{
-    tSirSetRMCReq *setRmcReq = (tSirSetRMCReq *)pMsgBuf;
-    tpPESession psessionEntry;
-
-    if (!setRmcReq)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Enable:NULL message") );)
-        return;
-    }
-
-    pMac->rmcContext.rmcEnabled = TRUE;
-
-    /*
-     * This API relies on a single active IBSS session.
-     */
-    psessionEntry = limIsIBSSSessionActive(pMac);
-    if (NULL == psessionEntry)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC:Enable RMC request no active IBSS"));)
-        pMac->rmcContext.state = eRMC_RULER_NOT_SELECTED;
-        return;
-    }
-
-    /* Send RULER_REQ to f/w */
-    __limPostMsgRulerReq(pMac, eRMC_SUGGEST_RULER_CMD,
-                        setRmcReq->mcastTransmitter);
-
-    pMac->rmcContext.state = eRMC_RULER_ENABLE_REQUESTED;
-}
-
-static void
-__limProcessRMCDisableRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
-{
-    tpPESession psessionEntry;
-    tSirRMCInfo RMC;
-    tSirSetRMCReq *setRmcReq = (tSirSetRMCReq *)pMsgBuf;
-    tSirRetStatus status;
-    v_PVOID_t pvosGCtx;
-    VOS_STATUS vos_status;
-    v_MACADDR_t vosMcastTransmitter;
-
-    pMac->rmcContext.rmcEnabled = FALSE;
-
-    /*
-     * This API relies on a single active IBSS session.
-     */
-    psessionEntry = limIsIBSSSessionActive(pMac);
-    if (NULL == psessionEntry)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Disable:No active IBSS"));)
-        return;
-    }
-
-    if (!setRmcReq)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Disable:NULL message") );)
-        return;
-    }
-
-    /* Cancel pending timer */
-    tx_timer_deactivate(&pMac->rmcContext.gRmcRulerSelectTimer);
-
-    vosMcastTransmitter.bytes[0] = psessionEntry->selfMacAddr[0];
-    vosMcastTransmitter.bytes[1] = psessionEntry->selfMacAddr[1];
-    vosMcastTransmitter.bytes[2] = psessionEntry->selfMacAddr[2];
-    vosMcastTransmitter.bytes[3] = psessionEntry->selfMacAddr[3];
-    vosMcastTransmitter.bytes[4] = psessionEntry->selfMacAddr[4];
-    vosMcastTransmitter.bytes[5] = psessionEntry->selfMacAddr[5];
-
-    pvosGCtx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
-    vos_status = WLANTL_DisableRMC(pvosGCtx, &vosMcastTransmitter);
-
-    if (VOS_STATUS_SUCCESS != vos_status)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC:Disable: TL disable failed"));)
-    }
-
-    if (pMac->rmcContext.state == eRMC_RULER_ACTIVE)
-    {
-        RMC.dialogToken = 0;
-        RMC.action = SIR_MAC_RMC_RULER_INFORM_CANCELLED;
-        vos_mem_copy(&RMC.mcastRuler, &pMac->rmcContext.ruler, sizeof(tSirMacAddr));
-
-        status = limSendRMCActionFrame(pMac, pMac->rmcContext.ruler,
-                             &RMC, psessionEntry);
-        if (eSIR_FAILURE == status)
-        {
-            PELOGE(limLog(pMac, LOGE, FL("RMC:Disable: Action frame send failed"));)
-        }
-
-        pMac->rmcContext.state = eRMC_RULER_NOT_SELECTED;
-    }
-
-    __limPostMsgUpdateInd(pMac, eRMC_RULER_CANCELLED, eRMC_TRANSMITTER_ROLE,
-                         setRmcReq->mcastTransmitter, pMac->rmcContext.ruler);
-
-    vos_mem_zero(pMac->rmcContext.ruler, sizeof(tSirMacAddr));
-
-}
-
-static void
-__limProcessRMCRulerSelectResponse(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
-{
-    tSirRmcRulerSelectInd *pRmcRulerSelectInd;
-    tpPESession psessionEntry;
-    tSirRetStatus status;
-    v_PVOID_t pvosGCtx;
-    VOS_STATUS vos_status;
-    v_MACADDR_t vosMcastTransmitter;
-    tSirRMCInfo RMC;
-
-    if (NULL == pMsgBuf)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Ruler_Select_Resp:NULL message"));)
-        return;
-    }
-
-    /*
-     * This API relies on a single active IBSS session.
-     */
-    psessionEntry = limIsIBSSSessionActive(pMac);
-    if (NULL == psessionEntry)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC:Ruler_Select_Resp:No active IBSS"));)
-        pMac->rmcContext.state = eRMC_RULER_NOT_SELECTED;
-        return;
-    }
-
-    pRmcRulerSelectInd = (tSirRmcRulerSelectInd *)pMsgBuf;
-
-    if (pMac->rmcContext.state != eRMC_RULER_ENABLE_REQUESTED)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Ruler_Select_Resp:Bad state %s"),
-                        __limMcastTxStateToString(pMac->rmcContext.state) );)
-        return;
-    }
-
-    if (pRmcRulerSelectInd->status)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC:Ruler_Select_Resp:FW Status %d"),
-                        pRmcRulerSelectInd->status);)
-        pMac->rmcContext.state = eRMC_RULER_NOT_SELECTED;
-        return;
-    }
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE, FL("RMC:Ruler_Select_Resp:lock acquire failed"));
-        pMac->rmcContext.state = eRMC_RULER_NOT_SELECTED;
-        return;
-    }
-
-    vos_mem_copy(&pMac->rmcContext.ruler, &pRmcRulerSelectInd->ruler[0],
-                 sizeof(tSirMacAddr));
-
-    if (!VOS_IS_STATUS_SUCCESS
-            (vos_lock_release(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE, FL("RMC: Ruler_Select_Resp: lock release failed"));
-    }
-
-    RMC.dialogToken = 0;
-    RMC.action = SIR_MAC_RMC_RULER_INFORM_SELECTED;
-    vos_mem_copy(&RMC.mcastRuler, &pRmcRulerSelectInd->ruler[0],
-                 sizeof(tSirMacAddr));
-
-    PELOG1(limLog(pMac, LOG1, FL("RMC: Ruler_Select :ruler " MAC_ADDRESS_STR),
-             MAC_ADDR_ARRAY(pRmcRulerSelectInd->ruler[0]));)
-
-    status = limSendRMCActionFrame(pMac,
-                          SIR_MAC_RMC_MCAST_ADDRESS,
-                          &RMC,
-                          psessionEntry);
-
-    if (eSIR_FAILURE == status)
-    {
-        PELOGE(limLog(pMac, LOGE,
-         FL("RMC: Ruler_Select_Resp: Action send failed"));)
-    }
-
-    __limPostMsgUpdateInd(pMac, eRMC_RULER_ACCEPTED, eRMC_TRANSMITTER_ROLE,
-                 psessionEntry->selfMacAddr, pMac->rmcContext.ruler);
-
-    vosMcastTransmitter.bytes[0] = psessionEntry->selfMacAddr[0];
-    vosMcastTransmitter.bytes[1] = psessionEntry->selfMacAddr[1];
-    vosMcastTransmitter.bytes[2] = psessionEntry->selfMacAddr[2];
-    vosMcastTransmitter.bytes[3] = psessionEntry->selfMacAddr[3];
-    vosMcastTransmitter.bytes[4] = psessionEntry->selfMacAddr[4];
-    vosMcastTransmitter.bytes[5] = psessionEntry->selfMacAddr[5];
-
-    /* Enable TL */
-    pvosGCtx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
-    vos_status = WLANTL_EnableRMC(pvosGCtx, &vosMcastTransmitter);
-
-    pMac->rmcContext.state = eRMC_RULER_ACTIVE;
-
-    if (tx_timer_activate(&pMac->rmcContext.gRmcRulerSelectTimer)!= TX_SUCCESS)
-    {
-        limLog(pMac, LOGE,
-         FL("Ruler_Select_Resp:Activate RMC Response timer failed"));
-    }
-}
-
-static void
-__limProcessRMCRulerPickNew(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
-{
-    tSirRmcUpdateInd *pRmcUpdateInd;
-    tpPESession psessionEntry;
-    tSirRetStatus status;
-    tSirRMCInfo RMC;
-    v_PVOID_t pvosGCtx;
-    VOS_STATUS vos_status;
-    v_MACADDR_t vosMcastTransmitter;
-    tSirMacAddr zeroMacAddr = { 0, 0, 0, 0, 0, 0 };
-
-    if (NULL == pMsgBuf)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Ruler_Pick_New:NULL message"));)
-        return;
-    }
-
-    /*
-     * This API relies on a single active IBSS session.
-     */
-    psessionEntry = limIsIBSSSessionActive(pMac);
-    if (NULL == psessionEntry)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Ruler_Pick_New:No active IBSS"));)
-        return;
-    }
-
-    pvosGCtx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
-
-    pRmcUpdateInd = (tSirRmcUpdateInd *)pMsgBuf;
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE, FL("RMC:Ruler_Pick_New:lock acquire failed"));
-        return;
-    }
-
-
-    /* Fill out Action frame parameters */
-    RMC.dialogToken = 0;
-
-    if (VOS_FALSE == vos_mem_compare(&zeroMacAddr,
-                        &pRmcUpdateInd->mcastRuler,
-                        sizeof(tSirMacAddr)))
-    {
-
-        vos_mem_copy(&RMC.mcastRuler, &pRmcUpdateInd->mcastRuler,
-                     sizeof(tSirMacAddr));
-
-        RMC.action = SIR_MAC_RMC_RULER_INFORM_CANCELLED;
-        status = limSendRMCActionFrame(pMac,
-                         pRmcUpdateInd->mcastRuler,
-                         &RMC, psessionEntry);
-        if (eSIR_FAILURE == status)
-        {
-            PELOGE(limLog(pMac, LOGE,
-                FL("RMC:Ruler_Pick_New: Inform_Cancel Action send failed"));)
-            goto done;
-        }
-
-        vosMcastTransmitter.bytes[0] = psessionEntry->selfMacAddr[0];
-        vosMcastTransmitter.bytes[1] = psessionEntry->selfMacAddr[1];
-        vosMcastTransmitter.bytes[2] = psessionEntry->selfMacAddr[2];
-        vosMcastTransmitter.bytes[3] = psessionEntry->selfMacAddr[3];
-        vosMcastTransmitter.bytes[4] = psessionEntry->selfMacAddr[4];
-        vosMcastTransmitter.bytes[5] = psessionEntry->selfMacAddr[5];
-
-        vos_status = WLANTL_DisableRMC(pvosGCtx, &vosMcastTransmitter);
-
-        if (VOS_STATUS_SUCCESS != vos_status)
-        {
-            PELOGE(limLog(pMac, LOGE,
-                 FL("RMC:Ruler_Pick_New: TL disable failed"));)
-        }
-    }
-
-    vos_mem_copy(pMac->rmcContext.ruler, pRmcUpdateInd->ruler[0],
-                 sizeof(tSirMacAddr));
-
-    pMac->rmcContext.state = eRMC_RULER_NOT_SELECTED;
-
-    if (VOS_TRUE == vos_mem_compare(&zeroMacAddr,
-                        pMac->rmcContext.ruler,
-                        sizeof(tSirMacAddr)))
-    {
-        PELOGE(limLog(pMac, LOGE,
-           FL("RMC:Ruler_Pick_New: No candidate rulers available"));)
-        goto done;
-    }
-
-
-    RMC.action = SIR_MAC_RMC_RULER_INFORM_SELECTED;
-    vos_mem_copy(&RMC.mcastRuler, &pMac->rmcContext.ruler,
-                     sizeof(tSirMacAddr));
-    status = limSendRMCActionFrame(pMac, SIR_MAC_RMC_MCAST_ADDRESS,
-                         &RMC, psessionEntry);
-    if (eSIR_FAILURE == status)
-    {
-        PELOGE(limLog(pMac, LOGE,
-           FL("RMC:Ruler_Pick_New: Inform_Selected Action send failed"));)
-        goto done;
-    }
-
-    __limPostMsgUpdateInd(pMac, eRMC_RULER_ACCEPTED, eRMC_TRANSMITTER_ROLE,
-                         psessionEntry->selfMacAddr, pMac->rmcContext.ruler);
-
-    vosMcastTransmitter.bytes[0] = psessionEntry->selfMacAddr[0];
-    vosMcastTransmitter.bytes[1] = psessionEntry->selfMacAddr[1];
-    vosMcastTransmitter.bytes[2] = psessionEntry->selfMacAddr[2];
-    vosMcastTransmitter.bytes[3] = psessionEntry->selfMacAddr[3];
-    vosMcastTransmitter.bytes[4] = psessionEntry->selfMacAddr[4];
-    vosMcastTransmitter.bytes[5] = psessionEntry->selfMacAddr[5];
-
-    /* Enable TL */
-    vos_status = WLANTL_EnableRMC(pvosGCtx, &vosMcastTransmitter);
-
-    if (VOS_STATUS_SUCCESS != vos_status)
-    {
-        PELOGE(limLog(pMac, LOGE,
-            FL("RMC:Ruler_Pick_New: TL enable failed"));)
-        goto done;
-    }
-
-    pMac->rmcContext.state = eRMC_RULER_ACTIVE;
-
-    if (tx_timer_activate(&pMac->rmcContext.gRmcRulerSelectTimer)!= TX_SUCCESS)
-    {
-        limLog(pMac, LOGE,
-         FL("Ruler_Pick_New:Activate RMC Response timer failed"));
-    }
-
-done:
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_release(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE,
-            FL("RMC: Ruler_Pick_New: lock release failed"));
-    }
-}
-
-static void
-__limProcessRMCRulerInformSelected(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
-{
-    tpSirMacMgmtHdr pHdr;
-    tANI_U8 *pFrameData;
-    tANI_U32 frameLen;
-    tLimRmcGroupContext *entry;
-    tpPESession psessionEntry;
-    tSirRetStatus status;
-
-    if (!pMsgBuf)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Ruler_Inform:NULL msg"));)
-        return;
-    }
-
-    /*
-     * This API relies on a single active IBSS session.
-     */
-    psessionEntry = limIsIBSSSessionActive(pMac);
-    if (NULL == psessionEntry)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC:Become_Ruler_Resp:No active IBSS"));)
-        return;
-    }
-
-    /*
-     * Get the frame header
-     */
-    pHdr = WDA_GET_RX_MAC_HEADER((tANI_U8 *)pMsgBuf);
-
-    frameLen = WDA_GET_RX_PAYLOAD_LEN((tANI_U8 *)pMsgBuf);
-    if (frameLen < sizeof(tSirMacIbssExtNetworkFrameHdr))
-    {
-        PELOGE(limLog(pMac, LOGE,
-             FL("RMC: Ruler_Inform:Bad length %d "), frameLen);)
-        return;
-    }
-
-    pFrameData = WDA_GET_RX_MPDU_DATA((tANI_U8 *)pMsgBuf) +
-                    sizeof(tSirMacIbssExtNetworkFrameHdr);
-
-    if (!pFrameData)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Ruler_Inform:NULL data"));)
-        return;
-    }
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE, FL("RMC:Become_Ruler_Resp:lock acquire failed"));
-        return;
-    }
-
-    /*
-     * Check if this transmitter exists in our database.
-     */
-    entry = __rmcGroupLookupHashEntry(pMac, pHdr->sa);
-
-    if (VOS_FALSE == vos_mem_compare(pFrameData, psessionEntry->selfMacAddr,
-                                     sizeof(tSirMacAddr)))
-    {
-        if (entry)
-        {
-            PELOG1(limLog(pMac, LOG1,
-                 FL("RMC: Ruler_Inform: Ruler Cancelled"));)
-
-            __limPostMsgUpdateInd(pMac, eRMC_RULER_CANCELLED,
-                      eRMC_RULER_ROLE, pHdr->sa, psessionEntry->selfMacAddr);
-
-            /*
-             * Delete hash entry for this Group address.
-             */
-            status = __rmcGroupDeleteHashEntry(pMac, pHdr->sa);
-            if (eSIR_FAILURE == status)
-            {
-                PELOGE(limLog(pMac, LOGE,
-                      FL("RMC: Ruler_Inform:hash delete failed"));)
-            }
-        }
-    }
-    else
-    {
-        if (NULL == entry)
-        {
-            /* Add the transmitter address to the hash */
-            entry = __rmcGroupInsertHashEntry(pMac, pHdr->sa);
-            if (entry)
-            {
-                if (entry->isRuler != eRMC_RULER_PENDING)
-                {
-                    __limPostMsgRulerReq(pMac, eRMC_BECOME_RULER_CMD,
-                                         pHdr->sa);
-                    entry->isRuler = eRMC_RULER_PENDING;
-                }
-            }
-            else
-            {
-                PELOGE(limLog(pMac, LOGE,
-                         FL("RMC: Ruler_Inform:Hash insert failed"));)
-            }
-
-        }
-    }
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_release(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE,
-            FL("RMC: Ruler_Inform: lock release failed"));
-    }
-
-}
-
-static void
-__limProcessRMCBecomeRulerResp(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
-{
-    tSirRmcBecomeRulerInd *pRmcBecomeRulerInd;
-    tLimRmcGroupContext *entry;
-    tSirRetStatus status = eSIR_SUCCESS;
-
-    if (NULL == pMsgBuf)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Become_Ruler_Resp:NULL message"));)
-        return;
-    }
-
-    pRmcBecomeRulerInd = (tSirRmcBecomeRulerInd *)pMsgBuf;
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE, FL("RMC:Become_Ruler_Resp:lock acquire failed"));
-        return;
-    }
-
-    /*
-     * Find the entry for this Group Address.
-     */
-    entry = __rmcGroupLookupHashEntry(pMac,
-                  pRmcBecomeRulerInd->mcastTransmitter);
-    if (NULL == entry)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Become_Ruler_Resp: No entry"));)
-        goto done;
-    }
-
-    if (pRmcBecomeRulerInd->status)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC:Become_Ruler_Resp:FW Status %d"),
-                        pRmcBecomeRulerInd->status);)
-        status = eSIR_FAILURE;
-        goto done;
-    }
-
-    if (entry->isRuler != eRMC_RULER_PENDING)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Become_Ruler_Resp:Bad state: %s"),
-                        __limRulerStateToString(entry->isRuler) );)
-        status = eSIR_FAILURE;
-        goto done;
-    }
-
-    entry->isRuler = eRMC_IS_A_RULER;
-
-done:
-    if (eSIR_FAILURE == status)
-    {
-        status = __rmcGroupDeleteHashEntry(pMac,
-                       pRmcBecomeRulerInd->mcastTransmitter);
-        if (eSIR_FAILURE == status)
-        {
-            PELOGE(limLog(pMac, LOGE,
-                      FL("RMC: Become_Ruler_Resp:hash delete failed"));)
-        }
-    }
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_release(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE,
-            FL("RMC: Become_Ruler_Resp: lock release failed"));
-    }
-
-    return;
-}
-
-static void
-__limProcessRMCRulerInformCancelled(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
-{
-    tpSirMacMgmtHdr pHdr;
-    tANI_U8 *pFrameData;
-    tANI_U32 frameLen;
-    tSirRetStatus status;
-    tLimRmcGroupContext *entry;
-    tpPESession psessionEntry;
-
-    if (!pMsgBuf)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Ruler_Inform_Cancel:NULL msg"));)
-        return;
-    }
-
-    /*
-     * This API relies on a single active IBSS session.
-     */
-    psessionEntry = limIsIBSSSessionActive(pMac);
-    if (NULL == psessionEntry)
-    {
-        PELOGE(limLog(pMac, LOGE,
-             FL("RMC:Ruler_Inform_Cancel:No active IBSS"));)
-        return;
-    }
-
-    pHdr = WDA_GET_RX_MAC_HEADER((tANI_U8 *)pMsgBuf);
-
-    frameLen = WDA_GET_RX_PAYLOAD_LEN((tANI_U8 *)pMsgBuf);
-    if (frameLen < sizeof(tSirMacIbssExtNetworkFrameHdr))
-    {
-        PELOGE(limLog(pMac, LOGE,
-             FL("RMC: Ruler_Inform:Bad length %d "), frameLen);)
-        return;
-    }
-
-    pFrameData = WDA_GET_RX_MPDU_DATA((tANI_U8 *)pMsgBuf) +
-                    sizeof(tSirMacIbssExtNetworkFrameHdr);
-
-    if (!pFrameData)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Ruler_Inform_Cancel:NULL data"));)
-        return;
-    }
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE, FL("RMC:Ruler_Inform_Cancel lock acquire failed"));
-        return;
-    }
-
-    /*
-     * Find the entry for this Group Address.
-     */
-    entry = __rmcGroupLookupHashEntry(pMac, pHdr->sa);
-    if (NULL == entry)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Ruler_Inform_Cancel: No entry"));)
-        goto done;
-    }
-
-    __limPostMsgUpdateInd(pMac, eRMC_RULER_CANCELLED,
-                     eRMC_RULER_ROLE, pHdr->sa, psessionEntry->selfMacAddr);
-
-    /*
-     * Delete hash entry for this Group address.
-     */
-    status = __rmcGroupDeleteHashEntry(pMac, pHdr->sa);
-    if (eSIR_FAILURE == status)
-    {
-        PELOGE(limLog(pMac, LOGE,
-                  FL("RMC: Ruler_Inform_Cancel:hash delete failed"));)
-    }
-
-done:
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_release(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE,
-            FL("RMC: Ruler_Inform_Cancel: lock release failed"));
-    }
-    return;
-}
-
-void
-limProcessRMCMessages(tpAniSirGlobal pMac, eRmcMessageType msgType,
-                      tANI_U32 *pMsgBuf)
-{
-
-    if (pMsgBuf == NULL)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: Buffer is Pointing to NULL"));)
-        return;
-    }
-
-    limLog(pMac, LOG1, FL("RMC: limProcessRMCMessages: %s"),
-                        __limRulerMessageToString(msgType));
-
-    switch (msgType)
-    {
-        case eLIM_RMC_ENABLE_REQ:
-            __limProcessRMCEnableRequest(pMac, pMsgBuf);
-            break;
-
-        case eLIM_RMC_DISABLE_REQ:
-            __limProcessRMCDisableRequest(pMac, pMsgBuf);
-            break;
-
-        case eLIM_RMC_RULER_SELECT_RESP:
-            __limProcessRMCRulerSelectResponse(pMac, pMsgBuf);
-            break;
-
-        case eLIM_RMC_RULER_PICK_NEW:
-            __limProcessRMCRulerPickNew(pMac, pMsgBuf);
-            break;
-
-        case eLIM_RMC_OTA_RULER_INFORM_SELECTED:
-            __limProcessRMCRulerInformSelected(pMac, pMsgBuf);
-            break;
-
-        case eLIM_RMC_BECOME_RULER_RESP:
-            __limProcessRMCBecomeRulerResp(pMac, pMsgBuf);
-            break;
-
-        case eLIM_RMC_OTA_RULER_INFORM_CANCELLED:
-            __limProcessRMCRulerInformCancelled(pMac, pMsgBuf);
-            break;
-
-
-        default:
-            break;
-    } // switch (msgType)
-    return;
-} /*** end limProcessRMCMessages() ***/
-
-void
-limRmcInit(tpAniSirGlobal pMac)
-{
-    tANI_U32 cfgValue;
-
-    if (wlan_cfgGetInt(pMac, WNI_CFG_RMC_ACTION_PERIOD_FREQUENCY,
-                  &cfgValue) != eSIR_SUCCESS)
-    {
-        /**
-         * Could not get Action Period Frequency value
-         * from CFG. Log error.
-         */
-        limLog(pMac, LOGP, FL("could not retrieve ActionPeriodFrequency"));
-    }
-
-    cfgValue = SYS_MS_TO_TICKS(cfgValue);
-
-    vos_mem_zero(&pMac->rmcContext, sizeof(pMac->rmcContext));
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_init(&pMac->rmcContext.lkRmcLock)))
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC lock init failed!"));)
-    }
-
-    if (tx_timer_create(&pMac->rmcContext.gRmcRulerSelectTimer,
-                            "RMC RSP TIMEOUT",
-                            __rmcRulerSelectTimerHandler,
-                            0 /* param */,
-                            cfgValue, 0,
-                            TX_NO_ACTIVATE) != TX_SUCCESS)
-    {
-        limLog(pMac, LOGE, FL("could not create RMC response timer"));
-    }
-
-    pMac->rmcContext.rmcTimerValInTicks = cfgValue;
-}
-
-void
-limRmcCleanup(tpAniSirGlobal pMac)
-{
-    limRmcIbssDelete(pMac);
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_destroy(&pMac->rmcContext.lkRmcLock)))
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC lock destroy failed!"));)
-    }
-
-    tx_timer_delete(&pMac->rmcContext.gRmcRulerSelectTimer);
-}
-
-void
-limRmcTransmitterDelete(tpAniSirGlobal pMac, tSirMacAddr transmitter)
-{
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE,
-             FL("RMC: limRMCTransmitterDelete lock acquire failed"));
-        return;
-    }
-
-    __rmcGroupDeleteHashEntry(pMac, transmitter);
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_release(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE,
-            FL("RMC: limRMCTransmitterDelete lock release failed"));
-    }
-
-    limLog(pMac, LOG1, FL("RMC: limRmcTransmitterDelete complete"));
-}
-
-void
-limRmcIbssDelete(tpAniSirGlobal pMac)
-{
-    tpPESession psessionEntry;
-    tSirMacAddr zeroMacAddr = { 0, 0, 0, 0, 0, 0 };
-
-    /*
-     * This API relies on a single active IBSS session.
-     */
-    psessionEntry = limIsIBSSSessionActive(pMac);
-    if (NULL == psessionEntry)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("RMC: limRmcIbssDelete:No active IBSS"));)
-        return;
-    }
-
-    if (VOS_FALSE == vos_mem_compare(&zeroMacAddr,
-                            &pMac->rmcContext.ruler, sizeof(tSirMacAddr)))
-    {
-        __limPostMsgUpdateInd(pMac, eRMC_RULER_CANCELLED,
-                         eRMC_TRANSMITTER_ROLE, psessionEntry->selfMacAddr,
-                         pMac->rmcContext.ruler);
-    }
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE,
-             FL("RMC: limRmcIbssDelete lock acquire failed"));
-        return;
-    }
-
-    /* Cancel pending timer */
-    tx_timer_deactivate(&pMac->rmcContext.gRmcRulerSelectTimer);
-
-    /* Delete all entries from Ruler database. */
-    __rmcGroupDeleteAllEntries(pMac);
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_release(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE,
-            FL("RMC: limRmcIbssDelete lock release failed"));
-    }
-
-    limLog(pMac, LOG1, FL("RMC: limRmcIbssDelete complete"));
-}
-
-void
-limRmcDumpStatus(tpAniSirGlobal pMac)
-{
-    tLimRmcGroupContext *entry;
-    int index, count;
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE,
-             FL("RMC: limRmcDumpStatus lock acquire failed"));
-        return;
-    }
-
-
-    limLog(pMac, LOGE, FL(" ----- RMC Transmitter Information ----- \n"));
-    limLog(pMac, LOGE,
-         FL("   Ruler Address   |  RMC State \n"));
-
-    if (pMac->rmcContext.state != eRMC_RULER_NOT_SELECTED)
-    {
-        limLog(pMac,LOGE, FL( MAC_ADDRESS_STR " | %s\n"),
-                         MAC_ADDR_ARRAY(pMac->rmcContext.ruler),
-                        __limMcastTxStateToString(pMac->rmcContext.state));
-    }
-
-    limLog( pMac,LOGE, FL(" ----- RMC Ruler Information ----- \n"));
-    limLog( pMac,LOGE, FL("  Transmitter Address\n"));
-
-    count = 0;
-    for (index = 0; index < RMC_MCAST_GROUPS_HASH_SIZE; index++)
-    {
-        entry = pMac->rmcContext.rmcGroupRxHashTable[index];
-
-        while (entry)
-        {
-            count++;
-            limLog( pMac,LOGE, FL("%d. " MAC_ADDRESS_STR " \n"),
-                    count, MAC_ADDR_ARRAY(entry->transmitter));
-            entry = entry->next;
-        }
-    }
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_release(&pMac->rmcContext.lkRmcLock)))
-    {
-        limLog(pMac, LOGE,
-            FL("RMC: limRmcDumpStatus lock release failed"));
-    }
-
-    return;
-
-}
-
-VOS_STATUS
-limRmcTriggerRulerSelection(tpAniSirGlobal pMac, tSirMacAddr macAddr)
-{
-    if ((TRUE == pMac->rmcContext.rmcEnabled) &&
-        (eRMC_RULER_NOT_SELECTED == pMac->rmcContext.state))
-    {
-        limLog(pMac, LOG1,
-          FL("Ruler selection trigerred in FW"));
-
-        __limPostMsgRulerReq(pMac, eRMC_SUGGEST_RULER_CMD, macAddr);
-
-        pMac->rmcContext.state = eRMC_RULER_ENABLE_REQUESTED;
-
-        return VOS_STATUS_SUCCESS;
-    }
-    else
-    {
-        limLog(pMac, LOG1,
-          FL("Could not trigger ruler selection: RMC state %d rmcEnabled %d"),
-          pMac->rmcContext.state, pMac->rmcContext.rmcEnabled);
-
-        return VOS_STATUS_E_FAILURE;
-    }
-}
-
-#endif /* WLAN_FEATURE_RMC */
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limRMC.h b/wlan/prima/CORE/MAC/src/pe/lim/limRMC.h
deleted file mode 100644
index 1ebf0de..0000000
--- a/wlan/prima/CORE/MAC/src/pe/lim/limRMC.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * This file was originally distributed by Qualcomm Atheros, Inc.
- * under proprietary terms before Copyright ownership was assigned
- * to the Linux Foundation.
- */
-
-/*
- *
- * Date:          08/15/13
- * History:-
- * Date           Modified by    Modification Information
- * --------------------------------------------------------------------
- */
-#ifndef __LIM_RMC_H
-#define __LIM_RMC_H
-
-#ifdef WLAN_FEATURE_RMC
-
-typedef enum {
-    eLIM_RMC_ENABLE_REQ = 0,
-    eLIM_RMC_DISABLE_REQ = 1,
-    eLIM_RMC_BECOME_RULER_RESP = 2,
-    eLIM_RMC_RULER_SELECT_RESP = 3,
-    eLIM_RMC_RULER_PICK_NEW = 4,
-    eLIM_RMC_OTA_RULER_INFORM_CANCELLED = 5,
-    eLIM_RMC_OTA_RULER_INFORM_ACK = 6,
-    eLIM_RMC_OTA_RULER_INFORM_SELECTED = 7,
-} eRmcMessageType;
-
-typedef enum {
-    eRMC_RULER_NOT_SELECTED     = 0,
-    eRMC_RULER_ENABLE_REQUESTED = 1,
-    eRMC_RULER_OTA_REQUEST_SENT = 2,
-    eRMC_RULER_ACTIVE           = 3,
-} eRmcMcastTxState;
-
-typedef enum {
-    eRMC_IS_NOT_A_RULER = 0,
-    eRMC_RULER_PENDING = 1,
-    eRMC_IS_A_RULER = 2,
-} eRmcRulerState;
-
-enum {
-    eRMC_SUGGEST_RULER_CMD = 0,
-    eRMC_BECOME_RULER_CMD  = 1,
-};
-
-enum {
-    eRMC_RULER_ACCEPTED  = 0,     //Host-->FW
-    eRMC_RULER_CANCELLED = 1,     //Host-->FW
-    eRMC_RULER_PICK_NEW  = 2,     //FW-->Host
-};
-
-/* tRoleType; */
-typedef enum
-{
-    eRMC_RULER_ROLE,
-    eRMC_TRANSMITTER_ROLE,
-} eRmcRole;
-
-#define RMC_MCAST_GROUPS_HASH_SIZE 32
-
-typedef struct sLimRmcGroupContext
-{
-    tSirMacAddr          transmitter;
-    eRmcRulerState      isRuler;
-    struct sLimRmcGroupContext *next;
-} tLimRmcGroupContext, *tpLimRmcGroupContext;
-
-typedef struct sLimRmcContext
-{
-    tANI_BOOLEAN         rmcEnabled;
-    tSirMacAddr          ruler;
-    eRmcMcastTxState     state;
-    TX_TIMER             gRmcRulerSelectTimer;
-    tANI_U32             rmcTimerValInTicks;
-    vos_lock_t           lkRmcLock;
-    tLimRmcGroupContext *rmcGroupRxHashTable[RMC_MCAST_GROUPS_HASH_SIZE];
-} tLimRmcContext, *tpLimRmcContext;
-
-
-void limRmcInit(tpAniSirGlobal pMac);
-void limRmcCleanup(tpAniSirGlobal pMac);
-void limRmcTransmitterDelete(tpAniSirGlobal pMac, tSirMacAddr transmitter);
-void limRmcIbssDelete(tpAniSirGlobal pMac);
-void limRmcDumpStatus(tpAniSirGlobal pMac);
-
-VOS_STATUS
-limRmcTriggerRulerSelection(tpAniSirGlobal pMac, tSirMacAddr macAddr);
-#endif /* WLAN_FEATURE_RMC */
-
-#endif /*  __LIM_RMC_H */
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limRoamingAlgo.c b/wlan/prima/CORE/MAC/src/pe/lim/limRoamingAlgo.c
index 4a0f067..28fa775 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limRoamingAlgo.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limRoamingAlgo.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -37,7 +37,7 @@
  *
  */
 
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "cfgApi.h"
 #include "limTypes.h"
 #include "limTimerUtils.h"
@@ -152,8 +152,8 @@
     tSirMacAddr      bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
     tSirBackgroundScanMode   backgroundScan;
 
-    limLog(pMac, LOG1, FL("Background Scan: %d success, %d consec fail "),
-        pMac->lim.gLimNumOfBackgroundScanSuccess,  pMac->lim.gLimNumOfConsecutiveBkgndScanFailure);
+    PELOG1(limLog(pMac, LOG1, FL("Background Scan: %d success, %d consec fail "),
+        pMac->lim.gLimNumOfBackgroundScanSuccess,  pMac->lim.gLimNumOfConsecutiveBkgndScanFailure);)
 
     if (! limIsBackgroundScanAllowed(pMac))
     {
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limScanResultUtils.c b/wlan/prima/CORE/MAC/src/pe/lim/limScanResultUtils.c
index 26b3b5b..c735bc8 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limScanResultUtils.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limScanResultUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -71,17 +71,15 @@
 tANI_U32
 limDeactivateMinChannelTimerDuringScan(tpAniSirGlobal pMac)
 {
-    if ((VOS_TRUE ==
-         tx_timer_running(&pMac->lim.limTimers.gLimMinChannelTimer)) &&
-         (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) &&
-             (pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE))
+    if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) && (pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE))
     {
         /**
-         * Beacon/Probe Response is received during active scanning.
-         * Deactivate MIN channel timer if running.
-         */
-
+            * Beacon/Probe Response is received during active scanning.
+            * Deactivate MIN channel timer if running.
+            */
+        
         limDeactivateAndChangeTimer(pMac,eLIM_MIN_CHANNEL_TIMER);
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_MAX_CHANNEL_TIMER));
         if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer)
                                           == TX_TIMER_ERROR)
         {
@@ -125,14 +123,14 @@
  * @return None
  */
 #if defined WLAN_FEATURE_VOWIFI
-void
+eHalStatus
 limCollectBssDescription(tpAniSirGlobal pMac,
                          tSirBssDescription *pBssDescr,
                          tpSirProbeRespBeacon pBPR,
                          tANI_U8  *pRxPacketInfo,
                          tANI_U8  fScanning)
 #else
-void
+eHalStatus
 limCollectBssDescription(tpAniSirGlobal pMac,
                          tSirBssDescription *pBssDescr,
                          tpSirProbeRespBeacon pBPR,
@@ -153,15 +151,26 @@
     pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
     rfBand = WDA_GET_RX_RFBAND(pRxPacketInfo);
 
+    /**
+     * Drop all the beacons and probe response without P2P IE during P2P search
+     */
+    if (NULL != pMac->lim.gpLimMlmScanReq && pMac->lim.gpLimMlmScanReq->p2pSearch)
+    {
+        if (NULL == limGetP2pIEPtr(pMac, (pBody + SIR_MAC_B_PR_SSID_OFFSET), ieLen))
+        {
+            limLog( pMac, LOG3, MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pHdr->bssId));
+            return eHAL_STATUS_FAILURE;
+        }
+    }
 
     /**
      * Length of BSS desription is without length of
      * length itself and length of pointer
-     * that holds ieFields
+     * that holds the next BSS description
      */
     pBssDescr->length = (tANI_U16)(
-                    ((uintptr_t)OFFSET_OF(tSirBssDescription, ieFields)) -
-                    sizeof(pBssDescr->length) + ieLen);
+                    sizeof(tSirBssDescription) - sizeof(tANI_U16) -
+                    sizeof(tANI_U32) + ieLen);
 
     // Copy BSS Id
     vos_mem_copy((tANI_U8 *) &pBssDescr->bssId,
@@ -176,32 +185,7 @@
     pBssDescr->beaconInterval = pBPR->beaconInterval;
     pBssDescr->capabilityInfo = limGetU16((tANI_U8 *) &pBPR->capabilityInfo);
 
-    pBssDescr->HTCapsPresent = 0;
-    pBssDescr->chanWidth = eHT_CHANNEL_WIDTH_20MHZ;
-    pBssDescr->wmeInfoPresent = 0;
-    pBssDescr->vhtCapsPresent = 0;
-    pBssDescr->beacomformingCapable = 0;
-    /* HT capability */
-    if (pBPR->HTCaps.present) {
-        pBssDescr->HTCapsPresent = 1;
-        if (pBPR->HTCaps.supportedChannelWidthSet)
-            pBssDescr->chanWidth = eHT_CHANNEL_WIDTH_40MHZ;
-    }
-    if (pBPR->wmeEdcaPresent)
-        pBssDescr->wmeInfoPresent = 1;
-
-#ifdef WLAN_FEATURE_11AC
-    /* VHT Parameters */
-    if (pBPR->VHTCaps.present) {
-        pBssDescr->vhtCapsPresent = 1;
-        if (pBPR->VHTCaps.muBeamformerCap)
-            pBssDescr->beacomformingCapable = 1;
-    }
-    if (pBPR->VHTOperation.present)
-        if (pBPR->VHTOperation.chanWidth == 1)
-            pBssDescr->chanWidth = eHT_CHANNEL_WIDTH_80MHZ;
-#endif
-    if(!pBssDescr->beaconInterval )
+     if(!pBssDescr->beaconInterval )
     {
 			        limLog(pMac, LOGW,
             FL("Beacon Interval is ZERO, making it to default 100 "
@@ -257,7 +241,7 @@
     //SINR no longer reported by HW
     pBssDescr->sinr = 0;
 
-    pBssDescr->nReceivedTime = vos_timer_get_system_time();
+    pBssDescr->nReceivedTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
 
 #if defined WLAN_FEATURE_VOWIFI
     if( fScanning )
@@ -284,14 +268,13 @@
     }
 #endif
 
-#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_ROAM_SCAN_OFFLOAD)
+#ifdef FEATURE_WLAN_ESE
     pBssDescr->QBSSLoad_present = FALSE;
     pBssDescr->QBSSLoad_avail = 0; 
     if( pBPR->QBSSLoad.present) 
     {
         pBssDescr->QBSSLoad_present = TRUE;
         pBssDescr->QBSSLoad_avail = pBPR->QBSSLoad.avail;
-        pBssDescr->QBSS_ChanLoad = pBPR->QBSSLoad.chautil;
     }
 #endif
     // Copy IE fields
@@ -307,7 +290,7 @@
         pBssDescr->aniIndicator,
         ieLen );
 
-    return;
+    return eHAL_STATUS_SUCCESS;
 } /*** end limCollectBssDescription() ***/
 
 /**
@@ -533,15 +516,21 @@
         return;
     }
 
-    vos_mem_zero(pBssDescr, frameLen);
-
     // In scan state, store scan result.
 #if defined WLAN_FEATURE_VOWIFI
-    limCollectBssDescription(pMac, &pBssDescr->bssDescription,
+    status = limCollectBssDescription(pMac, &pBssDescr->bssDescription,
                              pBPR, pRxPacketInfo, fScanning);
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        goto last;
+    }
 #else
-    limCollectBssDescription(pMac, &pBssDescr->bssDescription,
+    status = limCollectBssDescription(pMac, &pBssDescr->bssDescription,
                              pBPR, pRxPacketInfo);
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        goto last;
+    }
 #endif
     pBssDescr->bssDescription.fProbeRsp = fProbeRsp;
 
@@ -556,13 +545,13 @@
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
     if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo))
     {
-       limLog(pMac, LOG1, FL(" pHdr->addr1:"MAC_ADDRESS_STR),
+       limLog(pMac, LOG2, FL(" pHdr->addr1:"MAC_ADDRESS_STR),
               MAC_ADDR_ARRAY(pHdr->addr1));
-       limLog(pMac, LOG1, FL(" pHdr->addr2:"MAC_ADDRESS_STR),
+       limLog(pMac, LOG2, FL(" pHdr->addr2:"MAC_ADDRESS_STR),
               MAC_ADDR_ARRAY(pHdr->addr2));
-       limLog(pMac, LOG1, FL(" pHdr->addr3:"MAC_ADDRESS_STR),
+       limLog(pMac, LOG2, FL(" pHdr->addr3:"MAC_ADDRESS_STR),
               MAC_ADDR_ARRAY(pHdr->addr3));
-       limLog( pMac, LOG1, FL("Save this entry in LFR cache"));
+       limLog( pMac, LOG2, FL("Save this entry in LFR cache"));
        status = limLookupNaddLfrHashEntry(pMac, pBssDescr, LIM_HASH_ADD, dontUpdateAll);
     }
     else
@@ -616,10 +605,12 @@
         }
     }//(eANI_BOOLEAN_TRUE == fScanning)
 
+last:
     if( eHAL_STATUS_SUCCESS != status )
     {
         vos_mem_free( pBssDescr );
     }
+    return;
 } /****** end limCheckAndAddBssDescription() ******/
 
 
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limScanResultUtils.h b/wlan/prima/CORE/MAC/src/pe/lim/limScanResultUtils.h
index 28ea943..f9b43a0 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limScanResultUtils.h
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limScanResultUtils.h
@@ -61,13 +61,13 @@
 tANI_U32 limDeactivateMinChannelTimerDuringScan(tpAniSirGlobal);
 void    limCheckAndAddBssDescription(tpAniSirGlobal, tpSirProbeRespBeacon, tANI_U8 *, tANI_BOOLEAN, tANI_U8);
 #if defined WLAN_FEATURE_VOWIFI
-void    limCollectBssDescription(tpAniSirGlobal,
+eHalStatus    limCollectBssDescription(tpAniSirGlobal,
                                  tSirBssDescription *,
                                  tpSirProbeRespBeacon,
                                  tANI_U8 *,
                                  tANI_U8);
 #else
-void    limCollectBssDescription(tpAniSirGlobal,
+eHalStatus    limCollectBssDescription(tpAniSirGlobal,
                                  tSirBssDescription *,
                                  tpSirProbeRespBeacon,
                                  tANI_U8 *);
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limSecurityUtils.c b/wlan/prima/CORE/MAC/src/pe/lim/limSecurityUtils.c
index 45a7823..32251c0 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limSecurityUtils.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limSecurityUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,7 +39,7 @@
 #include "wniApi.h"
 
 #include "sirCommon.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "cfgApi.h"
 
 
@@ -50,10 +50,6 @@
 
 
 #define LIM_SEED_LENGTH 16
-/**
- *preauth node timeout value in interval of 10msec
- */
-#define LIM_OPENAUTH_TIMEOUT 500
 
 /**
  * limIsAuthAlgoSupported()
@@ -215,7 +211,7 @@
     {
         pTempNode = pCurrNode->next;
 
-        limLog(pMac, LOG1, FL("=====> limDeletePreAuthList "));
+        PELOG1(limLog(pMac, LOG1, FL("=====> limDeletePreAuthList "));)
         limReleasePreAuthNode(pMac, pCurrNode);
 
         pCurrNode = pTempNode;
@@ -264,69 +260,7 @@
     return pTempNode;
 } /*** end limSearchPreAuthList() ***/
 
-/**
- * limDeleteOpenAuthPreAuthNode
- *
- *FUNCTION:
- * This function is called to delete any stale preauth nodes on
- * receiving authentication frame and existing preauth nodes
- * reached the maximum allowed limit.
- *
- *LOGIC:
- *
- *ASSUMPTIONS:
- *
- *NOTE:
- *
- * @param  pMac - Pointer to Global MAC structure
- *
- * @return true if any preauthnode deleted else false
- */
 
-tANI_U8
-limDeleteOpenAuthPreAuthNode(tpAniSirGlobal pMac)
-{
-    struct tLimPreAuthNode    *pPrevNode, *pTempNode, *pFoundNode;
-    tANI_U8 authNodeFreed = false;
-
-    pTempNode = pPrevNode = pMac->lim.pLimPreAuthList;
-
-    if (pTempNode == NULL)
-        return authNodeFreed;
-
-    while (pTempNode != NULL)
-    {
-        if (pTempNode->mlmState == eLIM_MLM_AUTHENTICATED_STATE &&
-            pTempNode->authType == eSIR_OPEN_SYSTEM &&
-            (vos_timer_get_system_ticks() >
-                   (LIM_OPENAUTH_TIMEOUT + pTempNode->timestamp) ||
-             vos_timer_get_system_ticks() < pTempNode->timestamp))
-        {
-            // Found node to be deleted
-            authNodeFreed = true;
-            pFoundNode = pTempNode;
-            if (pMac->lim.pLimPreAuthList == pTempNode)
-            {
-                pPrevNode = pMac->lim.pLimPreAuthList = pTempNode =
-                                 pFoundNode->next;
-            }
-            else
-            {
-                pPrevNode->next = pTempNode->next;
-                pTempNode = pPrevNode->next;
-            }
-
-            limReleasePreAuthNode(pMac, pFoundNode);
-        }
-        else
-        {
-            pPrevNode = pTempNode;
-            pTempNode = pPrevNode->next;
-        }
-    }
-
-    return authNodeFreed;
-}
 
 /**
  * limAddPreAuthNode
@@ -431,11 +365,10 @@
         pMac->lim.pLimPreAuthList = pTempNode->next;
 
 
-        limLog(pMac, LOG1, FL(" first node to delete"));
-        limLog(pMac, LOG1,
-               FL(" Release data entry:%p idx %d peer: " MAC_ADDRESS_STR),
-                                         pTempNode, pTempNode->authNodeIdx,
-                                                   MAC_ADDR_ARRAY(macAddr));
+        PELOG1(limLog(pMac, LOG1, FL("=====> limDeletePreAuthNode : first node to delete"));)
+        PELOG1(limLog(pMac, LOG1, FL("Release data entry: %x id %d peer "),
+                        pTempNode, pTempNode->authNodeIdx);
+        limPrintMacAddr(pMac, macAddr, LOG1);)
         limReleasePreAuthNode(pMac, pTempNode);
 
         return;
@@ -453,10 +386,10 @@
 
             pPrevNode->next = pTempNode->next;
 
-            limLog(pMac, LOG1, FL(" subsequent node to delete"));
-            limLog(pMac, LOG1,
-                   FL("Release data entry: %p id %d peer: "MAC_ADDRESS_STR),
-                   pTempNode, pTempNode->authNodeIdx, MAC_ADDR_ARRAY(macAddr));
+            PELOG1(limLog(pMac, LOG1, FL("=====> limDeletePreAuthNode : subsequent node to delete"));
+            limLog(pMac, LOG1, FL("Release data entry: %x id %d peer "),
+                         pTempNode, pTempNode->authNodeIdx);
+            limPrintMacAddr(pMac, macAddr, LOG1);)
             limReleasePreAuthNode(pMac, pTempNode);
 
             return;
@@ -524,13 +457,8 @@
     sessionEntry->limMlmState = sessionEntry->limPrevMlmState;
     
     MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, sessionEntry->peSessionId, sessionEntry->limMlmState));
-    /* Set the authAckStatus status flag as sucess as
-     * host have received the auth rsp and no longer auth
-     * retry is needed also cancel the auth rety timer
-     */
-    pMac->authAckStatus = LIM_AUTH_ACK_RCD_SUCCESS;
-    // 'Change' timer for future activations
-    limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER);
+
+
     // 'Change' timer for future activations
     limDeactivateAndChangeTimer(pMac, eLIM_AUTH_FAIL_TIMER);
 
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limSecurityUtils.h b/wlan/prima/CORE/MAC/src/pe/lim/limSecurityUtils.h
index e379bc2..913e347 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limSecurityUtils.h
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limSecurityUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -55,7 +55,6 @@
 void               limReleasePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthNode pAuthNode);
 void               limRestoreFromAuthState(tpAniSirGlobal,
                                            tSirResultCodes, tANI_U16,tpPESession);
-tANI_U8 limDeleteOpenAuthPreAuthNode(tpAniSirGlobal pMac);
 
 // Encryption/Decryption related functions
 tCfgWepKeyEntry    *limLookUpKeyMappings(tSirMacAddr);
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limSendManagementFrames.c b/wlan/prima/CORE/MAC/src/pe/lim/limSendManagementFrames.c
index b5a926d..15b6194 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limSendManagementFrames.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limSendManagementFrames.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -53,7 +53,7 @@
 #include "limAssocUtils.h"
 #include "limFT.h"
 #ifdef WLAN_FEATURE_11W
-#include "wniCfg.h"
+#include "wniCfgAp.h"
 #endif
 
 #if defined WLAN_FEATURE_VOWIFI
@@ -62,7 +62,7 @@
 
 #include "wlan_qct_wda.h"
 
-#define IS_BROADCAST_MAC(x) (((x[0] & x[1] & x[2] & x[3] & x[4] & x[5]) == 0xff) ? 1 : 0)
+
 ////////////////////////////////////////////////////////////////////////
 
 tSirRetStatus limStripOffExtCapIE(tpAniSirGlobal pMac,
@@ -317,6 +317,7 @@
     tANI_U8              sessionId;
     tANI_U8             *p2pIe = NULL;
     tANI_U32             txFlag = 0;
+    tANI_U32             chanbond24G = 0;
 
 #ifndef GEN4_SCAN
     return eSIR_FAILURE;
@@ -413,9 +414,9 @@
            }
     }
 
-    if((nChannelNum <= SIR_11B_CHANNEL_END)
-       && (!IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
-       && (!pMac->roam.configParam.channelBondingMode24GHz))
+    /* Get HT40 capability  for 2.4GHz band */
+    wlan_cfgGetInt(pMac,WNI_CFG_CHANNEL_BONDING_24G,&chanbond24G);
+    if( (nChannelNum <= SIR_11B_CHANNEL_END) && chanbond24G != TRUE)
     {
         pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
         pr.HTCaps.shortGI40MHz = 0;
@@ -426,13 +427,12 @@
        //Include HT Capability IE
        if (psessionEntry->vhtCapability)
        {
-          PopulateDot11fVHTCaps( pMac, &pr.VHTCaps,
-                      psessionEntry->currentOperChannel , eSIR_FALSE );
+          PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, eSIR_FALSE );
        }
     }  else {
        if (IS_DOT11_MODE_VHT(dot11mode))
        {
-          PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, nChannelNum, eSIR_FALSE );
+          PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, eSIR_FALSE );
        }
     }
 #endif
@@ -525,11 +525,6 @@
         txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; 
     }
 
-    if( ( psessionEntry != NULL ) && ( psessionEntry->is11Gonly == true ) &&
-                                     ( !IS_BROADCAST_MAC(bssid) ) ){
-        txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
-    }
-
     halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload,
                             HAL_TXRX_FRM_802_11_MGMT,
                             ANI_TXDIR_TODS,
@@ -740,41 +735,20 @@
         PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps );
         PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry );
     }
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    /* Populate Overlapping BSS Scan Parameters IEs,
-     * when operating in HT40 in 2.4GHz.
-     */
-    if ((pMac->roam.configParam.apHT40_24GEnabled)
-     && (IS_DOT11_MODE_HT(psessionEntry->dot11mode)))
-    {
-        PopulateDot11fOBSSScanParameters( pMac, &pFrm->OBSSScanParameters,
-                                                             psessionEntry);
-        /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in
-         * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK
-         * Mode in 40 MHz bit in HT capablity.
-         */
-        pFrm->HTCaps.dsssCckMode40MHz = 1;
-    }
-#endif
-
-    PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry);
-
 #ifdef WLAN_FEATURE_11AC
     if(psessionEntry->vhtCapability)
     {
         limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response"));
-        PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps,
-                              psessionEntry->currentOperChannel, eSIR_TRUE );
-        PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation ,
-                                          psessionEntry->currentOperChannel);
+        PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps, eSIR_TRUE );
+        PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation );
         // we do not support multi users yet
         //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad );
+        PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry);
     }
 #endif
 
 
-    if ( psessionEntry->pLimStartBssReq )
+    if ( psessionEntry->pLimStartBssReq ) 
     {
       PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
           &pFrm->WPA );
@@ -1319,8 +1293,8 @@
         }
     }
 
-    limLog( pMac, LOG1, FL("Sending an Add TS Request frame to ") );
-    limPrintMacAddr( pMac, peerMacAddr, LOG1 );
+    PELOG3(limLog( pMac, LOG3, FL("Sending an Add TS Request frame to ") );
+    limPrintMacAddr( pMac, peerMacAddr, LOG3 );)
 
     if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
        || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
@@ -1482,7 +1456,6 @@
         if ( pSta->mlmStaContext.htCapability  && 
              psessionEntry->htCapability )
         {
-            limLog(pMac, LOG1, FL("Populate HT IEs in Assoc Response"));
             PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
             /*
              *Check the STA capability and update the HTCaps accordingly
@@ -1496,41 +1469,15 @@
 
             PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry );
         }
-         limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d,"
-                          "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"),
-                 frm.HTCaps.supportedChannelWidthSet, frm.HTCaps.mimoPowerSave,
-                 frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, frm.HTCaps.shortGI40MHz,
-                 frm.HTCaps.dsssCckMode40MHz, frm.HTCaps.maxRxAMPDUFactor);
 
-
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        /* Populate Overlapping BSS Scan Parameters IEs,
-         * when operating in HT40 in 2.4GHz.
-         */
-        if ((pMac->roam.configParam.apHT40_24GEnabled)
-         && (IS_DOT11_MODE_HT(psessionEntry->dot11mode)))
-        {
-            PopulateDot11fOBSSScanParameters( pMac, &frm.OBSSScanParameters,
-                                                               psessionEntry);
-            /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in
-             * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK
-             * Mode in 40 MHz bit in HT capablity.
-             */
-            frm.HTCaps.dsssCckMode40MHz = 1;
-        }
-#endif
-
-        PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
 #ifdef WLAN_FEATURE_11AC
         if( pSta->mlmStaContext.vhtCapability && 
             psessionEntry->vhtCapability )
         {
             limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response"));
-            PopulateDot11fVHTCaps( pMac, &frm.VHTCaps,
-                    psessionEntry->currentOperChannel, eSIR_TRUE );
-            PopulateDot11fVHTOperation( pMac, &frm.VHTOperation,
-                                         psessionEntry->currentOperChannel);
+            PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, eSIR_TRUE );
+            PopulateDot11fVHTOperation( pMac, &frm.VHTOperation);
+            PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
         }
 #endif
 
@@ -1702,16 +1649,16 @@
 
     if (subType == LIM_ASSOC)
     {
-        limLog(pMac, LOG1,
+        PELOG1(limLog(pMac, LOG1,
                FL("*** Sending Assoc Resp status %d aid %d to "),
-               statusCode, aid);
+               statusCode, aid);)
     }    
     else{
-        limLog(pMac, LOG1,
+        PELOG1(limLog(pMac, LOG1,
                FL("*** Sending ReAssoc Resp status %d aid %d to "),
-               statusCode, aid);
+               statusCode, aid);)
     }
-    limPrintMacAddr(pMac, pMacHdr->da, LOG1);
+    PELOG1(limPrintMacAddr(pMac, pMacHdr->da, LOG1);)
 
     if ( addnIEPresent )
     {
@@ -1735,28 +1682,12 @@
     MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
            psessionEntry->peSessionId,
            pMacHdr->fc.subType));
-
-    if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
-    {
-        limLog(pMac, LOG1, FL("Re/AssocRsp - txBdToken %u"), pMac->lim.txBdToken);
-        /// Queue Association Response frame in high priority WQ
-        halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
-                HAL_TXRX_FRM_802_11_MGMT,
-                ANI_TXDIR_TODS,
-                7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
-                limTxComplete, pFrame, limTxBdComplete,
-                txFlag, pMac->lim.txBdToken );
-        pMac->lim.txBdToken++;
-    }
-    else
-    {
-        /// Queue Association Response frame in high priority WQ
-        halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
-                HAL_TXRX_FRM_802_11_MGMT,
-                ANI_TXDIR_TODS,
-                7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
-                limTxComplete, pFrame, txFlag );
-    }
+    /// Queue Association Response frame in high priority WQ
+    halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
+                            HAL_TXRX_FRM_802_11_MGMT,
+                            ANI_TXDIR_TODS,
+                            7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+                            limTxComplete, pFrame, txFlag );
     MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
            psessionEntry->peSessionId,
            halstatus));
@@ -2020,9 +1951,9 @@
         }
     }
 
-    limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "),
+    PELOG1(limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "),
             nStatusCode );
-    limPrintMacAddr( pMac, pMacHdr->da, LOG1 );
+    limPrintMacAddr( pMac, pMacHdr->da, LOG1 );)
 
     if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
        || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
@@ -2210,8 +2141,8 @@
         }
     }
 
-    limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes);
-    limPrintMacAddr(pMac, pMacHdr->da, LOG1);
+    PELOG1(limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes);
+    limPrintMacAddr(pMac, pMacHdr->da, LOG1);)
 
     if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
        || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
@@ -2249,7 +2180,7 @@
     tDot11fAssocRequest *pFrm;
     tANI_U16            caps;
     tANI_U8            *pFrame;
-    tSirRetStatus       nSirStatus = eSIR_FAILURE;
+    tSirRetStatus       nSirStatus;
     tLimMlmAssocCnf     mlmAssocCnf;
     tANI_U32            nPayload, nStatus;
     tANI_U8             fQosEnabled, fWmeEnabled, fWsmEnabled;
@@ -2293,12 +2224,9 @@
     vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 );
 
     vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0);
-    if (psessionEntry->is_ext_caps_present)
-    {
-        nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, pAddIE,
+    nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, pAddIE,
                                   &nAddIELen,
                                   &extractedExtCap );
-    }
     if(eSIR_SUCCESS != nSirStatus )
     {
         extractedExtCapFlag = eANI_BOOLEAN_FALSE;
@@ -2310,9 +2238,10 @@
      */
     else
     {
-        if (extractedExtCap.interworkingService)
+        if(extractedExtCap.interworkingService)
+        {
             extractedExtCap.qosMap = 1;
-        extractedExtCapFlag = lim_is_ext_cap_ie_present(&extractedExtCap);
+        }
     }
 
     caps = pMlmAssocReq->capabilityInfo;
@@ -2441,7 +2370,6 @@
     if ( psessionEntry->htCapability &&
             pMac->lim.htCapabilityPresentInBeacon)
     {
-        limLog(pMac, LOG1, FL("Populate HT IEs in Assoc Request"));
         PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps );
 #ifdef DISABLE_GF_FOR_INTEROP
 
@@ -2461,26 +2389,15 @@
 #endif
 
     }
-
-    limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d,"
-                          "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"),
-           pFrm->HTCaps.supportedChannelWidthSet, pFrm->HTCaps.mimoPowerSave,
-           pFrm->HTCaps.greenField, pFrm->HTCaps.shortGI20MHz, pFrm->HTCaps.shortGI40MHz,
-           pFrm->HTCaps.dsssCckMode40MHz, pFrm->HTCaps.maxRxAMPDUFactor);
-
-
 #ifdef WLAN_FEATURE_11AC
     if ( psessionEntry->vhtCapability &&
         psessionEntry->vhtCapabilityPresentInBeacon)
     {
         limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request"));
-        PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps,
-                        psessionEntry->currentOperChannel, eSIR_FALSE );
-
+        PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps, eSIR_FALSE );
     }
 #endif
-    if (psessionEntry->is_ext_caps_present)
-        PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry);
+    PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry);
 
 #if defined WLAN_FEATURE_VOWIFI_11R
     if (psessionEntry->pLimJoinReq->is11Rconnection)
@@ -2640,15 +2557,11 @@
         txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
     }
 
-    if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ||
-       psessionEntry->pePersona == VOS_STA_MODE)
+    if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE)
     {
         txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
     }
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-    limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_START_EVENT, psessionEntry,
-            eSIR_SUCCESS, eSIR_SUCCESS);
-#endif
+
     pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
     limLog( pMac, LOG1, FL("Sending Assoc req over WQ5 to "MAC_ADDRESS_STR
               " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da),
@@ -2659,30 +2572,14 @@
            psessionEntry->peSessionId,
            pMacHdr->fc.subType));
 
-    if( ( psessionEntry->is11Gonly == true ) &&
-                          ( !IS_BROADCAST_MAC(pMlmAssocReq->peerMacAddr) ) ){
-        txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
-    }
-    if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
-    {
-        limLog(pMac, LOG1, FL("Assoc Req - txBdToken %u"), pMac->lim.txBdToken);
-        halstatus = halTxFrameWithTxComplete( pMac, pPacket,
-                ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
-                HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
-                7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
-                limTxComplete, pFrame, limTxBdComplete, txFlag,
-                pMac->lim.txBdToken);
-        pMac->lim.txBdToken++;
-    }
-    else
-    {
-        halstatus = halTxFrame( pMac, pPacket,
-                ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
-                HAL_TXRX_FRM_802_11_MGMT,
-                ANI_TXDIR_TODS,
-                7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
-                limTxComplete, pFrame, txFlag );
-    }
+    // enable caching
+    WLANTL_EnableCaching(psessionEntry->staId);
+
+    halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
+            HAL_TXRX_FRM_802_11_MGMT,
+            ANI_TXDIR_TODS,
+            7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+            limTxComplete, pFrame, txFlag );
     MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
            psessionEntry->peSessionId,
            halstatus));
@@ -2695,9 +2592,6 @@
         return;
     }
 
-    //Enable caching only if Assoc Request is successfully submitted to the h/w
-    WLANTL_EnableCaching(psessionEntry->staId);
-
     // Free up buffer allocated for mlmAssocReq
     vos_mem_free(pMlmAssocReq);
     pMlmAssocReq = NULL;
@@ -2937,11 +2831,7 @@
     {
         PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
     }
-    limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d,"
-                          "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"),
-                 frm.HTCaps.supportedChannelWidthSet, frm.HTCaps.mimoPowerSave,
-                 frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, frm.HTCaps.shortGI40MHz,
-                 frm.HTCaps.dsssCckMode40MHz, frm.HTCaps.maxRxAMPDUFactor);
+
 #if defined WLAN_FEATURE_VOWIFI_11R
     if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent &&
          (pMac->ft.ftSmeContext.addMDIE == TRUE)
@@ -2959,13 +2849,10 @@
              psessionEntry->vhtCapabilityPresentInBeacon)
     {
         limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request"));
-        PopulateDot11fVHTCaps( pMac, &frm.VHTCaps,
-                         psessionEntry->currentOperChannel, eSIR_FALSE );
-
+        PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, eSIR_FALSE );
     }
 #endif
-    if (psessionEntry->is_ext_caps_present)
-        PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
+    PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
 
     nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
     if ( DOT11F_FAILED( nStatus ) )
@@ -3111,55 +2998,33 @@
         vos_mem_free(psessionEntry->assocReq);
         psessionEntry->assocReq = NULL;
     }
-    if (ft_ies_length)
+
+    psessionEntry->assocReq = vos_mem_malloc(ft_ies_length);
+    if ( NULL == psessionEntry->assocReq )
     {
-        psessionEntry->assocReq = vos_mem_malloc(ft_ies_length);
-        if (NULL == psessionEntry->assocReq)
-        {
-            limLog(pMac, LOGE,
-                        FL("Unable to allocate memory for FT IEs"));
-            psessionEntry->assocReqLen = 0;
-        }
-        else
-        {
-            /* Store the FT IEs. This is sent to csr/hdd in join cnf response.*/
-            vos_mem_copy(psessionEntry->assocReq,
-                    pMac->ft.ftSmeContext.reassoc_ft_ies,
-                    (ft_ies_length));
-            psessionEntry->assocReqLen = ft_ies_length;
-        }
+        PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
+        psessionEntry->assocReqLen = 0;
     }
     else
     {
-        limLog(pMac, LOG1, FL("FT IEs not present"));
-        psessionEntry->assocReqLen = 0;
+       //Store the Assoc request. This is sent to csr/hdd in join cnf response. 
+       vos_mem_copy( psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies,
+                    (ft_ies_length));
+       psessionEntry->assocReqLen = (ft_ies_length);
     }
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-    limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_START_EVENT, psessionEntry,
-            eSIR_SUCCESS, eSIR_SUCCESS);
-#endif
+
+
+    // Enable TL cahching in case of roaming
+    WLANTL_EnableCaching(psessionEntry->staId);
+
     MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
            psessionEntry->peSessionId,
            pMacHdr->fc.subType));
-    if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
-    {
-        limLog( pMac, LOG1, FL("Reassoc req - txBdToken %u"), pMac->lim.txBdToken);
-        halstatus = halTxFrameWithTxComplete( pMac, pPacket,
-                ( tANI_U16 ) (nBytes + ft_ies_length),
-                HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
-                7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
-                limTxComplete, pFrame, limTxBdComplete, txFlag,
-                pMac->lim.txBdToken);
-        pMac->lim.txBdToken++;
-    }
-    else
-    {
-        halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length),
-                HAL_TXRX_FRM_802_11_MGMT,
-                ANI_TXDIR_TODS,
-                7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
-                limTxComplete, pFrame, txFlag );
-    }
+    halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length),
+            HAL_TXRX_FRM_802_11_MGMT,
+            ANI_TXDIR_TODS,
+            7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+            limTxComplete, pFrame, txFlag );
     MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
            psessionEntry->peSessionId,
            halstatus));
@@ -3172,9 +3037,6 @@
         goto end;
     }
 
-    // Enable TL cahching in case of roaming
-    WLANTL_EnableCaching(psessionEntry->staId);
-
 end:
     // Free up buffer allocated for mlmAssocReq
     vos_mem_free( pMlmReassocReq );
@@ -3188,48 +3050,16 @@
 {
     tLimMlmReassocCnf       mlmReassocCnf; // keep sme
     tLimMlmReassocReq       *pTmpMlmReassocReq = NULL;
-#ifdef FEATURE_WLAN_ESE
-    tANI_U32                val=0;
-#endif
-    if (pMlmReassocReq == NULL)
+    if(NULL == pTmpMlmReassocReq)
     {
-        limLog(pMac, LOGE,
-           FL("Invalid pMlmReassocReq"));
-        goto end;
+        pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
+        if ( NULL == pTmpMlmReassocReq ) goto end;
+        vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0);
+        vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq));
     }
 
-    pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
-    if ( NULL == pTmpMlmReassocReq ) goto end;
-    vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0);
-    vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq));
-
     // Prepare and send Reassociation request frame
     // start reassoc timer.
-#ifdef FEATURE_WLAN_ESE
-    /*
-     * In case of Ese Reassociation, change the reassoc timer
-     * value.
-     */
-    val = pMlmReassocReq->reassocFailureTimeout;
-    if (psessionEntry->isESEconnection)
-    {
-        val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
-    }
-    if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
-                                                TX_SUCCESS)
-    {
-        limLog(pMac, LOGP,
-           FL("unable to deactivate Reassoc failure timer"));
-    }
-    val = SYS_MS_TO_TICKS(val);
-    if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
-                                val, 0) != TX_SUCCESS)
-    {
-        limLog(pMac, LOGP,
-          FL("unable to change Reassociation failure timer"));
-    }
-#endif
-
     pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
     // Start reassociation failure timer
     MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
@@ -3292,7 +3122,7 @@
 #if defined WLAN_FEATURE_VOWIFI
     tANI_U8               PowerCapsPopulated = FALSE;
 #endif
-    tpSirMacMgmtHdr       pMacHdr;
+    tpSirMacMgmtHdr     pMacHdr;
 
     if(NULL == psessionEntry)
     {
@@ -3437,20 +3267,13 @@
     {
         PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
     }
-    limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d,"
-                          "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"),
-                 frm.HTCaps.supportedChannelWidthSet, frm.HTCaps.mimoPowerSave,
-                 frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, frm.HTCaps.shortGI40MHz,
-                 frm.HTCaps.dsssCckMode40MHz, frm.HTCaps.maxRxAMPDUFactor);
 #ifdef WLAN_FEATURE_11AC
     if ( psessionEntry->vhtCapability &&
              psessionEntry->vhtCapabilityPresentInBeacon)
     {
         limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request"));
-        PopulateDot11fVHTCaps( pMac, &frm.VHTCaps,
-                     psessionEntry->currentOperChannel, eSIR_FALSE );
-        if (psessionEntry->is_ext_caps_present)
-            PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
+        PopulateDot11fVHTCaps( pMac, &frm.VHTCaps, eSIR_FALSE );
+        PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
     }
 #endif
 
@@ -3557,39 +3380,23 @@
         txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
     }
 
-    if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ||
-       psessionEntry->pePersona == VOS_STA_MODE)
+    if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE)
     {
         txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
     }
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-    limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_START_EVENT, psessionEntry,
-             eSIR_SUCCESS, eSIR_SUCCESS);
-#endif
 
     MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
            psessionEntry->peSessionId,
            pMacHdr->fc.subType));
 
-    if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
-    {
-        limLog(pMac, LOG1, FL("Reassoc req - txBdToken %u"), pMac->lim.txBdToken);
-        halstatus = halTxFrameWithTxComplete( pMac, pPacket,
-                ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
-                HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
-                7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
-                limTxComplete, pFrame, limTxBdComplete,
-                txFlag, pMac->lim.txBdToken );
-        pMac->lim.txBdToken++;
-    }
-    else
-    {
-        halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
-                HAL_TXRX_FRM_802_11_MGMT,
-                ANI_TXDIR_TODS,
-                7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
-                limTxComplete, pFrame, txFlag );
-    }
+    // enable caching
+    WLANTL_EnableCaching(psessionEntry->staId);
+
+    halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
+                            HAL_TXRX_FRM_802_11_MGMT,
+                            ANI_TXDIR_TODS,
+                            7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
+                            limTxComplete, pFrame, txFlag );
     MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
            psessionEntry->peSessionId,
            halstatus));
@@ -3602,9 +3409,6 @@
         goto end;
     }
 
-    // enable caching
-    WLANTL_EnableCaching(psessionEntry->staId);
-
 end:
     // Free up buffer allocated for mlmAssocReq
     vos_mem_free( pMlmReassocReq );
@@ -3612,48 +3416,6 @@
 
 } // limSendReassocReqMgmtFrame
 
-eHalStatus limAuthTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
-{
-    tANI_U32 txCompleteSuccess;
-    tpSirTxBdStatus pTxBdStatus;
-
-    if (!pData)
-    {
-        limLog(pMac, LOG1,
-                FL(" pData is NULL"));
-        return eHAL_STATUS_FAILURE;
-    }
-
-    if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
-    {
-        pTxBdStatus = (tpSirTxBdStatus) pData;
-        txCompleteSuccess = pTxBdStatus->txCompleteStatus;
-        limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"),
-                pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken);
-    }
-    else
-    {
-        txCompleteSuccess = *((tANI_U32*) pData);
-        limLog(pMac, LOG1,
-                FL("txCompleteSuccess= %d"), txCompleteSuccess);
-    }
-
-    if(txCompleteSuccess)
-    {
-       pMac->authAckStatus = LIM_AUTH_ACK_RCD_SUCCESS;
-       // 'Change' timer for future activations
-       limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER);
-    }
-    else
-       pMac->authAckStatus = LIM_AUTH_ACK_RCD_FAILURE;
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-    limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_START_EVENT, NULL,
-                       pMac->authAckStatus, eSIR_SUCCESS);
-#endif
-
-    return eHAL_STATUS_SUCCESS;
-}
-
 /**
  * \brief Send an Authentication frame
  *
@@ -3681,8 +3443,7 @@
                      tpSirMacAuthFrameBody pAuthFrameBody,
                      tSirMacAddr           peerMacAddr,
                      tANI_U8               wepBit,
-                     tpPESession           psessionEntry,
-                     tAniBool              waitForAck
+                     tpPESession           psessionEntry 
                                                        )
 {
     tANI_U8            *pFrame, *pBody;
@@ -3863,11 +3624,11 @@
     {
         vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen);
 
-        limLog(pMac, LOG1,
+        PELOG1(limLog(pMac, LOG1,
            FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR),
            pAuthFrameBody->authStatusCode,
            (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS),
-           MAC_ADDR_ARRAY(pMacHdr->da));
+           MAC_ADDR_ARRAY(pMacHdr->da));)
 
     }
     else
@@ -3926,12 +3687,12 @@
         }
 #endif
 
-        limLog(pMac, LOG1,
+        PELOG1(limLog(pMac, LOG1,
            FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR),
            pAuthFrameBody->authTransactionSeqNumber,
            pAuthFrameBody->authStatusCode,
            (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS),
-           MAC_ADDR_ARRAY(pMacHdr->da));
+           MAC_ADDR_ARRAY(pMacHdr->da));)
     }
     PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);)
 
@@ -3947,15 +3708,13 @@
         txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
     }
 
-    if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ||
-       psessionEntry->pePersona == VOS_STA_MODE)
+    if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE)
     {
         txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
     }
 
-    limLog( pMac, LOG1,
-         FL("Sending Auth Frame over WQ5 with waitForAck %d to "MAC_ADDRESS_STR
-            " From " MAC_ADDRESS_STR), waitForAck, MAC_ADDR_ARRAY(pMacHdr->da),
+    limLog( pMac, LOG1, FL("Sending Auth Frame over WQ5 to "MAC_ADDRESS_STR
+                   " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da),
               MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
 
     txFlag |= HAL_USE_FW_IN_TX_PATH;
@@ -3963,55 +3722,22 @@
     MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
            psessionEntry->peSessionId,
            pMacHdr->fc.subType));
-
-    if( ( psessionEntry->is11Gonly == true ) &&
-                        ( !IS_BROADCAST_MAC(peerMacAddr) ) ){
-         txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
-    }
-    if(eSIR_TRUE == waitForAck)
-    {
-        pMac->authAckStatus = LIM_AUTH_ACK_NOT_RCD;
-        limLog(pMac, LOG1, FL("Auth frame - txBdToken %u"),
-                pMac->lim.txBdToken);
-        halstatus = halTxFrameWithTxComplete( pMac, pPacket,
-                    ( tANI_U16 ) frameLen,
-                    HAL_TXRX_FRM_802_11_MGMT,
-                    ANI_TXDIR_TODS,
-                    7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
-                    limTxComplete, pFrame, limAuthTxCompleteCnf, txFlag,
-                    pMac->lim.txBdToken);
-        pMac->lim.txBdToken++;
-        MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
-               psessionEntry->peSessionId,
-               halstatus));
-        if (!HAL_STATUS_SUCCESS(halstatus))
-        {
-            limLog( pMac, LOGE,
-             FL("Could not send Auth frame, retCode=%X "),
-                    halstatus );
-            pMac->authAckStatus = LIM_AUTH_ACK_RCD_FAILURE;
-            //Pkt will be freed up by the callback
-        }
-    }
-    else
-    {
-      /// Queue Authentication frame in high priority WQ
-      halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen,
+    /// Queue Authentication frame in high priority WQ
+    halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen,
                             HAL_TXRX_FRM_802_11_MGMT,
                             ANI_TXDIR_TODS,
                             7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
                             limTxComplete, pFrame, txFlag );
-      MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
+    MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
            psessionEntry->peSessionId,
            halstatus));
-      if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
-      {
+    if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
+    {
         limLog(pMac, LOGE,
                FL("*** Could not send Auth frame, retCode=%X ***"),
                halstatus);
 
         //Pkt will be freed up by the callback
-      }
     }
 
     return;
@@ -4130,8 +3856,6 @@
         pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
         if (pStaDs == NULL)
         {
-            limLog(pMac, LOGE,
-                   FL("StaDs Null"));
             mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
             goto end;
         }
@@ -4140,8 +3864,6 @@
         if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry))
         {
             mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
-            limLog(pMac, LOGE,
-                   FL("CleanupRxPath error"));
             goto end;
         }
 
@@ -4204,27 +3926,13 @@
     return eHAL_STATUS_SUCCESS;
 }
 
-eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
+eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess)
 {
-    if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
-    {
-        tpSirTxBdStatus pTxBdStatus;
-        pTxBdStatus = (tpSirTxBdStatus) pData;
-        limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"),
-                pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken);
-    }
     return limSendDisassocCnf(pMac);
 }
 
-eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
+eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess)
 {
-    if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
-    {
-        tpSirTxBdStatus pTxBdStatus;
-        pTxBdStatus = (tpSirTxBdStatus) pData;
-        limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"),
-                pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken);
-    }
     return limSendDeauthCnf(pMac);
 }
 
@@ -4352,7 +4060,12 @@
         txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
     }
 
-    txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
+    if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) ||
+       (psessionEntry->pePersona == VOS_P2P_GO_MODE) ||
+       (psessionEntry->pePersona == VOS_STA_SAP_MODE))
+    {
+        txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
+    }
 
     if( IS_FW_IN_TX_PATH_FEATURE_ENABLE )
     {
@@ -4380,8 +4093,7 @@
                 ANI_TXDIR_TODS,
                 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
                 limTxComplete, pFrame, limDisassocTxCompleteCnf,
-                txFlag,
-                pMac->lim.txBdToken++);
+                txFlag );
         MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
                psessionEntry->peSessionId,
                halstatus));
@@ -4556,7 +4268,12 @@
         txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
     }
 
-    txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
+    if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) ||
+       (psessionEntry->pePersona == VOS_P2P_GO_MODE) ||
+       (psessionEntry->pePersona == VOS_STA_SAP_MODE))
+    {
+        txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
+    }
 
     if( IS_FW_IN_TX_PATH_FEATURE_ENABLE )
     {
@@ -4586,8 +4303,7 @@
                 HAL_TXRX_FRM_802_11_MGMT,
                 ANI_TXDIR_TODS,
                 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
-                limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag,
-                pMac->lim.txBdToken++);
+                limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag );
         MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
                psessionEntry->peSessionId,
                halstatus));
@@ -7013,140 +6729,3 @@
    return nSirStatus;
 } // End limSendSaQueryResponseFrame
 #endif
-
-#ifdef WLAN_FEATURE_RMC
-tSirRetStatus
-limSendRMCActionFrame(tpAniSirGlobal  pMac,
-                        tSirMacAddr   peerMacAddr,
-                        tSirRMCInfo  *pRMC,
-                        tpPESession   psessionEntry)
-{
-    tSirRetStatus    nSirStatus;
-    tANI_U8         *pFrame;
-    tDot11fRMC       RMC;
-    tANI_U32         nPayload, nBytes, nStatus;
-    tpSirMacMgmtHdr  pMacHdr;
-    void            *pPacket;
-    eHalStatus       halstatus;
-    tANI_U8          txFlag = 0;
-    tANI_U8 MagicCode[] = { 0x4f, 0x58, 0x59, 0x47, 0x45, 0x4e };
-
-    if (NULL == psessionEntry)
-    {
-       return eSIR_FAILURE;
-    }
-
-    vos_mem_set(( tANI_U8* )&RMC, sizeof( RMC ), 0);
-
-    RMC.Action.action     = pRMC->action;
-    RMC.RMCDialogToken.token = pRMC->dialogToken;
-    RMC.Category.category = SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY;
-    RMC.RMCVersion.version = SIR_MAC_RMC_VER;
-
-    vos_mem_copy(&RMC.RMCOUI.oui, SIR_MAC_RMC_OUI, SIR_MAC_RMC_OUI_SIZE);
-    vos_mem_copy(&RMC.MagicCode.magic, MagicCode, sizeof(MagicCode));
-
-    vos_mem_copy(&RMC.Ruler.mac, pRMC->mcastRuler, sizeof(tSirMacAddr));
-
-    nStatus = dot11fGetPackedRMCSize( pMac, &RMC, &nPayload );
-    if ( DOT11F_FAILED( nStatus ) )
-    {
-        limLog( pMac, LOGE, FL("Failed to calculate the packed size for "
-                               "an RMC (0x%08x)."),
-                nStatus );
-        // We'll fall back on the worst case scenario:
-        nPayload = sizeof( tDot11fRMC );
-    }
-    else if ( DOT11F_WARNED( nStatus ) )
-    {
-        limLog( pMac, LOGW, FL("There were warnings while calculating "
-                               "the packed size for an RMC Action Frame"
-                               " (0x%08x)."), nStatus );
-    }
-
-    nBytes = nPayload + sizeof( tSirMacMgmtHdr );
-
-    halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
-                             ( tANI_U16 )nBytes, ( void** ) &pFrame,
-                             ( void** ) &pPacket );
-    if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
-    {
-        limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an RMC "
-                               "Action Frame."), nBytes );
-        return eSIR_FAILURE;
-    }
-
-    // Paranoia:
-    vos_mem_set( pFrame, nBytes, 0 );
-
-    // Next, we fill out the buffer descriptor:
-    nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
-                    SIR_MAC_MGMT_ACTION, peerMacAddr,
-                    psessionEntry->selfMacAddr);
-    if ( eSIR_SUCCESS != nSirStatus )
-    {
-        limLog( pMac, LOGE, FL("Failed to populate the buffer descriptor "
-                               "for an RMC Action Frame (%d)."),
-                nSirStatus );
-        palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
-                    ( void* ) pFrame, ( void* ) pPacket );
-        return nSirStatus;
-    }
-
-    // Update A3 with the BSSID
-    pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
-    sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
-
-    // That done, pack the struct:
-    nStatus = dot11fPackRMC( pMac, &RMC,
-                                      pFrame + sizeof(tSirMacMgmtHdr),
-                                      nPayload, &nPayload );
-    if ( DOT11F_FAILED( nStatus ) )
-    {
-        limLog( pMac, LOGE, FL("Failed to pack an RMC "
-                               "(0x%08x)."),
-                nStatus );
-        palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame,
-                     ( void* ) pPacket );
-        return eSIR_FAILURE;
-    }
-    else if ( DOT11F_WARNED( nStatus ) )
-    {
-        limLog( pMac, LOGW, FL("There were warnings while packing "
-                               "an RMC (0x%08x)."), nStatus );
-    }
-
-    limLog( pMac, LOG1, FL("Sending an RMC Action frame to "
-             MAC_ADDRESS_STR), MAC_ADDR_ARRAY(peerMacAddr));
-
-    /*
-     * With this masking, RMC action frames will be sent
-     * at self-sta rates for both 2G and 5G bands.
-     */
-    txFlag |= HAL_USE_SELF_STA_REQUESTED_MASK;
-
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
-           psessionEntry->peSessionId,
-           pMacHdr->fc.subType));
-    // Queue RMC Action frame in high priority WQ
-    halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
-                            HAL_TXRX_FRM_802_11_MGMT,
-                            ANI_TXDIR_TODS,
-                            7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
-                            limTxComplete, pFrame, txFlag );
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
-           psessionEntry->peSessionId,
-           halstatus));
-    if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
-    {
-        limLog( pMac, LOGE, FL( "*** Could not send an RMC Action frame"
-                                " (%X) ***" ), halstatus );
-        //Pkt will be freed up by the callback
-        return eSIR_FAILURE;
-    }
-
-    return eSIR_SUCCESS;
-
-} // End limSendRMCActionFrame.
-
-#endif /* WLAN_FEATURE_RMC */
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limSendMessages.c b/wlan/prima/CORE/MAC/src/pe/lim/limSendMessages.c
index 91e028b..b71640f 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limSendMessages.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limSendMessages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -271,17 +271,13 @@
     msgQ.bodyptr = pChnlParams;
     msgQ.bodyval = 0;
 #if defined WLAN_FEATURE_VOWIFI  
-    limLog( pMac, LOG1,
-        FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d,"
-        " ChannelNumber - %d, maxTxPower - %d"),
-        pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber,
-                                                pChnlParams->maxTxPower);
+    PELOG3(limLog( pMac, LOG3,
+        FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, maxTxPower - %d"),
+        pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->maxTxPower);)
 #else
-    limLog( pMac, LOG1,
-        FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, "
-        "ChannelNumber - %d, LocalPowerConstraint - %d"),
-        pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber,
-                                        pChnlParams->localPowerConstraint);
+    PELOG3(limLog( pMac, LOG3,
+        FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, LocalPowerConstraint - %d"),
+        pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->localPowerConstraint);)
 #endif
     MTRACE(macTraceMsgTx(pMac, peSessionId, msgQ.type));
     limLog(pMac,LOG1,"SessionId:%d WDA_CHNL_SWITCH_REQ for SSID:%s",peSessionId,
@@ -673,13 +669,10 @@
     {
         limLog(pMac, LOGE,
                    FL("could not retrieve Valid channel list"));
-        vos_mem_free(ht40OBSSScanInd);
-        return eSIR_FAILURE;
     }
     /* Extract 24G channel list */
     channel24GNum = 0;
-    for( count =0 ;count < validChannelNum &&
-                   (channel24GNum < SIR_ROAM_MAX_CHANNELS);count++)
+    for( count =0 ;count < validChannelNum ;count++)
     {
        if ((validChanList[count]> RF_CHAN_1) &&
            (validChanList[count] < RF_CHAN_14))
@@ -699,10 +692,7 @@
     msgQ.reserved = 0;
     msgQ.bodyptr = (void *)ht40OBSSScanInd;
     msgQ.bodyval = 0;
-    limLog(pMac, LOG1, FL("Sending WDA_HT40_OBSS_SCAN_IND to WDA"
-           "Obss Scan trigger width = %d, delay factor = %d"),
-           ht40OBSSScanInd->BSSChannelWidthTriggerScanInterval,
-            ht40OBSSScanInd->BSSWidthChannelTransitionDelayFactor);
+    PELOGW(limLog(pMac, LOGW, FL("Sending WDA_HT40_OBSS_SCAN_IND to WDA"));)
     MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
     retCode = wdaPostCtrlMsg(pMac, &msgQ);
     if (eSIR_SUCCESS != retCode)
@@ -734,7 +724,7 @@
     bssIdx = psessionEntry->bssIdx;
 
     VOS_TRACE (VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
-               " Sending STOP OBSS cmd, bssid %d staid %d ",
+               " Sending STOP OBSS cmd, bssid %d staid %d \n",
                psessionEntry->bssIdx, psessionEntry->staId);
 
     msgQ.type = WDA_HT40_OBSS_STOP_SCAN_IND;
@@ -798,9 +788,7 @@
     tANI_U8            *ptr;
     tANI_U32           i;
     tANI_U32           msgSize;
-    tANI_BOOLEAN       ignore_secchannel_bcn_filter = false;
     tpBeaconFilterIe   pIe;
-    tpDphHashNode      pStaDs;
 
     if( psessionEntry == NULL )
     {
@@ -846,36 +834,10 @@
     //Fill the BSSIDX
     pBeaconFilterMsg->bssIdx = psessionEntry->bssIdx;
 
-    pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
-                            &psessionEntry->dph.dphHashTable);
-    if((psessionEntry->currentOperChannel <= RF_CHAN_14) &&
-       ((psessionEntry->htSupportedChannelWidthSet ==
-                                eHT_CHANNEL_WIDTH_20MHZ) ||
-        (pStaDs != NULL && (pStaDs->htSupportedChannelWidthSet ==
-                                eHT_CHANNEL_WIDTH_20MHZ))))
-    {
-        ignore_secchannel_bcn_filter = true;
-    }
-
     //Fill message with info contained in the beaconFilterTable
     ptr = (tANI_U8 *)pBeaconFilterMsg + sizeof(tBeaconFilterMsg);
     for(i=0; i < (pBeaconFilterMsg->ieNum); i++)
     {
-        /*
-        *Interoperability workaround:  TP-LINK TL-WDR6300
-        *The value of Secondary Channel Offset in HT Operation element
-        *of beacon frame switching between 1 and 0, which causes dut(sta)
-        *to wake up frequently.
-        */
-        if((ignore_secchannel_bcn_filter == true) &&
-           (beaconFilterTable[i].elementId == SIR_MAC_HT_INFO_EID) &&
-           (beaconFilterTable[i].byte.offset == 1) &&
-           (beaconFilterTable[i].byte.bitMask == HT_BYTE1_FILTER_MASK))
-        {
-            limLog( pMac, LOGW,
-                FL("Skip Secondary Channel bcn filter when channel is 20Mhz"));
-            continue;
-        }
         pIe = (tpBeaconFilterIe) ptr;
         pIe->elementId = beaconFilterTable[i].elementId;
         pIe->checkIePresence = beaconFilterTable[i].checkIePresence;
@@ -953,6 +915,107 @@
     return retCode;
 }
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/** ---------------------------------------------------------
+\fn      limSendTdlsLinkEstablish
+\brief   LIM sends a message to HAL to set tdls direct link
+\param   tpAniSirGlobal  pMac
+\param   
+\return  None
+  -----------------------------------------------------------*/
+tSirRetStatus limSendTdlsLinkEstablish(tpAniSirGlobal pMac, tANI_U8 bIsPeerResponder, tANI_U8 linkIdenOffset, 
+                tANI_U8 ptiBufStatusOffset, tANI_U8 ptiFrameLen, tANI_U8 *ptiFrame, tANI_U8 *extCapability)
+{
+    tSirMsgQ msgQ;
+    tSirRetStatus retCode;
+    tpSirTdlsLinkEstablishInd pTdlsLinkEstablish = NULL;
+
+    // Allocate memory.
+    pTdlsLinkEstablish = vos_mem_malloc(sizeof(tSirTdlsLinkEstablishInd));
+    if ( NULL == pTdlsLinkEstablish )
+    {
+        limLog( pMac, LOGP,
+        FL( "Unable to allocate memory while sending Tdls Link Establish " ));
+
+        retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+        return retCode;
+    }
+
+    vos_mem_set((tANI_U8 *) pTdlsLinkEstablish, sizeof(tSirTdlsLinkEstablishInd), 0);
+
+    pTdlsLinkEstablish->bIsResponder = !!bIsPeerResponder; 
+    pTdlsLinkEstablish->linkIdenOffset = linkIdenOffset;
+    pTdlsLinkEstablish->ptiBufStatusOffset = ptiBufStatusOffset;
+    pTdlsLinkEstablish->ptiTemplateLen = ptiFrameLen;
+    /* Copy ptiFrame template */
+    vos_mem_copy(pTdlsLinkEstablish->ptiTemplateBuf, ptiFrame, ptiFrameLen);
+    /* Copy extended capabilities */
+    vos_mem_copy((tANI_U8 *) pTdlsLinkEstablish->extCapability,  extCapability, sizeof(pTdlsLinkEstablish->extCapability));
+
+    msgQ.type = SIR_HAL_TDLS_LINK_ESTABLISH;
+    msgQ.reserved = 0;
+    msgQ.bodyptr = pTdlsLinkEstablish;
+    msgQ.bodyval = 0;
+    
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+    retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
+    if (retCode != eSIR_SUCCESS)
+    {
+        vos_mem_free(pTdlsLinkEstablish);
+        limLog(pMac, LOGP, FL("Posting tdls link establish %d failed, reason = %x "), retCode);
+    }
+
+    return retCode;
+}
+
+/** ---------------------------------------------------------
+\fn      limSendTdlsLinkTeardown
+\brief   LIM sends a message to HAL to indicate tdls direct link is teardowned
+\param   tpAniSirGlobal  pMac
+\param   
+\return  None
+  -----------------------------------------------------------*/
+tSirRetStatus limSendTdlsLinkTeardown(tpAniSirGlobal pMac, tANI_U16 staId)
+{
+    tSirMsgQ msgQ;
+    tSirRetStatus retCode;
+    tpSirTdlsLinkTeardownInd pTdlsLinkTeardown = NULL;
+
+    // Allocate memory.
+    pTdlsLinkTeardown = vos_mem_malloc(sizeof(tSirTdlsLinkTeardownInd));
+    if ( NULL == pTdlsLinkTeardown )
+    {
+        limLog( pMac, LOGP,
+        FL( "Unable to allocate memory while sending Tdls Link Teardown " ));
+
+        retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
+        return retCode;
+    }
+
+    vos_mem_set((tANI_U8 *) pTdlsLinkTeardown, sizeof(tSirTdlsLinkTeardownInd), 0);
+
+    pTdlsLinkTeardown->staId = staId;
+
+    msgQ.type = SIR_HAL_TDLS_LINK_TEARDOWN;
+    msgQ.reserved = 0;
+    msgQ.bodyptr = pTdlsLinkTeardown;
+    msgQ.bodyval = 0;
+    
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
+    retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
+    if (retCode != eSIR_SUCCESS)
+    {
+        vos_mem_free(pTdlsLinkTeardown);
+        limLog(pMac, LOGP, FL("Posting tdls link teardown %d failed, reason = %x "), retCode);
+    }
+
+    return retCode;
+}
+
+#endif
+
 #ifdef WLAN_FEATURE_11W
 /** ---------------------------------------------------------
 \fn      limSendExcludeUnencryptInd
@@ -987,8 +1050,8 @@
     msgQ.reserved = 0;
     msgQ.bodyptr = pExcludeUnencryptParam;
     msgQ.bodyval = 0;
-    limLog(pMac, LOG1,
-                FL("Sending WDA_EXCLUDE_UNENCRYPTED_IND"));
+    PELOG3(limLog(pMac, LOG3,
+                FL("Sending WDA_EXCLUDE_UNENCRYPTED_IND"));)
     MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
     retCode = wdaPostCtrlMsg(pMac, &msgQ);
     if (eSIR_SUCCESS != retCode)
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limSendMessages.h b/wlan/prima/CORE/MAC/src/pe/lim/limSendMessages.h
index 645cc86..a86a28d 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limSendMessages.h
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limSendMessages.h
@@ -96,6 +96,11 @@
 
 tSirRetStatus limSendBeaconFilterInfo(tpAniSirGlobal pMac, tpPESession psessionEntry);
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+tSirRetStatus limSendTdlsLinkEstablish(tpAniSirGlobal pMac, tANI_U8 bIsPeerResponder, tANI_U8 linkIdenOffset, \
+                tANI_U8 ptiBufStatusOffset, tANI_U8 ptiFrameLen, tANI_U8 *ptiFrame, tANI_U8 *extCapability);
+tSirRetStatus limSendTdlsLinkTeardown(tpAniSirGlobal pMac, tANI_U16 staId);
+#endif
 #ifdef WLAN_FEATURE_11W
 tSirRetStatus limSendExcludeUnencryptInd(tpAniSirGlobal pMac,
                                          tANI_BOOLEAN excludeUnenc,
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c b/wlan/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
index 3c7b02d..7fb6c71 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -41,7 +41,7 @@
 #include "sirCommon.h"
 #include "aniGlobal.h"
 
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "sysDef.h"
 #include "cfgApi.h"
 
@@ -116,7 +116,7 @@
     mmhMsg.type = msgType;
     mmhMsg.bodyptr = pSirSmeRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, smesessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, smesessionId, mmhMsg.type));
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
    {
@@ -194,7 +194,7 @@
     mmhMsg.type = pSirSmeJoinRsp->messageType;
     mmhMsg.bodyptr = pSirSmeJoinRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 }
 
@@ -234,16 +234,16 @@
     }
     else
     {
-        if (IS_DOT11_MODE_HT(psessionEntry->dot11mode)
-#ifdef WLAN_FEATURE_11AC
-        || IS_DOT11_MODE_VHT(psessionEntry->dot11mode)
-        )
-#endif
+        if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
         {
-           if (pStaDs->htShortGI20Mhz || pStaDs->htShortGI40Mhz)
-               rate_flags |= eHAL_TX_RATE_SGI;
-        }
+            if (pStaDs->htShortGI20Mhz || pStaDs->htShortGI40Mhz )
+                rate_flags |= eHAL_TX_RATE_SGI;
 
+            if (pStaDs->htSupportedChannelWidthSet)
+                rate_flags |=eHAL_TX_RATE_HT40;
+            else
+                rate_flags |=eHAL_TX_RATE_HT20;
+        }
 #ifdef WLAN_FEATURE_11AC
         if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
         {
@@ -262,15 +262,7 @@
                     rate_flags |= eHAL_TX_RATE_VHT20;
            }
         }
-        else
 #endif
-        if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
-        {
-            if (pStaDs->htSupportedChannelWidthSet)
-                rate_flags |=eHAL_TX_RATE_HT40;
-            else
-                rate_flags |=eHAL_TX_RATE_HT20;
-        }
     }
 
      return rate_flags;
@@ -318,9 +310,9 @@
         limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
 
-    limLog(pMac, LOG1,
+    PELOG1(limLog(pMac, LOG1,
            FL("Sending message %s with reasonCode %s"),
-           limMsgStr(msgType), limResultCodeStr(resultCode));
+           limMsgStr(msgType), limResultCodeStr(resultCode));)
 
     if(psessionEntry == NULL)
     {
@@ -483,21 +475,7 @@
                 vos_mem_free( psessionEntry->assocRsp);
                 psessionEntry->assocRsp = NULL;
             }
-#ifdef WLAN_FEATURE_VOWIFI_11R
-            if(psessionEntry->ricData != NULL)
-            {
-                vos_mem_free( psessionEntry->ricData);
-                psessionEntry->ricData = NULL;
-            }
-#endif
 
-#ifdef FEATURE_WLAN_ESE
-            if(psessionEntry->tspecIes != NULL)
-            {
-                vos_mem_free(psessionEntry->tspecIes);
-                psessionEntry->tspecIes = NULL;
-            }
-#endif
         }
     }
 
@@ -585,8 +563,8 @@
     tANI_U16            ieLen;
     tANI_U16            ieOffset, curLen;
 
-    limLog(pMac, LOG1, FL("Sending message %s with reasonCode %s"),
-           limMsgStr(msgType), limResultCodeStr(resultCode));
+    PELOG1(limLog(pMac, LOG1, FL("Sending message %s with reasonCode %s"),
+           limMsgStr(msgType), limResultCodeStr(resultCode));)
 
     size = sizeof(tSirSmeStartBssRsp);
 
@@ -681,12 +659,11 @@
     mmhMsg.bodyval = 0;
     if(psessionEntry == NULL)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     }
     else
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
-                  psessionEntry->peSessionId, mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
     }
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
@@ -737,6 +714,10 @@
     tANI_U8               *pbBuf;
     tSirBssDescription    *pDesc;
 
+    PELOG1(limLog(pMac, LOG1,
+       FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s"),
+       length, limResultCodeStr(resultCode));)
+
     if (resultCode != eSIR_SME_SUCCESS)
     {
         limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
@@ -787,8 +768,7 @@
                 pSirSmeScanRsp->length      = curMsgLen;
                 mmhMsg.bodyptr = pSirSmeScanRsp;
                 mmhMsg.bodyval = 0;
-                MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION,
-                                                           mmhMsg.type));
+                MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
                 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
                 pSirSmeScanRsp = vos_mem_malloc(allocLength);
                 if ( NULL == pSirSmeScanRsp )
@@ -807,12 +787,17 @@
             }
             curMsgLen = msgLen;
 
+            PELOG2(limLog(pMac, LOG2, FL("ScanRsp : msgLen %d, bssDescr Len=%d"),
+                          msgLen, ptemp->bssDescription.length);)
             pDesc->length
                     = ptemp->bssDescription.length;
             vos_mem_copy( (tANI_U8 *) &pDesc->bssId,
                           (tANI_U8 *) &ptemp->bssDescription.bssId,
                            ptemp->bssDescription.length);
 
+            PELOG2(limLog(pMac, LOG2, FL("BssId "));
+            limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);)
+
             pSirSmeScanRsp->sessionId   = smesessionId;
             pSirSmeScanRsp->transcationId = smetranscationId;
 
@@ -831,10 +816,6 @@
     }
     else
     {
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-        limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RES_FOUND_EVENT, NULL,
-            eSIR_SUCCESS, eSIR_SUCCESS);
-#endif
         // send last message
         pSirSmeScanRsp->statusCode  = eSIR_SME_SUCCESS;
         pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
@@ -847,8 +828,9 @@
         mmhMsg.type = eWNI_SME_SCAN_RSP;
         mmhMsg.bodyptr = pSirSmeScanRsp;
         mmhMsg.bodyval = 0;
+        MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
         limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
-        limLog(pMac, LOG1, FL("statusCode : eSIR_SME_SUCCESS"));
+        PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS"));)
     }
 
     return;
@@ -948,8 +930,7 @@
                 pSirSmeScanRsp->length      = curMsgLen;
                 mmhMsg.bodyptr = pSirSmeScanRsp;
                 mmhMsg.bodyval = 0;
-                MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION,
-                                                         mmhMsg.type));
+                MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
                 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
                 pSirSmeScanRsp = vos_mem_malloc(allocLength);
                 if ( NULL == pSirSmeScanRsp )
@@ -1009,7 +990,7 @@
         mmhMsg.type = eWNI_SME_SCAN_RSP;
         mmhMsg.bodyptr = pSirSmeScanRsp;
         mmhMsg.bodyval = 0;
-        MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
         limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
         PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS\n"));)
     }
@@ -1044,9 +1025,9 @@
     tpSirSmeScanRsp   pSirSmeScanRsp;
     tSirMsgQ          mmhMsg;
 
-    limLog(pMac, LOG1,
+    PELOG1(limLog(pMac, LOG1,
        FL("limPostSmeScanRspMessage: send SME_SCAN_RSP (len %d, reasonCode %s). "),
-       length, limResultCodeStr(resultCode));
+       length, limResultCodeStr(resultCode));)
 
     pSirSmeScanRsp = vos_mem_malloc(length);
     if ( NULL == pSirSmeScanRsp )
@@ -1074,7 +1055,7 @@
     mmhMsg.bodyptr = pSirSmeScanRsp;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -1242,7 +1223,7 @@
     mmhMsg.bodyptr = pMsg;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
 
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 }
@@ -1288,17 +1269,14 @@
     tANI_U8                     *pBuf;
     tSirSmeDisassocRsp      *pSirSmeDisassocRsp;
     tSirSmeDisassocInd      *pSirSmeDisassocInd;
-    tSirSmeDisConDoneInd    *pSirSmeDisConDoneInd;
     tANI_U32 *pMsg;
-    bool failure = FALSE;
-
-    limLog(pMac, LOG1, FL("Disassoc Ntf with trigger : %d"
-            "reasonCode: %d"),
-            disassocTrigger,
-            reasonCode);
     
     switch (disassocTrigger)
     {
+        case eLIM_PEER_ENTITY_DISASSOC:
+            if (reasonCode != eSIR_SME_STA_NOT_ASSOCIATED)
+                return;
+
         case eLIM_HOST_DISASSOC:
             /**
              * Disassociation response due to
@@ -1311,10 +1289,10 @@
                 // Log error
                 limLog(pMac, LOGP,
                    FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_RSP"));
-                failure = TRUE;
-                goto error;
+
+                return;
             }
-            limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_RSP with "
+            limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with "
             "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
             MAC_ADDR_ARRAY(peerMacAddr));
             pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP;
@@ -1349,35 +1327,6 @@
             pMsg = (tANI_U32*) pSirSmeDisassocRsp;
             break;
 
-        case eLIM_PEER_ENTITY_DISASSOC:
-        case eLIM_LINK_MONITORING_DISASSOC:
-            pSirSmeDisConDoneInd = vos_mem_malloc(sizeof(tSirSmeDisConDoneInd));
-            if ( NULL == pSirSmeDisConDoneInd )
-            {
-                // Log error
-                limLog(pMac, LOGP,
-                 FL("call to AllocateMemory failed for disconnect indication"));
-
-                return;
-            }
-            vos_mem_zero(pSirSmeDisConDoneInd, sizeof(tSirSmeDisConDoneInd));
-            limLog(pMac, LOG1,
-                   FL("send  eWNI_SME_DISCONNECT_DONE_IND withretCode: %d"),
-                       reasonCode);
-            pSirSmeDisConDoneInd->messageType = eWNI_SME_DISCONNECT_DONE_IND;
-            pSirSmeDisConDoneInd->length      = sizeof(tSirSmeDisConDoneInd);
-            vos_mem_copy(pSirSmeDisConDoneInd->peerMacAddr, peerMacAddr,
-                         sizeof(tSirMacAddr));
-            pSirSmeDisConDoneInd->sessionId   = smesessionId;
-
-            if (reasonCode == eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE)
-                pSirSmeDisConDoneInd->reasonCode = 0;
-            else
-                pSirSmeDisConDoneInd->reasonCode = reasonCode;
-
-            pMsg = (tANI_U32 *)pSirSmeDisConDoneInd;
-            break;
-
         default:
             /**
              * Disassociation indication due to Disassociation
@@ -1391,8 +1340,7 @@
                 limLog(pMac, LOGP,
                    FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
 
-                failure = TRUE;
-                goto error;
+                return;
             }
             limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_IND with "
             "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
@@ -1404,7 +1352,6 @@
             pSirSmeDisassocInd->sessionId = smesessionId;
             pSirSmeDisassocInd->transactionId = smetransactionId;
             pSirSmeDisassocInd->reasonCode = reasonCode;
-            pSirSmeDisassocInd->assocId = aid;
             pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
 
             limCopyU32(pBuf, reasonCode);
@@ -1425,16 +1372,15 @@
             break;
     }
 
-error:
     /* Delete the PE session Created */
     if((psessionEntry != NULL) && ((psessionEntry ->limSystemRole ==  eLIM_STA_ROLE) ||
                                   (psessionEntry ->limSystemRole ==  eLIM_BT_AMP_STA_ROLE)) )
     {
         peDeleteSession(pMac,psessionEntry);
     }
-    if (failure == FALSE)
-        limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
-                                             (tANI_U32*) pMsg );
+        
+    limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
+                                              (tANI_U32*) pMsg );
 } /*** end limSendSmeDisassocNtf() ***/
 
 
@@ -1470,7 +1416,6 @@
     pSirSmeDisassocInd->transactionId =  psessionEntry->transactionId;
     pSirSmeDisassocInd->statusCode    =  pStaDs->mlmStaContext.disassocReason;
     pSirSmeDisassocInd->reasonCode    =  pStaDs->mlmStaContext.disassocReason;
-    pSirSmeDisassocInd->assocId       =  pStaDs->assocId;
 
     vos_mem_copy( pSirSmeDisassocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
 
@@ -1482,8 +1427,7 @@
     mmhMsg.bodyptr = pSirSmeDisassocInd;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
-                                                            mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason); 
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -1511,8 +1455,6 @@
     tSirMsgQ  mmhMsg;
     tSirSmeDeauthInd  *pSirSmeDeauthInd;
 
-    limSendTLPauseInd(pMac, pStaDs->staIndex);
-
     pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
     if ( NULL == pSirSmeDeauthInd )
     {
@@ -1525,7 +1467,6 @@
 
     pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
     pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
-    pSirSmeDeauthInd->assocId = pStaDs->assocId;
     if(eSIR_INFRA_AP_MODE == psessionEntry->bssType)
     {
         pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.cleanupTrigger;
@@ -1683,7 +1624,7 @@
  */
 void
 limSendSmeMgmtTXCompletion(tpAniSirGlobal pMac,
-                           tANI_U32 smeSessionId,
+                           tpPESession psessionEntry,
                            tANI_U32 txCompleteStatus)
 {
     tSirMsgQ  mmhMsg;
@@ -1701,7 +1642,7 @@
     pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd);
 
     //sessionId
-    pSirMgmtTxCompletionInd->sessionId = smeSessionId;
+    pSirMgmtTxCompletionInd->sessionId = psessionEntry->smeSessionId;
 
     pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus;
 
@@ -1750,7 +1691,6 @@
     tANI_U8             *pBuf;
     tSirSmeDeauthRsp    *pSirSmeDeauthRsp;
     tSirSmeDeauthInd    *pSirSmeDeauthInd;
-    tSirSmeDisConDoneInd *pSirSmeDisConDoneInd;
     tpPESession         psessionEntry;
     tANI_U8             sessionId;
     tANI_U32            *pMsg;
@@ -1758,6 +1698,9 @@
     psessionEntry = peFindSessionByBssid(pMac,peerMacAddr,&sessionId);  
     switch (deauthTrigger)
     {
+        case eLIM_PEER_ENTITY_DEAUTH:
+            return;
+            
         case eLIM_HOST_DEAUTH:
             /**
              * Deauthentication response to host triggered
@@ -1792,36 +1735,6 @@
 
             break;
 
-        case eLIM_PEER_ENTITY_DEAUTH:
-        case eLIM_LINK_MONITORING_DEAUTH:
-            pSirSmeDisConDoneInd = vos_mem_malloc(sizeof(tSirSmeDisConDoneInd));
-            if ( NULL == pSirSmeDisConDoneInd )
-            {
-                // Log error
-                limLog(pMac, LOGP,
-                 FL("call to AllocateMemory failed for disconnect indication"));
-
-                return;
-            }
-            vos_mem_zero(pSirSmeDisConDoneInd, sizeof(tSirSmeDisConDoneInd));
-            limLog(pMac, LOG1,
-                   FL("send  eWNI_SME_DISCONNECT_DONE_IND withretCode: %d"),
-                       reasonCode);
-
-            pSirSmeDisConDoneInd->messageType = eWNI_SME_DISCONNECT_DONE_IND;
-            pSirSmeDisConDoneInd->length      = sizeof(tSirSmeDisConDoneInd);
-            vos_mem_copy(pSirSmeDisConDoneInd->peerMacAddr, peerMacAddr,
-                    sizeof(tSirMacAddr));
-            pSirSmeDisConDoneInd->sessionId   = smesessionId;
-
-            if (reasonCode == eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE)
-                pSirSmeDisConDoneInd->reasonCode = 0;
-            else
-                pSirSmeDisConDoneInd->reasonCode = reasonCode;
-
-            pMsg = (tANI_U32 *)pSirSmeDisConDoneInd;
-            break;
-
         default:
             /**
              * Deauthentication indication due to Deauthentication
@@ -1843,7 +1756,6 @@
             pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
             pSirSmeDeauthInd->length      = sizeof(tSirSmeDeauthInd);
             pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
-            pSirSmeDeauthInd->assocId    = aid;
 
             // sessionId
             pBuf = (tANI_U8*) &pSirSmeDeauthInd->sessionId;
@@ -1960,7 +1872,7 @@
     }
 
 
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
     if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
     {
         vos_mem_free(pSirSmeWmStatusChangeNtf);
@@ -2036,13 +1948,11 @@
     mmhMsg.bodyval = 0;
     if(NULL == psessionEntry)
     {
-          MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION,
-                                                  mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     }
     else
     {
-          MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
-                     psessionEntry->peSessionId, mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
     }
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
@@ -2120,12 +2030,11 @@
     mmhMsg.bodyval = 0;
     if(NULL == psessionEntry)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     }
     else
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
-                   psessionEntry->peSessionId, mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
     }
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 } /*** end limSendSmeSetContextRsp() ***/
@@ -2261,7 +2170,7 @@
     msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
     msgQ.bodyptr = pNewBssInd;
     msgQ.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
 } /*** end limSendSmeNeighborBssInd() ***/
 
@@ -2307,12 +2216,11 @@
     mmhMsg.bodyval = 0;
     if(NULL == psessionEntry)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     }
     else
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
-                 psessionEntry->peSessionId, mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
     }
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, 0);
@@ -2397,12 +2305,11 @@
     mmhMsg.bodyval = 0;
     if(NULL == psessionEntry)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     }
     else
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
-                   psessionEntry->peSessionId, mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
     }
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
@@ -2507,7 +2414,7 @@
 
     mmhMsg.bodyptr = stats;
     mmhMsg.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);                                                  
 
     return;
@@ -2566,7 +2473,7 @@
 
     mmhMsg.bodyptr = stats;
     mmhMsg.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);                                                  
 
     return;
@@ -2625,7 +2532,7 @@
 
     mmhMsg.bodyptr = stats;
     mmhMsg.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
@@ -2682,7 +2589,7 @@
     mmhMsg.type = eWNI_SME_GET_TSM_STATS_RSP;
     mmhMsg.bodyptr = pStats;
     mmhMsg.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
@@ -2733,7 +2640,7 @@
     mmhMsg.type    = msgType;
 //    mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
     mmhMsg.bodyptr = pNewPeerInd;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
     
 }
@@ -2774,8 +2681,8 @@
     mmhMsg.bodyptr = pExitBmpsInd;
     mmhMsg.bodyval = 0;
   
-    limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. "));
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+    PELOG1(limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. "));)
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)reasonCode);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -2841,7 +2748,7 @@
     mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
     mmhMsg.bodyptr = aggrQosRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, smesessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, smesessionId, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
@@ -2866,7 +2773,7 @@
     mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
     mmhMsg.bodyptr = NULL;
     mmhMsg.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
@@ -2890,7 +2797,7 @@
     mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
     mmhMsg.bodyptr = NULL;
     mmhMsg.bodyval = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
@@ -2916,9 +2823,9 @@
     pSmeMaxAssocInd->sessionId = smesessionId;
     mmhMsg.type = pSmeMaxAssocInd->mesgType;
     mmhMsg.bodyptr = pSmeMaxAssocInd;
-    limLog(pMac, LOG1, FL("msgType %s peerMacAddr "MAC_ADDRESS_STR
-                  " sme session id %d"), "eWNI_SME_MAX_ASSOC_EXCEEDED", MAC_ADDR_ARRAY(peerMacAddr),smesessionId);
-    MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, smesessionId, mmhMsg.type));
+    PELOG1(limLog(pMac, LOG1, FL("msgType %s peerMacAddr "MAC_ADDRESS_STR
+                  " sme session id %d"), "eWNI_SME_MAX_ASSOC_EXCEEDED", MAC_ADDR_ARRAY(peerMacAddr));)
+    MTRACE(macTraceMsgTx(pMac, smesessionId, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
@@ -2950,14 +2857,10 @@
         return;
     }
 
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-    limDiagEventReport(pMac, WLAN_PE_DIAG_ROAM_CANDIDATE_FOUND,
-                       NULL, eSIR_SUCCESS, eSIR_SUCCESS);
-#endif
-
     pSirSmeCandidateFoundInd->messageType = eWNI_SME_CANDIDATE_FOUND_IND;
-    pSirSmeCandidateFoundInd->length = sizeof(tSirSmeCandidateFoundInd);
-    pSirSmeCandidateFoundInd->sessionId = sessionId;
+    pSirSmeCandidateFoundInd->length = sizeof(tSirSmeDisassocInd);
+
+    pSirSmeCandidateFoundInd->sessionId     =  sessionId;
 
 
     limLog( pMac, LOGE, FL("posting candidate ind to SME"));
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limSerDesUtils.c b/wlan/prima/CORE/MAC/src/pe/lim/limSerDesUtils.c
index e879a07..2784ebc 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limSerDesUtils.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limSerDesUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -229,16 +229,10 @@
 #endif
 #endif
 
-#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_ROAM_SCAN_OFFLOAD)
-    /* Extract QBSSLoad_present */
-    pBssDescription->QBSSLoad_present = *pBuf++;
-    len  -= sizeof(tANI_U8);
-    if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
-        return eSIR_FAILURE;
-
-    /* Extract QBSS_ChanLoad */
-    pBssDescription->QBSS_ChanLoad = *pBuf++;
-    len  -= sizeof(tANI_U8);
+#ifdef FEATURE_WLAN_ESE
+    pBssDescription->QBSSLoad_present = limGetU16(pBuf);
+    pBuf += sizeof(tANI_U16);
+    len  -= sizeof(tANI_U16);
     if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
         return eSIR_FAILURE;
 
@@ -283,28 +277,9 @@
         return eSIR_FAILURE;
     }
 
-    pBuf += (WSCIE_PROBE_RSP_LEN);
-    len -= (WSCIE_PROBE_RSP_LEN);
-
-    /* Extract HTCapsPresent */
-    pBssDescription->HTCapsPresent = *pBuf++;
-    len --;
-
-    /* Extract vhtCapsPresent */
-    pBssDescription->vhtCapsPresent = *pBuf++;
-    len --;
-
-    /* Extract wmeInfoPresent */
-    pBssDescription->wmeInfoPresent = *pBuf++;
-    len --;
-
-    /* Extract beacomformingCapable */
-    pBssDescription->beacomformingCapable = *pBuf++;
-    len --;
-
-    /* Extract chanWidth */
-    pBssDescription->chanWidth = *pBuf++;
-    len --;
+    /* 1 reserved byte padding */
+    pBuf += (WSCIE_PROBE_RSP_LEN + 1);
+    len -= (WSCIE_PROBE_RSP_LEN + 1);
 
     if (len > 0)
     {
@@ -764,11 +739,6 @@
         len  -= pStartBssReq->extendedRateSet.numRates;
     }
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    /* extract apHT40_24GEnabled */
-    pStartBssReq->apHT40_24GEnabled = *pBuf++;
-    len--;
-#endif
     if (len)
     {
         limLog(pMac, LOGW, FL("Extra bytes left in SME_START_BSS_REQ, len=%d"), len);
@@ -993,22 +963,6 @@
         return eSIR_FAILURE;
     }
 
-    pJoinReq->bOSENAssociation = *pBuf++;
-    len--;
-    if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
-    {
-        limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
-        return eSIR_FAILURE;
-    }
-
-    pJoinReq->bWPSAssociation = *pBuf++;
-    len--;
-    if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
-    {
-         limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
-         return eSIR_FAILURE;
-    }
-
     // Extract cbMode
     pJoinReq->cbMode = *pBuf++;
     len--;
@@ -1059,11 +1013,6 @@
         }
     }
 
-    //Extract rateBitMap
-    pJoinReq->rateBitMap = limGetU16(pBuf);
-    pBuf += sizeof(tANI_U16);
-    len -= sizeof(tANI_U16);
-
     // Extract RSN IE
     pJoinReq->rsnIE.length = limGetU16(pBuf);
     pBuf += sizeof(tANI_U16);
@@ -1127,7 +1076,7 @@
     if (pJoinReq->addIEScan.length)
     {
         // Check for IE length (that includes length of type & length)
-        if (pJoinReq->addIEScan.length > SIR_MAC_MAX_ADD_IE_LENGTH + 2)
+        if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2)
         {
             limLog(pMac, LOGE,
                    FL("Invalid addIE Scan length %d in SME_JOIN_REQ"),
@@ -1354,11 +1303,11 @@
     pBuf += pJoinReq->supportedChannels.numChnl;
     len-= pJoinReq->supportedChannels.numChnl;
 
-    limLog(pMac, LOG1,
+    PELOG2(limLog(pMac, LOG2,
             FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d"),
             pJoinReq->powerCap.minTxPower,
             pJoinReq->powerCap.maxTxPower,
-            pJoinReq->supportedChannels.numChnl);
+            pJoinReq->supportedChannels.numChnl);)
 
     // Extract uapsdPerAcBitmask
     pJoinReq->uapsdPerAcBitmask = *pBuf++;
@@ -1487,13 +1436,6 @@
     limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
     pBuf += sizeof(tANI_U32);
     mLen += sizeof(tANI_U32);
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    limCopyU32(pBuf, pAssocInd->HT40MHzIntoPresent);
-    pBuf += sizeof(tANI_U32);
-    mLen += sizeof(tANI_U32);
-#endif
-
      // Fill in length of SME_ASSOC_IND message
     limCopyU16(pLen, mLen);
 
@@ -1633,9 +1575,7 @@
     pBuf += sizeof(tSirMacAddr);
 
     vos_mem_copy( pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
-    pBuf += sizeof(tSirMacAddr);
 
-    pDisassocCnf->assocId = limGetU16(pBuf);
 
     return eSIR_SUCCESS;
 } /*** end limDisassocCnfSerDes() ***/
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limSession.c b/wlan/prima/CORE/MAC/src/pe/lim/limSession.c
index 58b7571..3c85332 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limSession.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limSession.c
@@ -33,6 +33,9 @@
 
   \author Sunit Bhatia
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -109,23 +112,20 @@
             vos_mem_set((void*)&pMac->lim.gpSession[i], sizeof(tPESession), 0);
 
             //Allocate space for Station Table for this session.
-            pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = vos_mem_vmalloc(
+            pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = vos_mem_malloc(
                                                   sizeof(tpDphHashNode)*numSta);
             if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pHashTable )
             {
-                limLog(pMac, LOGE, FL("memory allocate for size %lu failed!"),
-                            (long unsigned int) sizeof(tpDphHashNode)*numSta);
+                limLog(pMac, LOGE, FL("memory allocate failed!"));
                 return NULL;
             }
 
-            pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = vos_mem_vmalloc(
+            pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = vos_mem_malloc(
                                                        sizeof(tDphHashNode)*numSta);
             if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray )
             {
-                limLog(pMac, LOGE, FL("memory allocate failed for Node array"
-                                                               "of size %lu"),
-                             (long unsigned int) sizeof(tDphHashNode)*numSta);
-                vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
+                limLog(pMac, LOGE, FL("memory allocate failed!"));
+                vos_mem_free(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
                 pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL;
                 return NULL;
             }
@@ -134,15 +134,13 @@
             dphHashTableClassInit(pMac, 
                            &pMac->lim.gpSession[i].dph.dphHashTable);
 
-            pMac->lim.gpSession[i].gpLimPeerIdxpool = vos_mem_vmalloc(sizeof(
+            pMac->lim.gpSession[i].gpLimPeerIdxpool = vos_mem_malloc(sizeof(
                                 *pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1));
             if ( NULL == pMac->lim.gpSession[i].gpLimPeerIdxpool )
             {
-                limLog(pMac, LOGE, FL("memory allocate failed "
-                "for peerId pool of size %lu!"), (long unsigned int)
-                sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1));
-                vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
-                vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray);
+                PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
+                vos_mem_free(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
+                vos_mem_free(pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray);
                 pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL;
                 pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = NULL;
                 return NULL;
@@ -197,7 +195,7 @@
             return(&pMac->lim.gpSession[i]);
         }
     }
-    limLog(pMac, LOGE, FL("Session can not be created.. Reached Max permitted sessions "));
+    limLog(pMac, LOGE, FL("Session can not be created.. Reached Max permitted sessions \n "));
     return NULL;
 }
 
@@ -230,7 +228,7 @@
         }
     }
 
-    limLog(pMac, LOG4, FL("Session lookup fails for BSSID: "));
+    limLog(pMac, LOG4, FL("Session lookup fails for BSSID: \n "));
     limPrintMacAddr(pMac, bssid, LOG4);
     return(NULL);
 
@@ -279,13 +277,14 @@
 {
     if(sessionId >=  pMac->lim.maxBssId)
     {
-        limLog(pMac, LOGE, FL("Invalid sessionId: %d "), sessionId);
+        limLog(pMac, LOGE, FL("Invalid sessionId: %d \n "), sessionId);
         return(NULL);
     }
     if((pMac->lim.gpSession[sessionId].valid == TRUE))
     {
         return(&pMac->lim.gpSession[sessionId]);
     }
+    limLog(pMac, LOG1, FL("Session %d  not active\n "), sessionId);
     return(NULL);
 
 }
@@ -346,7 +345,6 @@
     tANI_U16 i = 0;
     tANI_U16 n;
     TX_TIMER *timer_ptr;
-    eHalStatus lock_status = eHAL_STATUS_SUCCESS;
 
     limLog(pMac, LOGW, FL("Trying to delete a session %d Opmode %d BssIdx %d"
            " BSSID: " MAC_ADDRESS_STR), psessionEntry->peSessionId,
@@ -401,26 +399,21 @@
         psessionEntry->pLimMlmJoinReq = NULL;
     }
 
-    lock_status =  pe_AcquireGlobalLock(&pMac->lim);
-    if (eHAL_STATUS_SUCCESS == lock_status)
+    if(psessionEntry->dph.dphHashTable.pHashTable != NULL)
     {
-         if (psessionEntry->dph.dphHashTable.pHashTable != NULL)
-         {
-             vos_mem_vfree(psessionEntry->dph.dphHashTable.pHashTable);
-             psessionEntry->dph.dphHashTable.pHashTable = NULL;
-         }
+        vos_mem_free(psessionEntry->dph.dphHashTable.pHashTable);
+        psessionEntry->dph.dphHashTable.pHashTable = NULL;
     }
-    pe_ReleaseGlobalLock(&pMac->lim);
 
     if(psessionEntry->dph.dphHashTable.pDphNodeArray != NULL)
     {
-        vos_mem_vfree(psessionEntry->dph.dphHashTable.pDphNodeArray);
+        vos_mem_free(psessionEntry->dph.dphHashTable.pDphNodeArray);
         psessionEntry->dph.dphHashTable.pDphNodeArray = NULL;
     }
 
     if(psessionEntry->gpLimPeerIdxpool != NULL)
     {
-        vos_mem_vfree(psessionEntry->gpLimPeerIdxpool);
+        vos_mem_free(psessionEntry->gpLimPeerIdxpool);
         psessionEntry->gpLimPeerIdxpool = NULL;
     }
 
@@ -529,7 +522,7 @@
       }
    }   
 
-   limLog(pMac, LOG1, FL("Session lookup fails for Peer StaId: "));
+   limLog(pMac, LOG1, FL("Session lookup fails for Peer StaId: \n "));
    limPrintMacAddr(pMac, sa, LOG1);
    return NULL;
 }
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limSessionUtils.c b/wlan/prima/CORE/MAC/src/pe/lim/limSessionUtils.c
index 023672f..3026a9d 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limSessionUtils.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limSessionUtils.c
@@ -253,7 +253,7 @@
 
     if(sessionId >=  pMac->lim.maxBssId)
     {
-        limLog(pMac, LOGE, FL("Invalid sessionId: %d "), sessionId);
+        limLog(pMac, LOGE, FL("Invalid sessionId: %d \n "), sessionId);
         return FALSE;
     }
 
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limSessionUtils.h b/wlan/prima/CORE/MAC/src/pe/lim/limSessionUtils.h
index 7e169f6..9e211dd 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limSessionUtils.h
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limSessionUtils.h
@@ -38,6 +38,9 @@
 
   \author Sunit Bhatia
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limSmeReqUtils.c b/wlan/prima/CORE/MAC/src/pe/lim/limSmeReqUtils.c
index 42689a2..07614f1 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limSmeReqUtils.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limSmeReqUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,7 +39,7 @@
  */
 
 #include "wniApi.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "cfgApi.h"
 #include "sirApi.h"
 #include "schApi.h"
@@ -855,13 +855,6 @@
     tANI_U8 valid = true;
     tANI_U8 i = 0;
 
-    if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
-    {
-        valid = false;
-        limLog(pMac, LOGE, FL("Number of SSIDs > SIR_SCAN_MAX_NUM_SSID"));
-        goto end;
-    }
-
     for (i = 0; i < pScanReq->numSsid; i++)
     {
         if (pScanReq->ssId[i].length > SIR_MAC_MAX_SSID_LENGTH)
@@ -872,7 +865,7 @@
             goto end;    
         }
     }
-    if ((pScanReq->bssType < 0) || (pScanReq->bssType > eSIR_AUTO_MODE))
+    if (pScanReq->bssType > eSIR_AUTO_MODE)
     {
         limLog(pMac, LOGE, FL("Invalid BSS Type"));
         valid = false;
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limTimerUtils.c b/wlan/prima/CORE/MAC/src/pe/lim/limTimerUtils.c
index 1e3d522..5dd4a1e 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limTimerUtils.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limTimerUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -40,7 +40,7 @@
 #include "limAssocUtils.h"
 #include "limSecurityUtils.h"
 #include "pmmApi.h"
-#include "limApi.h"
+
 
 // default value 5000 ms for background scan period when it is disabled
 #define LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS    5000
@@ -54,8 +54,6 @@
 #define LIM_KEEPALIVE_TIMER_MS                   3000
 // Lim JoinProbeRequest Retry  timer default (200)ms
 #define LIM_JOIN_PROBE_REQ_TIMER_MS              200
-#define LIM_AUTH_RETRY_TIMER_MS              60
-
 
 //default beacon interval value used in HB timer interval calculation
 #define LIM_HB_TIMER_BEACON_INTERVAL             100
@@ -259,18 +257,7 @@
             limLog(pMac, LOGP, FL("could not create Periodic Join Probe Request timer"));
             goto err_timer;
         }
-        //Send Auth frame every 60 ms
-        if ((tx_timer_create(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer,
-                        "Periodic AUTH Timer",
-                        limTimerHandler, SIR_LIM_AUTH_RETRY_TIMEOUT,
-                        SYS_MS_TO_TICKS(LIM_AUTH_RETRY_TIMER_MS), 0,
-                        TX_NO_ACTIVATE)) != TX_SUCCESS)
-        {
-            /// Could not create Periodic Join Probe Request timer.
-            // Log error
-            limLog(pMac, LOGP, FL("could not create Periodic AUTH Timer timer"));
-            goto err_timer;
-        }
+
         if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
                       &cfgValue) != eSIR_SUCCESS)
         {
@@ -468,6 +455,39 @@
                FL("call to create background scan timer failed"));
             goto err_timer;
         }
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+        /*
+         * create TDLS timers..
+         * a) TDLS discovery response timer.
+         */
+
+        if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
+                                            &cfgValue) != eSIR_SUCCESS)
+        {
+            /*
+             * Could not get discovery response Timeout value
+             * from CFG. Log error.
+             */
+            limLog(pMac, LOGP,
+               FL("could not retrieve ReassocFailureTimeout value"));
+        }
+        cfgValue = SYS_MS_TO_TICKS(cfgValue);
+
+        /*
+         * create TDLS discovery response wait timer and activate it later
+         */
+        if (tx_timer_create(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer,
+                            "TDLS discovery response WAIT",
+                            limTimerHandler,
+                            SIR_LIM_TDLS_DISCOVERY_RSP_WAIT,
+                            cfgValue, 0,
+                            TX_NO_ACTIVATE) != TX_SUCCESS)
+        {
+            limLog(pMac, LOGP,
+               FL("could not create TDLS discovery response wait timer"));
+        goto err_timer;
+        }
+#endif
     }
 
     /**
@@ -560,7 +580,7 @@
                FL("could not retrieve mac preauth value"));
     }
     pMac->lim.gLimPreAuthTimerTable.numEntry = cfgValue;
-    pMac->lim.gLimPreAuthTimerTable.pTable = vos_mem_vmalloc(cfgValue*sizeof(tLimPreAuthNode));
+    pMac->lim.gLimPreAuthTimerTable.pTable = vos_mem_malloc(cfgValue*sizeof(tLimPreAuthNode));
     if(pMac->lim.gLimPreAuthTimerTable.pTable == NULL)
     {
         limLog(pMac, LOGP, FL("AllocateMemory failed!"));
@@ -677,32 +697,18 @@
         goto err_timer;
     }
 
-    cfgValue = WNI_CFG_ACTIVE_PASSIVE_CON_MAX;
-    if (eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_PASSIVE_CON,
-                                      &cfgValue))
-    {
-        limLog(pMac, LOGP,
-               FL("could not retrieve WNI_CFG_ACTIVE_PASSIVE_CON"));
-    }
-    if (cfgValue)
-    {
-        cfgValue = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT;
-        cfgValue = SYS_MS_TO_TICKS(cfgValue);
-        if (tx_timer_create(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer,
+    cfgValue = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT;
+    cfgValue = SYS_MS_TO_TICKS(cfgValue);
+    if (tx_timer_create(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer,
                                   "ACTIVE TO PASSIVE CHANNEL", limTimerHandler,
                  SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE, cfgValue, 0,
                  TX_NO_ACTIVATE) != TX_SUCCESS)
-        {
-            limLog(pMac, LOGW,FL("could not create timer for passive channel to active channel"));
-            goto err_timer;
-        }
-    }
-    else
     {
-        limLog(pMac, LOG1,
-               FL("gLimActiveToPassiveChannelTimer not created %d"), cfgValue);
+        limLog(pMac, LOGW,FL("could not create timer for passive channel to active channel"));
+        goto err_timer;
     }
 
+
     return TX_SUCCESS;
 
     err_timer:
@@ -727,7 +733,6 @@
         tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
         tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
         tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
-        tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
         tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
         tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
         tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
@@ -739,7 +744,7 @@
 
         if(NULL != pMac->lim.gLimPreAuthTimerTable.pTable)
         {
-            vos_mem_vfree(pMac->lim.gLimPreAuthTimerTable.pTable);
+            vos_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable);
             pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
         }
 
@@ -788,7 +793,7 @@
     msg.bodyptr = NULL;
     msg.bodyval = 0;
 
-    if ((statusCode = limPostMsgApiHighPri(pMac, &msg)) != eSIR_SUCCESS)
+    if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
         limLog(pMac, LOGE,
                FL("posting message %X to LIM failed, reason=%d"),
                msg.type, statusCode);
@@ -904,16 +909,7 @@
        (pMac->lim.pSessionEntry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE))
     {
         limLog(pMac, LOGE, FL("Reassoc timeout happened"));
-#ifdef FEATURE_WLAN_ESE
-        if (((pMac->lim.pSessionEntry->isESEconnection) &&
-             (pMac->lim.reAssocRetryAttempt <
-             (LIM_MAX_REASSOC_RETRY_LIMIT - 1)))||
-            ((!pMac->lim.pSessionEntry->isESEconnection) &&
-             (pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT))
-           )
-#else
-        if (pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT)
-#endif
+        if(pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT)
         {
             limSendRetryReassocReqFrame(pMac, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, pMac->lim.pSessionEntry);
             pMac->lim.reAssocRetryAttempt++;
@@ -1003,7 +999,8 @@
 limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
 {
     tANI_U32    val=0, val1=0;
-    tpPESession  psessionEntry;
+
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
 
     switch (timerId)
     {
@@ -1131,23 +1128,12 @@
                     break;
                 }
             }
-            if (val)
+            if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
+                                val, 0) != TX_SUCCESS)
             {
-                if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
-                                    val, 0) != TX_SUCCESS)
-                {
-                    // Could not change min channel timer.
-                    // Log error
-                    limLog(pMac, LOGE, FL("Unable to change periodic timer"));
-                }
-            }
-            else
-            {
-                limLog(pMac, LOGE, FL("Do not change gLimPeriodicProbeReqTimer values,"
-                       "value = %d minchannel time = %d"
-                       "maxchannel time = %d"), val,
-                       pMac->lim.gpLimMlmScanReq->minChannelTime,
-                       pMac->lim.gpLimMlmScanReq->maxChannelTime);
+                // Could not change min channel timer.
+                // Log error
+                limLog(pMac, LOGP, FL("Unable to change periodic timer"));
             }
 
             break;
@@ -1309,37 +1295,6 @@
 
             break;
 
-        case eLIM_AUTH_RETRY_TIMER:
-
-            if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer)
-                                         != TX_SUCCESS)
-            {
-                // Could not deactivate Auth Retry Timer.
-                limLog(pMac, LOGP,
-                       FL("Unable to deactivate Auth Retry timer"));
-            }
-            if ((psessionEntry = peFindSessionBySessionId(pMac,
-                pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId))
-                                                                      == NULL)
-            {
-                   limLog(pMac, LOGP,
-                     FL("session does not exist for given SessionId : %d"),
-                     pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId);
-                   break;
-            }
-            /* 3/5 of the beacon interval*/
-            val = psessionEntry->beaconParams.beaconInterval * 3/5;
-            val = SYS_MS_TO_TICKS(val);
-            if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer,
-                                val, 0) != TX_SUCCESS)
-            {
-                // Could not change Auth Retry timer.
-                // Log error
-                limLog(pMac, LOGP, FL("Unable to change Auth Retry timer"));
-            }
-
-            break;
-
         case eLIM_ASSOC_FAIL_TIMER:
             if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer) !=
                                     TX_SUCCESS)
@@ -1838,6 +1793,7 @@
        return;
    }
 
+   MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
 #ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
    if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
       return;
@@ -1911,6 +1867,7 @@
 #endif
 
     limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
 
     //only start the hearbeat-timer if the timeout value is non-zero
     if(pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs > 0)
@@ -2054,6 +2011,7 @@
 limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal pMac, tANI_U32 timerId, tANI_U16 staId)
 {
     tANI_U32    val;
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
 
     switch (timerId)
     {
@@ -2164,6 +2122,7 @@
 
 void limActivateCnfTimer(tpAniSirGlobal pMac, tANI_U16 staId, tpPESession psessionEntry)
 {
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_CNF_WAIT_TIMER));
     pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId = psessionEntry->peSessionId;
     if (tx_timer_activate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
                 != TX_SUCCESS)
@@ -2195,6 +2154,7 @@
 
 void limActivateAuthRspTimer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode)
 {
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_AUTH_RESP_TIMER));
     if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS)
     {
         /// Could not activate auth rsp timer.
@@ -2281,8 +2241,8 @@
     tSirMsgQ    msg;
     tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
 
-    limLog(pMac, LOG1,
-        FL("ChannelSwitch Timer expired.  Posting msg to LIM "));
+    PELOG1(limLog(pMac, LOG1,
+        FL("ChannelSwitch Timer expired.  Posting msg to LIM "));)
 
     msg.type = SIR_LIM_CHANNEL_SWITCH_TIMEOUT;
     msg.bodyval = (tANI_U32)param;
@@ -2301,8 +2261,8 @@
     msg.bodyval = (tANI_U32)param;
     msg.bodyptr = NULL;
 
-    limLog(pMac, LOG1,
-        FL("Post SIR_LIM_QUIET_TIMEOUT msg. "));
+    PELOG1(limLog(pMac, LOG1,
+        FL("Post SIR_LIM_QUIET_TIMEOUT msg. "));)
     limPostMsgApi(pMac, &msg);
 }
 
@@ -2315,8 +2275,8 @@
     msg.type = SIR_LIM_QUIET_BSS_TIMEOUT;
     msg.bodyval = (tANI_U32)param;
     msg.bodyptr = NULL;
-    limLog(pMac, LOG1,
-        FL("Post SIR_LIM_QUIET_BSS_TIMEOUT msg. "));
+    PELOG1(limLog(pMac, LOG1,
+        FL("Post SIR_LIM_QUIET_BSS_TIMEOUT msg. "));)
     limPostMsgApi(pMac, &msg);
 }
 #if 0
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limTimerUtils.h b/wlan/prima/CORE/MAC/src/pe/lim/limTimerUtils.h
index 1906182..e623bff 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limTimerUtils.h
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limTimerUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -68,16 +68,21 @@
 #ifdef WLAN_FEATURE_VOWIFI_11R
     eLIM_FT_PREAUTH_RSP_TIMER,
 #endif
+    eLIM_REMAIN_CHN_TIMER,
     eLIM_PERIODIC_PROBE_REQ_TIMER,
 #ifdef FEATURE_WLAN_ESE
     eLIM_TSM_TIMER,
 #endif
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+    eLIM_TDLS_DISCOVERY_RSP_WAIT,
+    eLIM_TDLS_LINK_SETUP_RSP_TIMEOUT,
+    eLIM_TDLS_LINK_SETUP_CNF_TIMEOUT,
+#endif
     eLIM_DISASSOC_ACK_TIMER,
     eLIM_DEAUTH_ACK_TIMER,
     eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER,
     eLIM_INSERT_SINGLESHOT_NOA_TIMER,
-    eLIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE,
-    eLIM_AUTH_RETRY_TIMER
+    eLIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE
 };
 
 #define LIM_DISASSOC_DEAUTH_ACK_TIMEOUT         500
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limTrace.c b/wlan/prima/CORE/MAC/src/pe/lim/limTrace.c
index 662670b..955dc0d 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limTrace.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limTrace.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,6 +33,9 @@
 
   \author Sunit Bhatia
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -82,6 +85,7 @@
 #ifdef WLAN_FEATURE_VOWIFI_11R
         CASE_RETURN_STRING(eLIM_FT_PREAUTH_RSP_TIMER);
 #endif
+        CASE_RETURN_STRING(eLIM_REMAIN_CHN_TIMER);
         CASE_RETURN_STRING(eLIM_PERIODIC_PROBE_REQ_TIMER);
 #ifdef FEATURE_WLAN_ESE
         CASE_RETURN_STRING(eLIM_TSM_TIMER);
@@ -91,7 +95,6 @@
         CASE_RETURN_STRING(eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
         CASE_RETURN_STRING(eLIM_INSERT_SINGLESHOT_NOA_TIMER);
         CASE_RETURN_STRING(eLIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE);
-        CASE_RETURN_STRING(eLIM_AUTH_RETRY_TIMER);
         default:
             return( "UNKNOWN" );
             break;
@@ -151,199 +154,108 @@
 
     switch (pRecord->code) {
         case TRACE_CODE_MLM_STATE:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s  %-30s(0x%x)",
-               recIndex, pRecord->time, pRecord->session,
-               "MLM State:",
-               limTraceGetMlmStateString((tANI_U16)pRecord->data),
-               pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                           "MLM State:", limTraceGetMlmStateString((tANI_U16)pRecord->data), pRecord->data );
             break;
         case TRACE_CODE_SME_STATE:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-               recIndex, pRecord->time, pRecord->session,
-               "SME State:",
-               limTraceGetSmeStateString((tANI_U16)pRecord->data),
-               pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                            "SME State:", limTraceGetSmeStateString((tANI_U16)pRecord->data), pRecord->data );
             break;
         case TRACE_CODE_TX_MGMT:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-               recIndex, pRecord->time, pRecord->session,
-               "TX Mgmt:", frameSubtypeStr[pRecord->data], pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                            "TX Mgmt:", frameSubtypeStr[pRecord->data], pRecord->data );
             break;
 
         case TRACE_CODE_RX_MGMT:
             if (LIM_TRACE_MAX_SUBTYPES <= LIM_TRACE_GET_SUBTYPE(pRecord->data))
             {
-                limLog(pMac, LOG1, "Wrong Subtype - %d",
-                    LIM_TRACE_GET_SUBTYPE(pRecord->data));
+                limLog(pMac, LOGE, "Wrong Subtype - %d", LIM_TRACE_GET_SUBTYPE(pRecord->data));
             }
             else
             {
-                limLog(pMac,
-                    LOG1, "%04d %012u S%d %-14s %-30s(%d) SN: %d ",
-                    recIndex, pRecord->time, pRecord->session,
-                    "RX Mgmt:",
-                    frameSubtypeStr[LIM_TRACE_GET_SUBTYPE(pRecord->data)],
-                    LIM_TRACE_GET_SUBTYPE(pRecord->data),
-                    LIM_TRACE_GET_SSN(pRecord->data));
+                limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(%d)    SN: %d ", recIndex, pRecord->time, pRecord->session,
+                                            "RX Mgmt:", frameSubtypeStr[LIM_TRACE_GET_SUBTYPE(pRecord->data)],
+                                            LIM_TRACE_GET_SUBTYPE(pRecord->data),
+                                            LIM_TRACE_GET_SSN(pRecord->data) );
             }
             break;
         case TRACE_CODE_RX_MGMT_DROP:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(%d)",
-                   recIndex, pRecord->time, pRecord->session,
-                   "Drop RX Mgmt:",
-                   __limTraceGetMgmtDropReasonString((tANI_U16)pRecord->data),
-                   pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(%d)  ", recIndex, pRecord->time, pRecord->session,
+                                            "Drop RX Mgmt:", __limTraceGetMgmtDropReasonString((tANI_U16)pRecord->data), pRecord->data);
             break;
 
 
         case TRACE_CODE_RX_MGMT_TSF:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s0x%x(%d)",
-                   recIndex, pRecord->time, pRecord->session,
-                   "RX Mgmt TSF:", " ", pRecord->data, pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s0x%x(%d) ", recIndex, pRecord->time, pRecord->session,
+                                            "RX Mgmt TSF:", " ", pRecord->data, pRecord->data );
             break;
 
         case TRACE_CODE_TX_COMPLETE:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s  %d",
-                   recIndex, pRecord->time, pRecord->session,
-                   "TX Complete", pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %d", recIndex, pRecord->time, pRecord->session,
+                                            "TX Complete", pRecord->data );
             break;
 
         case TRACE_CODE_TX_SME_MSG:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                   recIndex, pRecord->time, pRecord->session,
-                   "TX SME Msg:",
-                   macTraceGetSmeMsgString((tANI_U16)pRecord->data),
-                   pRecord->data );
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                            "TX SME Msg:", macTraceGetSmeMsgString((tANI_U16)pRecord->data), pRecord->data );
             break;
         case TRACE_CODE_RX_SME_MSG:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                   recIndex, pRecord->time, pRecord->session,
-                   LIM_TRACE_GET_DEFRD_OR_DROPPED(pRecord->data)
-                   ? "Def/Drp LIM Msg:": "RX Sme Msg:",
-                   macTraceGetSmeMsgString((tANI_U16)pRecord->data),
-                   pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                            LIM_TRACE_GET_DEFRD_OR_DROPPED(pRecord->data) ? "Def/Drp LIM Msg:": "RX Sme Msg:",
+                                            macTraceGetSmeMsgString((tANI_U16)pRecord->data), pRecord->data );
             break;
 
         case TRACE_CODE_TX_WDA_MSG:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                   recIndex, pRecord->time, pRecord->session,
-                   "TX WDA Msg:",
-                   macTraceGetWdaMsgString((tANI_U16)pRecord->data),
-                   pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                            "TX WDA Msg:", macTraceGetWdaMsgString((tANI_U16)pRecord->data), pRecord->data );
             break;
 
         case TRACE_CODE_RX_WDA_MSG:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                   recIndex, pRecord->time, pRecord->session,
-                   LIM_TRACE_GET_DEFRD_OR_DROPPED(pRecord->data)
-                   ? "Def/Drp LIM Msg:": "RX WDA Msg:",
-                   macTraceGetWdaMsgString((tANI_U16)pRecord->data),
-                   pRecord->data );
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                            LIM_TRACE_GET_DEFRD_OR_DROPPED(pRecord->data) ? "Def/Drp LIM Msg:": "RX WDA Msg:",
+                                            macTraceGetWdaMsgString((tANI_U16)pRecord->data), pRecord->data );
             break;
 
         case TRACE_CODE_TX_LIM_MSG:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                   recIndex, pRecord->time, pRecord->session,
-                   "TX LIM Msg:",
-                   macTraceGetLimMsgString((tANI_U16)pRecord->data),
-                   pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                            "TX LIM Msg:", macTraceGetLimMsgString((tANI_U16)pRecord->data), pRecord->data );
             break;
         case TRACE_CODE_RX_LIM_MSG:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                   recIndex, pRecord->time, pRecord->session,
-                   LIM_TRACE_GET_DEFRD_OR_DROPPED(pRecord->data)
-                   ? "Def/Drp LIM Msg:": "RX LIM Msg",
-                   macTraceGetLimMsgString((tANI_U16)pRecord->data),
-                   pRecord->data );
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                            LIM_TRACE_GET_DEFRD_OR_DROPPED(pRecord->data) ? "Def/Drp LIM Msg:": "RX LIM Msg",
+                                            macTraceGetLimMsgString((tANI_U16)pRecord->data), pRecord->data );
             break;
         case TRACE_CODE_TX_CFG_MSG:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                   recIndex, pRecord->time, pRecord->session,
-                   "TX CFG Msg:",
-                   macTraceGetCfgMsgString((tANI_U16)pRecord->data),
-                   pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                            "TX CFG Msg:", macTraceGetCfgMsgString((tANI_U16)pRecord->data), pRecord->data );
             break;
         case TRACE_CODE_RX_CFG_MSG:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                   recIndex, pRecord->time, pRecord->session,
-                   LIM_TRACE_GET_DEFRD_OR_DROPPED(pRecord->data)
-                   ? "Def/Drp LIM Msg:": "RX CFG Msg:",
-                   macTraceGetCfgMsgString
-                   ((tANI_U16)MAC_TRACE_GET_MSG_ID(pRecord->data)),
-                   pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                            LIM_TRACE_GET_DEFRD_OR_DROPPED(pRecord->data) ? "Def/Drp LIM Msg:": "RX CFG Msg:",
+                                            macTraceGetCfgMsgString((tANI_U16)MAC_TRACE_GET_MSG_ID(pRecord->data)),
+                                            pRecord->data );
             break;
 
         case TRACE_CODE_TIMER_ACTIVATE:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                   recIndex, pRecord->time, pRecord->session,
-                   "Timer Actvtd",
-                   __limTraceGetTimerString((tANI_U16)pRecord->data),
-                   pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                            "Timer Actvtd", __limTraceGetTimerString((tANI_U16)pRecord->data), pRecord->data );
             break;
         case TRACE_CODE_TIMER_DEACTIVATE:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                  recIndex, pRecord->time, pRecord->session,
-                  "Timer DeActvtd",
-                  __limTraceGetTimerString((tANI_U16)pRecord->data),
-                  pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                            "Timer DeActvtd", __limTraceGetTimerString((tANI_U16)pRecord->data), pRecord->data );
             break;
 
         case TRACE_CODE_INFO_LOG:
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                  recIndex, pRecord->time, pRecord->session,
-                  "INFORMATION_LOG",
-                  macTraceGetInfoLogString((tANI_U16)pRecord->data),
-                  pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s  %-30s(0x%x) \n", recIndex, pRecord->time, pRecord->session,
+                                            "INFORMATION_LOG", macTraceGetInfoLogString((tANI_U16)pRecord->data), pRecord->data );
             break;
         default :
-            limLog(pMac, LOG1, "%04d %012u S%d %-14s(%d) (0x%x)",
-                  recIndex, pRecord->time, pRecord->session,
-                  "Unknown Code", pRecord->code, pRecord->data);
+            limLog(pMac, LOGE, "%04d    %012u  S%d    %-14s(%d) (0x%x) ", recIndex, pRecord->time, pRecord->session,
+                                             "Unknown Code", pRecord->code, pRecord->data );
             break;
     }
 }
 
-/**
- * lim_state_info_dump() - print state information of lim layer
-  */
-static void lim_state_info_dump(void)
-{
-    tHalHandle hal;
-    tpAniSirGlobal mac;
-    v_CONTEXT_t vos_ctx_ptr;
-
-    /* get the global voss context */
-    vos_ctx_ptr = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL);
-
-    if (NULL == vos_ctx_ptr) {
-        VOS_ASSERT(0);
-        return;
-    }
-
-    hal = vos_get_context(VOS_MODULE_ID_PE, vos_ctx_ptr);
-    if (NULL == hal) {
-        VOS_ASSERT(0);
-        return;
-    }
-
-    mac = PMAC_STRUCT(hal);
-
-    limLog(mac, LOG1, FL("SmeState: %d PrevSmeState: %d MlmState: %d"
-           "PrevMlmState: %d SystemInScanLearnMode: %d ProcessDefdMsgs: %d"
-           "gLimHalScanState: %d"), mac->lim.gLimSmeState,
-           mac->lim.gLimPrevSmeState, mac->lim.gLimMlmState,
-           mac->lim.gLimPrevMlmState, mac->lim.gLimSystemInScanLearnMode,
-           mac->lim.gLimProcessDefdMsgs, mac->lim.gLimHalScanState);
-}
-
-/**
- * lim_register_debug_callback() - registration function for lim layer
- * to print lim state information
-  */
-void lim_register_debug_callback()
-{
-    vos_register_debug_callback(VOS_MODULE_ID_PE, &lim_state_info_dump);
-}
 
 void macTraceMsgTx(tpAniSirGlobal pMac, tANI_U8 session, tANI_U32 data)
 {
@@ -365,9 +277,6 @@
         case SIR_CFG_MODULE_ID:
             macTrace(pMac, TRACE_CODE_TX_CFG_MSG, session, data);
             break;
-        default:
-            macTrace(pMac, moduleId, session, data);
-            break;
     }
 }
 
@@ -391,9 +300,6 @@
         case SIR_CFG_MODULE_ID:
             macTraceNew(pMac, module, TRACE_CODE_TX_CFG_MSG, session, data);
             break;
-        default:
-            macTrace(pMac, moduleId, session, data);
-            break;
         }
 }
 
@@ -421,9 +327,6 @@
         case SIR_CFG_MODULE_ID:
             macTrace(pMac, TRACE_CODE_RX_CFG_MSG, session, data);
             break;
-        default:
-            macTrace(pMac, moduleId, session, data);
-            break;
         }
 }
 
@@ -453,9 +356,6 @@
         case SIR_CFG_MODULE_ID:
             macTraceNew(pMac, module, TRACE_CODE_RX_CFG_MSG, session, data);
             break;
-        default:
-            macTrace(pMac, moduleId, session, data);
-            break;
         }
 }
 
@@ -499,11 +399,6 @@
         CASE_RETURN_STRING( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE);
         CASE_RETURN_STRING( eLIM_MLM_WT_REMOVE_STA_KEY_STATE);
         CASE_RETURN_STRING( eLIM_MLM_WT_SET_MIMOPS_STATE);
-#if defined WLAN_FEATURE_VOWIFI_11R
-        CASE_RETURN_STRING(eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE);
-        CASE_RETURN_STRING(eLIM_MLM_WT_FT_REASSOC_RSP_STATE);
-#endif
-        CASE_RETURN_STRING(eLIM_MLM_P2P_LISTEN_STATE);
         default:
             return( "UNKNOWN" );
             break;
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limTypes.h b/wlan/prima/CORE/MAC/src/pe/lim/limTypes.h
index 35137b8..e4ae419 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limTypes.h
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limTypes.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -51,7 +51,6 @@
 
 #include "limApi.h"
 #include "limDebug.h"
-#include "limTrace.h"
 #include "limSendSmeRspMessages.h"
 #include "sysGlobal.h"
 #include "dphGlobal.h"
@@ -258,16 +257,12 @@
 
 
     tAniBool               WmmStaInfoPresent;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    tAniBool               HT40MHzIntoPresent;
-#endif
 
     // Required for indicating the frames to upper layer
     tANI_U32             beaconLength;
     tANI_U8*             beaconPtr;
     tANI_U32             assocReqLength;
-    tANI_U8*             assocReqPtr;
-    uint32_t             rate_flags;
+    tANI_U8*             assocReqPtr;    
 } tLimMlmAssocInd, *tpLimMlmAssocInd;
 
 typedef struct sLimMlmReassocReq
@@ -301,9 +296,6 @@
     tSirSupChnl             supportedChannels;
 
     tAniBool               WmmStaInfoPresent;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    tAniBool               HT40MHzIntoPresent;
-#endif
 
     // Required for indicating the frames to upper layer
     tANI_U32             beaconLength;
@@ -678,8 +670,7 @@
 tSirRetStatus limPopulateMacHeader(tpAniSirGlobal, tANI_U8*, tANI_U8, tANI_U8, tSirMacAddr,tSirMacAddr);
 tSirRetStatus limSendProbeReqMgmtFrame(tpAniSirGlobal, tSirMacSSid *, tSirMacAddr, tANI_U8, tSirMacAddr, tANI_U32, tANI_U32, tANI_U8 *); 
 void limSendProbeRspMgmtFrame(tpAniSirGlobal, tSirMacAddr, tpAniSSID, short, tANI_U8, tpPESession, tANI_U8);
-void limSendAuthMgmtFrame(tpAniSirGlobal, tSirMacAuthFrameBody *, tSirMacAddr,
-                                             tANI_U8, tpPESession , tAniBool);
+void limSendAuthMgmtFrame(tpAniSirGlobal, tSirMacAuthFrameBody *, tSirMacAddr, tANI_U8,tpPESession);
 void limSendAssocReqMgmtFrame(tpAniSirGlobal, tLimMlmAssocReq *,tpPESession);
 void limSendReassocReqMgmtFrame(tpAniSirGlobal, tLimMlmReassocReq *,tpPESession);
 #ifdef WLAN_FEATURE_VOWIFI_11R
@@ -699,9 +690,6 @@
 void limSendNullDataFrame(tpAniSirGlobal, tpDphHashNode);
 void limSendDisassocMgmtFrame(tpAniSirGlobal, tANI_U16, tSirMacAddr, tpPESession, tANI_BOOLEAN waitForAck);
 void limSendDeauthMgmtFrame(tpAniSirGlobal, tANI_U16, tSirMacAddr, tpPESession, tANI_BOOLEAN waitForAck);
-void limSendSmeDisassocDeauthNtf( tpAniSirGlobal pMac,
-                                eHalStatus status, tANI_U32 *pCtx );
-
 
 void limContinueChannelScan(tpAniSirGlobal);
 tSirResultCodes limMlmAddBss(tpAniSirGlobal, tLimMlmStartReq *,tpPESession psessionEntry);
@@ -723,6 +711,18 @@
 void limProcessIappFrame(tpAniSirGlobal, tANI_U8 *,tpPESession);
 #endif
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+tSirRetStatus limSendTdlsDisReqFrame(tpAniSirGlobal pMac, 
+           tSirMacAddr peer_mac, tANI_U8 dialog, tpPESession psessionEntry);
+tSirRetStatus limSendTdlsLinkSetupReqFrame(tpAniSirGlobal pMac,
+           tSirMacAddr peerMac, tANI_U8 dialog, tpPESession psessionEntry,
+           tANI_U8* addIe, tANI_U16 len); 
+
+eHalStatus limTdlsPrepareSetupReqFrame(tpAniSirGlobal pMac,
+                              tLimTdlsLinkSetupInfo *linkSetupInfo,
+                                 tANI_U8 dialog, tSirMacAddr peerMac,
+                                                 tpPESession psessionEntry);
+#endif
 #ifdef FEATURE_WLAN_TDLS
 void limInitTdlsData(tpAniSirGlobal, tpPESession);
 tSirRetStatus limProcessSmeTdlsMgmtSendReq(tpAniSirGlobal pMac, 
@@ -735,7 +735,7 @@
                                                            tANI_U32 *pMsgBuf);
 void limSendSmeTDLSDeleteAllPeerInd(tpAniSirGlobal pMac, tpPESession psessionEntry);
 void limSendSmeMgmtTXCompletion(tpAniSirGlobal pMac,
-                                tANI_U32 smeSessionId,
+                                tpPESession psessionEntry,
                                 tANI_U32 txCompleteStatus);
 tSirRetStatus limDeleteTDLSPeers(tpAniSirGlobal pMac, tpPESession psessionEntry);
 eHalStatus limProcessTdlsAddStaRsp(tpAniSirGlobal pMac, void *msg, tpPESession);
@@ -828,7 +828,6 @@
 void limSendHalInitScanReq( tpAniSirGlobal, tLimLimHalScanState, tSirLinkTrafficCheck);
 void limSendHalStartScanReq( tpAniSirGlobal, tANI_U8, tLimLimHalScanState);
 void limSendHalEndScanReq( tpAniSirGlobal, tANI_U8, tLimLimHalScanState);
-void limSendTLPauseInd(tpAniSirGlobal pMac, uint16_t staId);
 void limSendHalFinishScanReq( tpAniSirGlobal, tLimLimHalScanState);
 
 void limContinuePostChannelScan(tpAniSirGlobal pMac);
@@ -873,15 +872,6 @@
 tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, 
                    tANI_U8 *transId, tSirMacAddr peer,tpPESession psessionEntry);
 #endif
-
-#ifdef WLAN_FEATURE_RMC
-void limProcessRMCMessages(tpAniSirGlobal pMac, eRmcMessageType msgType,
-                             tANI_U32 *pMsgBuf);
-tSirRetStatus limSendRMCActionFrame(tpAniSirGlobal  pMac,
-                 tSirMacAddr peerMacAddr, tSirRMCInfo  *pRMC,
-                 tpPESession psessionEntry);
-#endif /* WLAN_FEATURE_RMC */
-
 // Inline functions
 
 /**
@@ -922,10 +912,7 @@
     msg.bodyptr = pMsgBuf;
     msg.bodyval = 0;
     if (msgType > eWNI_SME_MSG_TYPES_BEGIN)
-    {
-        MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, msg.type));
         limProcessSmeReqMessages(pMac, &msg);
-    }
     else
         limProcessMlmRspMessages(pMac, msgType, pMsgBuf);
 } /*** end limPostSmeMessage() ***/
@@ -968,7 +955,6 @@
     msg.type = (tANI_U16) msgType;
     msg.bodyptr = pMsgBuf;
     msg.bodyval = 0;
-    MTRACE(macTraceMsgRx(pMac, NO_SESSION, msg.type));
     limProcessMlmReqMessages(pMac, &msg);
 } /*** end limPostMlmMessage() ***/
 
@@ -1085,6 +1071,25 @@
 void limAbortRemainOnChan(tpAniSirGlobal pMac);
 tSirRetStatus __limProcessSmeNoAUpdate(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf);
 void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac);
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+void limProcessTdlsFrame(tpAniSirGlobal, tANI_U32 *);
+void limProcessTdlsPublicActionFrame(tpAniSirGlobal pMac, tANI_U32 *pBd, 
+                                                               tpPESession) ;
+#ifdef FEATURE_WLAN_TDLS_NEGATIVE
+#define LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_DSCV_REQ   0x1 /* 5.1.4-5 */
+#define LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_SETUP_REQ  0x2 /* 5.2.4-16 */
+#define LIM_TDLS_NEGATIVE_STATUS_37_IN_SETUP_CNF    0x4 /* 5.2.4-10 */
+#define LIM_TDLS_NEGATIVE_SEND_REQ_TO_SETUP_REQ     0x8 /* 5.2.4-20/32 */
+#define LIM_TDLS_NEGATIVE_RSP_TIMEOUT_TO_SETUP_REQ  0x10 /* 5.2.3.4 */
+#define LIM_TDLS_NEGATIVE_TREAT_TDLS_PROHIBIT_AP    0x20 /* 5.2.4-49 */
+   /* following is not paticularily tested in WFA test plan, but will help to validate our TDLS behavior in-house */
+#define LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_DSCV_RSP   0x40
+#define LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_SETUP_RSP  0x80
+
+void limTdlsSetNegativeBehavior(tpAniSirGlobal pMac, tANI_U8 value, tANI_BOOLEAN on);
+#endif
+#endif
+
 void limProcessDisassocAckTimeout(tpAniSirGlobal pMac);
 void limProcessDeauthAckTimeout(tpAniSirGlobal pMac);
 eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac);
@@ -1101,10 +1106,5 @@
 
 int limProcessRemainOnChnlReq(tpAniSirGlobal pMac, tANI_U32 *pMsg);
 void limRemainOnChnRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data);
-void limProcessMlmSpoofMacAddrRsp(tpAniSirGlobal pMac, tSirRetStatus rspStatus);
-tSirRetStatus limProcessSmeSetTdls2040BSSCoexReq(tpAniSirGlobal pMac,
-                                                 tANI_U32 *pMsgBuf);
-tSirRetStatus limProcessSmeDelAllTdlsPeers(tpAniSirGlobal pMac,
-                                           tANI_U32 *pMsgBuf);
 #endif /* __LIM_TYPES_H */
 
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limUtils.c b/wlan/prima/CORE/MAC/src/pe/lim/limUtils.c
index 7c39022..3e66554 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limUtils.c
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016. The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2015. The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -57,7 +57,7 @@
 #include "limSession.h"
 #include "vos_nvitem.h"
 #ifdef WLAN_FEATURE_11W
-#include "wniCfg.h"
+#include "wniCfgAp.h"
 #endif
 
 /* Static global used to mark situations where pMac->lim.gLimTriggerBackgroundScanDuringQuietBss is SET
@@ -92,20 +92,6 @@
                                     eHalStatus status,
                                     tANI_U32 *ctx);
 /** -------------------------------------------------------------
-\fn limCheck11BRateBitmap
-\brief Verifies if basic rates are set.
-\param     tANI_U16 pRateBitmap
-\return tANI_BOOLEAN - true or false
-  -------------------------------------------------------------*/
-
-tANI_BOOLEAN limCheck11BRateBitmap(tANI_U16 pRateBitmap)
-{
-        return ( ( pRateBitmap & ( 1 << 0 ) ) || ( pRateBitmap & ( 1 << 1 ) ) ||
-                        ( pRateBitmap & ( 1 << 2 ) ) ||
-                               ( pRateBitmap & ( 1 << 3 ) ) ? 1 : 0 ) ;
-}
-
-/** -------------------------------------------------------------
 \fn limAssignDialogueToken
 \brief Assigns dialogue token.
 \param     tpAniSirGlobal    pMac
@@ -164,52 +150,53 @@
     tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
     tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
 
-    /* if the list is empty */
+    //if the list is empty
     if(NULL == pCurrNode)
       return eSIR_FAILURE;
 
-    /* If the matching node is the first node.*/
-    if ((token == pCurrNode->token) &&
+    // if the matching node is the first node.
+    if(pCurrNode &&
         (assocId == pCurrNode->assocId) &&
-        (tid == pCurrNode->tid)) {
-        pMac->lim.pDialogueTokenHead = pCurrNode->next;
-        /* There was only one node in the list.
-         * So tail pointer also needs to be adjusted.
-         */
-        if (NULL == pMac->lim.pDialogueTokenHead)
+        (tid == pCurrNode->tid))
+    {
+        pMac->lim.pDialogueTokenHead = pCurrNode->next;        
+        //there was only one node in the list. So tail pointer also needs to be adjusted.
+        if(NULL == pMac->lim.pDialogueTokenHead)
             pMac->lim.pDialogueTokenTail = NULL;
         vos_mem_free(pCurrNode);
+        pMac->lim.pDialogueTokenHead = NULL;
         return eSIR_SUCCESS;
     }
 
-    /* first node did not match. so move to the next one. */
+    //first node did not match. so move to the next one.
     pCurrNode = pCurrNode->next;
-
-    while (NULL != pCurrNode) {
-         if ((token == pCurrNode->token) &&
-           (assocId == pCurrNode->assocId) &&
-           (tid == pCurrNode->tid)) {
-           break;
+    while(NULL != pCurrNode )
+    {
+        if(token == pCurrNode->token)
+        {
+            break;
         }
+
         pPrevNode = pCurrNode;
         pCurrNode = pCurrNode->next;
     }
 
-    if (pCurrNode) {
+    if(pCurrNode &&
+        (assocId == pCurrNode->assocId) &&
+        (tid == pCurrNode->tid))
+    {
         pPrevNode->next = pCurrNode->next;
-        /* if the node being deleted is the last one
-         * then we also need to move the tail pointer
-         * to the prevNode.
-         */
+        //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
         if(NULL == pCurrNode->next)
               pMac->lim.pDialogueTokenTail = pPrevNode;
         vos_mem_free(pCurrNode);
+        pMac->lim.pDialogueTokenHead = NULL;
         return eSIR_SUCCESS;
     }
 
-    limLog(pMac, LOGW,
-       FL("LIM does not have matching dialogue token node"));
+    PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
     return eSIR_FAILURE;
+
 }
 
 
@@ -575,8 +562,6 @@
             return "eWNI_SME_DEAUTH_CNF";
         case eWNI_SME_MIC_FAILURE_IND:
             return "eWNI_SME_MIC_FAILURE_IND";
-        case eWNI_SME_LOST_LINK_PARAMS_IND:
-            return "eWNI_SME_LOST_LINK_PARAMS_IND";
         case eWNI_SME_ADDTS_REQ:
             return "eWNI_SME_ADDTS_REQ";
         case eWNI_SME_ADDTS_RSP:
@@ -1027,10 +1012,6 @@
         tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
         tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
 
-        // Deactivate and delete Auth Retry timer.
-        tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
-        tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
-
         // Deactivate and delete Association failure timer.
         tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
         tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
@@ -1398,15 +1379,9 @@
          **/
     if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
     {
-        if (!(pMac->lim.deferredMsgCnt & 0xF))
+        if(!(pMac->lim.deferredMsgCnt & 0xF))
         {
-            limLog(pMac, LOGE,
-             FL("Deferred Message Queue is full. Msg:%d Messages Failed:%d"),
-                                    limMsg->type, ++pMac->lim.deferredMsgCnt);
-            vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL,
-                     WLAN_LOG_INDICATOR_HOST_DRIVER,
-                     WLAN_LOG_REASON_QUEUE_FULL,
-                     FALSE, TRUE);
+            PELOGE(limLog(pMac, LOGE, FL("Deferred Message Queue is full. Msg:%d Messages Failed:%d"), limMsg->type, ++pMac->lim.deferredMsgCnt);)
         }
         else
         {
@@ -1944,7 +1919,7 @@
     pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
     if(NULL == pStaDs)
     {
-      limLog(pMac, LOG1, FL("pStaDs is NULL"));
+      PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL"));)
       return;
     }
     limGetRfBand(pMac, &rfBand, psessionEntry);
@@ -2603,7 +2578,6 @@
         return;
     }
     channel = psessionEntry->gLimChannelSwitch.primaryChannel;
-
     /*
      *  This potentially can create issues if the function tries to set
      * channel while device is in power-save, hence putting an extra check
@@ -2620,34 +2594,7 @@
 
     /* Channel-switch timeout has occurred. reset the state */
     psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
-
-    /*
-     * If Lim allows Switch channel on same channel on which preauth
-     * is going on then LIM will not post resume link(WDA_FINISH_SCAN)
-     * during preauth rsp handling hence firmware may crash on ENTER/
-     * EXIT BMPS request.
-     */
-    if(pMac->ft.ftPEContext.pFTPreAuthReq)
-    {
-        limLog(pMac, LOGE,
-           FL("Avoid Switch Channel req during pre auth"));
-        return;
-    }
-    /* If link is already suspended mean some off
-     * channel operation or scan is in progress, Allowing
-     * Change channel here will lead to either Init Scan
-     * sent twice or missing Finish scan when change
-     * channel is completed, this may lead
-     * to driver in invalid state and crash.
-     */
-    if (limIsLinkSuspended(pMac))
-    {
-       limLog(pMac, LOGE, FL("Link is already suspended for "
-               "some other reason. Return here for sessionId:%d"),
-               pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId);
-       return;
-    }
-
+    
     /* Check if the AP is switching to a channel that we support.
      * Else, just don't bother to switch. Indicate HDD to look for a 
      * better AP to associate
@@ -2951,7 +2898,7 @@
         return;
     }
 
-  limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
+  PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
   switch( psessionEntry->gLimSpecMgmt.quietState )
   {
     case eLIM_QUIET_BEGIN:
@@ -3072,7 +3019,7 @@
         return;
     }
 
-  limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
+  PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
   if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
   {
   }
@@ -3332,8 +3279,8 @@
    mmhMsg.bodyptr = pSirSmeSwitchChInd;
    mmhMsg.bodyval = 0;
    
-   MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
-                                                            mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
+   
    SysProcessMmhMsg(pMac, &mmhMsg);
 }
 
@@ -3355,8 +3302,8 @@
     tANI_U32 localPwrConstraint;
 #endif
     
-    limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
-           psessionEntry->currentOperChannel, newChannel);
+    PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d "),
+           psessionEntry->currentOperChannel, newChannel);)
     psessionEntry->currentReqChannel = newChannel;
     psessionEntry->limRFBand = limGetRFBand(newChannel);
 
@@ -3427,11 +3374,6 @@
                 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
 #endif
 
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-       limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
-                 psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_OPERATION);
-#endif
-
     // Store the new primary and secondary channel in session entries if different
     if (psessionEntry->currentOperChannel != newChannel)
     {
@@ -5555,10 +5497,10 @@
 
     tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
                                             : &pDeltsReq->req.tsinfo;
-   limLog(pMac, LOG1,
+   PELOG1(limLog(pMac, LOG1,
            FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d,  up %d, direction = %d)"),
            pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
-           tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
+           tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
 
        // if no Access Control, ignore the request
 
@@ -5726,12 +5668,9 @@
             if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
                  (pBaCandidate->baInfo[tid].fBaEnable))
             {
-                limLog(pMac, LOG1,
-                        FL("BA setup for staId = %d, TID: %d, SSN: %d"),
-                        pSta->staIndex, tid,
-                        pBaCandidate->baInfo[tid].startingSeqNum);
-                limPostMlmAddBAReq(pMac, pSta, tid,
-                        pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
+                limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
+                        pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
+                limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);  
             }
         }
     }
@@ -5932,9 +5871,9 @@
     PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
     goto error2;
   }
-  limLog(pMac, LOG1, "Sent DELTS request to station with "
-                "assocId = %d MacAddr = "MAC_ADDRESS_STR,
-                pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
+  PELOG1(limLog(pMac, LOG1, "Sent DELTS request to station with "
+         "assocId = %d MacAddr = "MAC_ADDRESS_STR,
+         pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
 
   limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
           psessionEntry);
@@ -6033,25 +5972,14 @@
           FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
       pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
   }
-  else if (pMac->miracastVendorConfig)
-  {
-      if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
-      {
-           limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
-           status = eSIR_FAILURE;
-           goto returnFailure;
-      }
-
-      pMlmAddBAReq->baBufferSize = val;
-  }
   else
       pMlmAddBAReq->baBufferSize = 0;
 
   limLog( pMac, LOGW,
-      FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d buff = %d" ),
+      FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
       (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
       pStaDs->staIndex,
-      tid, pMlmAddBAReq->baBufferSize );
+      tid );
 
   // BA Timeout
   if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
@@ -6331,8 +6259,6 @@
   if (!(IS_HWSTA_IDX(pSta->staIndex)))
   {
     retCode = eHAL_STATUS_FAILURE;
-    limLog( pMac, LOGE,
-        FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
     goto returnFailure;
   }
 #endif //WLAN_SOFTAP_VSTA_FEATURE
@@ -6807,11 +6733,11 @@
 
     if (mode == eLIM_STOP_TX)
         {
-            limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
+            PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
         }
     else
         {
-            limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
+            PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
         }
     return;
 }
@@ -7125,7 +7051,7 @@
     tANI_U16  direction = pTsInfo->traffic.direction;  
     tANI_U8   ac = upToAc(userPrio);
 
-    limLog(pMac, LOG1, FL(" Set UAPSD mask for AC %d, direction %d, action=%d (1=set,0=clear) "),ac, direction, action );
+    PELOG1(limLog(pMac, LOG1, FL(" Set UAPSD mask for AC %d, direction %d, action=%d (1=set,0=clear) "),ac, direction, action );)
 
     /* Converting AC to appropriate Uapsd Bit Mask
      * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
@@ -7434,8 +7360,6 @@
 {
       if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type) 
         {
-            /*Decrement the Pending count before droping */
-            limDecrementPendingMgmtCount (pMac);
             vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
         }
       else if(pLimMsg->bodyptr != NULL)
@@ -7521,7 +7445,7 @@
    mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
    mmhMsg.bodyptr = pRsp;
    mmhMsg.bodyval = 0;
-   MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
    limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 
 }
@@ -7560,7 +7484,7 @@
    mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
    mmhMsg.bodyptr = pRsp;
    mmhMsg.bodyval = 0;
-   MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
    limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 
 }
@@ -8125,13 +8049,7 @@
     pSta->pmfSaQueryRetryCount++;
     if (pSta->pmfSaQueryRetryCount >= maxRetries)
     {
-        limLog(pMac, LOGE,
-           FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
-                                     MAC_ADDR_ARRAY(pSta->staAddr));
-        limSendDisassocMgmtFrame(pMac,
-                  eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
-                  pSta->staAddr, psessionEntry, FALSE);
-        limTriggerSTAdeletion(pMac, pSta, psessionEntry);
+        limLog(pMac, LOG1, FL("SA Query timed out"));
         pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
         return;
     }
@@ -8274,19 +8192,6 @@
     }
     psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
                                                              cfgValue;
-
-    if (wlan_cfgGetInt(pMac,
-         WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
-         != eSIR_SUCCESS)
-    {
-       limLog(pMac, LOGE, FL("Fail to retrieve"
-              "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
-       return ;
-    }
-    psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
-                                                                   cfgValue;
-
-
     if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
                        &cfgValue) != eSIR_SUCCESS)
     {
@@ -8459,150 +8364,3 @@
     }
     return;
 }
-
-void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
-                          tANI_U8 smeSessionId,
-                          tANI_U32 maxRateFlag)
-{
-    tpSirSmeUpdateMaxRateParams  pRsp;
-    tSirMsgQ                     msg;
-
-    pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
-    if (NULL == pRsp)
-    {
-        limLog(pMac, LOGP, FL("Memory allocation failed"));
-        return;
-    }
-    vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
-    pRsp->maxRateFlag = maxRateFlag;
-    pRsp->smeSessionId = smeSessionId;
-    msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
-    msg.bodyptr = pRsp;
-    msg.bodyval = 0;
-    limSysProcessMmhMsgApi(pMac, &msg,  ePROT);
-    return;
-}
-
-void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
-{
-    if( pMac->sys.gSysBbtPendingMgmtCount )
-    {
-         vos_spin_lock_acquire( &pMac->sys.lock );
-         pMac->sys.gSysBbtPendingMgmtCount--;
-         vos_spin_lock_release( &pMac->sys.lock );
-    }
-    else
-         limLog(pMac, LOGW, FL("Pending Management count going negative"));
-}
-
-eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
-{
-    tpSirTxBdStatus pTxBdStatus;
-
-    if (!pData)
-    {
-       limLog(pMac, LOGE, FL("pData is NULL"));
-       return eHAL_STATUS_FAILURE;
-    }
-
-    pTxBdStatus = (tpSirTxBdStatus) pData;
-
-    limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
-            pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
-    return eHAL_STATUS_SUCCESS;
-}
-
-/**
- * lim_is_robust_mgmt_action_frame() - Check if action catagory is
- * robust action frame
- * @action_catagory: Action frame catagory.
- *
- * This function is used to check if given action catagory is robust
- * action frame.
- *
- * Return: bool
- */
-bool lim_is_robust_mgmt_action_frame(uint8 action_catagory)
-{
-   switch (action_catagory) {
-       /*
-        * NOTE: This function doesn't take care of the DMG
-        * (Directional Multi-Gigatbit) BSS case as 8011ad
-        * support is not yet added. In future, if the support
-        * is required then this function need few more arguments
-        * and little change in logic.
-        */
-       case SIR_MAC_ACTION_SPECTRUM_MGMT:
-       case SIR_MAC_ACTION_QOS_MGMT:
-       case SIR_MAC_ACTION_DLP:
-       case SIR_MAC_ACTION_BLKACK:
-       case SIR_MAC_ACTION_RRM:
-       case SIR_MAC_ACTION_FAST_BSS_TRNST:
-       case SIR_MAC_ACTION_SA_QUERY:
-       case SIR_MAC_ACTION_PROT_DUAL_PUB:
-       case SIR_MAC_ACTION_WNM:
-       case SIR_MAC_ACITON_MESH:
-       case SIR_MAC_ACTION_MHF:
-       case SIR_MAC_ACTION_FST:
-            return true;
-       default:
-            VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
-                   FL("non-PMF action category[%d] "),
-                   action_catagory);
-            break;
-   }
-   return false;
-}
-
-/**
- * lim_is_ext_cap_ie_present - checks if ext ie is present
- * @ext_cap: extended IEs structure
- *
- * Return: true if ext IEs are present else false
- */
-bool lim_is_ext_cap_ie_present (tDot11fIEExtCap *ext_cap)
-{
-    int i, size;
-    uint8_t *tmp_buf;
-
-    tmp_buf = (uint8_t *) ext_cap;
-    size = sizeof(*ext_cap);
-
-    for (i = 0; i < size; i++)
-        if (tmp_buf[i])
-            return true;
-
-    return false;
-}
-
-/**
- * lim_update_caps_info_for_bss - Update capability info for this BSS
- *
- * @mac_ctx: mac context
- * @caps: Pointer to capability info to be updated
- * @bss_caps: Capability info of the BSS
- *
- * Update the capability info in Assoc/Reassoc request frames and reset
- * the spectrum management, short preamble, immediate block ack bits
- * if the BSS doesnot support it
- *
- * Return: None
- */
-void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx,
-                                  uint16_t *caps, uint16_t bss_caps)
-{
-    if (!(bss_caps & LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) {
-          *caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
-          limLog(mac_ctx, LOG1, FL("Clearing spectrum management:no AP support"));
-    }
-
-    if (!(bss_caps & LIM_SHORT_PREAMBLE_BIT_MASK)) {
-          *caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
-          limLog(mac_ctx, LOG1, FL("Clearing short preamble:no AP support"));
-    }
-
-    if (!(bss_caps & LIM_IMMEDIATE_BLOCK_ACK_MASK)) {
-          *caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
-          limLog(mac_ctx, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
-    }
-}
diff --git a/wlan/prima/CORE/MAC/src/pe/lim/limUtils.h b/wlan/prima/CORE/MAC/src/pe/lim/limUtils.h
index 763bf04..0bbe756 100644
--- a/wlan/prima/CORE/MAC/src/pe/lim/limUtils.h
+++ b/wlan/prima/CORE/MAC/src/pe/lim/limUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -61,8 +61,6 @@
 #define LIM_MAX_REASSOC_RETRY_LIMIT            2
 #endif
 
-#define LIM_MAX_BANDS ( 48 )
-
 // classifier ID is coded as 0-3: tsid, 4-5:direction
 #define LIM_MAKE_CLSID(tsid, dir) (((tsid) & 0x0F) | (((dir) & 0x03) << 4))
 
@@ -105,7 +103,6 @@
     BW20,
     BW40PLUS,
     BW40MINUS,
-    BW80,
     BWALL
 } offset_t;
 
@@ -113,10 +110,9 @@
     tANI_U8 op_class;
     tANI_U8 ch_spacing;
     offset_t    offset;
-    tANI_U8 channels[25];
+    tANI_U8 channels[15];
 }op_class_map_t;
 // LIM utility functions
-tANI_BOOLEAN limCheck11BRateBitmap(tANI_U16 RateBitmap);
 void limGetBssidFromPkt(tpAniSirGlobal, tANI_U8 *, tANI_U8 *, tANI_U32 *);
 char * limMlmStateStr(tLimMlmStates state);
 char * limSmeStateStr(tLimSmeStates state);
@@ -439,7 +435,7 @@
     WLAN_PE_DIAG_REASSOC_REQ_EVENT,
     WLAN_PE_DIAG_REASSOC_RSP_EVENT,
     WLAN_PE_DIAG_AUTH_REQ_EVENT,
-    WLAN_PE_DIAG_AUTH_RSP_EVENT = 10,
+    WLAN_PE_DIAG_AUTH_RSP_EVENT,
     WLAN_PE_DIAG_DISASSOC_REQ_EVENT,
     WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
     WLAN_PE_DIAG_DISASSOC_IND_EVENT,
@@ -449,7 +445,7 @@
     WLAN_PE_DIAG_DEAUTH_IND_EVENT,
     WLAN_PE_DIAG_START_BSS_REQ_EVENT,
     WLAN_PE_DIAG_START_BSS_RSP_EVENT,
-    WLAN_PE_DIAG_AUTH_IND_EVENT = 20,
+    WLAN_PE_DIAG_AUTH_IND_EVENT,
     WLAN_PE_DIAG_ASSOC_IND_EVENT,
     WLAN_PE_DIAG_ASSOC_CNF_EVENT,
     WLAN_PE_DIAG_REASSOC_IND_EVENT,
@@ -459,7 +455,7 @@
     WLAN_PE_DIAG_STOP_BSS_RSP_EVENT,
     WLAN_PE_DIAG_DEAUTH_CNF_EVENT,
     WLAN_PE_DIAG_ADDTS_REQ_EVENT,
-    WLAN_PE_DIAG_ADDTS_RSP_EVENT = 30,
+    WLAN_PE_DIAG_ADDTS_RSP_EVENT,
     WLAN_PE_DIAG_DELTS_REQ_EVENT,
     WLAN_PE_DIAG_DELTS_RSP_EVENT,
     WLAN_PE_DIAG_DELTS_IND_EVENT,
@@ -469,7 +465,7 @@
     WLAN_PE_DIAG_EXIT_BMPS_RSP_EVENT,
     WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT,
     WLAN_PE_DIAG_ENTER_IMPS_REQ_EVENT,
-    WLAN_PE_DIAG_ENTER_IMPS_RSP_EVENT = 40,
+    WLAN_PE_DIAG_ENTER_IMPS_RSP_EVENT,
     WLAN_PE_DIAG_EXIT_IMPS_REQ_EVENT,
     WLAN_PE_DIAG_EXIT_IMPS_RSP_EVENT,
     WLAN_PE_DIAG_ENTER_UAPSD_REQ_EVENT,
@@ -479,7 +475,7 @@
     WLAN_PE_DIAG_WOWL_ADD_BCAST_PTRN_EVENT,
     WLAN_PE_DIAG_WOWL_DEL_BCAST_PTRN_EVENT,
     WLAN_PE_DIAG_ENTER_WOWL_REQ_EVENT,
-    WLAN_PE_DIAG_ENTER_WOWL_RSP_EVENT = 50,
+    WLAN_PE_DIAG_ENTER_WOWL_RSP_EVENT,
     WLAN_PE_DIAG_EXIT_WOWL_REQ_EVENT,
     WLAN_PE_DIAG_EXIT_WOWL_RSP_EVENT,
     WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT,
@@ -489,23 +485,8 @@
     WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT,
     WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT,
     WLAN_PE_DIAG_PREAUTH_DONE,
-    WLAN_PE_DIAG_REASSOCIATING = 60,
+    WLAN_PE_DIAG_REASSOCIATING,
     WLAN_PE_DIAG_CONNECTED,
-    WLAN_PE_DIAG_ASSOC_REQ_EVENT,
-    WLAN_PE_DIAG_AUTH_COMP_EVENT,
-    WLAN_PE_DIAG_ASSOC_COMP_EVENT,
-    WLAN_PE_DIAG_AUTH_START_EVENT,
-    WLAN_PE_DIAG_ASSOC_START_EVENT,
-    WLAN_PE_DIAG_REASSOC_START_EVENT,
-    WLAN_PE_DIAG_ROAM_AUTH_START_EVENT,
-    WLAN_PE_DIAG_ROAM_AUTH_COMP_EVENT,
-    WLAN_PE_DIAG_ROAM_ASSOC_START_EVENT = 70,
-    WLAN_PE_DIAG_ROAM_ASSOC_COMP_EVENT,
-    WLAN_PE_DIAG_SCAN_COMP_EVENT,
-    WLAN_PE_DIAG_SCAN_RES_FOUND_EVENT,
-    WLAN_PE_DIAG_ROAM_REQUESTED,
-    WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
-    WLAN_PE_DIAG_ROAM_CANDIDATE_FOUND,
 }WLAN_PE_DIAG_EVENT_TYPE;
 
 void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode);
@@ -527,6 +508,12 @@
   --------------------------------------------------------------------------*/
 void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState);
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+tANI_U8 limTdlsFindLinkPeer(tpAniSirGlobal pMac, tSirMacAddr peerMac, tLimTdlsLinkSetupPeer  **setupPeer);
+void limTdlsDelLinkPeer(tpAniSirGlobal pMac, tSirMacAddr peerMac);
+void limStartTdlsTimer(tpAniSirGlobal pMac, tANI_U8 sessionId, TX_TIMER *timer, tANI_U32 timerId, 
+                                      tANI_U16 timerType, tANI_U32 timerMsg);
+#endif
 void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U32 phyMode,
                                 tANI_U8 *pShortSlotEnable);
 
@@ -563,19 +550,4 @@
 void limParseBeaconForTim(tpAniSirGlobal pMac, tANI_U8* pRxPacketInfo,
                           tpPESession psessionEntry);
 
-void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
-                          tANI_U8 smeSessionId,
-                          tANI_U32 maxRateFlag);
-
-extern tANI_U32 limGetMaxRateFlags(tpDphHashNode pStaDs,
-                                   tpPESession psessionEntry);
-
-void limDecrementPendingMgmtCount (tpAniSirGlobal pMac);
-
-eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData);
-bool lim_is_robust_mgmt_action_frame(uint8 action_catagory);
-bool lim_is_ext_cap_ie_present (tDot11fIEExtCap *ext_cap);
-void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx,
-                             uint16_t *caps, uint16_t bss_caps);
-
 #endif /* __LIM_UTILS_H */
diff --git a/wlan/prima/CORE/MAC/src/pe/pmm/pmmAP.c b/wlan/prima/CORE/MAC/src/pe/pmm/pmmAP.c
index 528626e..fb36c49 100644
--- a/wlan/prima/CORE/MAC/src/pe/pmm/pmmAP.c
+++ b/wlan/prima/CORE/MAC/src/pe/pmm/pmmAP.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -44,7 +44,7 @@
 #include "schApi.h"
 #include "limApi.h"
 #include "cfgApi.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 
 #include "pmmApi.h"
 #include "pmmDebug.h"
diff --git a/wlan/prima/CORE/MAC/src/pe/pmm/pmmApi.c b/wlan/prima/CORE/MAC/src/pe/pmm/pmmApi.c
index 21ac26c..48a220a 100644
--- a/wlan/prima/CORE/MAC/src/pe/pmm/pmmApi.c
+++ b/wlan/prima/CORE/MAC/src/pe/pmm/pmmApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,7 +38,7 @@
  */
 
 #include "palTypes.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 
 #include "sirCommon.h"
 #include "aniGlobal.h"
@@ -222,8 +222,6 @@
     if (NULL == limMsg->bodyptr)
     {
         PELOGE(pmmLog(pMac, LOGE, FL("pmmBmps: Received SIR_HAL_ENTER_BMPS_RSP with NULL "));)
-        nextState = ePMM_STATE_READY;
-        retStatus = eSIR_SME_BMPS_REQ_FAILED;
         goto failure;
     }
     pEnterBmpsParams = (tpEnterBmpsParams)(limMsg->bodyptr);
@@ -232,8 +230,8 @@
     //If response is failure, then send the response back to PMC and reset its state.
     if(pEnterBmpsParams->status == eHAL_STATUS_SUCCESS)
     {
-        pmmLog(pMac, LOG1,
-            FL("pmmBmps: Received successful response from HAL to enter BMPS_POWER_SAVE "));
+        PELOG2(pmmLog(pMac, LOG2,
+            FL("pmmBmps: Received successful response from HAL to enter BMPS_POWER_SAVE "));)
 
         pMac->pmm.gPmmState = ePMM_STATE_BMPS_SLEEP;
 
@@ -261,7 +259,7 @@
             FL("pmmBmps: BMPS_INIT_PWR_SAVE_REQ failed, informing SME"));)
 
         pmmBmpsUpdateInitFailureCnt(pMac);
-        nextState = ePMM_STATE_READY;
+        nextState = ePMM_STATE_BMPS_WAKEUP;
         retStatus = eSIR_SME_BMPS_REQ_FAILED;
         goto failure;
     }
@@ -275,7 +273,7 @@
        {
            if(VOS_TRUE != tx_timer_running(&pMac->lim.limTimers.gLimHeartBeatTimer))
            {
-               PELOGE(pmmLog(pMac, LOGW, FL("Unexpected heartbeat timer not running"));)
+               PELOGE(pmmLog(pMac, LOGE, FL("Unexpected heartbeat timer not running"));)
                limReactivateHeartBeatTimer(pMac, psessionEntry);
            }
        }
@@ -342,9 +340,7 @@
 
     /* send wakeup request, only when in sleep state */
     PELOGW(pmmLog(pMac, LOGW, FL("pmmBmps: Sending eWNI_PMC_EXIT_BMPS_REQ to HAL"));)
-
-    if ((pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
-         (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP))
+    if (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP)
     {
         /* Store the reason code for exiting BMPS. This value will be
          * checked when PMM receives SIR_HAL_EXIT_BMPS_RSP from HAL
@@ -367,8 +363,8 @@
         }
         else
         {
-            pmmLog(pMac, LOG1,
-                          FL("pmmBmps: eWNI_PMC_EXIT_BMPS_REQ was successfully sent to HAL"));
+            PELOG1(pmmLog(pMac, LOG1,
+                          FL("pmmBmps: eWNI_PMC_EXIT_BMPS_REQ was successfully sent to HAL"));)
         }
     }
     else
@@ -600,7 +596,7 @@
         return retStatus;
     }
 
-    pmmLog(pMac, LOG1, FL("WDA_EXIT_BMPS_REQ has been successfully sent to HAL"));
+    PELOG1(pmmLog(pMac, LOG1, FL("WDA_EXIT_BMPS_REQ has been successfully sent to HAL"));)
     return retStatus;
 }
 
@@ -681,7 +677,7 @@
             (tANI_U8)GET_MIN_VALUE((tANI_U8) numBeaconPerRssiAverage, WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE_STAMAX);
 
     pmmLog (pMac, LOG1,
-        "%s: RssiFilterInfo..%d %x %x", __func__, (int)pBmpsParams->bRssiFilterEnable,
+        "%s: [INFOLOG]RssiFilterInfo..%d %x %x", __func__, (int)pBmpsParams->bRssiFilterEnable,
         (unsigned int)pBmpsParams->rssiFilterPeriod, (unsigned int)pBmpsParams->numBeaconPerRssiAverage);
 
     msgQ.type = WDA_ENTER_BMPS_REQ;
@@ -689,8 +685,8 @@
     msgQ.bodyptr = pBmpsParams;
     msgQ.bodyval = 0;
 
-    pmmLog( pMac, LOG1,
-        FL( "pmmBmps: Sending WDA_ENTER_BMPS_REQ" ));
+    PELOG2(pmmLog( pMac, LOG2,
+        FL( "pmmBmps: Sending WDA_ENTER_BMPS_REQ" ));)
 
     /* we need to defer any incoming messages until we get a
      * WDA_ENTER_BMPS_RSP from HAL.
@@ -796,7 +792,7 @@
     msgQ.bodyptr = pUpdatedPwrSaveCfg;
     msgQ.bodyval = 0;
 
-    pmmLog( pMac, LOG1, FL( "pmmBmps: Sending WDA_PWR_SAVE_CFG to HAL"));
+    PELOG1(pmmLog( pMac, LOG1, FL( "pmmBmps: Sending WDA_PWR_SAVE_CFG to HAL"));)
     MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
@@ -889,7 +885,6 @@
     {
         case eHAL_STATUS_SUCCESS:
             retStatus = eSIR_SME_SUCCESS;
-            pMac->pmm.gPmmState = ePMM_STATE_BMPS_WAKEUP;
             /* Update wakeup statistics */
             pmmUpdateWakeupStats(pMac);
             break;
@@ -901,13 +896,14 @@
                  * But, PMC will be informed about the error.
                  */
                 retStatus = eSIR_SME_BMPS_REQ_FAILED;
-                pMac->pmm.gPmmState = ePMM_STATE_BMPS_SLEEP;
                 pmmBmpsUpdateWakeupReqFailureCnt(pMac);
             }
             break;
 
     }
 
+    pMac->pmm.gPmmState = ePMM_STATE_BMPS_WAKEUP;
+
     // turn on background scan
     pMac->sys.gSysEnableScanMode = true;
 
@@ -976,7 +972,7 @@
        (pMac->lim.gLimTimersCreated))
     {
         if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &beaconInterval) != eSIR_SUCCESS)
-            pmmLog(pMac, LOG1, FL("Fail to get BEACON_INTERVAL value"));
+            PELOG1(pmmLog(pMac, LOG1, FL("Fail to get BEACON_INTERVAL value"));)
 
         /* Change timer to reactivate it in future */
         heartBeatInterval= SYS_MS_TO_TICKS(beaconInterval * heartBeatInterval);
@@ -984,7 +980,7 @@
         if( tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
                             (tANI_U32)heartBeatInterval, 0) != TX_SUCCESS)
         {
-            pmmLog(pMac, LOG1, FL("Fail to change HeartBeat timer"));
+            PELOG1(pmmLog(pMac, LOG1, FL("Fail to change HeartBeat timer"));)
         }
 
         /* update some statistics */
@@ -1095,8 +1091,8 @@
          */
         case eHAL_STATUS_HEARTBEAT_TMOUT:
             {
-                pmmLog(pMac, LOG1,
-                              FL("pmmBmps: The device woke up due to HeartBeat Timeout"));
+                PELOG1(pmmLog(pMac, LOG1,
+                              FL("pmmBmps: The device woke up due to HeartBeat Timeout"));)
 
                 /* Proceed only if HeartBeat timer is created */
                 if((pMac->lim.limTimers.gLimHeartBeatTimer.pMac) &&
@@ -1112,8 +1108,8 @@
                     if(tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
                                        (tANI_U32)heartBeatInterval, 0) != TX_SUCCESS)
                     {
-                        pmmLog(pMac, LOG1,
-                               FL("pmmBmps: Unable to change HeartBeat timer"));
+                        PELOG1(pmmLog(pMac, LOG1,
+                               FL("pmmBmps: Unable to change HeartBeat timer"));)
                     }
 
                     /* update some statistics */
@@ -1504,8 +1500,8 @@
     }
     else
     {
-        pmmLog(pMac, LOG1,
-               FL("pmmImps: Waiting for SoftMac response for IMPS request"));
+        PELOG1(pmmLog(pMac, LOG1,
+               FL("pmmImps: Waiting for SoftMac response for IMPS request"));)
     }
     return;
 
@@ -1543,7 +1539,6 @@
 {
     tPmmState nextState = pMac->pmm.gPmmState;
     tSirResultCodes resultCode = eSIR_SME_SUCCESS;
-    static int failCnt = 0;
 
     /* we need to process all the deferred messages enqueued since
      * the initiating the WDA_ENTER_IMPS_REQ.
@@ -1567,8 +1562,8 @@
         //if success, change the state to IMPS sleep mode
         pMac->pmm.gPmmState = ePMM_STATE_IMPS_SLEEP;
 
-        pmmLog(pMac, LOG1,
-            FL("pmmImps: Received successful WDA_ENTER_IMPS_RSP from HAL"));
+        PELOG2(pmmLog(pMac, LOG2,
+            FL("pmmImps: Received successful WDA_ENTER_IMPS_RSP from HAL"));)
 
         //update power save statistics
         pmmImpsUpdatePwrSaveStats(pMac);
@@ -1580,20 +1575,18 @@
     else
     {
         // go back to previous state if request failed
-        nextState = ePMM_STATE_READY;
+        nextState = ePMM_STATE_IMPS_WAKEUP;
         resultCode = eSIR_SME_CANNOT_ENTER_IMPS;
         goto failure;
     }
     return;
 
 failure:
-    if (!(failCnt & 0xF))
-         PELOGE(pmmLog(pMac, LOGE,
+    PELOGE(pmmLog(pMac, LOGE, 
            FL("pmmImpsSleepRsp failed, Ret Code: %d, next state will be: %d"),
            rspStatus,
            pMac->pmm.gPmmState);)
 
-    failCnt++;
     pmmImpsUpdateSleepErrStats(pMac, rspStatus);
 
     pMac->pmm.gPmmState = nextState;
@@ -1718,8 +1711,8 @@
         {
             resultCode = eSIR_SME_SUCCESS;
             pMac->pmm.gPmmState = ePMM_STATE_IMPS_WAKEUP;
-            pmmLog(pMac, LOG1,
-                          FL("pmmImps: Received WDA_EXIT_IMPS_RSP with Successful response from HAL"));
+            PELOG2(pmmLog(pMac, LOG2,
+                          FL("pmmImps: Received WDA_EXIT_IMPS_RSP with Successful response from HAL"));)
             //update power save statistics
             pmmImpsUpdateWakeupStats(pMac);
         }
@@ -1794,14 +1787,11 @@
     {
         PELOGE(pmmLog(pMac, LOGE,
             FL("pmmUapsd: HAL_ENTER_UAPSD_REQ failed with response: %x"), retStatus);)
-        if (retStatus == eSIR_PMM_INVALID_REQ)
-            resultCode = eSIR_SME_UAPSD_REQ_INVALID;
-        else
-            resultCode = eSIR_SME_UAPSD_REQ_FAILED;
+        resultCode = eSIR_SME_UAPSD_REQ_FAILED;
         goto failure;
     }
 
-    pmmLog(pMac, LOG1, FL("pmmUapsd: Waiting for WDA_ENTER_UAPSD_RSP "));
+    PELOG1(pmmLog(pMac, LOG1, FL("pmmUapsd: Waiting for WDA_ENTER_UAPSD_RSP "));)
     return;
 
 failure:
@@ -2520,12 +2510,12 @@
     if (SIR_PM_SLEEP_MODE == mode)
     {
         msgQ.type = WDA_ENTER_IMPS_REQ;
-        pmmLog (pMac, LOG1, FL("Sending WDA_ENTER_IMPS_REQ to HAL"));
+        PELOG2(pmmLog (pMac, LOG2, FL("Sending WDA_ENTER_IMPS_REQ to HAL"));)
     }
     else
     {
         msgQ.type = WDA_EXIT_IMPS_REQ;
-        pmmLog (pMac, LOG1, FL("Sending WDA_EXIT_IMPS_REQ to HAL"));
+        PELOG2(pmmLog (pMac, LOG2, FL("Sending WDA_EXIT_IMPS_REQ to HAL"));)
     }
 
     msgQ.reserved = 0;
@@ -2688,22 +2678,6 @@
             pUapsdParams->viTriggerEnabled, 
             pUapsdParams->voTriggerEnabled);)
 
-        if (pUapsdParams->bkDeliveryEnabled == 0 &&
-            pUapsdParams->beDeliveryEnabled == 0 &&
-            pUapsdParams->viDeliveryEnabled == 0 &&
-            pUapsdParams->voDeliveryEnabled == 0 &&
-            pUapsdParams->bkTriggerEnabled == 0 &&
-            pUapsdParams->beTriggerEnabled == 0 &&
-            pUapsdParams->viTriggerEnabled == 0 &&
-            pUapsdParams->voTriggerEnabled == 0)
-        {
-            limLog(pMac, LOGW, FL("No Need to enter UAPSD since Trigger "
-                 "Enabled and Delivery Enabled Mask is zero for all ACs"));
-            vos_mem_free(pUapsdParams);
-            retStatus = eSIR_PMM_INVALID_REQ;
-            return retStatus;
-        }
-
         PELOGW(pmmLog (pMac, LOGW, FL("pmmUapsd: Sending WDA_ENTER_UAPSD_REQ to HAL"));)
     }
     else
diff --git a/wlan/prima/CORE/MAC/src/pe/pmm/pmmDebug.c b/wlan/prima/CORE/MAC/src/pe/pmm/pmmDebug.c
index 202b9b1..b0cecd1 100644
--- a/wlan/prima/CORE/MAC/src/pe/pmm/pmmDebug.c
+++ b/wlan/prima/CORE/MAC/src/pe/pmm/pmmDebug.c
@@ -33,6 +33,9 @@
 
   \author Sunit Bhatia
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/MAC/src/pe/rrm/rrmApi.c b/wlan/prima/CORE/MAC/src/pe/rrm/rrmApi.c
index d094864..f96d180 100644
--- a/wlan/prima/CORE/MAC/src/pe/rrm/rrmApi.c
+++ b/wlan/prima/CORE/MAC/src/pe/rrm/rrmApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -45,7 +45,7 @@
 #include "wniApi.h"
 #include "sirApi.h"
 #include "aniGlobal.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "limTypes.h"
 #include "limUtils.h"
 #include "limSendSmeRspMessages.h"
@@ -450,8 +450,7 @@
    //Send request to SME.
    mmhMsg.type    = pSmeNeighborRpt->messageType;
    mmhMsg.bodyptr = pSmeNeighborRpt;
-   MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, pSessionEntry->peSessionId,
-                                                           mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, mmhMsg.type));
    status = limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
    return status;
@@ -670,8 +669,7 @@
    //Send request to SME.
    mmhMsg.type    = eWNI_SME_BEACON_REPORT_REQ_IND;
    mmhMsg.bodyptr = pSmeBcnReportReq;
-   MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, pSessionEntry->peSessionId,
-                                                           mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, mmhMsg.type));
    return limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 }
 
diff --git a/wlan/prima/CORE/MAC/src/pe/sch/schApi.c b/wlan/prima/CORE/MAC/src/pe/sch/schApi.c
index c9c8ef4..24bee2c 100644
--- a/wlan/prima/CORE/MAC/src/pe/sch/schApi.c
+++ b/wlan/prima/CORE/MAC/src/pe/sch/schApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,7 +39,7 @@
  */
 #include "palTypes.h"
 #include "aniGlobal.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 
 #include "sirMacProtDef.h"
 #include "sirMacPropExts.h"
@@ -243,7 +243,7 @@
     tSirMsgQ        msgQ;
     tANI_U32        retCode;
 
-    schLog(pMac, LOG1, FL("Sending SIR_SCH_START_SCAN_RSP to LIM"));
+    PELOG1(schLog(pMac, LOG1, FL("Sending LIM message to go into scan"));)
     msgQ.type = SIR_SCH_START_SCAN_RSP;
     if ((retCode = limPostMsgApi(pMac, &msgQ)) != eSIR_SUCCESS)
         schLog(pMac, LOGE,
@@ -353,7 +353,6 @@
         && (pMac->sch.schObject.fBeaconChanged)
         && ((psessionEntry->proxyProbeRspEn)
         || (IS_FEATURE_SUPPORTED_BY_FW(WPS_PRBRSP_TMPL)))
-        && vos_is_probe_rsp_offload_enabled()
       )
 
     {
diff --git a/wlan/prima/CORE/MAC/src/pe/sch/schBeaconGen.c b/wlan/prima/CORE/MAC/src/pe/sch/schBeaconGen.c
index 12ca744..031380c 100644
--- a/wlan/prima/CORE/MAC/src/pe/sch/schBeaconGen.c
+++ b/wlan/prima/CORE/MAC/src/pe/sch/schBeaconGen.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,7 +38,7 @@
  */
  
 #include "palTypes.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "aniGlobal.h"
 #include "sirMacProtDef.h"
 
@@ -276,7 +276,6 @@
     if((psessionEntry->limSystemRole == eLIM_AP_ROLE) 
         && ((psessionEntry->proxyProbeRspEn)
         || (IS_FEATURE_SUPPORTED_BY_FW(WPS_PRBRSP_TMPL)))
-        && vos_is_probe_rsp_offload_enabled()
       )
     {
         /* Initialize the default IE bitmap to zero */
@@ -339,33 +338,15 @@
         PopulateDot11fHTCaps( pMac,psessionEntry, &pBcn2->HTCaps );
         PopulateDot11fHTInfo( pMac, &pBcn2->HTInfo, psessionEntry );
     }
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    if ((pMac->roam.configParam.apHT40_24GEnabled)
-     && (IS_DOT11_MODE_HT(psessionEntry->dot11mode)))
-    {
-        PopulateDot11fOBSSScanParameters( pMac, &pBcn2->OBSSScanParameters,
-                                                               psessionEntry);
-        /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in
-         * a 20/40 MHz BSS may generate DSSS/CCK transmissions. Set DSSS/CCK
-         * Mode in 40 MHz bit in HT capablity.
-         */
-        pBcn2->HTCaps.dsssCckMode40MHz = 1;
-    }
-#endif
-
-    PopulateDot11fExtCap( pMac, &pBcn2->ExtCap, psessionEntry);
-
 #ifdef WLAN_FEATURE_11AC
     if(psessionEntry->vhtCapability)
     {        
         schLog( pMac, LOGW, FL("Populate VHT IEs in Beacon"));
-        PopulateDot11fVHTCaps( pMac, &pBcn2->VHTCaps,
-                              psessionEntry->currentOperChannel, eSIR_TRUE );
-        PopulateDot11fVHTOperation( pMac, &pBcn2->VHTOperation,
-                                          psessionEntry->currentOperChannel);
+        PopulateDot11fVHTCaps( pMac, &pBcn2->VHTCaps, eSIR_TRUE );
+        PopulateDot11fVHTOperation( pMac, &pBcn2->VHTOperation);
         // we do not support multi users yet
         //PopulateDot11fVHTExtBssLoad( pMac, &bcn2.VHTExtBssLoad);
+        PopulateDot11fExtCap( pMac, &pBcn2->ExtCap, psessionEntry);
         if(psessionEntry->gLimOperatingMode.present)
             PopulateDot11fOperatingMode( pMac, &pBcn2->OperatingMode, psessionEntry );
     }
@@ -421,7 +402,6 @@
     if((psessionEntry->limSystemRole == eLIM_AP_ROLE) 
         && ((psessionEntry->proxyProbeRspEn)
         || (IS_FEATURE_SUPPORTED_BY_FW(WPS_PRBRSP_TMPL)))
-        && vos_is_probe_rsp_offload_enabled()
       )
     {
         /* Can be efficiently updated whenever new IE added  in Probe response in future */
@@ -637,31 +617,6 @@
                      sizeof(beacon2->HTInfo));
     }
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    // Overlapping BSS Scan Parameters IE
-    if (pMac->roam.configParam.apHT40_24GEnabled)
-    {
-        if (beacon2->OBSSScanParameters.present)
-        {
-            SetProbeRspIeBitmap(DefProbeRspIeBitmap,
-                          SIR_MAC_OBSS_SCAN_PARAMETERS_EID);
-            vos_mem_copy((void *)&prb_rsp->OBSSScanParameters,
-                              (void *)&beacon2->OBSSScanParameters,
-                              sizeof(beacon2->OBSSScanParameters));
-        }
-
-        if (beacon2->ExtCap.present)
-        {
-            SetProbeRspIeBitmap(DefProbeRspIeBitmap,
-                        SIR_MAC_EXTENDED_CAPABILITIES_EID);
-            vos_mem_copy((void *)&prb_rsp->ExtCap,
-                              (void *)&beacon2->ExtCap,
-                              sizeof(beacon2->ExtCap));
-
-        }
-    }
-#endif
-
 #ifdef WLAN_FEATURE_11AC
     if(beacon2->VHTCaps.present)
     {
diff --git a/wlan/prima/CORE/MAC/src/pe/sch/schBeaconProcess.c b/wlan/prima/CORE/MAC/src/pe/sch/schBeaconProcess.c
index 8d3483b..c24a314 100644
--- a/wlan/prima/CORE/MAC/src/pe/sch/schBeaconProcess.c
+++ b/wlan/prima/CORE/MAC/src/pe/sch/schBeaconProcess.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,7 +38,7 @@
  */
 
 #include "palTypes.h"
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 
 #include "cfgApi.h"
 #include "pmmApi.h"
@@ -131,8 +131,7 @@
                 if (((!(pBcnStruct->erpPresent)) && 
                       !(pBcnStruct->HTInfo.present))|| 
                     //if erp not present then  11B AP overlapping
-                    (!pMac->roam.configParam.ignorePeerErpInfo &&
-                      pBcnStruct->erpPresent &&
+                    (pBcnStruct->erpPresent &&
                     (pBcnStruct->erpIEInfo.useProtection ||
                     pBcnStruct->erpIEInfo.nonErpPresent)))
                 {
@@ -159,8 +158,7 @@
               if (((!(pBcnStruct->erpPresent)) && 
                     !(pBcnStruct->HTInfo.present))|| 
                   //if erp not present then  11B AP overlapping
-                  (!pMac->roam.configParam.ignorePeerErpInfo &&
-                    pBcnStruct->erpPresent &&
+                  (pBcnStruct->erpPresent &&
                   (pBcnStruct->erpIEInfo.useProtection ||
                   pBcnStruct->erpIEInfo.nonErpPresent)))
               {
@@ -202,8 +200,7 @@
                   //then we need to enable protection from 11g station. 
                   //we don't need protection from 11b because if that's needed then our operating
                   //mode would have already been set to legacy in the previous blocks.
-                  if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBcnStruct->HTInfo.opMode
-                     && !pMac->roam.configParam.ignorePeerHTopMode)
+                  if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBcnStruct->HTInfo.opMode)
                   {
                       if((eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode) &&
                           (eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode))
@@ -337,7 +334,7 @@
     tUpdateBeaconParams beaconParams;
     tANI_U8 sendProbeReq = FALSE;
     tpDphHashNode pStaDs = NULL;
-    tANI_U32   channelBondingMode = 0;
+    tANI_U32   channelBondingMode;
 #ifdef WLAN_FEATURE_11AC
     tpSirMacMgmtHdr    pMh = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
     tANI_U16  aid;
@@ -408,8 +405,8 @@
         bi = psessionEntry->beaconParams.beaconInterval;
         if (bi != pBeacon->beaconInterval)
         {
-           schLog(pMac, LOG1, FL("Beacon interval changed from %d to %d"),
-                   pBeacon->beaconInterval, bi);
+           PELOG1(schLog(pMac, LOG1, FL("Beacon interval changed from %d to %d"),
+                   pBeacon->beaconInterval, bi);)
 
             bi = pBeacon->beaconInterval;
             psessionEntry->beaconParams.beaconInterval = (tANI_U16) bi;
@@ -493,7 +490,7 @@
         /* Update the channel bonding mode only if channel bonding
          * mode is enabled in INI.
          */
-        if ( (pStaDs != NULL) && (HAL_STA_INVALID_IDX != pStaDs->staIndex ) &&
+        if ( (pStaDs != NULL) &&
               (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != channelBondingMode) )
         {
            /* Following check is related to HT40 on 2.4GHz mode*/
@@ -518,8 +515,6 @@
                              pBeacon->HTInfo.recommendedTxWidthSet;
                   pStaDs->htSecondaryChannelOffset =
                              pBeacon->HTInfo.secondaryChannelOffset;
-                  limUpdateMaxRateFlag(pMac, psessionEntry->smeSessionId,
-                                       limGetMaxRateFlags(pStaDs, psessionEntry));
               }
            }
         }
@@ -540,7 +535,7 @@
        /* Update the channel bonding mode only if channel bonding
         * mode is enabled in INI.
         */
-       if ( (NULL != pStaDs) && (HAL_STA_INVALID_IDX != pStaDs->staIndex ) &&
+       if ( (NULL != pStaDs)  &&
             (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != channelBondingMode) )
        {
           if (psessionEntry->vhtCapability && pBeacon->OperatingMode.present )
@@ -551,25 +546,30 @@
                 eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
              if (operMode != pBeacon->OperatingMode.chanWidth)
              {
-                   schLog(pMac, LOG1,
+                PELOG1(schLog(pMac, LOG1,
                          FL(" received OpMode Chanwidth %d, staIdx = %d"),
                          pBeacon->OperatingMode.chanWidth,
-                         pStaDs->staIndex);
-                   schLog(pMac, LOG1, FL(" MAC -" MAC_ADDRESS_STR),
-                                              MAC_ADDR_ARRAY(pMh->sa));
+                         pStaDs->staIndex);)
+                   PELOG1(schLog(pMac, LOG1, FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x"),
+                            pMh->sa[0],
+                            pMh->sa[1],
+                            pMh->sa[2],
+                            pMh->sa[3],
+                            pMh->sa[4],
+                            pMh->sa[5]);)
 
                    if (pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
                    {
-                      schLog(pMac, LOG1,
-                               FL("Updating the CH Width to 80MHz"));
+                      PELOG1(schLog(pMac, LOG1,
+                               FL("Updating the CH Width to 80MHz"));)
                          pStaDs->vhtSupportedChannelWidthSet =
                          WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
                       pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
                    }
                    else if (pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
                    {
-                      schLog(pMac, LOG1,
-                               FL("Updating the CH Width to 40MHz"));
+                      PELOG1(schLog(pMac, LOG1,
+                               FL("Updating the CH Width to 40MHz"));)
                          pStaDs->vhtSupportedChannelWidthSet =
                          WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
                       pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
@@ -577,8 +577,8 @@
                    else if (pBeacon->OperatingMode.chanWidth ==
                          eHT_CHANNEL_WIDTH_20MHZ)
                    {
-                      schLog(pMac, LOG1,
-                               FL("Updating the CH Width to 20MHz"));
+                      PELOG1(schLog(pMac, LOG1,
+                               FL("Updating the CH Width to 20MHz"));)
                          pStaDs->vhtSupportedChannelWidthSet =
                          WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
                       pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
@@ -593,18 +593,23 @@
              operMode = pStaDs->vhtSupportedChannelWidthSet;
              if (operMode != pBeacon->VHTOperation.chanWidth)
              {
-                   schLog(pMac, LOG1,
+                PELOG1(schLog(pMac, LOG1,
                          FL(" received VHTOP CHWidth %d staIdx = %d"),
                          pBeacon->VHTOperation.chanWidth,
-                         pStaDs->staIndex);
-                   schLog(pMac, LOG1, FL(" MAC -" MAC_ADDRESS_STR),
-                                            MAC_ADDR_ARRAY(pMh->sa));
+                         pStaDs->staIndex);)
+                   PELOG1(schLog(pMac, LOG1, FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x"),
+                            pMh->sa[0],
+                            pMh->sa[1],
+                            pMh->sa[2],
+                            pMh->sa[3],
+                            pMh->sa[4],
+                            pMh->sa[5]);)
 
                    if (pBeacon->VHTOperation.chanWidth ==
                          WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
                    {
-                      schLog(pMac, LOG1,
-                               FL("Updating the CH Width to 80MHz"));
+                      PELOG1(schLog(pMac, LOG1,
+                               FL("Updating the CH Width to 80MHz"));)
                          pStaDs->vhtSupportedChannelWidthSet =
                          WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
                       pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
@@ -617,16 +622,16 @@
                          WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
                       if (pBeacon->HTCaps.supportedChannelWidthSet)
                       {
-                         schLog(pMac, LOG1,
-                                  FL("Updating the CH Width to 40MHz"));
+                         PELOG1(schLog(pMac, LOG1,
+                                  FL("Updating the CH Width to 40MHz"));)
                             pStaDs->htSupportedChannelWidthSet =
                             eHT_CHANNEL_WIDTH_40MHZ;
                          chWidth = eHT_CHANNEL_WIDTH_40MHZ;
                       }
                       else
                       {
-                         schLog(pMac, LOG1,
-                                  FL("Updating the CH Width to 20MHz"));
+                         PELOG1(schLog(pMac, LOG1,
+                                  FL("Updating the CH Width to 20MHz"));)
                             pStaDs->htSupportedChannelWidthSet =
                             eHT_CHANNEL_WIDTH_20MHZ;
                          chWidth = eHT_CHANNEL_WIDTH_20MHZ;
@@ -644,6 +649,7 @@
     /* Obtain the Max Tx power for the current regulatory  */
     regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
 #endif
+
 #if defined WLAN_FEATURE_VOWIFI
     {
         tPowerdBm  localRRMConstraint = 0;
@@ -701,8 +707,8 @@
 
     if(beaconParams.paramChangeBitmap)
     {
-        schLog(pMac, LOGW, FL("Beacon for session[%d] got changed. "), psessionEntry->peSessionId);
-        schLog(pMac, LOGW, FL("sending beacon param change bitmap: 0x%x "), beaconParams.paramChangeBitmap);
+        PELOGW(schLog(pMac, LOGW, FL("Beacon for session[%d] got changed. "), psessionEntry->peSessionId);)
+        PELOGW(schLog(pMac, LOGW, FL("sending beacon param change bitmap: 0x%x "), beaconParams.paramChangeBitmap);)
         limSendBeaconParams(pMac, &beaconParams, psessionEntry);
     }
 
@@ -748,6 +754,7 @@
 
         return;
     }
+
     if (beaconStruct.ssidPresent)
     {
         beaconStruct.ssId.ssId[beaconStruct.ssId.length] = 0;
@@ -779,10 +786,8 @@
         {
             //Update the beacons and apply the new settings to HAL
             schSetFixedBeaconFields(pMac, pAPSession);
-            schLog(pMac, LOG1, FL("Beacon for PE session[%d] got changed."),
-                                                      pAPSession->peSessionId);
-            schLog(pMac, LOG1, FL("sending beacon param change bitmap: 0x%x "),
-                                               beaconParams.paramChangeBitmap);
+            PELOG1(schLog(pMac, LOG1, FL("Beacon for PE session[%d] got changed.  "), pAPSession->peSessionId);)
+            PELOG1(schLog(pMac, LOG1, FL("sending beacon param change bitmap: 0x%x "), beaconParams.paramChangeBitmap);)
             limSendBeaconParams(pMac, &beaconParams, pAPSession);
         }
     }
@@ -829,43 +834,14 @@
     vos_log_qos_edca_pkt_type *log_ptr = NULL;
 #endif //FEATURE_WLAN_DIAG_SUPPORT 
 
-    schLog(pMac, LOG2, FL("Updating parameter set count: Old %d ---> new %d"),
-           psessionEntry->gLimEdcaParamSetCount, edca->qosInfo.count);
+    PELOG1(schLog(pMac, LOG1, FL("Updating parameter set count: Old %d ---> new %d"),
+           psessionEntry->gLimEdcaParamSetCount, edca->qosInfo.count);)
 
     psessionEntry->gLimEdcaParamSetCount = edca->qosInfo.count;
     psessionEntry->gLimEdcaParams[EDCA_AC_BE] = edca->acbe;
     psessionEntry->gLimEdcaParams[EDCA_AC_BK] = edca->acbk;
     psessionEntry->gLimEdcaParams[EDCA_AC_VI] = edca->acvi;
     psessionEntry->gLimEdcaParams[EDCA_AC_VO] = edca->acvo;
-
-    if (pMac->roam.configParam.enable_edca_params) {
-        psessionEntry->gLimEdcaParams[EDCA_AC_VO].aci.aifsn =
-               pMac->roam.configParam.edca_vo_aifs;
-        psessionEntry->gLimEdcaParams[EDCA_AC_VI].aci.aifsn =
-               pMac->roam.configParam.edca_vi_aifs;
-        psessionEntry->gLimEdcaParams[EDCA_AC_BK].aci.aifsn =
-               pMac->roam.configParam.edca_bk_aifs;
-        psessionEntry->gLimEdcaParams[EDCA_AC_BE].aci.aifsn =
-               pMac->roam.configParam.edca_be_aifs;
-
-        psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.min =
-               pMac->roam.configParam.edca_vo_cwmin;
-        psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.min =
-               pMac->roam.configParam.edca_vi_cwmin;
-        psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.min =
-               pMac->roam.configParam.edca_bk_cwmin;
-        psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.min =
-               pMac->roam.configParam.edca_be_cwmin;
-
-        psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.max =
-               pMac->roam.configParam.edca_vo_cwmax;
-        psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.max =
-               pMac->roam.configParam.edca_vi_cwmax;
-        psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.max =
-               pMac->roam.configParam.edca_bk_cwmax;
-        psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.max =
-               pMac->roam.configParam.edca_be_cwmax;
-    }
 //log: LOG_WLAN_QOS_EDCA_C
 #ifdef FEATURE_WLAN_DIAG_SUPPORT
     WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C);
@@ -890,18 +866,16 @@
     }
     WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
-    schLog(pMac, LOG1,
-           FL("edsa param enabled in ini %d. Updating Local EDCA Params(gLimEdcaParams) to: "),
-           pMac->roam.configParam.enable_edca_params);
+    PELOG1(schLog(pMac, LOGE, FL("Updating Local EDCA Params(gLimEdcaParams) to: "));)
     for(i=0; i<MAX_NUM_AC; i++)
     {
-        schLog(pMac, LOG1, FL("AC[%d]:  AIFSN: %d, ACM %d, CWmin %d, CWmax %d, TxOp %d"),
+        PELOG1(schLog(pMac, LOG1, FL("AC[%d]:  AIFSN: %d, ACM %d, CWmin %d, CWmax %d, TxOp %d"),
             i,
             psessionEntry->gLimEdcaParams[i].aci.aifsn, 
             psessionEntry->gLimEdcaParams[i].aci.acm,
             psessionEntry->gLimEdcaParams[i].cw.min,
             psessionEntry->gLimEdcaParams[i].cw.max,
-            psessionEntry->gLimEdcaParams[i].txoplimit);
+            psessionEntry->gLimEdcaParams[i].txoplimit);)
     }
 
     return eSIR_SUCCESS;
diff --git a/wlan/prima/CORE/MAC/src/pe/sch/schMessage.c b/wlan/prima/CORE/MAC/src/pe/sch/schMessage.c
index 083a7c8..bd33de4 100644
--- a/wlan/prima/CORE/MAC/src/pe/sch/schMessage.c
+++ b/wlan/prima/CORE/MAC/src/pe/sch/schMessage.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,7 +38,7 @@
 #include "palTypes.h"
 #include "sirCommon.h"
 
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "aniGlobal.h"
 #include "cfgApi.h"
 #include "limApi.h"
diff --git a/wlan/prima/CORE/SAP/inc/sapApi.h b/wlan/prima/CORE/SAP/inc/sapApi.h
index 0da7bbc..1c92e07 100644
--- a/wlan/prima/CORE/SAP/inc/sapApi.h
+++ b/wlan/prima/CORE/SAP/inc/sapApi.h
@@ -39,6 +39,8 @@
   module.
   
       
+  Copyright (c) 2010 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
@@ -187,6 +189,7 @@
     eSAP_ASSOC_STA_CALLBACK_EVENT,  /*Event sent when user called WLANSAP_GetAssocStations */
     eSAP_GET_WPSPBC_SESSION_EVENT,  /* Event send when user call  WLANSAP_getWpsSessionOverlap */  
     eSAP_WPS_PBC_PROBE_REQ_EVENT, /* Event send on WPS PBC probe request is received */
+    eSAP_INDICATE_MGMT_FRAME,
     eSAP_REMAIN_CHAN_READY,
     eSAP_SEND_ACTION_CNF,
     eSAP_DISCONNECT_ALL_P2P_CLIENT,
@@ -285,8 +288,7 @@
     tANI_U32     assocReqLength;
     tANI_U8*     assocReqPtr;
     tANI_U32     assocRespLength;
-    tANI_U8*     assocRespPtr;
-    uint32_t rate_flags;
+    tANI_U8*     assocRespPtr;    
 } tSap_StationAssocReassocCompleteEvent;
 
 typedef struct sap_StationDisassocCompleteEvent_s {
@@ -394,6 +396,7 @@
         tSap_AssocStaListEvent                    sapAssocStaListEvent; /*SAP_ASSOC_STA_CALLBACK_EVENT */
         tSap_GetWPSPBCSessionEvent                sapGetWPSPBCSessionEvent; /*SAP_GET_WPSPBC_SESSION_EVENT */
         tSap_WPSPBCProbeReqEvent                  sapPBCProbeReqEvent; /*eSAP_WPS_PBC_PROBE_REQ_EVENT */
+        tSap_ManagementFrameInfo                  sapManagementFrameInfo; /*eSAP_INDICATE_MGMT_FRAME*/
         tSap_SendActionCnf                        sapActionCnf;  /* eSAP_SEND_ACTION_CNF */ 
         tSap_UnknownSTAJoinEvent                  sapUnknownSTAJoin; /* eSAP_UNKNOWN_STA_JOIN */
         tSap_MaxAssocExceededEvent                sapMaxAssocExceeded; /* eSAP_MAX_ASSOC_EXCEEDED */
@@ -1002,12 +1005,7 @@
 VOS_STATUS 
 WLANSAP_DisassocSta
 (
-    v_PVOID_t  pvosGCtx,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-    const v_U8_t *pPeerStaMac
-#else
-    v_U8_t *pPeerStaMac
-#endif
+    v_PVOID_t  pvosGCtx, v_U8_t *pPeerStaMac
 );
 
 /*==========================================================================
diff --git a/wlan/prima/CORE/SAP/src/sapApiLinkCntl.c b/wlan/prima/CORE/SAP/src/sapApiLinkCntl.c
index 9d4d193..fc56481 100644
--- a/wlan/prima/CORE/SAP/src/sapApiLinkCntl.c
+++ b/wlan/prima/CORE/SAP/src/sapApiLinkCntl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -42,6 +42,9 @@
   Are listed for each API below. 
   
   
+  Copyright (c) 2010 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
@@ -71,9 +74,6 @@
 #include "sme_Api.h"
 // SAP Internal API header file
 #include "sapInternal.h"
-#ifdef WLAN_FEATURE_AP_HT40_24G
-#include "vos_utils.h"
-#endif
 
 /*----------------------------------------------------------------------------
  * Preprocessor Definitions and Constants
@@ -105,907 +105,35 @@
  * -------------------------------------------------------------------------*/
 
 /*==========================================================================
-  FUNCTION    sapSetOperatingChannel()
-
-  DESCRIPTION
-    Set SAP Operating Channel
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    *pContext   : The second context pass in for the caller (sapContext)
-    operChannel : SAP Operating Channel
-
-  RETURN VALUE
-
-  SIDE EFFECTS
-============================================================================*/
-
-void sapSetOperatingChannel(ptSapContext psapContext, v_U8_t operChannel)
-{
-    v_U8_t i = 0;
-    v_U32_t event;
-    tHalHandle hHal = NULL;
-    uint32_t operating_band = 0;
-
-    hHal = VOS_GET_HAL_CB(psapContext->pvosGCtx);
-    if (NULL == hHal)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                     "hHal is NULL in %s", __func__);
-        return;
-    }
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                FL("SAP Channel : %d"), psapContext->channel);
-
-    if (operChannel == SAP_CHANNEL_NOT_SELECTED)
-#ifdef SOFTAP_CHANNEL_RANGE
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                FL("No suitable channel selected"));
-
-        if ( eCSR_BAND_ALL ==  psapContext->scanBandPreference ||
-                psapContext->allBandScanned == eSAP_TRUE)
-        {
-            if(psapContext->channelList != NULL)
-            {
-                 psapContext->channel = SAP_CHANNEL_NOT_SELECTED;
-                 for ( i = 0 ; i < psapContext->numofChannel ; i++)
-                 {
-                    if (NV_CHANNEL_ENABLE ==
-                     vos_nv_getChannelEnabledState(psapContext->channelList[i]))
-                    {
-                        psapContext->channel = psapContext->channelList[i];
-                        break;
-                    }
-                 }
-            }
-
-            /*
-             * In case if channel is not selected then channel
-             * to be selected based on band configured in .ini
-             */
-            if (!psapContext->channel)
-            {
-                ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND,
-                             &operating_band);
-                if (operating_band == eSAP_RF_SUBBAND_5_LOW_GHZ ||
-                    operating_band == eSAP_RF_SUBBAND_5_MID_GHZ ||
-                    operating_band == eSAP_RF_SUBBAND_5_HIGH_GHZ)
-                {
-                    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                              FL("Default channel selection from band %d"),
-                              operating_band);
-
-                    (operating_band == eSAP_RF_SUBBAND_5_LOW_GHZ) ?
-                            (psapContext->channel =
-                                     SAP_DEFAULT_LOW_5GHZ_CHANNEL) :
-                    (operating_band == eSAP_RF_SUBBAND_5_MID_GHZ) ?
-                            (psapContext->channel =
-                                     SAP_DEFAULT_MID_5GHZ_CHANNEL) :
-                    (operating_band == eSAP_RF_SUBBAND_5_HIGH_GHZ) ?
-                            (psapContext->channel =
-                                     SAP_DEFAULT_HIGH_5GHZ_CHANNEL) : 0;
-
-                    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                              FL("channel selected to start bss %d"),
-                              psapContext->channel);
-                }
-                else
-                {
-                    psapContext->channel = SAP_DEFAULT_24GHZ_CHANNEL;
-                }
-            }
-        }
-        else
-        {
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                    FL("Has scan band preference"));
-            if (eCSR_BAND_24 == psapContext->currentPreferredBand)
-                psapContext->currentPreferredBand = eCSR_BAND_5G;
-            else
-                psapContext->currentPreferredBand = eCSR_BAND_24;
-
-            psapContext->allBandScanned = eSAP_TRUE;
-            //go back to DISCONNECT state, scan next band
-            psapContext->sapsMachine = eSAP_DISCONNECTED;
-            event = eSAP_CHANNEL_SELECTION_FAILED;
-        }
-    }
-#else
-       psapContext->channel = SAP_DEFAULT_24GHZ_CHANNEL;
-#endif
-    else
-    {
-      psapContext->channel = operChannel;
-    }
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("SAP Channel : %d"), psapContext->channel);
-}
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-/*==========================================================================
-  FUNCTION    sap_ht2040_timer_cb()
-
-  DESCRIPTION
-    SAP HT40 timer CallBack, Once this function execute it will move SAP
-    from HT20 to HT40
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    usrDataForCallback   : The second context pass in for the caller (sapContext)
-
-  RETURN VALUE
-  SIDE EFFECTS
-============================================================================*/
-void sap_ht2040_timer_cb(v_PVOID_t usrDataForCallback)
-{
-    v_U8_t cbMode;
-    tHalHandle hHal;
-    eHalStatus halStatus = eHAL_STATUS_SUCCESS;
-    ptSapContext sapContext = (ptSapContext)usrDataForCallback;
-    eSapPhyMode sapPhyMode;
-
-    hHal = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME,
-                                             sapContext->pvosGCtx);
-    if (NULL == hHal)
-    {
-        /* we have a serious problem */
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
-                   FL("Invalid hHal"));
-       return;
-    }
-
-    cbMode = sme_GetChannelBondingMode24G(hHal);
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("Current Channel bonding : %d"), cbMode);
-
-    if(cbMode)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
-                  FL("Already in HT40 Channel bonding : %d"), cbMode);
-       return;
-    }
-
-    sapPhyMode =
-        sapConvertSapPhyModeToCsrPhyMode(sapContext->csrRoamProfile.phyMode);
-
-    sme_SelectCBMode(hHal, sapPhyMode, sapContext->channel);
-
-    cbMode = sme_GetChannelBondingMode24G(hHal);
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("Selected Channel bonding : %d"), cbMode);
-
-    if(cbMode)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("Move SAP from HT20 to HT40"));
-
-        if (cbMode == eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY)
-            cbMode = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
-        else if (cbMode == eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY)
-            cbMode = PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
-
-        halStatus = sme_SetHT2040Mode(hHal, sapContext->sessionId, cbMode);
-
-        if (halStatus == eHAL_STATUS_FAILURE )
-        {
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                              FL("Failed to change HT20/40 mode"));
-        }
-    }
-}
-
-/*==========================================================================
-  FUNCTION    sapCheckHT2040CoexAction()
-
-  DESCRIPTION
-    Check 20/40 Coex Info
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    ptSapContext   : The second context pass in for the caller (sapContext)
-    tpSirHT2040CoexInfoInd : 20/40 Coex info
-
-  RETURN VALUE
-    The eHalStatus code associated with performing the operation
-
-    eHAL_STATUS_SUCCESS: Success
-
-  SIDE EFFECTS
-============================================================================*/
-void sapCheckHT2040CoexAction(ptSapContext psapCtx,
-                       tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd)
-{
-    v_U8_t i;
-    v_U8_t isHT40Allowed = 1;
-    tHalHandle hHal;
-    v_U8_t cbMode;
-    eHalStatus halStatus;
-    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
-    unsigned int delay;
-
-    /* tHalHandle */
-    hHal = VOS_GET_HAL_CB(psapCtx->pvosGCtx);
-
-    if (NULL == hHal)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                  FL("In invalid hHal"));
-        return;
-    }
-
-    // Get Channel Bonding Mode
-    cbMode = sme_GetChannelBondingMode24G(hHal);
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("Current Channel Bonding Mode: %d"),
-               cbMode);
-
-    if (pSmeHT2040CoexInfoInd->HT20MHzBssWidthReq)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("20 MHz BSS width request bit is "
-                   "set in 20/40 coexistence info"));
-        isHT40Allowed = 0;
-    }
-
-    if (pSmeHT2040CoexInfoInd->HT40MHzIntolerant)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("40 MHz intolerant bit is set in "
-                    "20/40 coexistence info"));
-        isHT40Allowed = 0;
-    }
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                FL("Total Reported 20/40 BSS Intolerant Channels :%d"),
-                pSmeHT2040CoexInfoInd->channel_num);
-
-    if ((0 == psapCtx->affected_start) && (0 == psapCtx->affected_end))
-    {
-        if (!sapGet24GOBSSAffectedChannel(hHal, psapCtx))
-        {
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                  FL("Failed to get OBSS Affected Channel "
-                     "Range for Channel: %d"), psapCtx->channel);
-            return;
-        }
-        /* Update to Original Channel Bonding for 2.4GHz */
-        sme_UpdateChannelBondingMode24G(hHal, cbMode);
-    }
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("OBSS Affected Channel Range : [%d %d]"),
-               psapCtx->affected_start, psapCtx->affected_end);
-
-    if (pSmeHT2040CoexInfoInd->channel_num)
-    {
-        for(i = 0; i < pSmeHT2040CoexInfoInd->channel_num; i++)
-        {
-            if ((pSmeHT2040CoexInfoInd->HT2040BssIntoChanReport[i] >
-                                                  psapCtx->affected_start)
-              && (pSmeHT2040CoexInfoInd->HT2040BssIntoChanReport[i] <
-                                                  psapCtx->affected_end))
-            {
-                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                           FL("BSS Intolerant Channel: %d within OBSS"
-                             " Affected Channel Range : [%d %d]"),
-                           pSmeHT2040CoexInfoInd->HT2040BssIntoChanReport[i],
-                           psapCtx->affected_start, psapCtx->affected_end);
-                isHT40Allowed = 0;
-                break;
-            }
-
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                       FL("Reported 20/40 BSS Intolerant Channel:%d "
-                        " is Out of OBSS Affected Channel Range : [%d %d]"),
-                       pSmeHT2040CoexInfoInd->HT2040BssIntoChanReport[i],
-                       psapCtx->affected_start, psapCtx->affected_end);
-        }
-    }
-
-    if (!isHT40Allowed)
-    {
-        if(cbMode)
-        {
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("Move SAP from HT40 to HT20"));
-
-            halStatus = sme_SetHT2040Mode(hHal, psapCtx->sessionId,
-                                            PHY_SINGLE_CHANNEL_CENTERED);
-            if (halStatus == eHAL_STATUS_FAILURE)
-            {
-                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                        FL("Failed to change HT20/40 mode"));
-                return;
-            }
-
-            /* Disable Channel Bonding for 2.4GHz */
-            sme_UpdateChannelBondingMode24G(hHal,
-                                PHY_SINGLE_CHANNEL_CENTERED);
-        }
-
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                FL("SAP is Already in HT20"));
-
-        if ((!sapCheckHT40SecondaryIsNotAllowed(psapCtx))
-           && (!psapCtx->numHT40IntoSta))
-        {
-            /* Stop Previous Running HT20/40 Timer & Start timer
-               with (OBSS TransitionDelayFactor * obss interval)
-               delay after time out move AP from HT20 -> HT40
-               mode
-             */
-            if (VOS_TIMER_STATE_RUNNING == psapCtx->sap_HT2040_timer.state)
-            {
-                vosStatus = vos_timer_stop(&psapCtx->sap_HT2040_timer);
-                if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                               FL("Failed to Stop HT20/40 timer"));
-            }
-
-            delay = psapCtx->ObssScanInterval * psapCtx->ObssTransitionDelayFactor;
-
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                       FL("Start HT20/40 itransition"
-                       " timer (%d sec)"), delay);
-
-            vosStatus = vos_timer_start( &psapCtx->sap_HT2040_timer,
-                                                (delay * 1000));
-
-            if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                            FL("Failed to Start HT20/40 timer"));
-        }
-    }
-    return;
-}
-
-/*==========================================================================
-  FUNCTION    sapCheckFor20MhzObss()
-
-  DESCRIPTION
-    Check 20 MHz Overlapping BSS
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    channelNumber : Peer BSS Operating Channel
-    tpSirProbeRespBeacon: Pointer to Beacon Struct
-    ptSapContext: Pointer to SAP Context
-
-  RETURN VALUE
-    v_U8_t          : Success - Found OBSS BSS, Fail - zero
-
-  SIDE EFFECTS
-============================================================================*/
-
-eHalStatus sapCheckFor20MhzObss(v_U8_t channelNumber,
-                            tpSirProbeRespBeacon  pBeaconStruct,
-                            ptSapContext psapCtx)
-{
-
-    v_U16_t secondaryChannelOffset;
-    eHalStatus halStatus = eHAL_STATUS_SUCCESS;
-
-    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-             FL("channelNumber: %d BSS: %s"), channelNumber,
-             pBeaconStruct->ssId.ssId);
-
-    if (channelNumber < psapCtx->affected_start
-      || channelNumber > psapCtx->affected_end)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                FL("channelNumber: %d out of Affetced Channel Range: [%d,%d]"),
-                channelNumber, psapCtx->affected_start,
-                psapCtx->affected_end);
-        return halStatus;
-    }
-
-    if (!pBeaconStruct->HTCaps.present)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("Found overlapping legacy BSS: %s on Channel : %d"),
-                   pBeaconStruct->ssId.ssId, channelNumber);
-        halStatus = eHAL_STATUS_FAILURE;
-        return halStatus;
-    }
-
-    if (pBeaconStruct->HTInfo.present)
-    {
-        secondaryChannelOffset = pBeaconStruct->HTInfo.secondaryChannelOffset;
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("BSS: %s secondaryChannelOffset: %d on Channel : %d"),
-                   pBeaconStruct->ssId.ssId, secondaryChannelOffset,
-                   channelNumber);
-        if (PHY_SINGLE_CHANNEL_CENTERED == secondaryChannelOffset)
-        {
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("Found overlapping 20 MHz HT BSS: %s on Channel : %d"),
-                   pBeaconStruct->ssId.ssId, channelNumber);
-            halStatus = eHAL_STATUS_FAILURE;
-            return halStatus;
-        }
-     }
-     return halStatus;
-}
-
-/*==========================================================================
-  FUNCTION    sapGetPrimarySecondaryChannelOfBss()
-
-  DESCRIPTION
-    Get Primary & Seconary Channel of Overlapping BSS
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    tpSirProbeRespBeacon: Pointer to Beacon Struct
-    pri_chan : Primary Operating Channel
-    sec_chan : Seconary Operating Channel
-
-  RETURN VALUE
-
-  SIDE EFFECTS
-============================================================================*/
-
-void sapGetPrimarySecondaryChannelOfBss(tpSirProbeRespBeacon pBeaconStruct,
-                                        v_U32_t *pri_chan, v_U32_t *sec_chan)
-{
-    v_U16_t secondaryChannelOffset;
-    *pri_chan = 0;
-    *sec_chan = 0;
-
-    if (pBeaconStruct->HTInfo.present)
-    {
-        *pri_chan = pBeaconStruct->HTInfo.primaryChannel;
-        secondaryChannelOffset = pBeaconStruct->HTInfo.secondaryChannelOffset;
-        if (PHY_DOUBLE_CHANNEL_LOW_PRIMARY == secondaryChannelOffset)
-            *sec_chan = *pri_chan + 4;
-        else if (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == secondaryChannelOffset)
-            *sec_chan = *pri_chan - 4;
-    }
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("BSS Primary & Secondary Channel : %d %d "),
-               *pri_chan, *sec_chan);
-}
-
-/*==========================================================================
-  FUNCTION    sapCheckHT40SecondaryIsNotAllowed()
-
-  DESCRIPTION
-    Check HT40 Channel Secondary is Allowed
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    ptSapContext: Pointer to SAP Context
-
-  RETURN VALUE
-    v_U8_t          : Success - HT40 Allowed in Selected Channale Pair
-                      Fail - HT40 Not Allowed
-
-  SIDE EFFECTS
-============================================================================*/
-
-eHalStatus sapCheckHT40SecondaryIsNotAllowed(ptSapContext psapCtx)
-{
-    v_U8_t count;
-    v_U8_t fValidChannel = 0;
-    eHalStatus halStatus = eHAL_STATUS_SUCCESS;
-#ifdef FEATURE_WLAN_CH_AVOID
-    int i;
-    v_U16_t unsafeChannelList[NUM_20MHZ_RF_CHANNELS];
-    v_U16_t unsafeChannelCount;
-#endif /* FEATURE_WLAN_CH_AVOID */
-
-    /* Verify that HT40 secondary channel is an allowed 20 MHz
-     * channel */
-    for (count = RF_CHAN_1; count <= RF_CHAN_14; count++)
-    {
-        if ((regChannels[count].enabled)
-         && (rfChannels[count].channelNum == psapCtx->sap_sec_chan))
-        {
-            fValidChannel = TRUE;
-            break;
-        }
-    }
-
-#ifdef FEATURE_WLAN_CH_AVOID
-    /* Get unsafe cahnnel list from cached location */
-    vos_get_wlan_unsafe_channel(unsafeChannelList,
-                                  sizeof(unsafeChannelList),
-                                  &unsafeChannelCount);
-
-    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-        FL("Unsafe Channel count %d"
-           " SAP Secondary Channel: %d"),
-           unsafeChannelCount, psapCtx->sap_sec_chan);
-
-    for (i = 0; i < unsafeChannelCount; i++)
-    {
-        if ((psapCtx->sap_sec_chan == unsafeChannelList[i]))
-        {
-            VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                FL("Unsafe Channel %d SAP Secondary Channel: %d"),
-                    unsafeChannelList[i], psapCtx->sap_sec_chan);
-            fValidChannel = FALSE;
-            break;
-        }
-    }
-#endif /* FEATURE_WLAN_CH_AVOID */
-
-    if (!fValidChannel)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("HT40 In Secondary Channel : %d not allowed"),
-                   psapCtx->sap_sec_chan);
-
-        halStatus = eHAL_STATUS_FAILURE;
-        return halStatus;
-    }
-
-    return halStatus;
-}
-
-/*==========================================================================
-  FUNCTION    sapGet24GOBSSAffectedChannel()
-
-  DESCRIPTION
-    Get OBSS Affected Channel Range
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    tHalHandle  : tHalHandle passed in with Affected Channel
-    ptSapContext: Pointer to SAP Context
-
-  RETURN VALUE
-    v_U8_t          : Success - Able to get AffectedChannel
-                      Fail - Fail to get AffectedChannel
-
-  SIDE EFFECTS
-============================================================================*/
-
-eHalStatus sapGet24GOBSSAffectedChannel(tHalHandle halHandle,
-                                          ptSapContext psapCtx)
-{
-
-    v_U8_t cbMode;
-    v_U32_t pri_freq, sec_freq;
-    v_U32_t affected_start_freq, affected_end_freq;
-    eSapPhyMode sapPhyMode;
-    eHalStatus halStatus;
-
-    pri_freq = vos_chan_to_freq(psapCtx->channel);
-
-    sapPhyMode =
-     sapConvertSapPhyModeToCsrPhyMode(psapCtx->csrRoamProfile.phyMode);
-
-    sme_SelectCBMode(halHandle, sapPhyMode, psapCtx->channel);
-
-    cbMode = sme_GetChannelBondingMode24G(halHandle);
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("Selected Channel bonding : %d"), cbMode);
-
-    if (cbMode == eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY)
-        sec_freq = pri_freq - 20;
-    else if (cbMode == eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY)
-        sec_freq = pri_freq + 20;
-    else
-        sec_freq = eCSR_INI_SINGLE_CHANNEL_CENTERED;
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("Primary Freq : %d MHz Secondary Freq : %d MHz"),
-               pri_freq, sec_freq);
-
-    if (sec_freq)
-    {
-        /* As per 802.11 Std, Section 10.15.3.2 */
-        affected_start_freq = (pri_freq + sec_freq) / 2 - 25;
-        affected_end_freq = (pri_freq + sec_freq) / 2 + 25;
-
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                FL("Affected Start Freq: %d MHz Affected End Freq : %d MHz"),
-                affected_start_freq, affected_end_freq);
-
-        psapCtx->affected_start = vos_freq_to_chan(affected_start_freq);
-
-        /* As there is no channel availabe for 2397 & 2402 Frequency
-         * Hence taking valid channel 1 (Freq 2412) here
-         */
-        if (affected_start_freq < 2412)
-            psapCtx->affected_start = 1;
-
-        psapCtx->affected_end = vos_freq_to_chan(affected_end_freq);
-
-        /* As there is no channel availabe for 2477 & 2482 Frequency
-         * Hence taking lower channel 13 (Freq 2472) here.
-         */
-        if ((2477 == (affected_end_freq)) || (2482 == affected_end_freq))
-        {
-            psapCtx->affected_end = 13;
-        }
-        else if (2487 == affected_end_freq)
-        {
-           /* As there is no channel availabe for 2487 Frequency
-            * Hence taking lower channel 14 (Freq 2484) here.
-            */
-            psapCtx->affected_end = 14;
-        }
-
-        psapCtx->sap_sec_chan = vos_freq_to_chan(sec_freq);
-
-        halStatus = eHAL_STATUS_SUCCESS;
-        return halStatus;
-    }
-    else
-    {
-        psapCtx->affected_start = 0;
-        psapCtx->affected_end = 0;
-        psapCtx->sap_sec_chan = 0;
-        halStatus = eHAL_STATUS_FAILURE;
-        return halStatus;
-    }
-}
-
-/*==========================================================================
-  FUNCTION    sapCheck40Mhz24G
-
-  DESCRIPTION
-  Check HT40 is possible in 2.4GHz mode
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    halHandle       : Pointer to HAL handle
-    ptSapContext    : Pointer to SAP Context
-    pResult         : Pointer to tScanResultHandle
-
-  RETURN VALUE
-    v_U8_t          : Success - HT40 Possible, Fail - zero
-
-  SIDE EFFECTS
-============================================================================*/
-
-eHalStatus sapCheck40Mhz24G(tHalHandle halHandle, ptSapContext psapCtx,
-                                         tScanResultHandle pResult)
-{
-    v_U32_t pri_chan, sec_chan;
-    v_U32_t ieLen = 0;
-    v_U8_t channelNumber = 0;
-    tSirProbeRespBeacon *pBeaconStruct;
-    tCsrScanResultInfo *pScanResult;
-    tpAniSirGlobal  pMac = (tpAniSirGlobal) halHandle;
-    eHalStatus halStatus = eHAL_STATUS_FAILURE;
-
-    if ( (0 == psapCtx->affected_start) && (0 == psapCtx->affected_end)
-       && (0 == psapCtx->sap_sec_chan))
-    {
-        if (eHAL_STATUS_SUCCESS !=
-                 sapGet24GOBSSAffectedChannel(halHandle, psapCtx))
-        {
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                FL("Failed to get OBSS Affected Channel Range for Channel: %d"),
-                                psapCtx->channel);
-            return halStatus;
-        }
-    }
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("40 MHz affected channel range: [%d,%d] MHz"),
-               psapCtx->affected_start, psapCtx->affected_end);
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("SAP Primary & Secondary Channel : [%d,%d] MHz"),
-               psapCtx->channel, psapCtx->sap_sec_chan);
-
-    pBeaconStruct = vos_mem_malloc(sizeof(tSirProbeRespBeacon));
-    if ( NULL == pBeaconStruct )
-    {
-        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                   FL("Unable to allocate memory "));
-        return halStatus;
-    }
-
-    /* Check neighboring BSSes from scan result to see whether 40 MHz is
-     * allowed per IEEE Std 802.11-2012, 10.15.3.2 */
-    pScanResult = sme_ScanResultGetFirst(halHandle, pResult);
-
-    while (pScanResult)
-    {
-
-        /* if the Beacon has channel ID, use it other wise we will
-         * rely on the channelIdSelf
-         */
-        if(pScanResult->BssDescriptor.channelId == 0)
-            channelNumber = pScanResult->BssDescriptor.channelIdSelf;
-        else
-            channelNumber = pScanResult->BssDescriptor.channelId;
-
-        if (channelNumber > SIR_11B_CHANNEL_END)
-        {
-            VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("channelNumber: %d BSS: %s"),
-                   channelNumber,  pBeaconStruct->ssId.ssId);
-            goto NextResult;
-        }
-
-        if ((pScanResult->BssDescriptor.ieFields != NULL))
-        {
-            ieLen = (pScanResult->BssDescriptor.length + sizeof(tANI_U16));
-            ieLen += (sizeof(tANI_U32) - sizeof(tSirBssDescription));
-            vos_mem_set((tANI_U8 *) pBeaconStruct,
-                               sizeof(tSirProbeRespBeacon), 0);
-
-            if ((eSIR_SUCCESS == sirParseBeaconIE(pMac, pBeaconStruct,
-                     (tANI_U8 *)( pScanResult->BssDescriptor.ieFields), ieLen)))
-            {
-                /* Check Peer BSS is HT20 or Legacy AP */
-                if (eHAL_STATUS_SUCCESS !=
-                          sapCheckFor20MhzObss(channelNumber, pBeaconStruct,
-                                                                    psapCtx))
-                {
-                    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                              FL("Overlapping 20 MHz BSS is found"));
-                    vos_mem_free(pBeaconStruct);
-                    return halStatus;
-                }
-
-                sapGetPrimarySecondaryChannelOfBss(pBeaconStruct,
-                                                &pri_chan, &sec_chan);
-
-                /* Check peer BSS Operating channel is not within OBSS affected
-                 * channel range
-                 */
-                if ((pri_chan < psapCtx->affected_start
-                    || pri_chan > psapCtx->affected_end)
-                   && (sec_chan < psapCtx->affected_start
-                    || sec_chan > psapCtx->affected_end))
-                {
-                    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                     FL("Peer BSS: %s Primary & Secondary Channel [%d %d]"
-                        "is out of affected Range: [%d %d]"),
-                     pBeaconStruct->ssId.ssId, pri_chan, sec_chan,
-                     psapCtx->affected_start, psapCtx->affected_end);
-                    goto NextResult; /* not within affected channel range */
-                }
-
-                VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                 FL("Neighboring BSS: %s Primary & Secondary Channel [%d %d]"),
-                 pBeaconStruct->ssId.ssId, pri_chan, sec_chan);
-
-                if (sec_chan)
-                {
-                    /* Peer BSS is HT40 capable then check peer BSS
-                     * primary & secondary channel with SAP
-                     * Primary & Secondary channel.
-                     */
-                    if ((psapCtx->channel !=  pri_chan)
-                       || (psapCtx->sap_sec_chan != sec_chan))
-                    {
-                        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                                  FL("40 MHz Pri/Sec channel : [%d %d]"
-                                  " missmatch with  BSS: %s"
-                                  " Pri/Sec channel : [%d %d]"),
-                                  psapCtx->channel, psapCtx->sap_sec_chan,
-                                  pBeaconStruct->ssId.ssId, pri_chan, sec_chan);
-                         vos_mem_free(pBeaconStruct);
-                         return halStatus;
-                    }
-                }
-
-                if (pBeaconStruct->HTCaps.present)
-                {
-                    /* Check Peer BSS HT capablity has 40MHz Intolerant bit */
-                    if (pBeaconStruct->HTCaps.stbcControlFrame)
-                    {
-                        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                                      FL("Found BSS: %s with 40 MHz"
-                                      "Intolerant is set on Channel : %d"),
-                                      pBeaconStruct->ssId.ssId,
-                                      channelNumber);
-                        vos_mem_free(pBeaconStruct);
-                        return halStatus;
-                    }
-                }
-            }
-            else
-            {
-                VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                          FL("Failed to Parse the Beacon IEs"));
-            }
-        }
-        else
-        {
-            VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                       FL("BSS IEs Failed is NULL in Scan"));
-        }
-
-NextResult:
-        pScanResult = sme_ScanResultGetNext(halHandle, pResult);
-    }
-    vos_mem_free(pBeaconStruct);
-
-    if (psapCtx->sap_sec_chan)
-    {
-        if (eHAL_STATUS_SUCCESS == sapCheckHT40SecondaryIsNotAllowed(psapCtx))
-        {
-            VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                       FL("Start SAP/P2P GO in HT 40MHz "
-                       "Primary & Secondary Channel: [%d %d]"),
-                       psapCtx->channel, psapCtx->sap_sec_chan);
-            halStatus = eHAL_STATUS_SUCCESS;
-            return halStatus;
-        }
-    }
-
-    return halStatus;
-}
-#endif
-
-/*==========================================================================
   FUNCTION    WLANSAP_ScanCallback()
 
-  DESCRIPTION
-    Callback for Scan (scan results) Events
+  DESCRIPTION 
+    Callback for Scan (scan results) Events  
 
-  DEPENDENCIES
-    NA.
+  DEPENDENCIES 
+    NA. 
 
-  PARAMETERS
+  PARAMETERS 
 
     IN
     tHalHandle  : tHalHandle passed in with the scan request
     *pContext   : The second context pass in for the caller (sapContext)
     scanID      : scanID got after the scan
     status      : Status of scan -success, failure or abort
-
+   
   RETURN VALUE
-    The eHalStatus code associated with performing the operation
+    The eHalStatus code associated with performing the operation  
 
     eHAL_STATUS_SUCCESS: Success
-
-  SIDE EFFECTS
+  
+  SIDE EFFECTS 
 ============================================================================*/
 eHalStatus
 WLANSAP_ScanCallback
 (
-  tHalHandle halHandle,
+  tHalHandle halHandle, 
   void *pContext,           /* Opaque SAP handle */
-  v_U32_t scanID,
+  v_U32_t scanID, 
   eCsrScanStatus scanStatus
 )
 {
@@ -1015,9 +143,9 @@
     void *pTempHddCtx;
     tWLAN_SAPEvent sapEvent; /* State machine event */
     v_U8_t operChannel = 0;
+    v_U8_t i = 0;
     VOS_STATUS sapstatus;
     v_U32_t event;
-    eSapPhyMode sapPhyMode;
 
     /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
@@ -1030,87 +158,95 @@
         return eHAL_STATUS_FAILURE;
     }
 
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-         "In %s, before switch on scanStatus = %d", __func__, scanStatus);
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before switch on scanStatus = %d", __func__, scanStatus);
 
-    switch (scanStatus)
+    switch (scanStatus) 
     {
         case eCSR_SCAN_SUCCESS:
             // sapScanCompleteCallback with eCSR_SCAN_SUCCESS
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-               "In %s, CSR scanStatus = %s (%d)", __func__,
-               "eCSR_SCAN_SUCCESS", scanStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR scanStatus = %s (%d)", __func__, "eCSR_SCAN_SUCCESS", scanStatus);
 
-            /* Get scan results, Run channel selection algorithm,
-             * select channel and keep in pSapContext->Channel
-             */
-            scanGetResultStatus = sme_ScanGetResult(halHandle, 0, NULL,
-                                                               &pResult);
+            // Get scan results, Run channel selection algorithm, select channel and keep in pSapContext->Channel
+            scanGetResultStatus = sme_ScanGetResult(halHandle, 0, NULL, &pResult);
 
             event = eSAP_MAC_SCAN_COMPLETE;
 
-            if ((scanGetResultStatus != eHAL_STATUS_SUCCESS)
-               && (scanGetResultStatus != eHAL_STATUS_E_NULL_VALUE))
+            if ((scanGetResultStatus != eHAL_STATUS_SUCCESS)&& (scanGetResultStatus != eHAL_STATUS_E_NULL_VALUE))
             {
                 // No scan results
-                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                     "In %s, Get scan result failed! ret = %d",
+                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, Get scan result failed! ret = %d",
                                 __func__, scanGetResultStatus);
-                sapSetOperatingChannel(psapContext, operChannel);
                 break;
             }
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-            if (psapContext->channel == AUTO_CHANNEL_SELECT)
-#endif
-            {
-                operChannel = sapSelectChannel(halHandle, psapContext, pResult);
-                sapSetOperatingChannel(psapContext, operChannel);
-            }
+            operChannel = sapSelectChannel(halHandle, psapContext, pResult);
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-            if ((psapContext->channel <= SIR_11B_CHANNEL_END)
-               && (psapContext->channel > 0))
-            {
-                if (eHAL_STATUS_SUCCESS !=
-                         sapCheck40Mhz24G(halHandle, psapContext, pResult))
-                {
-                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                               FL("Starting SAP into HT20"));
-                    /* Disable Channel Bonding for 2.4GHz */
-                    sme_UpdateChannelBondingMode24G(halHandle,
-                                          PHY_SINGLE_CHANNEL_CENTERED);
-                }
-             }
-#endif
             sme_ScanResultPurge(halHandle, pResult);
             break;
 
         default:
             event = eSAP_CHANNEL_SELECTION_FAILED;
-            if (psapContext->channel == AUTO_CHANNEL_SELECT)
-                sapSetOperatingChannel(psapContext, operChannel);
-#ifdef WLAN_FEATURE_AP_HT40_24G
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                            FL("Starting SAP into HT20"));
-            /* Disable Channel Bonding for 2.4GHz */
-            sme_UpdateChannelBondingMode24G(halHandle,
-                                   PHY_SINGLE_CHANNEL_CENTERED);
-#endif
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                 FL("CSR scanStatus = %s (%d)"),
-                 "eCSR_SCAN_ABORT/FAILURE", scanStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR scanStatus = %s (%d)", __func__, "eCSR_SCAN_ABORT/FAILURE", scanStatus);
     }
 
+    if (operChannel == SAP_CHANNEL_NOT_SELECTED)
+#ifdef SOFTAP_CHANNEL_RANGE
+    {
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+                "%s: No suitable channel selected", __func__);
 
-    sapPhyMode =
-     sapConvertSapPhyModeToCsrPhyMode(psapContext->csrRoamProfile.phyMode);
+        if ( eCSR_BAND_ALL ==  psapContext->scanBandPreference ||
+                psapContext->allBandScanned == eSAP_TRUE)
+        {
+            if(psapContext->channelList != NULL)
+            {
+                 psapContext->channel = SAP_DEFAULT_CHANNEL;
+                 for ( i = 0 ; i < psapContext->numofChannel ; i++)
+                 {
+                    if (NV_CHANNEL_ENABLE ==
+                        vos_nv_getChannelEnabledState(psapContext->channelList[i]))
+                    {
+                        psapContext->channel = psapContext->channelList[i];
+                        break;
+                    }
+                 }
+            }
+            else
+            {
+                /* if the channel list is empty then there is no valid channel in
+                   the selected sub-band so select default channel in the
+                   BAND(2.4GHz) as 2.4 channels are available in all the
+                   countries*/
+                   psapContext->channel = SAP_DEFAULT_CHANNEL;
+            }
+        }
+        else
+        {
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+                    "%s: Has scan band preference",
+                    __func__);
+            if (eCSR_BAND_24 == psapContext->currentPreferredBand)
+                psapContext->currentPreferredBand = eCSR_BAND_5G;
+            else
+                psapContext->currentPreferredBand = eCSR_BAND_24;
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    if (psapContext->channel > SIR_11B_CHANNEL_END)
+            psapContext->allBandScanned = eSAP_TRUE;
+            //go back to DISCONNECT state, scan next band
+            psapContext->sapsMachine = eSAP_DISCONNECTED;
+            event = eSAP_CHANNEL_SELECTION_FAILED;
+        }
+    }
+#else
+       psapContext->channel = SAP_DEFAULT_CHANNEL;
 #endif
-        sme_SelectCBMode(halHandle, sapPhyMode, psapContext->channel);
+    else
+    {
+      psapContext->channel = operChannel;
+    }
 
+    sme_SelectCBMode(halHandle,
+          sapConvertSapPhyModeToCsrPhyMode(psapContext->csrRoamProfile.phyMode),
+          psapContext->channel);
 #ifdef SOFTAP_CHANNEL_RANGE
     if(psapContext->channelList != NULL)
     {
@@ -1121,8 +257,7 @@
     }
 #endif    
 
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-           "In %s, Channel selected = %d", __func__, psapContext->channel);
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Channel selected = %d", __func__, psapContext->channel);
 
     /* Fill in the event structure */
     sapEvent.event = event;
@@ -1178,18 +313,13 @@
     VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
     eHalStatus halStatus = eHAL_STATUS_SUCCESS;
 
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                      FL("Before switch on roamStatus = %d"),
-                                 roamStatus);
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before switch on roamStatus = %d\n", __func__, roamStatus);
     switch(roamStatus)
     {
         case eCSR_ROAM_SESSION_OPENED:
         {
             /* tHalHandle */
             tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                           "eCSR_ROAM_SESSION_OPENED", roamStatus);
 
             if (NULL == hHal)
             {
@@ -1210,9 +340,8 @@
         }
 
         case eCSR_ROAM_INFRA_IND:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                           "eCSR_ROAM_INFRA_IND", roamStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                      __func__, "eCSR_ROAM_INFRA_IND", roamStatus);
             if(roamResult == eCSR_ROAM_RESULT_INFRA_START_FAILED)
             {
                 /* Fill in the event structure */ 
@@ -1231,21 +360,18 @@
             break;
 
         case eCSR_ROAM_LOSTLINK:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                        "eCSR_ROAM_LOSTLINK", roamStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                       __func__, "eCSR_ROAM_LOSTLINK", roamStatus);
             break;
 
         case eCSR_ROAM_MIC_ERROR_IND:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                        "eCSR_ROAM_MIC_ERROR_IND", roamStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                __func__, "eCSR_ROAM_MIC_ERROR_IND", roamStatus);
             break;
 
         case eCSR_ROAM_SET_KEY_COMPLETE:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                        "eCSR_ROAM_SET_KEY_COMPLETE", roamStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                __func__, "eCSR_ROAM_SET_KEY_COMPLETE", roamStatus);
             if (roamResult == eCSR_ROAM_RESULT_FAILURE )
             {
                 /* Format the SET KEY complete information pass to HDD... */
@@ -1254,9 +380,8 @@
             break;
 
         case eCSR_ROAM_REMOVE_KEY_COMPLETE:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                        "eCSR_ROAM_REMOVE_KEY_COMPLETE", roamStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                        __func__, "eCSR_ROAM_REMOVE_KEY_COMPLETE", roamStatus);
             if (roamResult == eCSR_ROAM_RESULT_FAILURE )
             {
                 /* Format the SET KEY complete information pass to HDD... */
@@ -1265,9 +390,8 @@
             break;
 
         case eCSR_ROAM_ASSOCIATION_COMPLETION:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                        "eCSR_ROAM_ASSOCIATION_COMPLETION", roamStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                       __func__, "eCSR_ROAM_ASSOCIATION_COMPLETION", roamStatus);
             if (roamResult == eCSR_ROAM_RESULT_FAILURE )
             {
                 /* Format the SET KEY complete information pass to HDD... */
@@ -1276,9 +400,8 @@
             break;
 
         case eCSR_ROAM_DISASSOCIATED:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                        "eCSR_ROAM_DISASSOCIATED", roamStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                       __func__, "eCSR_ROAM_DISASSOCIATED", roamStatus);
             if (roamResult == eCSR_ROAM_RESULT_MIC_FAILURE)
             {
                 /* Format the MIC failure event to return... */
@@ -1287,22 +410,21 @@
             break;
                         
         case eCSR_ROAM_WPS_PBC_PROBE_REQ_IND:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                        "eCSR_ROAM_WPS_PBC_PROBE_REQ_IND", roamStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)\n",
+                       __func__, "eCSR_ROAM_WPS_PBC_PROBE_REQ_IND", roamStatus);
             break;        
+
+        case eCSR_ROAM_INDICATE_MGMT_FRAME:
+            sapSignalHDDevent(sapContext, pCsrRoamInfo, 
+                              eSAP_INDICATE_MGMT_FRAME, 
+                              (v_PVOID_t) eSAP_STATUS_SUCCESS);
+            break;
         case eCSR_ROAM_REMAIN_CHAN_READY:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                        "eCSR_ROAM_REMAIN_CHAN_READY", roamStatus);
             sapSignalHDDevent(sapContext, pCsrRoamInfo, 
                               eSAP_REMAIN_CHAN_READY, 
                               (v_PVOID_t) eSAP_STATUS_SUCCESS);
             break;
         case eCSR_ROAM_SEND_ACTION_CNF:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                        "eCSR_ROAM_SEND_ACTION_CNF", roamStatus);
             sapSignalHDDevent(sapContext, pCsrRoamInfo, 
                             eSAP_SEND_ACTION_CNF, 
                             (v_PVOID_t)((eSapStatus)((roamResult == eCSR_ROAM_RESULT_NONE)
@@ -1310,48 +432,33 @@
             break;
 
        case eCSR_ROAM_DISCONNECT_ALL_P2P_CLIENTS:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                        "eCSR_ROAM_DISCONNECT_ALL_P2P_CLIENTS", roamStatus);
             sapSignalHDDevent(sapContext, pCsrRoamInfo, 
                             eSAP_DISCONNECT_ALL_P2P_CLIENT, 
                             (v_PVOID_t) eSAP_STATUS_SUCCESS );
             break;
             
        case eCSR_ROAM_SEND_P2P_STOP_BSS:
-           VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                             FL("Received stopbss"));
+           VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Received stopbss", __func__);
            sapSignalHDDevent(sapContext, pCsrRoamInfo, 
                             eSAP_MAC_TRIG_STOP_BSS_EVENT, 
                             (v_PVOID_t) eSAP_STATUS_SUCCESS );
         break;
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        case eCSR_ROAM_2040_COEX_INFO_IND:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                        FL("CSR roamStatus = %s (%d)"),
-                           "eCSR_ROAM_2040_COEX_INFO_IND",
-                           roamStatus);
-
-           sapCheckHT2040CoexAction(sapContext, pCsrRoamInfo->pSmeHT2040CoexInfoInd);
-           break;
-#endif
-
         default:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                         FL("CSR roamStatus not handled roamStatus = %s (%d)"),
-                         get_eRoamCmdStatus_str(roamStatus), roamStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, CSR roamStatus not handled roamStatus = %s (%d)\n",
+                       __func__, get_eRoamCmdStatus_str(roamStatus), roamStatus);
             break;
+
     }
 
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before switch on roamResult = %d\n",
+               __func__, roamResult);
 
     switch (roamResult)
     {
         case eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                         FL( "CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND",
-                              roamResult);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __func__, "eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND", roamResult);
             sapContext->nStaWPARSnReqIeLength = pCsrRoamInfo->rsnIELen;
              
             if(sapContext->nStaWPARSnReqIeLength)
@@ -1374,9 +481,8 @@
                 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
                 {
                    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                             FL("CSR roamResult = (%d) MAC ("
-                             MAC_ADDRESS_STR") fail"),
-                             roamResult,
+                             "In %s, CSR roamResult = (%d) MAC ("
+                             MAC_ADDRESS_STR") fail", __func__, roamResult,
                              MAC_ADDR_ARRAY(pCsrRoamInfo->peerMac));
                     halStatus = eHAL_STATUS_FAILURE;
                 }
@@ -1384,9 +490,8 @@
             else
             {
                 VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
-                          FL("CSR roamResult = (%d) MAC ("
-                          MAC_ADDRESS_STR") not allowed"),
-                          roamResult,
+                          "In %s, CSR roamResult = (%d) MAC ("
+                          MAC_ADDRESS_STR") not allowed", __func__, roamResult,
                           MAC_ADDR_ARRAY(pCsrRoamInfo->peerMac));
                 halStatus = eHAL_STATUS_FAILURE;
             } 
@@ -1394,10 +499,8 @@
             break;
 
         case eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                          FL("CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF",
-                              roamResult);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                        __func__, "eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF", roamResult);
 
             sapContext->nStaWPARSnReqIeLength = pCsrRoamInfo->rsnIELen;
             if (sapContext->nStaWPARSnReqIeLength)
@@ -1416,26 +519,11 @@
             {
                 halStatus = eHAL_STATUS_FAILURE;
             }
-#ifdef WLAN_FEATURE_AP_HT40_24G
-            else
-            {
-                if (pCsrRoamInfo->HT40MHzIntoEnabledSta)
-                {
-                    sapAddHT40IntolerantSta(sapContext, pCsrRoamInfo);
-                }
-            }
-#endif
             break;
 
-        case eCSR_ROAM_RESULT_DEAUTH_IND:
         case eCSR_ROAM_RESULT_DISASSOC_IND:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                          FL("CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_DISASSOC_IND",
-                              roamResult);
-#ifdef WLAN_FEATURE_AP_HT40_24G
-            sapRemoveHT40IntolerantSta(sapContext, pCsrRoamInfo);
-#endif
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                        __func__, "eCSR_ROAM_RESULT_DISASSOC_IND", roamResult);
             /* Fill in the event structure */
             vosStatus = sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_STA_DISASSOC_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
             if(!VOS_IS_STATUS_SUCCESS(vosStatus))
@@ -1444,11 +532,21 @@
             }
             break;
 
+        case eCSR_ROAM_RESULT_DEAUTH_IND:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __func__, "eCSR_ROAM_RESULT_DEAUTH_IND", roamResult);
+            /* Fill in the event structure */
+            //TODO: we will use the same event inorder to inform HDD to disassociate the station
+            vosStatus = sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_STA_DISASSOC_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
+            if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+            {
+                halStatus = eHAL_STATUS_FAILURE;
+            }
+            break;
+
         case eCSR_ROAM_RESULT_MIC_ERROR_GROUP:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                          FL("CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_MIC_ERROR_GROUP",
-                              roamResult);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                        __func__, "eCSR_ROAM_RESULT_MIC_ERROR_GROUP", roamResult);
             /* Fill in the event structure */
             //TODO: support for group key MIC failure event to be handled
             vosStatus = sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_STA_MIC_FAILURE_EVENT,(v_PVOID_t) NULL);
@@ -1459,10 +557,8 @@
             break;
 
         case eCSR_ROAM_RESULT_MIC_ERROR_UNICAST: 
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                          FL("CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_MIC_ERROR_UNICAST",
-                              roamResult);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __func__, "eCSR_ROAM_RESULT_MIC_ERROR_UNICAST", roamResult);
             /* Fill in the event structure */
             //TODO: support for unicast key MIC failure event to be handled
             vosStatus = sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_STA_MIC_FAILURE_EVENT,(v_PVOID_t) NULL);
@@ -1473,10 +569,8 @@
             break;
 
         case eCSR_ROAM_RESULT_AUTHENTICATED:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                          FL("CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_AUTHENTICATED",
-                              roamResult);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __func__, "eCSR_ROAM_RESULT_AUTHENTICATED", roamResult);
             /* Fill in the event structure */
             sapSignalHDDevent( sapContext, pCsrRoamInfo,eSAP_STA_SET_KEY_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
             if(!VOS_IS_STATUS_SUCCESS(vosStatus))
@@ -1486,19 +580,15 @@
             break;
 
         case eCSR_ROAM_RESULT_ASSOCIATED:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                          FL("CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_ASSOCIATED",
-                              roamResult);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __func__, "eCSR_ROAM_RESULT_ASSOCIATED", roamResult);
             /* Fill in the event structure */
             sapSignalHDDevent( sapContext, pCsrRoamInfo,eSAP_STA_REASSOC_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
             break;
 
         case eCSR_ROAM_RESULT_INFRA_STARTED:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                          FL("CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_INFRA_STARTED",
-                              roamResult);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __func__, "eCSR_ROAM_RESULT_INFRA_STARTED", roamResult);
             /* Fill in the event structure */ 
             sapEvent.event = eSAP_MAC_START_BSS_SUCCESS;
             sapEvent.params = pCsrRoamInfo;
@@ -1514,10 +604,8 @@
             break;
 
         case eCSR_ROAM_RESULT_INFRA_STOPPED:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                          FL("CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_INFRA_STOPPED",
-                              roamResult);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __func__, "eCSR_ROAM_RESULT_INFRA_STOPPED", roamResult);
             /* Fill in the event structure */ 
             sapEvent.event = eSAP_MAC_READY_FOR_CONNECTIONS;
             sapEvent.params = pCsrRoamInfo;
@@ -1533,10 +621,8 @@
             break;
 
         case eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                          FL("CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND",
-                              roamResult);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                        __func__, "eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND", roamResult);
             /* Fill in the event structure */
             //TODO: support for group key MIC failure event to be handled
             vosStatus = sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_WPS_PBC_PROBE_REQ_EVENT,(v_PVOID_t) NULL);
@@ -1547,23 +633,16 @@
             break;
 
         case eCSR_ROAM_RESULT_FORCED:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                          FL("CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_FORCED",
-                              roamResult);
-#ifdef WLAN_FEATURE_AP_HT40_24G
-            sapRemoveHT40IntolerantSta(sapContext, pCsrRoamInfo);
-#endif
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                       __func__, "eCSR_ROAM_RESULT_FORCED", roamResult);
             //This event can be used to inform hdd about user triggered disassoc event
             /* Fill in the event structure */
             sapSignalHDDevent( sapContext, pCsrRoamInfo, eSAP_STA_DISASSOC_EVENT, (v_PVOID_t)eSAP_STATUS_SUCCESS);
             break;
 
         case eCSR_ROAM_RESULT_NONE:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                          FL("CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_NONE",
-                              roamResult);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                    __func__, "eCSR_ROAM_RESULT_NONE", roamResult);
             //This event can be used to inform hdd about user triggered disassoc event
             /* Fill in the event structure */
             if ( roamStatus == eCSR_ROAM_SET_KEY_COMPLETE)
@@ -1577,10 +656,8 @@
             break;
 
         case eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                          FL("CSR roamResult = %s (%d)"),
-                             "eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED",
-                              roamResult);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)\n",
+                    __func__, "eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED", roamResult);
             /* Fill in the event structure */
             vosStatus = sapSignalHDDevent(sapContext, pCsrRoamInfo, eSAP_MAX_ASSOC_EXCEEDED, (v_PVOID_t)NULL);
             if(!VOS_IS_STATUS_SUCCESS(vosStatus))
@@ -1590,10 +667,8 @@
 
             break;
         default:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                          FL("CSR roamResult = %s (%d) not handled"),
-                             get_eCsrRoamResult_str(roamResult),
-                             roamResult);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, CSR roamResult = %s (%d) not handled\n",
+                       __func__,get_eCsrRoamResult_str(roamResult),roamResult);
             break;
     }
 
diff --git a/wlan/prima/CORE/SAP/src/sapChSelect.c b/wlan/prima/CORE/SAP/src/sapChSelect.c
index aa4c746..037ccfa 100644
--- a/wlan/prima/CORE/SAP/src/sapChSelect.c
+++ b/wlan/prima/CORE/SAP/src/sapChSelect.c
@@ -551,6 +551,8 @@
 
     if(countWeight > SOFTAP_COUNT_WEIGHT)
         countWeight = SOFTAP_COUNT_WEIGHT;
+    else if (countWeight < 0)
+        countWeight = 0;
 
     rssicountWeight =  rssiWeight + countWeight;      
 
@@ -1350,7 +1352,7 @@
     if ( NULL == pBeaconStruct )
     {
         VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                   "Unable to allocate memory in sapComputeSpectWeight");
+                   "Unable to allocate memory in sapComputeSpectWeight\n");
         return;
     }
     VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Computing spectral weight", __func__);
@@ -1628,7 +1630,7 @@
                 }
 
                 VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                   "In %s, bssdes.ch_self=%d, bssdes.ch_ID=%d, bssdes.rssi=%d, SpectCh.bssCount=%d, pScanResult=%p, ChannelWidth %d, secondaryChanOffset %d, center frequency %d ",
+                   "In %s, bssdes.ch_self=%d, bssdes.ch_ID=%d, bssdes.rssi=%d, SpectCh.bssCount=%d, pScanResult=%p, ChannelWidth %d, secondaryChanOffset %d, center frequency %d \n",
                   __func__, pScanResult->BssDescriptor.channelIdSelf, pScanResult->BssDescriptor.channelId, pScanResult->BssDescriptor.rssi, pSpectCh->bssCount, pScanResult,pSpectCh->channelWidth,secondaryChannelOffset,centerFreq);
                  pSpectCh++;
                  break;
@@ -1654,9 +1656,8 @@
 
         rssi = (v_S7_t)pSpectCh->rssiAgr;
 
-        pSpectCh->weight =
-         SAPDFS_NORMALISE_1000 * sapweightRssiCount(rssi, pSpectCh->bssCount);
-        pSpectCh->weight_copy = pSpectCh->weight;
+        pSpectCh->weight = SAPDFS_NORMALISE_1000 * sapweightRssiCount(rssi, pSpectCh->bssCount);
+
         //------ Debug Info ------
         VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
              "In %s, Chan=%d Weight= %d rssiAgr=%d bssCount=%d", __func__,
@@ -1806,7 +1807,7 @@
                best channel as the selected primary channel, update its
                weightage with the combined weight value */
             for (n=0; n<4; n++)
-                pSpectInfo[j+n].weight = ACS_WEIGHT_MAX * 4;
+                pSpectInfo[j+n].weight = ACS_WEIGHT_MAX;
 
             pSpectInfo[j+minIdx].weight = acsHT80Channels[i].weight;
         }
@@ -1814,13 +1815,13 @@
         {
             /* some channels does not exist in pSectInfo array,
                skip this channel and those in the same HT80 width*/
-            pSpectInfo[j].weight = ACS_WEIGHT_MAX * 4;
+            pSpectInfo[j].weight = ACS_WEIGHT_MAX;
             if ((pSpectInfo[j].chNum +4) == pSpectInfo[j+1].chNum)
-                pSpectInfo[j+1].weight = ACS_WEIGHT_MAX * 4;
+                pSpectInfo[j+1].weight = ACS_WEIGHT_MAX;
             if ((pSpectInfo[j].chNum +8) == pSpectInfo[j+2].chNum)
-                pSpectInfo[j+2].weight = ACS_WEIGHT_MAX * 4;
+                pSpectInfo[j+2].weight = ACS_WEIGHT_MAX;
             if ((pSpectInfo[j].chNum +12) == pSpectInfo[j+3].chNum)
-                pSpectInfo[j+3].weight = ACS_WEIGHT_MAX * 4;
+                pSpectInfo[j+3].weight = ACS_WEIGHT_MAX;
         }
     }
 
@@ -1829,7 +1830,7 @@
     {
         if ( CHANNEL_165 == pSpectInfo[j].chNum )
         {
-            pSpectInfo[j].weight = ACS_WEIGHT_MAX * 4;
+            pSpectInfo[j].weight = ACS_WEIGHT_MAX;
             break;
         }
     }
@@ -1898,14 +1899,14 @@
                     if (pSpectInfo[j].weight <= pSpectInfo[j+4].weight)
                     {
                         pSpectInfo[j].weight = tmpWeight1;
-                        pSpectInfo[j+4].weight = ACS_WEIGHT_MAX * 2;
-                        pSpectInfo[j+8].weight = ACS_WEIGHT_MAX * 2;
+                        pSpectInfo[j+4].weight = ACS_WEIGHT_MAX;
+                        pSpectInfo[j+8].weight = ACS_WEIGHT_MAX;
                     }
                     else
                     {
                         pSpectInfo[j+4].weight = tmpWeight1;
-                        pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
-                        pSpectInfo[j+8].weight = ACS_WEIGHT_MAX * 2;
+                        pSpectInfo[j].weight = ACS_WEIGHT_MAX;
+                        pSpectInfo[j+8].weight = ACS_WEIGHT_MAX;
                     }
                 }
                 else
@@ -1913,14 +1914,14 @@
                     if (pSpectInfo[j+4].weight <= pSpectInfo[j+8].weight)
                     {
                         pSpectInfo[j+4].weight = tmpWeight2;
-                        pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
-                        pSpectInfo[j+8].weight = ACS_WEIGHT_MAX * 2;
+                        pSpectInfo[j].weight = ACS_WEIGHT_MAX;
+                        pSpectInfo[j+8].weight = ACS_WEIGHT_MAX;
                     }
                     else
                     {
                         pSpectInfo[j+8].weight = tmpWeight2;
-                        pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
-                        pSpectInfo[j+4].weight = ACS_WEIGHT_MAX * 2;
+                        pSpectInfo[j].weight = ACS_WEIGHT_MAX;
+                        pSpectInfo[j+4].weight = ACS_WEIGHT_MAX;
                     }
                 }
             }
@@ -1930,17 +1931,17 @@
                 if (pSpectInfo[j].weight <= pSpectInfo[j+4].weight)
                 {
                     pSpectInfo[j].weight = tmpWeight1;
-                    pSpectInfo[j+4].weight = ACS_WEIGHT_MAX * 2;
+                    pSpectInfo[j+4].weight = ACS_WEIGHT_MAX;
                 }
                 else
                 {
                     pSpectInfo[j+4].weight = tmpWeight1;
-                    pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
+                    pSpectInfo[j].weight = ACS_WEIGHT_MAX;
                 }
             }
         }
         else
-            pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
+            pSpectInfo[j].weight = ACS_WEIGHT_MAX;
     }
 
     sapSortChlWeight(pSpectInfoParams);
@@ -1995,19 +1996,19 @@
                 pSpectInfo[j].weight = acsHT40Channels5G[i].weight;
                 /* mark the adjacent channel's weight as max value so
                    that it will be sorted to the bottom */
-                pSpectInfo[j+1].weight = ACS_WEIGHT_MAX * 2;
+                pSpectInfo[j+1].weight = ACS_WEIGHT_MAX;
             }
             else
             {
                 pSpectInfo[j+1].weight = acsHT40Channels5G[i].weight;
                 /* mark the adjacent channel's weight as max value so
                    that it will be sorted to the bottom */
-                pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
+                pSpectInfo[j].weight = ACS_WEIGHT_MAX;
             }
 
         }
         else
-           pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
+           pSpectInfo[j].weight = ACS_WEIGHT_MAX;
     }
 
     /* avoid channel 165 by setting its weight to max */
@@ -2016,7 +2017,7 @@
     {
         if ( CHANNEL_165  == pSpectInfo[j].chNum )
         {
-            pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
+            pSpectInfo[j].weight = ACS_WEIGHT_MAX;
             break;
         }
     }
@@ -2124,11 +2125,9 @@
     v_U32_t cbMode;
     eChannelWidthInfo chWidth = CHWIDTH_HT20;
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
     if (eSAP_RF_SUBBAND_2_4_GHZ == operatingBand)
         cbMode = sme_GetChannelBondingMode24G(halHandle);
     else
-#endif
         cbMode = sme_GetChannelBondingMode5G(halHandle);
 
     if (phyMode == eSAP_DOT11_MODE_11n ||
@@ -2187,6 +2186,13 @@
 #endif
     VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, Running SAP Ch Select", __func__);
 
+    if (NULL == pScanResult)
+    {
+        //scan is successfull, but no AP is present, select the first channel is channel range
+        ccmCfgGetInt( halHandle, WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL, &startChannelNum);
+        return startChannelNum;
+    }
+
     // Initialize the structure pointed by pSpectInfoParams
     if(sapChanSelInit( halHandle, pSpectInfoParams) != eSAP_TRUE ) {
         VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, Ch Select initialization failed", __func__);
@@ -2255,7 +2261,7 @@
                     continue;
                 }
 
-                if (pSpectInfoParams->pSpectCh[count].weight_copy >
+                if (pSpectInfoParams->pSpectCh[count].weight >
                         pSapCtx->acsBandSwitchThreshold)
                 {
                     /* the best channel exceeds the threshold
@@ -2274,7 +2280,7 @@
                     {
                         /* all bands are scanned, compare current best channel
                            with channel scanned previously */
-                        if ( pSpectInfoParams->pSpectCh[count].weight_copy >
+                        if ( pSpectInfoParams->pSpectCh[count].weight >
                                 pSapCtx->acsBestChannelInfo.weight)
                         {
                             /* previous stored channel is better */
@@ -2284,7 +2290,7 @@
                         {
                             pSapCtx->acsBestChannelInfo.channelNum = bestChNum;
                             pSapCtx->acsBestChannelInfo.weight =
-                                pSpectInfoParams->pSpectCh[count].weight_copy;
+                                pSpectInfoParams->pSpectCh[count].weight;
                         }
                     }
                 }
@@ -2297,7 +2303,7 @@
                     if(((pSpectInfoParams->pSpectCh[count].chNum == CHANNEL_1) ||
                                 (pSpectInfoParams->pSpectCh[count].chNum == CHANNEL_6) ||
                                 (pSpectInfoParams->pSpectCh[count].chNum == CHANNEL_11))&&
-                            (pSpectInfoParams->pSpectCh[count].weight_copy ==
+                            (pSpectInfoParams->pSpectCh[count].weight ==
                              pSapCtx->acsBestChannelInfo.weight))
                     {
                         tmpChNum = pSpectInfoParams->pSpectCh[count].chNum;
diff --git a/wlan/prima/CORE/SAP/src/sapChSelect.h b/wlan/prima/CORE/SAP/src/sapChSelect.h
index eb74218..1f6ff4e 100644
--- a/wlan/prima/CORE/SAP/src/sapChSelect.h
+++ b/wlan/prima/CORE/SAP/src/sapChSelect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -44,6 +44,9 @@
   Are listed for each API below. 
   
   
+  Copyright (c) 2010 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
@@ -84,10 +87,8 @@
 #define SOFTAP_RSSI_WEIGHT      (20)
 #define SOFTAP_COUNT_WEIGHT     (20)
 
-#define SAP_DEFAULT_24GHZ_CHANNEL     (6)
-#define SAP_DEFAULT_LOW_5GHZ_CHANNEL      (40)
-#define SAP_DEFAULT_MID_5GHZ_CHANNEL      (100)
-#define SAP_DEFAULT_HIGH_5GHZ_CHANNEL      (149)
+#define SAP_DEFAULT_CHANNEL     (6)
+#define SAP_DEFAULT_5GHZ_CHANNEL      (40)
 #define SAP_CHANNEL_NOT_SELECTED (0)
 
 #define SOFTAP_HT20_CHANNELWIDTH 0
@@ -131,7 +132,6 @@
     v_U16_t bssCount;   // bss found in scanresult for this channel
     v_S31_t rssiAgr;    // Max value of rssi among all BSS(es) from scanresult for this channel
     v_U32_t weight;     // Weightage of this channel
-    v_U32_t weight_copy; //copy of the orignal weight
     v_BOOL_t valid;     // Is this a valid center frequency for regulatory domain
 } tSapSpectChInfo;//tDfsSpectChInfo;
 
diff --git a/wlan/prima/CORE/SAP/src/sapFsm.c b/wlan/prima/CORE/SAP/src/sapFsm.c
index 4ebbae5..403cc2a 100644
--- a/wlan/prima/CORE/SAP/src/sapFsm.c
+++ b/wlan/prima/CORE/SAP/src/sapFsm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,6 +39,9 @@
   Are listed for each API below.
 
 
+  Copyright (c) 2010 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
@@ -62,10 +65,6 @@
  * Include Files
  * -------------------------------------------------------------------------*/
 #include "sapInternal.h"
-#ifdef WLAN_FEATURE_AP_HT40_24G
-#include "csrInsideApi.h"
-#include "cfgApi.h"
-#endif
 // Pick up the SME API definitions
 #include "sme_Api.h"
 // Pick up the PMC API definitions
@@ -101,13 +100,6 @@
 static VOS_STATUS sapGetChannelList(ptSapContext sapContext, v_U8_t **channelList,
                                  v_U8_t  *numberOfChannels);
 #endif
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-static VOS_STATUS sapGetChannelListForObss(tHalHandle halHandle,
-                       ptSapContext psapCtx, v_U8_t **channelList,
-                       v_U8_t *numberOfChannels);
-#endif
-
 /*----------------------------------------------------------------------------
  * Externalized Function Definitions
 * -------------------------------------------------------------------------*/
@@ -144,80 +136,6 @@
    sapEvent->u2 = 0;
 }
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-/*==========================================================================
-  FUNCTION    sapSetObssParm
-
-  DESCRIPTION
-    Function for Setting OBSS Scan interval & OBSS TRANS_DELAY_FACTOR
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    sapContext  : Sap Context value
-
-  RETURN VALUE
-    The VOS_STATUS code associated with performing the operation
-
-    VOS_STATUS_SUCCESS: Success
-
-  SIDE EFFECTS
-============================================================================*/
-void sapSetObssParm(ptSapContext sapContext)
-{
-    tHalHandle hHal;
-    tpAniSirGlobal pMac;
-    tANI_U32 cfgValue;
-
-    /* tHalHandle */
-    hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
-
-    if (NULL == hHal)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                   FL("Invalid hHal"));
-        return;
-    }
-
-    pMac = PMAC_STRUCT( hHal );
-
-    if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
-                       &cfgValue) != eSIR_SUCCESS)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                FL("Fail to retrieve"
-                "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
-       return;
-    }
-
-    sapContext->ObssScanInterval = cfgValue;
-
-    if (wlan_cfgGetInt(pMac,
-          WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR,
-                       &cfgValue) != eSIR_SUCCESS)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-              FL("Fail to retrieve"
-              "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
-       return;
-    }
-
-    sapContext->ObssTransitionDelayFactor = cfgValue;
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("ObssScanInterval: %d"
-                 " ObssTransitionDelayFactor: %d"),
-               sapContext->ObssScanInterval,
-               sapContext->ObssTransitionDelayFactor);
-
-    return;
-}
-#endif
-
-
 /*==========================================================================
   FUNCTION    sapGotoChannelSel
 
@@ -252,7 +170,6 @@
     tCsrScanRequest scanRequest;/* To be initialised if scan is required */
     v_U32_t    scanRequestID = 0;
     VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
-    eSapPhyMode sapPhyMode;
 
 #ifdef SOFTAP_CHANNEL_RANGE
     v_U8_t     *channelList = NULL;
@@ -260,7 +177,6 @@
 #endif
     tHalHandle hHal;
     tANI_U8   channel;
-    uint32_t operating_band = 0;
 
     hHal = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME, sapContext->pvosGCtx);
     if (NULL == hHal)
@@ -271,9 +187,6 @@
         return VOS_STATUS_E_FAULT;
     }
 
-    sapPhyMode =
-      sapConvertSapPhyModeToCsrPhyMode(sapContext->csrRoamProfile.phyMode);
-
     /*If STA-AP concurrency is enabled take the concurrent connected channel first. In other cases wpa_supplicant should take care */
     if (vos_get_concurrency_mode() == VOS_STA_SAP)
     {
@@ -283,10 +196,9 @@
         { /*if a valid channel is returned then use concurrent channel.
                   Else take whatever comes from configuartion*/
             sapContext->channel = channel;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-            if (sapContext->channel > SIR_11B_CHANNEL_END)
-#endif
-                sme_SelectCBMode(hHal, sapPhyMode, sapContext->channel);
+            sme_SelectCBMode(hHal,
+                             sapConvertSapPhyModeToCsrPhyMode(sapContext->csrRoamProfile.phyMode),
+                             channel);
         }
     }
 
@@ -330,8 +242,7 @@
 #endif
         /* Set requestType to Full scan */
 
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                   FL("Auto Channel Selection Scan"));
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, calling sme_ScanRequest", __func__);
 
         halStatus = sme_ScanRequest(hHal,
                             0,//Not used in csrScanRequest
@@ -341,41 +252,10 @@
                             sapContext);//void * pContext scanRequestID filled up
         if (eHAL_STATUS_SUCCESS != halStatus)
         {
-            VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                  FL("Auto Channel Selection Scan  fail %d!!!"), halStatus);
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                  FL("SoftAP Configuring for default channel, Ch= %d"),
-                  sapContext->channel);
-            /*
-             * In case of error, select channel based on band
-             * configured in .ini
-             */
-            ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND,
-                         &operating_band);
-            if (operating_band == eSAP_RF_SUBBAND_5_LOW_GHZ ||
-                operating_band == eSAP_RF_SUBBAND_5_MID_GHZ ||
-                operating_band == eSAP_RF_SUBBAND_5_HIGH_GHZ)
-            {
-                VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                          FL("Default channel selection from band %d"),
-                          operating_band);
-
-                (operating_band == eSAP_RF_SUBBAND_5_LOW_GHZ) ?
-                        (sapContext->channel = SAP_DEFAULT_LOW_5GHZ_CHANNEL) :
-                (operating_band == eSAP_RF_SUBBAND_5_MID_GHZ) ?
-                        (sapContext->channel = SAP_DEFAULT_MID_5GHZ_CHANNEL) :
-                (operating_band == eSAP_RF_SUBBAND_5_HIGH_GHZ) ?
-                        (sapContext->channel =
-                                     SAP_DEFAULT_HIGH_5GHZ_CHANNEL) : 0;
-
-                VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                          FL("channel selected to start bss %d"),
-                          sapContext->channel);
-            }
-            else
-            {
-                sapContext->channel = SAP_DEFAULT_24GHZ_CHANNEL;
-            }
+            VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "%s:sme_ScanRequest  fail %d!!!", __func__, halStatus);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "SoftAP Configuring for default channel, Ch= %d", sapContext->channel);
+            /* In case of error, switch to default channel */
+            sapContext->channel = SAP_DEFAULT_CHANNEL;
 
 #ifdef SOFTAP_CHANNEL_RANGE
             if(sapContext->channelList != NULL)
@@ -392,145 +272,24 @@
         }
         else
         {
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                  FL("Auto Channel Selection Scan Success"
-                     " scanRequestID=%d, Ch= %d"),
-                     scanRequestID, sapContext->channel);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, return from sme_ScanRequest, scanRequestID=%d, Ch= %d",
+                   __func__, scanRequestID, sapContext->channel);
         }
 
     }
     else
     {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-            FL("For configured channel, Ch= %d"), sapContext->channel);
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        if (vos_get_concurrency_mode() != VOS_STA_SAP)
-        {
-            if ((sapContext->channel <= SIR_11B_CHANNEL_END)
-              && (sapContext->channel > RF_CHAN_1))
-            {
-                // OBSS Scan for P2P GO/SAP where Auto Channel Selection is Disable
-                vosStatus = sapGetChannelListForObss(hHal, sapContext,
-                                                &channelList, &numOfChannels);
-                if (VOS_STATUS_SUCCESS == vosStatus && channelList != NULL)
-                {
-
-                    if (sapCheckHT40SecondaryIsNotAllowed(sapContext))
-                    {
-                        if(channelList != NULL)
-                        {
-                           vos_mem_free(channelList);
-                           channelList = NULL;
-                        }
-                        goto disable24GChannelBonding;
-                    }
-                    vos_mem_zero(&scanRequest, sizeof(scanRequest));
-
-                    /* Set scanType to Passive scan */
-                    scanRequest.scanType = eSIR_PASSIVE_SCAN;
-
-                    /* Set min and max channel time to zero */
-                    scanRequest.minChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME;
-                    scanRequest.maxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME;
-
-                    /* Set BSSType to default type */
-                    scanRequest.BSSType = eCSR_BSS_TYPE_ANY;
-
-                    /*Scan the channels in the list*/
-                    scanRequest.ChannelInfo.numOfChannels = numOfChannels;
-                    scanRequest.ChannelInfo.ChannelList = channelList;
-                    scanRequest.requestType = eCSR_SCAN_SOFTAP_CHANNEL_RANGE;
-                    sapContext->channelList = channelList;
-
-                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                         FL("OBSS Scan for SAP/P2P GO:  Ch= %d"),
-                         sapContext->channel);
-
-                    halStatus = sme_ScanRequest(hHal,
-                                    0,//Not used in csrScanRequest
-                                    &scanRequest,
-                                    &scanRequestID,//, when ID == 0 11D scan/active scan with callback, min-maxChntime set in csrScanRequest()?
-                                    &WLANSAP_ScanCallback,//csrScanCompleteCallback callback,
-                                    sapContext);//void * pContext scanRequestID filled up
-
-                    if (eHAL_STATUS_SUCCESS != halStatus)
-                    {
-                        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                                  FL("OBSS ScanRequest Fail %d!!!"),
-                                  halStatus);
-                        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                           FL("SoftAP Configuring for default channel, Ch= %d"),
-                           sapContext->channel);
-
-                        if(sapContext->channelList != NULL)
-                        {
-                           vos_mem_free(sapContext->channelList);
-                           sapContext->channelList = NULL;
-                        }
-                        goto disable24GChannelBonding;
-                    }
-                    else
-                    {
-                       VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                          FL("OBSS ScanRequest Success, scanRequestID=%d"
-                          " Ch= %d"), scanRequestID, sapContext->channel);
-                        goto startgo;
-                    }
-                }
-                else
-                {
-                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                      FL("Failed to Prepare the OBSS Scan channel list"));
-                    goto disable24GChannelBonding;
-                }
-disable24GChannelBonding:
-                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                  FL("Disable Channel Bonding"));
-                /* Disable Channel Bonding for 2.4GHz */
-                sme_UpdateChannelBondingMode24G(hHal,
-                                 PHY_SINGLE_CHANNEL_CENTERED);
-            }
-            else
-            {
-               VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                      FL("No concurrency & Channel: %d"),
-                      sapContext->channel);
-               goto selectChannelBonding;
-            }
-        }
-        else
-        {
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                  FL("With concurrency & Channel: %d"),
-                  sapContext->channel);
-            goto selectChannelBonding;
-        }
-#endif
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-selectChannelBonding:
-            if (sapContext->channel > SIR_11B_CHANNEL_END)
-#endif
-                sme_SelectCBMode(hHal, sapPhyMode, sapContext->channel);
-
-            /* Fill in the event structure */
-            // Eventhough scan was not done, means a user set channel was chosen
-            sapEventInit(sapEvent);
-            /* Handle event */
-            vosStatus = sapFsm(sapContext, sapEvent);
+        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, for configured channel, Ch= %d", __func__, sapContext->channel);
+        /* Fill in the event structure */
+        // Eventhough scan was not done, means a user set channel was chosen
+        sapEventInit(sapEvent);
+        /* Handle event */
+        vosStatus = sapFsm(sapContext, sapEvent);
     }
-#ifdef WLAN_FEATURE_AP_HT40_24G
-startgo:
-#endif
-    /* If scan failed, get default channel and advance state
-     * machine as success with default channel. Have to wait
-     * for the call back to be called to get the channel cannot
-     * advance state machine here as said above */
 
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-        FL("Before exiting sapGotoChannelSel channel=%d"),
-        sapContext->channel);
+    /* If scan failed, get default channel and advance state machine as success with default channel */
+    /* Have to wait for the call back to be called to get the channel cannot advance state machine here as said above */
+    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before exiting sapGotoChannelSel channel=%d", __func__, sapContext->channel);
 
     return VOS_STATUS_SUCCESS;
 }// sapGotoChannelSel
@@ -749,8 +508,8 @@
     /* Format the Start BSS Complete event to return... */
     if (NULL == sapContext->pfnSapEventCallback)
     {
-         VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-               FL("HDD Event callaback invalid"));
+         VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "%s: HDD Event"
+                " callaback invalid", __func__);
         return VOS_STATUS_E_INVAL;
     }
 
@@ -778,9 +537,8 @@
             }
             break;
        case eSAP_START_BSS_EVENT:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                       "eSAP_START_BSS_EVENT");
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                __func__, "eSAP_START_BSS_EVENT");
             sapApAppEvent.sapHddEventCode = eSAP_START_BSS_EVENT;
             sapApAppEvent.sapevt.sapStartBssCompleteEvent.status = (eSapStatus )context;
             if(pCsrRoamInfo != NULL ){
@@ -792,18 +550,16 @@
             break;
 
         case eSAP_STOP_BSS_EVENT:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_STOP_BSS_EVENT");
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                       __func__, "eSAP_STOP_BSS_EVENT");
             sapApAppEvent.sapHddEventCode = eSAP_STOP_BSS_EVENT;
             sapApAppEvent.sapevt.sapStopBssCompleteEvent.status = (eSapStatus )context;
             break;
 
         case eSAP_STA_ASSOC_EVENT:
         {
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_STA_ASSOC_EVENT");
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                __func__, "eSAP_STA_ASSOC_EVENT");
             if (pCsrRoamInfo->fReassocReq)
                 sapApAppEvent.sapHddEventCode = eSAP_STA_REASSOC_EVENT;
             else
@@ -827,8 +583,6 @@
                             pCsrRoamInfo->addIELen);
             }
 
-            sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.rate_flags = pCsrRoamInfo->maxRateFlags;
-
             sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.wmmEnabled = pCsrRoamInfo->wmmEnabledSta;
             sapApAppEvent.sapevt.sapStationAssocReassocCompleteEvent.status = (eSapStatus )context;
             //TODO: Need to fill sapAuthType
@@ -837,9 +591,8 @@
         }
 
         case eSAP_STA_DISASSOC_EVENT:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_STA_DISASSOC_EVENT");
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                       __func__, "eSAP_STA_DISASSOC_EVENT");
             sapApAppEvent.sapHddEventCode = eSAP_STA_DISASSOC_EVENT;
 
             vos_mem_copy( &sapApAppEvent.sapevt.sapStationDisassocCompleteEvent.staMac,
@@ -855,9 +608,8 @@
             break;
 
         case eSAP_STA_SET_KEY_EVENT:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_STA_SET_KEY_EVENT");
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                       __func__, "eSAP_STA_SET_KEY_EVENT");
             sapApAppEvent.sapHddEventCode = eSAP_STA_SET_KEY_EVENT;
             sapApAppEvent.sapevt.sapStationSetKeyCompleteEvent.status = (eSapStatus )context;
             vos_mem_copy(&sapApAppEvent.sapevt.sapStationSetKeyCompleteEvent.peerMacAddr,
@@ -865,9 +617,8 @@
             break;
 
         case eSAP_STA_DEL_KEY_EVENT :
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_STA_DEL_KEY_EVENT");
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                       __func__, "eSAP_STA_DEL_KEY_EVENT");
             sapApAppEvent.sapHddEventCode = eSAP_STA_DEL_KEY_EVENT;
             sapApAppEvent.sapevt.sapStationDeleteKeyCompleteEvent.status = (eSapStatus )context;
             //TODO: Should we need to send the key information
@@ -875,9 +626,8 @@
             break;
 
         case eSAP_STA_MIC_FAILURE_EVENT :
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_STA_MIC_FAILURE_EVENT");
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                        __func__, "eSAP_STA_MIC_FAILURE_EVENT");
             sapApAppEvent.sapHddEventCode = eSAP_STA_MIC_FAILURE_EVENT;
             vos_mem_copy( &sapApAppEvent.sapevt.sapStationMICFailureEvent.srcMacAddr,
                           pCsrRoamInfo->u.pMICFailureInfo->srcMacAddr,
@@ -897,47 +647,59 @@
             break;
 
         case eSAP_ASSOC_STA_CALLBACK_EVENT:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_ASSOC_STA_CALLBACK_EVENT");
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
+                       __func__, "eSAP_ASSOC_STA_CALLBACK_EVENT");
             break;
 
         case eSAP_WPS_PBC_PROBE_REQ_EVENT:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_WPS_PBC_PROBE_REQ_EVENT");
             sapApAppEvent.sapHddEventCode = eSAP_WPS_PBC_PROBE_REQ_EVENT;
 
             vos_mem_copy( &sapApAppEvent.sapevt.sapPBCProbeReqEvent.WPSPBCProbeReq,
                           pCsrRoamInfo->u.pWPSPBCProbeReq,
                           sizeof(tSirWPSPBCProbeReq));
             break;
+
+       case eSAP_INDICATE_MGMT_FRAME:
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+                                 "In %s, SAP event callback event = %s",
+                                __func__, "eSAP_INDICATE_MGMT_FRAME");
+            sapApAppEvent.sapHddEventCode = eSAP_INDICATE_MGMT_FRAME;
+            sapApAppEvent.sapevt.sapManagementFrameInfo.nFrameLength
+                                           = pCsrRoamInfo->nFrameLength;
+            sapApAppEvent.sapevt.sapManagementFrameInfo.pbFrames
+                                           = pCsrRoamInfo->pbFrames;
+            sapApAppEvent.sapevt.sapManagementFrameInfo.frameType
+                                           = pCsrRoamInfo->frameType;
+            sapApAppEvent.sapevt.sapManagementFrameInfo.rxChan
+                                           = pCsrRoamInfo->rxChan;
+
+            break;
        case eSAP_REMAIN_CHAN_READY:
             VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_REMAIN_CHAN_READY");
+                                 "In %s, SAP event callback event = %s",
+                                __func__, "eSAP_REMAIN_CHAN_READY");
            sapApAppEvent.sapHddEventCode = eSAP_REMAIN_CHAN_READY;
             break;
        case eSAP_SEND_ACTION_CNF:
             VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_SEND_ACTION_CNF");
+                                 "In %s, SAP event callback event = %s",
+                                __func__, "eSAP_SEND_ACTION_CNF");
             sapApAppEvent.sapHddEventCode = eSAP_SEND_ACTION_CNF;
             sapApAppEvent.sapevt.sapActionCnf.actionSendSuccess = (eSapStatus)context;
             break;
 
        case eSAP_DISCONNECT_ALL_P2P_CLIENT:
             VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_DISCONNECT_ALL_P2P_CLIENT");
+                             "In %s, SAP event callback event = %s",
+                            __func__, "eSAP_DISCONNECT_ALL_P2P_CLIENT");
             sapApAppEvent.sapHddEventCode = eSAP_DISCONNECT_ALL_P2P_CLIENT;
             sapApAppEvent.sapevt.sapActionCnf.actionSendSuccess = (eSapStatus)context;
             break;
 
        case eSAP_MAC_TRIG_STOP_BSS_EVENT :
             VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_MAC_TRIG_STOP_BSS_EVENT");
+                             "In %s, SAP event callback event = %s",
+                            __func__, "eSAP_MAC_TRIG_STOP_BSS_EVENT");
             sapApAppEvent.sapHddEventCode = eSAP_MAC_TRIG_STOP_BSS_EVENT;
             sapApAppEvent.sapevt.sapActionCnf.actionSendSuccess = (eSapStatus)context;
             break;
@@ -945,8 +707,8 @@
 
         case eSAP_UNKNOWN_STA_JOIN:
             VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_UNKNOWN_STA_JOIN");
+                       "In %s, SAP event callback event = %s",
+                       __func__, "eSAP_UNKNOWN_STA_JOIN");
             sapApAppEvent.sapHddEventCode = eSAP_UNKNOWN_STA_JOIN;
             vos_mem_copy((v_PVOID_t)sapApAppEvent.sapevt.sapUnknownSTAJoin.macaddr.bytes,
                          (v_PVOID_t)context, sizeof(v_MACADDR_t));
@@ -954,17 +716,16 @@
 
         case eSAP_MAX_ASSOC_EXCEEDED:
             VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
-                       FL("SAP event callback event = %s"),
-                          "eSAP_MAX_ASSOC_EXCEEDED");
+                    "In %s, SAP event callback event = %s",
+                    __func__, "eSAP_MAX_ASSOC_EXCEEDED");
             sapApAppEvent.sapHddEventCode = eSAP_MAX_ASSOC_EXCEEDED;
             vos_mem_copy((v_PVOID_t)sapApAppEvent.sapevt.sapMaxAssocExceeded.macaddr.bytes,
                     (v_PVOID_t)pCsrRoamInfo->peerMac, sizeof(v_MACADDR_t));
             break;
 
         default:
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                       FL("SAP Unknown callback event = %d"),
-                       sapHddevent);
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, SAP Unknown callback event = %d",
+                       __func__,sapHddevent);
             break;
     }
     vosStatus = (*sapContext->pfnSapEventCallback)
@@ -1037,9 +798,6 @@
                 /* Set SAP device role */
                 sapContext->sapsMachine = eSAP_CH_SELECT;
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-                sapSetObssParm(sapContext);
-#endif
                 /* Perform sme_ScanRequest */
                 vosStatus = sapGotoChannelSel(sapContext, sapEvent);
 
@@ -1092,23 +850,21 @@
                  /* Transition from eSAP_STARTING to eSAP_STARTED (both without substates) */
                  VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
                             __func__, "eSAP_STARTING", "eSAP_STARTED");
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-                /* Initialize the HT2040 timer */
-                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                           "In %s, Init HT20/40 timer", __func__);
-
-                vosStatus = vos_timer_init( &sapContext->sap_HT2040_timer,
-                                 VOS_TIMER_TYPE_SW, sap_ht2040_timer_cb,
-                                 (v_PVOID_t)sapContext );
-
-                if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                               "In %s, Failed to Init HT20/40 timer", __func__);
-#endif
              }
-             else if ((msg == eSAP_HDD_STOP_INFRA_BSS) ||
-                      (msg == eSAP_MAC_START_FAILS))
+             else if (msg == eSAP_MAC_START_FAILS)
+             {
+                 /*Transition from STARTING to DISCONNECTED (both without substates)*/
+                 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, from state %s => %s",
+                            __func__, "eSAP_STARTING", "eSAP_DISCONNECTED");
+
+                 /*Action code for transition */
+                 vosStatus = sapSignalHDDevent( sapContext, NULL, eSAP_START_BSS_EVENT,(v_PVOID_t) eSAP_STATUS_FAILURE);
+                 vosStatus =  sapGotoDisconnected(sapContext);
+
+                 /*Advance outer statevar */
+                 sapContext->sapsMachine = eSAP_DISCONNECTED;
+             }
+             else if (msg == eSAP_HDD_STOP_INFRA_BSS)
              {
                  /*Transition from eSAP_STARTING to eSAP_DISCONNECTING (both without substates)*/
                  VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
@@ -1118,22 +874,6 @@
                  sapContext->sapsMachine = eSAP_DISCONNECTED;
                  vosStatus = sapSignalHDDevent( sapContext, NULL, eSAP_START_BSS_EVENT, (v_PVOID_t)eSAP_STATUS_FAILURE);
                  vosStatus = sapGotoDisconnected(sapContext);
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-                 /* Reset the OBSS Affected Channel Range */
-                 if ( (0 != sapContext->affected_start)
-                   && (0 != sapContext->affected_end)
-                   && (0 != sapContext->sap_sec_chan) )
-                 {
-                     sapContext->affected_start = 0;
-                     sapContext->affected_end = 0;
-                     sapContext->sap_sec_chan = 0;
-                     VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                         FL("Reset the OBSS Affected Channel Range [%d %d]"),
-                         sapContext->affected_start, sapContext->affected_end);
-
-                 }
-#endif
                  /* Close the SME session*/
 
                  if (eSAP_TRUE == sapContext->isSapSessionOpen)
@@ -1147,8 +887,7 @@
                     }
                     else if (eHAL_STATUS_SUCCESS ==
                          sme_CloseSession(hHal,
-                                         sapContext->sessionId, FALSE,
-                                         VOS_TRUE, NULL, NULL))
+                                         sapContext->sessionId, NULL, NULL))
                      {
                          sapContext->isSapSessionOpen = eSAP_FALSE;
                      }
@@ -1177,33 +916,6 @@
                 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, in state %s, invalid event msg %d",
                            __func__, "eSAP_STARTED", msg);
             }
-#ifdef WLAN_FEATURE_AP_HT40_24G
-            /* Reset the OBSS Affected Channel Range */
-            if ( (0 != sapContext->affected_start)
-               && (0 != sapContext->affected_end)
-               && (0 != sapContext->sap_sec_chan) )
-            {
-                sapContext->affected_start = 0;
-                sapContext->affected_end = 0;
-                sapContext->sap_sec_chan = 0;
-                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                     FL("Reset the OBSS Affected Channel Range [%d %d]"),
-                     sapContext->affected_start, sapContext->affected_end);
-            }
-
-            if (VOS_TIMER_STATE_RUNNING == sapContext->sap_HT2040_timer.state)
-            {
-                vosStatus = vos_timer_stop(&sapContext->sap_HT2040_timer);
-                if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-                    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                              FL("Failed to Stop HT20/40 timer"));
-            }
-
-            vosStatus = vos_timer_destroy(&sapContext->sap_HT2040_timer);
-            if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-                VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                          FL("Failed to Destroy HT20/40 timer"));
-#endif
             break;
 
         case eSAP_DISCONNECTING:
@@ -1228,13 +940,15 @@
                     else
                     {
                         sapContext->isSapSessionOpen = eSAP_FALSE;
-                        sme_CloseSession(hHal,
-                                sapContext->sessionId,  TRUE, VOS_TRUE,
-                                NULL, sapContext);
-
-                        vosStatus = sapSignalHDDevent(sapContext, NULL,
-                                eSAP_STOP_BSS_EVENT,
-                                (v_PVOID_t) eSAP_STATUS_SUCCESS);
+                        if (!HAL_STATUS_SUCCESS(
+                            sme_CloseSession(hHal,
+                                     sapContext->sessionId,
+                                     sapRoamSessionCloseCallback, sapContext)))
+                        {
+                            vosStatus = sapSignalHDDevent(sapContext, NULL,
+                                              eSAP_STOP_BSS_EVENT,
+                                              (v_PVOID_t) eSAP_STATUS_SUCCESS);
+                        }
                     }
                 }
             }
@@ -1576,256 +1290,6 @@
     return;
 }
 
-/*==========================================================================
-  FUNCTION    sapGetStaId
-
-  DESCRIPTION
-    Get the STA ID from Mac address.
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    sapContext   : Sap Context value
-    staId        : STA ID
-    pCsrRoamInfo : Pointer to CSR info
-
-  RETURN VALUE
-
-  SIDE EFFECTS
-============================================================================*/
-
-VOS_STATUS sapGetStaId(ptSapContext sapContext, v_U8_t *staId,
-                                         tCsrRoamInfo *pCsrRoamInfo)
-{
-    v_U8_t i;
-
-    for (i = 0; i < WLAN_MAX_STA_COUNT; i++)
-    {
-        if (vos_mem_compare(&sapContext->aStaInfo[i].macAddrSTA,
-                pCsrRoamInfo->peerMac, sizeof(v_MACADDR_t))
-           && sapContext->aStaInfo[i].isUsed)
-        {
-            *staId = i;
-            return VOS_STATUS_SUCCESS;
-        }
-    }
-    return VOS_STATUS_E_FAILURE;
-}
-
-/*==========================================================================
-  FUNCTION    sapAddHT40IntolerantSta
-
-  DESCRIPTION
-    Add HT40 Intolerant STA & Move SAP from HT40 to HT20
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    sapContext   : Sap Context value
-    pCsrRoamInfo : Pointer to CSR info
-
-  RETURN VALUE
-
-  SIDE EFFECTS
-============================================================================*/
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-void sapAddHT40IntolerantSta(ptSapContext sapContext,
-                                     tCsrRoamInfo *pCsrRoamInfo)
-{
-
-    tHalHandle hHal;
-    v_U8_t cbMode;
-    tANI_U8  staId;
-    eHalStatus halStatus;
-    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
-
-    /* tHalHandle */
-    hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
-
-    if (NULL == hHal)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                   FL("In invalid hHal"));
-        return;
-    }
-
-    staId = pCsrRoamInfo->staId;
-
-    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-              FL("Add HT40 MHz Intolerant STA :"
-              MAC_ADDRESS_STR " STA ID: %d"),
-              MAC_ADDR_ARRAY(pCsrRoamInfo->peerMac),
-              staId);
-
-    // Get Channel Bonding Mode
-    cbMode = sme_GetChannelBondingMode24G(hHal);
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("Current Channel Bonding Mode: %d "
-                  "HT40IntolerantSet: %d"),
-               cbMode, sapContext->aStaInfo[staId].isHT40IntolerantSet);
-
-    if(sapContext->aStaInfo[staId].isHT40IntolerantSet)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("HT40Intolerant is Already Set: %d"),
-               sapContext->aStaInfo[staId].isHT40IntolerantSet);
-        return;
-    }
-
-    spin_lock_bh(&sapContext->staInfo_lock);
-
-    sapContext->aStaInfo[staId].isHT40IntolerantSet = 1;
-    sapContext->numHT40IntoSta++;
-
-    spin_unlock_bh(&sapContext->staInfo_lock);
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-              FL("Total No of HT40 Intolerant STA: %d"
-               " STA ID: %d HT40IntolerantSet: %d"),
-                sapContext->numHT40IntoSta,
-                staId, sapContext->aStaInfo[staId].isHT40IntolerantSet);
-
-    /* Stop HT20/40 Timer */
-    if (VOS_TIMER_STATE_RUNNING == sapContext->sap_HT2040_timer.state)
-    {
-        vosStatus = vos_timer_stop(&sapContext->sap_HT2040_timer);
-        if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                      FL("Failed to Stop HT20/40 timer"));
-    }
-
-    if(cbMode)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("Move SAP from HT40 to HT20"));
-
-        halStatus = sme_SetHT2040Mode(hHal, sapContext->sessionId,
-                                            PHY_SINGLE_CHANNEL_CENTERED);
-
-        if (halStatus == eHAL_STATUS_FAILURE)
-        {
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                        FL("Failed to change HT20/40 mode"));
-            return;
-        }
-
-        /* Disable Channel Bonding for 2.4GHz */
-        sme_UpdateChannelBondingMode24G(hHal,
-                                PHY_SINGLE_CHANNEL_CENTERED);
-
-    }
-    else
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("SAP is Already in HT20"));
-}
-
-/*==========================================================================
-  FUNCTION    sapRemoveHT40IntolerantSta
-
-  DESCRIPTION
-    Remove HT40 Intolerant STA & Move SAP from HT40 to HT20
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    sapContext   : Sap Context value
-    pCsrRoamInfo : Pointer to CSR info
-
-  RETURN VALUE
-
-  SIDE EFFECTS
-============================================================================*/
-
-void sapRemoveHT40IntolerantSta(ptSapContext sapContext,
-                                          tCsrRoamInfo *pCsrRoamInfo)
-{
-    tANI_U8  staId;
-    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
-    unsigned int delay;
-
-    vosStatus = sapGetStaId(sapContext, &staId, pCsrRoamInfo);
-
-    if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-    {
-        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                  FL("ERROR: SAP Failed to find sta id!!"));
-        return;
-    }
-
-    VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-              FL("Remove HT40 MHz Intolerant STA :"
-              MAC_ADDRESS_STR " STA ID: %d"
-              " HT40IntolerantSet:%d"),
-              MAC_ADDR_ARRAY(pCsrRoamInfo->peerMac),
-              staId, sapContext->aStaInfo[staId].isHT40IntolerantSet);
-
-    if(!sapContext->aStaInfo[staId].isHT40IntolerantSet)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("HT40Intolerant is not Set: %d"),
-               sapContext->aStaInfo[staId].isHT40IntolerantSet);
-        return;
-    }
-
-    spin_lock_bh(&sapContext->staInfo_lock);
-    sapContext->aStaInfo[staId].isHT40IntolerantSet = 0;
-
-    if (sapContext->numHT40IntoSta > 0)
-        sapContext->numHT40IntoSta--;
-
-    spin_unlock_bh(&sapContext->staInfo_lock);
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               FL("Total No of HT40 Intolerant STA: %d"
-               " STA ID: %d HT40IntolerantSet: %d"),
-                sapContext->numHT40IntoSta,
-                staId, sapContext->aStaInfo[staId].isHT40IntolerantSet);
-
-    if ((!sapCheckHT40SecondaryIsNotAllowed(sapContext))
-       && (!sapContext->numHT40IntoSta))
-    {
-        /* Stop Previous Running HT20/40 Timer & Start timer
-           with (OBSS TransitionDelayFactor * obss interval)
-           delay after time out move AP from HT20 -> HT40
-           mode
-         */
-        if (VOS_TIMER_STATE_RUNNING == sapContext->sap_HT2040_timer.state)
-        {
-            vosStatus = vos_timer_stop(&sapContext->sap_HT2040_timer);
-            if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-                 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                          FL("Failed to Stop HT20/40 timer"));
-        }
-
-        delay =
-         (sapContext->ObssScanInterval * sapContext->ObssTransitionDelayFactor);
-
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                   FL("Start HT20/40 itransition"
-                   " timer (%d sec)"), delay);
-
-        vosStatus = vos_timer_start( &sapContext->sap_HT2040_timer,
-                                              (delay * 1000));
-
-        if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-             VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                       FL("Failed to Start HT20/40 timer"));
-    }
-    return;
-}
-#endif
-
 VOS_STATUS
 sapIsPeerMacAllowed(ptSapContext sapContext, v_U8_t *peerMac)
 {
@@ -2074,73 +1538,3 @@
     return VOS_STATUS_SUCCESS;
 }
 #endif
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-static VOS_STATUS sapGetChannelListForObss(tHalHandle halHandle,
-                            ptSapContext psapCtx, v_U8_t **channelList,
-                            v_U8_t *numberOfChannels)
-{
-    v_U32_t startChannelNum;
-    v_U32_t endChannelNum;
-    v_U8_t  loopCount;
-    v_U8_t channelCount;
-    v_U8_t *list;
-
-    if (eHAL_STATUS_SUCCESS != sapGet24GOBSSAffectedChannel(halHandle, psapCtx))
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                   "%s:Not able to Get Affected Channel Range for Channel : %d",
-                    __func__, psapCtx->channel);
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               "%s: 40 MHz affected channel range: [%d,%d] MHz",
-                    __func__, psapCtx->affected_start, psapCtx->affected_end);
-
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               "%s: SAP Primary & Secondary Channel : [%d,%d] MHz",
-                    __func__, psapCtx->channel, psapCtx->sap_sec_chan);
-
-    /* Allocate the max number of channel supported */
-    list = (v_U8_t *)vos_mem_malloc(RF_CHAN_14 + 1);
-    if (NULL == list)
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                   "%s: Unable to allocate channel list", __func__);
-        *numberOfChannels = 0;
-        *channelList = NULL;
-        return VOS_STATUS_E_RESOURCES;
-    }
-
-    /*Search for the Active channels in the given range */
-    channelCount = 0;
-    startChannelNum = RF_CHAN_1;
-    endChannelNum = RF_CHAN_14;
-    for( loopCount = startChannelNum; loopCount <= endChannelNum; loopCount++ )
-    {
-        if ((rfChannels[loopCount].channelNum >= psapCtx->affected_start)
-           && (rfChannels[loopCount].channelNum <= psapCtx->affected_end))
-        {
-            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-               "%s: Channel Number: %d State : %d", __func__,
-               rfChannels[loopCount].channelNum,
-            vos_nv_getChannelEnabledState(rfChannels[loopCount].channelNum));
-            list[channelCount] = rfChannels[loopCount].channelNum;
-            channelCount++;
-        }
-    }
-     /* return the channel list and number of channels to scan*/
-    *numberOfChannels = channelCount;
-    if(channelCount != 0)
-    {
-       *channelList = list;
-    }
-    else
-    {
-       *channelList = NULL;
-        vos_mem_free(list);
-    }
-    return VOS_STATUS_SUCCESS;
-}
-#endif
diff --git a/wlan/prima/CORE/SAP/src/sapFsm_ext.h b/wlan/prima/CORE/SAP/src/sapFsm_ext.h
index bc5ee88..7a87786 100644
--- a/wlan/prima/CORE/SAP/src/sapFsm_ext.h
+++ b/wlan/prima/CORE/SAP/src/sapFsm_ext.h
@@ -25,6 +25,11 @@
  * to the Linux Foundation.
  */
 
+/*
+ * Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ * Qualcomm Confidential and Proprietary 
+ */
+
 /* This file is generated from btampFsm.cdd - do not edit manually*/
 /* Generated on: Thu Oct 16 15:40:39 PDT 2008 */
 
diff --git a/wlan/prima/CORE/SAP/src/sapInternal.h b/wlan/prima/CORE/SAP/src/sapInternal.h
index dd94138..ceb7c48 100644
--- a/wlan/prima/CORE/SAP/src/sapInternal.h
+++ b/wlan/prima/CORE/SAP/src/sapInternal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,6 +39,8 @@
   module.
 
 
+  Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
@@ -79,8 +81,6 @@
 #include "sapApi.h"
 #include "sapFsm_ext.h"
 #include "sapChSelect.h"
-#include "wlan_hdd_dp_utils.h"
-#include "wlan_hdd_main.h"
 
 /*----------------------------------------------------------------------------
  * Preprocessor Definitions and Constants
@@ -146,49 +146,6 @@
     v_U32_t             weight;
 }tSapAcsChannelInfo;
 
-typedef struct {
-    /** The station entry is used or not  */
-    v_BOOL_t isUsed;
-
-    /** Station ID reported back from HAL (through SAP). Broadcast
-     *  uses station ID zero by default in both libra and volans. */
-    v_U8_t ucSTAId;
-
-    /** MAC address of the station */
-    v_MACADDR_t macAddrSTA;
-
-    /** Current Station state so HDD knows how to deal with packet
-     *  queue. Most recent states used to change TL STA state. */
-    WLANTL_STAStateType tlSTAState;
-
-   /** Transmit queues for each AC (VO,VI,BE etc). */
-   hdd_list_t wmm_tx_queue[NUM_TX_QUEUES];
-
-   /** Might need to differentiate queue depth in contention case */
-   v_U16_t aTxQueueDepth[NUM_TX_QUEUES];
-
-   /**Track whether OS TX queue has been disabled.*/
-   v_BOOL_t txSuspended[NUM_TX_QUEUES];
-
-   /**Track whether 3/4th of resources are used */
-   v_BOOL_t vosLowResource;
-
-   /** Track QoS status of station */
-   v_BOOL_t isQosEnabled;
-
-   /** The station entry for which Deauth is in progress  */
-   v_BOOL_t isDeauthInProgress;
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-   /** Track HT40 Intolerant station */
-   v_BOOL_t isHT40IntolerantSet;
-#endif
-
-  /** Rate Flags for this connection */
-  uint32_t  rate_flags;
-
-} hdd_station_info_t;
-
 typedef struct sSapContext {
 
     vos_lock_t          SapGlobalLock;
@@ -264,17 +221,6 @@
     eCsrBand           scanBandPreference;
     v_U16_t            acsBandSwitchThreshold;
     tSapAcsChannelInfo acsBestChannelInfo;
-    spinlock_t staInfo_lock; //To protect access to station Info
-    hdd_station_info_t aStaInfo[WLAN_MAX_STA_COUNT];
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    v_U8_t            affected_start;
-    v_U8_t            affected_end;
-    v_U8_t            sap_sec_chan;
-    v_U8_t            numHT40IntoSta;
-    vos_timer_t       sap_HT2040_timer;
-    v_U8_t            ObssScanInterval;
-    v_U8_t            ObssTransitionDelayFactor;
-#endif
 } *ptSapContext;
 
 
@@ -298,32 +244,6 @@
 /*----------------------------------------------------------------------------
  * Function Declarations and Documentation
  * -------------------------------------------------------------------------*/
-#ifdef WLAN_FEATURE_AP_HT40_24G
-/*==========================================================================
-
-  FUNCTION    sapGet24GOBSSAffectedChannel()
-
-  DESCRIPTION
-    Get OBSS Affected Channel no for SAP
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    tHalHandle:  the tHalHandle passed in with the scan request
-    ptSapContext: Pointer to SAP context
-
-  RETURN VALUE
-
-  SIDE EFFECTS
-
-============================================================================*/
-
-eHalStatus sapGet24GOBSSAffectedChannel(tHalHandle halHandle,
-                                                ptSapContext psapCtx);
-#endif
 
 /*==========================================================================
 
@@ -618,53 +538,6 @@
 ============================================================================*/
 void sapFreeRoamProfile(tCsrRoamProfile *profile);
 
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-/*==========================================================================
-  FUNCTION    sapAddHT40IntolerantSta
-
-  DESCRIPTION
-    Add HT40 Intolerant STA & Move SAP from HT40 to HT20
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    sapContext   : Sap Context value
-    pCsrRoamInfo : Pointer to CSR info
-
-  RETURN VALUE
-
-  SIDE EFFECTS
-============================================================================*/
-
-void sapAddHT40IntolerantSta(ptSapContext sapContext, tCsrRoamInfo *pCsrRoamInfo);
-
-/*==========================================================================
-  FUNCTION    sapRemoveHT40IntolerantSta
-
-  DESCRIPTION
-    Remove HT40 Intolerant STA & Move SAP from HT40 to HT20
-
-  DEPENDENCIES
-    NA.
-
-  PARAMETERS
-
-    IN
-    sapContext   : Sap Context value
-    pCsrRoamInfo : Pointer to CSR info
-
-  RETURN VALUE
-
-  SIDE EFFECTS
-============================================================================*/
-
-void sapRemoveHT40IntolerantSta(ptSapContext sapContext, tCsrRoamInfo *pCsrRoamInfo);
-#endif
-
 /*==========================================================================
 
   FUNCTION    sapIsPeerMacAllowed
@@ -891,27 +764,6 @@
 ============================================================================*/
 eCsrPhyMode sapConvertSapPhyModeToCsrPhyMode( eSapPhyMode sapPhyMode );
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-/*==========================================================================
-FUNCTION  sap_ht2040_timer_cb
-
-DESCRIPTION Function to implement ht2040 timer callback implementation
-
-SIDE EFFECTS
-============================================================================*/
-void sap_ht2040_timer_cb(v_PVOID_t usrDataForCallback);
-
-/*==========================================================================
-FUNCTION  sapCheckHT40SecondaryIsNotAllowed
-
-DESCRIPTION Function to check HT40 secondary channel is allowed or not
-
-SIDE EFFECTS
-============================================================================*/
-
-eHalStatus sapCheckHT40SecondaryIsNotAllowed(ptSapContext psapCtx);
-#endif
-
 #ifdef __cplusplus
 }
 #endif 
diff --git a/wlan/prima/CORE/SAP/src/sapModule.c b/wlan/prima/CORE/SAP/src/sapModule.c
index a1d9071..898c24b 100644
--- a/wlan/prima/CORE/SAP/src/sapModule.c
+++ b/wlan/prima/CORE/SAP/src/sapModule.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -158,6 +158,8 @@
         return VOS_STATUS_E_FAULT;
     }
 
+    vos_mem_zero(pSapCtx, sizeof(tSapContext));
+
     /*------------------------------------------------------------------------
         Clean up SAP control block, initialize all values
     ------------------------------------------------------------------------*/
@@ -165,14 +167,6 @@
 
     WLANSAP_CleanCB(pSapCtx, 0 /*do not empty*/);
 
-    if (!VOS_IS_STATUS_SUCCESS(vos_spin_lock_init(&pSapCtx->staInfo_lock)))
-    {
-        VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
-                 "WLANSAP_Start failed init staInfo_lock");
-        vos_free_context(pvosGCtx, VOS_MODULE_ID_SAP, pSapCtx);
-        return VOS_STATUS_E_FAULT;
-    }
-
     // Setup the "link back" to the VOSS context
     pSapCtx->pvosGCtx = pvosGCtx;
 
@@ -265,6 +259,8 @@
         return VOS_STATUS_E_FAULT;
     }
 
+
+
     return VOS_STATUS_SUCCESS;
 }/* WLANSAP_Start */
 
@@ -602,6 +598,9 @@
 
         //Set the BSSID to your "self MAC Addr" read the mac address from Configuation ITEM received from HDD
         pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1;
+        vos_mem_copy(pSapCtx->csrRoamProfile.BSSIDs.bssid,
+                     pSapCtx->self_mac_addr,
+                     sizeof( tCsrBssid ) );
 
         //Save a copy to SAP context
         vos_mem_copy(pSapCtx->csrRoamProfile.BSSIDs.bssid,
@@ -1226,11 +1225,7 @@
 WLANSAP_DisassocSta
 (
     v_PVOID_t  pvosGCtx,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-    const v_U8_t *pPeerStaMac
-#else
     v_U8_t *pPeerStaMac
-#endif
 )
 {
     ptSapContext  pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
diff --git a/wlan/prima/CORE/SME/inc/btcApi.h b/wlan/prima/CORE/SME/inc/btcApi.h
index bab11f4..2743d18 100644
--- a/wlan/prima/CORE/SME/inc/btcApi.h
+++ b/wlan/prima/CORE/SME/inc/btcApi.h
@@ -31,6 +31,8 @@
 *
 * Description: BTC Events Layer API definitions.
 *
+* Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+* Qualcomm Confidential and Proprietary.
 *
 ******************************************************************************/
 
diff --git a/wlan/prima/CORE/SME/inc/ccmApi.h b/wlan/prima/CORE/SME/inc/ccmApi.h
index 0abfdc5..f386a9e 100644
--- a/wlan/prima/CORE/SME/inc/ccmApi.h
+++ b/wlan/prima/CORE/SME/inc/ccmApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -42,7 +42,7 @@
 #define CCMAPI_H__
 
 //#include "wniCfgAp.h" /* CFG_PARAM_MAX_NUM */
-#include "wniCfg.h"
+#include "wniCfgSta.h"
 #include "halTypes.h"
 
 #define CCM_11B_CHANNEL_END             14
diff --git a/wlan/prima/CORE/SME/inc/csrApi.h b/wlan/prima/CORE/SME/inc/csrApi.h
index 292aada..43a3d30 100644
--- a/wlan/prima/CORE/SME/inc/csrApi.h
+++ b/wlan/prima/CORE/SME/inc/csrApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -194,27 +194,10 @@
  */
 typedef enum
 {
-    eCSR_SCAN_ABORT_DEFAULT = 1,
+    eCSR_SCAN_ABORT_DEFAULT,
     eCSR_SCAN_ABORT_DUE_TO_BAND_CHANGE, //Scan aborted due to band change
 }eCsrAbortReason;
 
-typedef enum
-{
-   eCSR_INI_SINGLE_CHANNEL_CENTERED = 0,
-   eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY,
-   eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY,
-#ifdef WLAN_FEATURE_11AC
-   eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED,
-   eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED,
-   eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED,
-   eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW,
-   eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW,
-   eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH,
-   eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH,
-#endif
-   eCSR_INI_CHANNEL_BONDING_STATE_MAX
-}eIniChanBondState;
-
 #define CSR_SCAN_TIME_DEFAULT       0
 #define CSR_VALUE_IGNORED           0xFFFFFFFF
 #define CSR_RSN_PMKID_SIZE          16
@@ -402,9 +385,6 @@
     tANI_U8 MFPRequired;
     tANI_U8 MFPCapable;
 #endif
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-    tANI_BOOLEAN isPERRoamScan;
-#endif
 }tCsrScanResultFilter;
 
 
@@ -477,6 +457,7 @@
     eCSR_ROAM_FT_RESPONSE,
 #endif
     eCSR_ROAM_FT_START,
+    eCSR_ROAM_INDICATE_MGMT_FRAME,
     eCSR_ROAM_REMAIN_CHAN_READY,
     eCSR_ROAM_SEND_ACTION_CNF,
     //this mean error happens before association_start or roaming_start is called.
@@ -502,23 +483,12 @@
     eCSR_ROAM_UNPROT_MGMT_FRAME_IND,
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-    eCSR_ROAM_IBSS_PEER_INFO_COMPLETE,
-#endif
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    eCSR_ROAM_2040_COEX_INFO_IND,
-#endif
-
 #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
     eCSR_ROAM_TSM_IE_IND,
     eCSR_ROAM_CCKM_PREAUTH_NOTIFY,
     eCSR_ROAM_ESE_ADJ_AP_REPORT_IND,
     eCSR_ROAM_ESE_BCN_REPORT_IND,
 #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
-    eCSR_ROAM_UPDATE_MAX_RATE_IND,
-    eCSR_ROAM_LOST_LINK_PARAMS_IND,
-    eCSR_ROAM_UPDATE_SCAN_RESULT,
 }eRoamCmdStatus;
 
 
@@ -606,15 +576,8 @@
     eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND,
     eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND,
     eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP,
-    eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP,
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-    eCSR_ROAM_RESULT_IBSS_PEER_INFO_SUCCESS,
-    eCSR_ROAM_RESULT_IBSS_PEER_INFO_FAILED,
-#endif
-    /* If Scan for SSID failed to found proper BSS */
-    eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE,
 }eCsrRoamResult;
 
 
@@ -665,8 +628,6 @@
     eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED,
     // Participating in a Infra network and connected to a peer
     eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED,
-    /* Disconnecting with AP or stop connecting process */
-    eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTING,
 
 }eCsrConnectState;
 
@@ -932,7 +893,7 @@
      * It has the IE byte stream for additional IE,
      * which can be WSC IE and/or P2P IE
      */
-    tANI_U8  addIEScan[SIR_MAC_MAX_ADD_IE_LENGTH+2];       //Additional IE information.
+    tANI_U8  addIEScan[SIR_MAC_MAX_IE_LENGTH+2];       //Additional IE information.
     tANI_U32 nAddIEAssocLength;   //The byte count in the pAddIE for assoc
     tANI_U8 *pAddIEAssoc;       //If not null, it has the IE byte stream for additional IE, which can be WSC IE and/or P2P IE
 
@@ -1000,14 +961,6 @@
     tANI_BOOLEAN    isESEAssoc;
 #endif
     tANI_U32 dot11Mode;
-
-#ifdef WLAN_FEATURE_11W
-    /* Management Frame Protection */
-    tANI_BOOLEAN MFPEnabled;
-    tANI_U8 MFPRequired;
-    tANI_U8 MFPCapable;
-#endif
-
 }tCsrRoamConnectedProfile;
 
 
@@ -1160,7 +1113,7 @@
     /*Customer wants to optimize the scan time. Avoiding scans(passive) on DFS
     * channels while swipping through both bands can save some time
     * (apprx 1.3 sec) */
-    tANI_U8 fEnableDFSChnlScan;
+    tANI_BOOLEAN fEnableDFSChnlScan;
 
     //To enable/disable scanning 2.4Ghz channels twice on a single scan request from HDD
     tANI_BOOLEAN fScanTwice;
@@ -1186,17 +1139,10 @@
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
     tANI_BOOLEAN isRoamOffloadScanEnabled;
     tANI_BOOLEAN bFastRoamInConIniFeatureEnabled;
-    v_BOOL_t isPERRoamEnabled;
-    v_BOOL_t isPERRoamCCAEnabled;
-    v_U32_t rateUpThreshold;
-    v_U32_t rateDownThreshold;
-    v_U32_t waitPeriodForNextPERScan;
-    v_U32_t PERtimerThreshold;
-    v_U32_t PERroamTriggerPercent;
 #endif
 #endif
 
-    tANI_BOOLEAN ignorePeerErpInfo;
+
     tANI_U8 scanCfgAgingTime;
 
     tANI_U8   enableTxLdpc;
@@ -1210,29 +1156,6 @@
     tANI_BOOLEAN sendDeauthBeforeCon;
 
     eCsrBand  scanBandPreference;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    tANI_BOOLEAN apHT40_24GEnabled;
-    tANI_U32 channelBondingAPMode24GHz; // Use for SAP/P2P GO 2.4GHz channel Bonding
-#endif
-    tANI_U32 nOBSSScanWidthTriggerInterval;
-    tANI_U8 roamDelayStatsEnabled;
-    tANI_BOOLEAN ignorePeerHTopMode;
-    tANI_BOOLEAN disableP2PMacSpoofing;
-    tANI_BOOLEAN enableFatalEvent;
-    tANI_U8 max_chan_for_dwell_time_cfg;
-    uint32_t enable_edca_params;
-    uint32_t edca_vo_cwmin;
-    uint32_t edca_vi_cwmin;
-    uint32_t edca_bk_cwmin;
-    uint32_t edca_be_cwmin;
-    uint32_t edca_vo_cwmax;
-    uint32_t edca_vi_cwmax;
-    uint32_t edca_bk_cwmax;
-    uint32_t edca_be_cwmax;
-    uint32_t edca_vo_aifs;
-    uint32_t edca_vi_aifs;
-    uint32_t edca_bk_aifs;
-    uint32_t edca_be_aifs;
 }tCsrConfigParam;
 
 //Tush
@@ -1283,13 +1206,9 @@
         tSirMicFailureInfo *pMICFailureInfo;
         tCsrRoamConnectedProfile *pConnectedProfile;
         tSirWPSPBCProbeReq *pWPSPBCProbeReq;
-        tSirLostLinkParamsInfo *pLostLinkParams;
     } u;
 
     tANI_BOOLEAN wmmEnabledSta;   //set to true if WMM enabled STA
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    tANI_BOOLEAN HT40MHzIntoEnabledSta; //set to true if 40 MHz Intolerant enabled STA
-#endif
     tANI_U32 dtimPeriod;
 
 #ifdef FEATURE_WLAN_ESE
@@ -1321,9 +1240,6 @@
 
     tANI_S8 rxRssi;
     tANI_U32 maxRateFlags;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd;
-#endif
 }tCsrRoamInfo;
 
 typedef struct tagCsrFreqScanInfo
@@ -1349,10 +1265,6 @@
     tSirRSNie            rsnIE;           // RSN IE received from peer
     tSirAddie            addIE;           // Additional IE received from peer, which can be WSC and/or P2P IE
     tANI_U8              reassocReq;      //set to true if reassoc
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    tANI_U8              HT40MHzIntoEnabledSta; //set to true if 40 MHz Intolerant enabled STA
-#endif
-    uint32_t             rate_flags;
 } tSirSmeAssocIndToUpperLayerCnf, *tpSirSmeAssocIndToUpperLayerCnf;
 
 typedef struct tagCsrSummaryStatsInfo
@@ -1503,6 +1415,25 @@
 
 }tCsrTdlsSendMgmt;
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+typedef struct tagCsrTdlsDisRequest
+{
+        tSirMacAddr peerMac;
+            tANI_U8 disType;
+}tCsrTdlsDisRequest;
+
+typedef struct tagCsrTdlsSetupRequest
+{
+        tSirMacAddr peerMac;
+            tANI_U8 linkIndex;
+}tCsrTdlsSetupRequest;
+
+typedef struct tagCsrTdlsTeardownRequest
+{
+        tSirMacAddr peerMac;
+            tANI_U8 linkIndex;
+}tCsrTdlsTeardownRequest ;
+#endif
 #endif
 
 typedef void * tScanResultHandle;
@@ -1514,17 +1445,9 @@
 {
     tCsrBssid bssid;
     tANI_U8 channel;
-    /* To check if its a REASSOC or a FASTREASSOC IOCTL */
-    tANI_U8 src;
 }tCsrHandoffRequest;
 #endif
 
-typedef enum {
-    REASSOC     = 0,
-    FASTREASSOC = 1,
-    CONNECT_CMD_USERSPACE = 2,
-} handoff_src;
-
 #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
 typedef struct tagCsrEseBeaconReqParams
 {
@@ -1714,18 +1637,6 @@
 ---------------------------------------------------------------------------*/
 typedef void (*tCsrSnrCallback) (v_S7_t snr, tANI_U32 staId, void *pContext);
 
-/*---------------------------------------------------------------------------
-  This is the type for a get current antenna callback to be registered with SME
-  for getting cuurently used antenna index
-
-  \param antennaId to be filled by firmware.
-  \param pContext - any user data given at callback registration.
-  \return None
-
----------------------------------------------------------------------------*/
-typedef void ( *tCsrAntennaIndexCallback) (int antennaId, void *pContext);
-
-
 #ifdef WLAN_FEATURE_VOWIFI_11R
 eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tpSirBssDescription pBssDescription);
 #endif
diff --git a/wlan/prima/CORE/SME/inc/csrInternal.h b/wlan/prima/CORE/SME/inc/csrInternal.h
index cb13a47..91b962c 100644
--- a/wlan/prima/CORE/SME/inc/csrInternal.h
+++ b/wlan/prima/CORE/SME/inc/csrInternal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -40,8 +40,6 @@
 #define CSRINTERNAL_H__
 
 #include "vos_status.h"
-#include "vos_utils.h"
-
 #include "vos_lock.h"
 
 #include "palTimer.h"
@@ -49,8 +47,6 @@
 #include "vos_nvitem.h"
 #include "wlan_qct_tl.h"
 
-#include "csrApi.h"
-
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
 #include "csrNeighborRoam.h"
 #endif
@@ -278,7 +274,6 @@
    eCsrGlobalClassCStats,
    eCsrGlobalClassDStats,
    eCsrPerStaStats,
-   eCsrPerPktStats,
    eCsrMaxStats
 }eCsrRoamStatsClassTypes;
 
@@ -409,7 +404,7 @@
         tCsrBGScanRequest bgScanRequest;
     }u;
     //This flag will be set while aborting the scan due to band change
-     eCsrAbortReason        abortScanIndication;
+    tANI_BOOLEAN            abortScanDueToBandChange;
 }tScanCmd;
 
 typedef struct tagRoamCmd
@@ -623,13 +618,6 @@
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
     tANI_U8      isRoamOffloadScanEnabled;
     tANI_BOOLEAN bFastRoamInConIniFeatureEnabled;
-    v_BOOL_t     isPERRoamEnabled;
-    v_BOOL_t     isPERRoamCCAEnabled;
-    tANI_U32     rateUpThreshold;
-    tANI_U32     rateDownThreshold;
-    tANI_U32     waitPeriodForNextPERScan;
-    tANI_U32     PERtimerThreshold;
-    tANI_U32     PERroamTriggerPercent;
 #endif
 #endif
 
@@ -682,31 +670,7 @@
     tANI_U8 isCoalesingInIBSSAllowed;
     tANI_U8 allowDFSChannelRoam;
     tANI_BOOLEAN initialScanSkipDFSCh;
-    tANI_BOOLEAN ignorePeerErpInfo;
     tANI_BOOLEAN sendDeauthBeforeCon;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-    tANI_BOOLEAN apHT40_24GEnabled;
-    tANI_U32 channelBondingAPMode24GHz; // Use for SAP/P2P GO 2.4GHz channel Bonding
-#endif
-    tANI_U32 nOBSSScanWidthTriggerInterval;
-    tANI_U8 roamDelayStatsEnabled;
-    tANI_BOOLEAN ignorePeerHTopMode;
-    tANI_BOOLEAN disableP2PMacSpoofing;
-    tANI_BOOLEAN enableFatalEvent;
-    tANI_U8 max_chan_for_dwell_time_cfg;
-    uint32_t enable_edca_params;
-    uint32_t edca_vo_cwmin;
-    uint32_t edca_vi_cwmin;
-    uint32_t edca_bk_cwmin;
-    uint32_t edca_be_cwmin;
-    uint32_t edca_vo_cwmax;
-    uint32_t edca_vi_cwmax;
-    uint32_t edca_bk_cwmax;
-    uint32_t edca_be_cwmax;
-    uint32_t edca_vo_aifs;
-    uint32_t edca_vi_aifs;
-    uint32_t edca_bk_aifs;
-    uint32_t edca_be_aifs;
 }tCsrConfig;
 
 typedef struct tagCsrChannelPowerInfo
@@ -752,6 +716,8 @@
     vos_timer_t hTimerStaApConcTimer;
 #endif
     vos_timer_t hTimerIdleScan;
+    vos_timer_t hTimerResultAging;
+    vos_timer_t hTimerResultCfgAging;
     tPalTimerHandle hTimerBgScan;
     //changes on every scan, it is used as a flag for whether 11d info is found on every scan
     tANI_U8 channelOf11dInfo;
@@ -815,7 +781,7 @@
     /*Customer wants to optimize the scan time. Avoiding scans(passive) on DFS
     * channels while swipping through both bands can save some time
     * (apprx 1.3 sec) */
-    tANI_U8 fEnableDFSChnlScan;
+    tANI_BOOLEAN fEnableDFSChnlScan;
 
     /*
     * To enable/disable scanning only 2.4Ghz channels on first scan
@@ -832,11 +798,29 @@
 
     csrScanCompleteCallback callback11dScanDone;
     eCsrBand  scanBandPreference;  //This defines the band perference for scan
-    bool fcc_constraint;
-    /* flag to defer updated chanel list */
-    bool defer_update_channel_list;
 }tCsrScanStruct;
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/*
+ * struct to carry TDLS discovery info..
+ */
+typedef struct sCsrTdlsContext
+{
+    tDblLinkList tdlsPotentialPeerList ;
+    tANI_U16 tdlsCommonFlag ;
+    tANI_U16 tdlsCommonState ;
+    tANI_U16 tdlsPeerCount ;
+}tCsrTdlsCtxStruct;
+
+typedef struct sCsrTdlsPeerLinkInfo
+{
+    tListElem tdlsPeerStaLink ;
+    tSirTdlsPeerInfo tdlsDisPeerInfo ;
+}tCsrTdlsPeerLinkinfo ;
+#endif
+
+
+
 
 //Save the connected information. This structure + connectedProfile
 //should contain all information about the connection
@@ -915,8 +899,7 @@
     tCsrRoamConnectedInfo connectedInfo;
     tCsrRoamProfile *pCurRoamProfile;
     tSirBssDescription *pConnectBssDesc;
-    tANI_U16 NumPmkidCache; /* valid no. of pmkid in the cache */
-    tANI_U16 CurCacheIndex; /* the index in pmkidcache to write next to */
+    tANI_U16 NumPmkidCache;
     tPmkidCacheInfo PmkidCacheInfo[CSR_MAX_PMKID_ALLOWED];
     tANI_U8 cJoinAttemps;
     //This may or may not have the up-to-date valid channel list
@@ -945,7 +928,7 @@
     /* This contains the additional IE in (unicast)
      *  probe request at the time of join
      */
-    tANI_U8 addIEScan[SIR_MAC_MAX_ADD_IE_LENGTH+2];
+    tANI_U8 addIEScan[SIR_MAC_MAX_IE_LENGTH+2];
     tANI_U32 nAddIEAssocLength;      //the byte count for pAddIeAssocIE
     tANI_U8 *pAddIEAssoc; //this contains the additional IE in (re) assoc request
 
@@ -990,8 +973,6 @@
     * the PMKID cache. To clear the cache in this particular case this is added
     * it is needed by the HS 2.0 passpoint certification 5.2.a and b testcases */
     tANI_BOOLEAN fIgnorePMKIDCache;
-    tANI_BOOLEAN abortConnection;
-    bool dhcp_done;
 } tCsrRoamSession;
 
 typedef struct tagCsrRoamStruct
@@ -1019,7 +1000,6 @@
     tCsrGlobalClassCStatsInfo  classCStatsInfo;
     tCsrGlobalClassDStatsInfo  classDStatsInfo;
     tCsrPerStaStatsInfo        perStaStatsInfo[CSR_MAX_STA];
-    tPerTxPacketFrmFw          perPktStatsInfo;
     tDblLinkList  statsClientReqList;
     tDblLinkList  peStatsReqList;
     tCsrTlStatsReqInfo  tlStatsReqInfo;
@@ -1177,7 +1157,6 @@
 
 eHalStatus csrInitGetChannels(tpAniSirGlobal pMac);
 eHalStatus csrScanFilterResults(tpAniSirGlobal pMac);
-eHalStatus csrScanFilterDFSResults(tpAniSirGlobal pMac);
 
 eHalStatus csrSetModifyProfileFields(tpAniSirGlobal pMac, tANI_U32 sessionId,
                                      tCsrRoamModifyProfileFields *pModifyProfileFields);
@@ -1474,8 +1453,3 @@
 #endif
 
 void csrDisableDfsChannel(tpAniSirGlobal pMac);
-
-#ifdef WLAN_FEATURE_RMC
-eHalStatus csrEnableRMC(tpAniSirGlobal pMac, tANI_U32 sessionId);
-eHalStatus csrDisableRMC(tpAniSirGlobal pMac, tANI_U32 sessionId);
-#endif /* WLAN_FEATURE_RMC */
diff --git a/wlan/prima/CORE/SME/inc/csrNeighborRoam.h b/wlan/prima/CORE/SME/inc/csrNeighborRoam.h
index 5df4eee..4ef16f1 100644
--- a/wlan/prima/CORE/SME/inc/csrNeighborRoam.h
+++ b/wlan/prima/CORE/SME/inc/csrNeighborRoam.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -169,10 +169,11 @@
     vos_timer_t                 neighborScanTimer;
     vos_timer_t                 neighborResultsRefreshTimer;
     vos_timer_t                 emptyScanRefreshTimer;
+    tCsrTimerInfo               neighborScanTimerInfo;
     tCsrNeighborRoamChannelInfo roamChannelInfo;
     tANI_U8                     currentNeighborLookupThreshold;
     tANI_BOOLEAN                scanRspPending;
-    v_TIME_t                    scanRequestTimeStamp;
+    tANI_TIMESTAMP              scanRequestTimeStamp;
     tDblLinkList                roamableAPList;    // List of current FT candidates
     tANI_U32                    csrSessionId;
     tCsrRoamProfile             csrNeighborRoamProfile;
@@ -205,7 +206,6 @@
     tSirMacAddr                 cfgRoambssId;
     vos_timer_t                 forcedInitialRoamTo5GHTimer;
     tANI_U8                     isForcedInitialRoamTo5GH;
-    tANI_U8                     lastSentCmd;
 } tCsrNeighborRoamControlInfo, *tpCsrNeighborRoamControlInfo;
 
 
diff --git a/wlan/prima/CORE/SME/inc/csrSupport.h b/wlan/prima/CORE/SME/inc/csrSupport.h
index 28c775a..314feae 100644
--- a/wlan/prima/CORE/SME/inc/csrSupport.h
+++ b/wlan/prima/CORE/SME/inc/csrSupport.h
@@ -784,10 +784,6 @@
 tANI_BOOLEAN csrIsBssidMatch( tHalHandle hHal, tCsrBssid *pProfBssid, tCsrBssid *BssBssid );
 tANI_BOOLEAN csrMatchBSSToConnectProfile( tHalHandle hHal, tCsrRoamConnectedProfile *pProfile,
                                           tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes );
-
-void csrAddRateBitmap(tANI_U8 rate, tANI_U16 *pRateBitmap);
-tANI_BOOLEAN csrIsRateAlreadyPresent(tANI_U8 rate, tANI_U16 RateBitmap);
-
 tANI_BOOLEAN csrRatesIsDot11RateSupported( tHalHandle hHal, tANI_U8 rate );
 tANI_U16 csrRatesFindBestRate( tSirMacRateSet *pSuppRates, tSirMacRateSet *pExtRates, tSirMacPropRateSet *pPropRates );
 tSirBssType csrTranslateBsstypeToMacType(eCsrRoamBssType csrtype);
diff --git a/wlan/prima/CORE/SME/inc/nan_Api.h b/wlan/prima/CORE/SME/inc/nan_Api.h
deleted file mode 100644
index 8e49cf0..0000000
--- a/wlan/prima/CORE/SME/inc/nan_Api.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * This file was originally distributed by Qualcomm Atheros, Inc.
- * under proprietary terms before Copyright ownership was assigned
- * to the Linux Foundation.
- */
-
-/******************************************************************************
-*
-* Name:  nan_Api.h
-*
-* Description: NAN FSM defines.
-*
-******************************************************************************/
-
-#ifndef __NAN_API_H__
-#define __NAN_API_H__
-
-#include "vos_types.h"
-#include "halTypes.h"
-
-typedef struct sNanRequestReq
-{
-    tANI_U16 request_data_len;
-    const tANI_U8* request_data;
-} tNanRequestReq, *tpNanRequestReq;
-
-/******************************************************************************
- * Function: Pointer NanCallback
- *
- * Description:
- * this function pointer is used hold nan response callback. When ever driver
- * receives nan response, this callback will be used.
- *
- * Args:
- * first argument to pass hHal pointer and second argument
- * to pass the nan response data.
- *
- * Returns:
- * void
-******************************************************************************/
-typedef void (*NanCallback)(void*, tSirNanEvent*);
-
-/******************************************************************************
- * Function: sme_NanRegisterCallback
- *
- * Description:
- * This function gets called when HDD wants register nan rsp callback with
- * sme layer.
- *
- * Args:
- * hHal and callback which needs to be registered.
- *
- * Returns:
- * void
-******************************************************************************/
-void sme_NanRegisterCallback(tHalHandle hHal, NanCallback callback);
-
-/******************************************************************************
- * Function: sme_NanRequest
- *
- * Description:
- * This function gets called when HDD receives NAN vendor command
- * from userspace
- *
- * Args:
- * hHal, Nan Request structure ptr and sessionId
- *
- * Returns:
- * VOS_STATUS
-******************************************************************************/
-VOS_STATUS sme_NanRequest(tHalHandle hHalHandle, tpNanRequestReq input,
-        tANI_U32 sessionId);
-
-/******************************************************************************
-  \fn sme_NanEvent
-
-  \brief
-  a callback function called when SME received eWNI_SME_NAN_EVENT
-  event from WDA
-
-  \param hHal - HAL handle for device
-  \param pMsg - Message body passed from WDA; includes NAN header
-
-  \return VOS_STATUS
-******************************************************************************/
-VOS_STATUS sme_NanEvent(tHalHandle hHal, void* pMsg);
-
-#endif /* __NAN_API_H__ */
diff --git a/wlan/prima/CORE/SME/inc/oemDataApi.h b/wlan/prima/CORE/SME/inc/oemDataApi.h
index fa8dccc..2ae978b 100644
--- a/wlan/prima/CORE/SME/inc/oemDataApi.h
+++ b/wlan/prima/CORE/SME/inc/oemDataApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -54,14 +54,6 @@
 #define OEM_DATA_RSP_SIZE 1968
 #endif
 
-#ifndef NEW_OEM_DATA_REQ_SIZE
-#define NEW_OEM_DATA_REQ_SIZE 292
-#endif
-
-#ifndef NEW_OEM_DATA_RSP_SIZE
-#define NEW_OEM_DATA_RSP_SIZE 2100
-#endif
-
 /*************************************************************************************************************
   OEM DATA REQ/RSP - DATA STRUCTURES
 *************************************************************************************************************/
@@ -141,30 +133,6 @@
   -------------------------------------------------------------------------------*/
 eHalStatus oemData_IsOemDataReqAllowed(tHalHandle hHal);
 
-
-/* ---------------------------------------------------------------------------
-  OEM DATA REQ NEW - DATA STRUCTURES
-  -------------------------------------------------------------------------------*/
-/* Structure for defining req sent to the PE */
-typedef struct tagOemDataReqNew
-{
-    tSirMacAddr selfMacAddr;
-    tANI_U8 reserved[2];
-    tANI_U8   oemDataReqNew[NEW_OEM_DATA_REQ_SIZE];
-} tOemDataReqNew, tOemDataReqNewConfig;
-
-/* ---------------------------------------------------------------------------
-  OEM DATA RESPONSE - DATA STRUCTURES
-  -------------------------------------------------------------------------------*/
-typedef struct tagOemDataRspNew
-{
-    tANI_U8   oemDataRspNew[NEW_OEM_DATA_RSP_SIZE];
-} tOemDataRspNew;
-
-/*************************************************************************************************************/
-
-void send_oem_data_rsp_msg(tANI_U32 length, tANI_U8 *oemDataRsp);
-
 #endif //_OEM_DATA_API_H__
 
 #endif //FEATURE_OEM_DATA_SUPPORT
diff --git a/wlan/prima/CORE/SME/inc/pmc.h b/wlan/prima/CORE/SME/inc/pmc.h
index 5c75647..0afe567 100644
--- a/wlan/prima/CORE/SME/inc/pmc.h
+++ b/wlan/prima/CORE/SME/inc/pmc.h
@@ -31,6 +31,9 @@
 *
 * Description: Power Management Control (PMC) internal definitions.
 *
+* Copyright 2008 (c) Qualcomm, Incorporated.  
+  All Rights Reserved.
+* Qualcomm Confidential and Proprietary.
 *
 ******************************************************************************/
 
@@ -153,6 +156,9 @@
     void *impsCallbackContext;  /* value to be passed as parameter to routine specified above */
     vos_timer_t hImpsTimer;  /* timer to use with IMPS */
     vos_timer_t hTrafficTimer;  /* timer to measure traffic for BMPS */
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    vos_timer_t hDiagEvtTimer;  /* timer to report PMC state through DIAG event */
+#endif
     vos_timer_t hExitPowerSaveTimer;  /* timer for deferred exiting of power save mode */
     tDblLinkList powerSaveCheckList; /* power save check routine list */
     tDblLinkList requestFullPowerList; /* request full power callback routine list */
@@ -202,7 +208,6 @@
     v_BOOL_t    ImpsReqTimerFailed;
     tANI_U8     ImpsReqFailCnt;
     tANI_U8     ImpsReqTimerfailCnt;
-    tANI_U8     ImpsRspFailCnt;
 
 #ifdef FEATURE_WLAN_BATCH_SCAN
    /*HDD callback to be called after receiving SET BATCH SCAN RSP from FW*/
@@ -246,6 +251,13 @@
 extern void pmcStopTrafficTimer (tHalHandle hHal);
 extern void pmcImpsTimerExpired (tHalHandle hHal);
 extern void pmcTrafficTimerExpired (tHalHandle hHal);
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+extern eHalStatus pmcStartDiagEvtTimer (tHalHandle hHal);
+extern void pmcStopDiagEvtTimer (tHalHandle hHal);
+extern void pmcDiagEvtTimerExpired (tHalHandle hHal);
+#endif
+
 extern void pmcExitPowerSaveTimerExpired (tHalHandle hHal);
 extern tPmcState pmcGetPmcState (tHalHandle hHal);
 extern const char* pmcGetPmcStateStr(tPmcState state);
diff --git a/wlan/prima/CORE/SME/inc/pmcApi.h b/wlan/prima/CORE/SME/inc/pmcApi.h
index 4a1915f..e085be2 100644
--- a/wlan/prima/CORE/SME/inc/pmcApi.h
+++ b/wlan/prima/CORE/SME/inc/pmcApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -35,8 +35,11 @@
 
 * Description: Power Management Control (PMC) API definitions.
 
+* Copyright 2008 (c) Qualcomm, Incorporated.  
+
 * All Rights Reserved.
 
+* Qualcomm Confidential and Proprietary.
 
 *
 
@@ -56,11 +59,6 @@
 //should be large enough to allow the auth, DHCP handshake to complete
 #define BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP 8000  //unit = ms
 
-//This timer value is used to start the timer right after key completion
-//during roaming. This should be small enough to allow STA to enter PS
-//immediately after key completion as no DHCP phase during roaming.
-#define TRAFFIC_TIMER_ROAMING 100  //unit = ms
-
 #define PMC_IS_CHIP_ACCESSIBLE(pmcState) ( (IMPS != (pmcState)) && (REQUEST_IMPS != (pmcState)) && \
        (STANDBY != (pmcState)) && (REQUEST_STANDBY != (pmcState)) )
 
diff --git a/wlan/prima/CORE/SME/inc/smeInside.h b/wlan/prima/CORE/SME/inc/smeInside.h
index bb947dc..a7115c8 100644
--- a/wlan/prima/CORE/SME/inc/smeInside.h
+++ b/wlan/prima/CORE/SME/inc/smeInside.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -35,6 +35,9 @@
   
   \brief prototype for SME structures and APIs used insside SME
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -68,7 +71,7 @@
   ------------------------------------------------------------------------*/
 
 #define SME_TOTAL_COMMAND  30
-#define SME_START_CHAN_STEP 4
+
 
 typedef struct sGenericPmcCmd
 {
@@ -161,6 +164,23 @@
   tANI_U8 tdlsSwMode;
 } tTdlsChanSwitchCmdInfo;
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+typedef struct TdlsDisReqCmdinfo
+{
+      tSirMacAddr peerMac;
+          tANI_U8 tdlsDisType;
+} tTdlsDisReqCmdinfo;
+
+typedef struct tdlsLinkSetupReqCmdinfo
+{
+      tSirMacAddr peerMac;
+} tTdlsLinkSetupReqCmdinfo;
+
+typedef struct tdlsLinkTeardownCmdinfo
+{
+      tSirMacAddr peerMac;
+} tTdlsLinkTeardownCmdinfo;
+#endif
 /*
  * TDLS cmd info, CMD from SME to PE.
  */
@@ -169,6 +189,13 @@
   tANI_U32 size;
   union
   {
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+    tTdlsDisReqCmdinfo tdlsDisReqCmdInfo ;
+    tTdlsLinkSetupReqCmdinfo tdlsLinkSetupReqCmdInfo ;
+    tTdlsLinkTeardownCmdinfo tdlsLinkTeardownCmdInfo ;
+    //tEnterPeerUAPSDInfo enterUapsdInfo ;
+    //tExitPeerUAPSDinfo  exitUapsdInfo ;
+#endif
     tTdlsLinkEstablishCmdInfo tdlsLinkEstablishCmdInfo;
     tTdlsSendMgmtCmdInfo tdlsSendMgmtCmdInfo;
     tTdlsAddStaCmdInfo   tdlsAddStaCmdInfo;
@@ -202,11 +229,6 @@
 #ifdef FEATURE_WLAN_TDLS
         tTdlsCmd  tdlsCmd;
 #endif
-        tSirPNOScanReq pnoInfo;
-        tSirSpoofMacAddrReq macAddrSpoofCmd;
-        tAniGetFrameLogReq getFramelogCmd;
-        struct s_ani_set_tx_max_pwr set_tx_max_pwr;
-        tpNanRequest pNanReq;
     }u;
 }tSmeCmd;
 
@@ -223,8 +245,7 @@
 void smeProcessPendingQueue( tpAniSirGlobal pMac );
 void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd);
 void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
-        tDblLinkList *pList, bool flush_all);
-tANI_U32 sme_get_sessionid_from_activeList(tpAniSirGlobal pMac);
+        tDblLinkList *pList);
 tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac);
 tANI_BOOLEAN pmcProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
 //this function is used to abort a command where the normal processing of the command
@@ -232,8 +253,7 @@
 //the command, if applicable.
 void pmcAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
 tANI_BOOLEAN qosProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
-eHalStatus csrIsValidChannel(tpAniSirGlobal pMac, tANI_U8 chnNum);
-tANI_BOOLEAN csrRoamIsValid40MhzChannel(tpAniSirGlobal pMac, tANI_U8 channel);
+
 eHalStatus csrProcessScanCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
 eHalStatus csrRoamProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
 void csrRoamProcessWmStatusChangeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
@@ -250,23 +270,11 @@
                                          tCsrRoamRemoveKey *pRemoveKey, tANI_U32 roamId );
 eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, tRequestFullPowerReason *pReason,
                                  tANI_BOOLEAN *pfNeedPower);
-bool csr_is_disconnect_full_power_cmd(tSmeCmd *command);
 void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
 
 eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme);
 eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme);
 
-/* ---------------------------------------------------------------------------
-    \fn sme_SetCfgScanControlList
-    \brief  API to set Scan Control List
-    \param  hHal - The handle returned by macOpen.
-    \param  countryCode -  Pointer to the countryCode
-    \param  pChannelList -  Pointer to the valid channel list
-    \return eHalStatus
-  ---------------------------------------------------------------------------*/
-eHalStatus sme_SetCfgScanControlList(tHalHandle hHal, tANI_U8 *countryCode,
-                                                    tCsrChannel *pChannelList);
-
 #ifdef FEATURE_OEM_DATA_SUPPORT
 eHalStatus oemData_ProcessOemDataReqCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand);
 #endif
@@ -274,9 +282,7 @@
 eHalStatus csrProcessAddStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
 eHalStatus csrProcessAddStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
 eHalStatus csrProcessDelStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
-eHalStatus csrProcessMacAddrSpoofCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
 eHalStatus csrProcessDelStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
-eHalStatus csrProcessGetFrameLogCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
 
 #ifdef WLAN_NS_OFFLOAD
 /* ---------------------------------------------------------------------------
@@ -304,33 +310,11 @@
 eHalStatus csrTdlsSendMgmtReq(tHalHandle hHal, tANI_U8 sessionId, tCsrTdlsSendMgmt *tdlsSendMgmt);
 VOS_STATUS csrTdlsSendLinkEstablishParams(tHalHandle hHal,
                                           tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                          const tSirMacAddr peerMac,
-#else
                                           tSirMacAddr peerMac,
-#endif
                                           tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams);
-eHalStatus csrTdlsAddPeerSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                             const tSirMacAddr peerMac
-#else
-                             tSirMacAddr peerMac
-#endif
-                             );
-eHalStatus csrTdlsChangePeerSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                const tSirMacAddr peerMac,
-#else
-                                tSirMacAddr peerMac,
-#endif
-                                tCsrStaParams *pstaParams);
-eHalStatus csrTdlsDelPeerSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                             const tSirMacAddr peerMac
-#else
-                             tSirMacAddr peerMac
-#endif
-                             );
+eHalStatus csrTdlsAddPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac);
+eHalStatus csrTdlsChangePeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac, tCsrStaParams *pstaParams);
+eHalStatus csrTdlsDelPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac);
 eHalStatus csrTdlsProcessCmd(tpAniSirGlobal pMac,tSmeCmd *pCommand );
 eHalStatus csrTdlsProcessLinkEstablish( tpAniSirGlobal pMac, tSmeCmd *cmd );
 eHalStatus csrTdlsProcessChanSwitchReq(tpAniSirGlobal pMac, tSmeCmd *cmd ); //tdlsoffchan
@@ -341,6 +325,14 @@
                                     tANI_S32 tdlsOffCh,
                                     tANI_S32 tdlsOffChBwOffset,
                                     tANI_U8 tdlsSwMode);
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+eHalStatus csrTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId,
+                                          tCsrTdlsDisRequest *tdlsDisReq);
+eHalStatus csrTdlsSetupReq(tHalHandle hHal, tANI_U8 sessionId,
+                                         tCsrTdlsSetupRequest *tdlsSetupReq);
+eHalStatus csrTdlsTeardownReq(tHalHandle hHal, tANI_U8 sessionId,
+                                         tCsrTdlsTeardownRequest *teardown);
+#endif
 #endif /* FEATURE_WLAN_TDLS */
 
 #if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
@@ -359,6 +351,4 @@
 #endif
 void activeListCmdTimeoutHandle(void *userData);
 
-void csrGetStaticUapsdMask(tpAniSirGlobal pMac, tANI_U8 *staticUapsdMask);
-
 #endif //#if !defined( __SMEINSIDE_H )
diff --git a/wlan/prima/CORE/SME/inc/smeInternal.h b/wlan/prima/CORE/SME/inc/smeInternal.h
index 3280a92..57740f8 100644
--- a/wlan/prima/CORE/SME/inc/smeInternal.h
+++ b/wlan/prima/CORE/SME/inc/smeInternal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,6 +38,9 @@
   
   \brief prototype for SME internal structures and APIs used for SME and MAC
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -52,7 +55,6 @@
 #include "vos_memory.h"
 #include "vos_types.h"
 #include "csrLinkList.h"
-#include "vos_diag_core_event.h"
 
 /*-------------------------------------------------------------------------- 
   Type declarations
@@ -72,10 +74,6 @@
     eSmeCommandRemoveKey,
     eSmeCommandAddStaSession,
     eSmeCommandDelStaSession,
-    eSmeCommandPnoReq,
-    eSmeCommandMacSpoofRequest,
-    eSmeCommandGetFrameLogRequest,
-    eSmeCommandSetMaxTxPower,
 #ifdef FEATURE_WLAN_TDLS
     //eSmeTdlsCommandMask = 0x80000,  //To identify TDLS commands <TODO>
     //These can be considered as csr commands. 
@@ -84,8 +82,14 @@
     eSmeCommandTdlsDelPeer, 
     eSmeCommandTdlsLinkEstablish,
     eSmeCommandTdlsChannelSwitch, // tdlsoffchan
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+    eSmeCommandTdlsDiscovery,
+    eSmeCommandTdlsLinkSetup,
+    eSmeCommandTdlsLinkTear,
+    eSmeCommandTdlsEnterUapsd,
+    eSmeCommandTdlsExitUapsd,
 #endif
-    eSmeCommandNanReq,
+#endif
     //PMC
     eSmePmcCommandMask = 0x20000, //To identify PMC commands
     eSmeCommandEnterImps,
@@ -119,27 +123,6 @@
 #define SME_IS_START(pMac)  (SME_STATE_STOP != (pMac)->sme.state)
 #define SME_IS_READY(pMac)  (SME_STATE_READY == (pMac)->sme.state)
 
-#ifdef WLAN_FEATURE_RMC
-
-/* HDD Callback function */
-typedef void(*pIbssPeerInfoCb)(void *pUserData, void *infoParam);
-
-/* Peer info */
-typedef struct tagSmePeerInfoHddCbkInfo
-{
-   void *pUserData;
-   pIbssPeerInfoCb peerInfoCbk;
-}tSmePeerInfoHddCbkInfo;
-#endif /* WLAN_FEATURE_RMC */
-
-/* HDD Callback function */
-typedef void(*pEncryptMsgRSPCb)(void *pUserData, void *infoParam);
-
-typedef struct tagSmeEncMsgHddCbkInfo
-{
-   void *pUserData;
-   pEncryptMsgRSPCb pEncMsgCbk;
-}tSmeEncMsgHddCbkInfo;
 
 typedef struct tagSmeStruct
 {
@@ -160,9 +143,6 @@
     tDblLinkList smeScanCmdPendingList;
     //active scan command list
     tDblLinkList smeScanCmdActiveList;
-#ifdef WLAN_FEATURE_RMC
-    tSmePeerInfoHddCbkInfo peerInfoParams;
-#endif /* WLAN_FEATURE_RMC */
 #ifdef FEATURE_WLAN_CH_AVOID
     void (*pChAvoidNotificationCb) (void *pAdapter, void *indParam);
 #endif /* FEATURE_WLAN_CH_AVOID */
@@ -179,14 +159,7 @@
    int  extScanStartReqId;
    void *pEXTScanCallbackContext;
 #endif /* WLAN_FEATURE_EXTSCAN */
-   tSmeEncMsgHddCbkInfo pEncMsgInfoParams;
    void (*pBtCoexTDLSNotification) (void *pAdapter, int);
-   void (*nanCallback) (void*, tSirNanEvent*);
-   void (*rssiThresholdBreachedCb)(void *, struct rssi_breach_event *);
-#ifdef FEATURE_OEM_DATA_SUPPORT
-   void (*pOemDataIndCb) (void *, const tANI_U16, void *, tANI_U32);
-   void *pOemDataCallbackContext;
-#endif /* FEATURE_OEM_DATA_SUPPORT */
 
 } tSmeStruct, *tpSmeStruct;
 
diff --git a/wlan/prima/CORE/SME/inc/smeQosInternal.h b/wlan/prima/CORE/SME/inc/smeQosInternal.h
index 7398893..c8f08a8 100644
--- a/wlan/prima/CORE/SME/inc/smeQosInternal.h
+++ b/wlan/prima/CORE/SME/inc/smeQosInternal.h
@@ -35,6 +35,9 @@
   
   \brief prototype for SME QoS APIs
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/SME/inc/smeRrmInternal.h b/wlan/prima/CORE/SME/inc/smeRrmInternal.h
index 9ba377d..e0b6966 100644
--- a/wlan/prima/CORE/SME/inc/smeRrmInternal.h
+++ b/wlan/prima/CORE/SME/inc/smeRrmInternal.h
@@ -36,6 +36,9 @@
   
   \brief prototype for SME RRM APIs
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/SME/inc/sme_Api.h b/wlan/prima/CORE/SME/inc/sme_Api.h
index 842f998..ed7230d 100644
--- a/wlan/prima/CORE/SME/inc/sme_Api.h
+++ b/wlan/prima/CORE/SME/inc/sme_Api.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,6 +38,9 @@
   
   \brief prototype for SME APIs
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -46,7 +49,6 @@
 /*--------------------------------------------------------------------------
   Include Files
   ------------------------------------------------------------------------*/
-#include <linux/version.h>
 #include "ccmApi.h"
 #include "csrApi.h"
 #include "pmcApi.h"
@@ -57,9 +59,6 @@
 #include "btcApi.h"
 #include "vos_nvitem.h"
 #include "p2p_Api.h"
-#ifdef WLAN_FEATURE_RMC
-#include "smeInternal.h"
-#endif
 
 #ifdef FEATURE_OEM_DATA_SUPPORT
 #include "oemDataApi.h"
@@ -68,7 +67,6 @@
 #if defined WLAN_FEATURE_VOWIFI
 #include "smeRrmInternal.h"
 #endif
-#include "nan_Api.h"
 
 /*-------------------------------------------------------------------------- 
   Preprocessor definitions and constants
@@ -80,7 +78,6 @@
 #define SME_GLOBAL_CLASSC_STATS   8
 #define SME_GLOBAL_CLASSD_STATS  16
 #define SME_PER_STA_STATS        32
-#define SME_PER_PKT_STATS        64
 
 #define SME_INVALID_COUNTRY_CODE "XX"
 
@@ -90,56 +87,6 @@
 //Macro to indicate invalid no of tspecs
 #define INVALID_TSPEC 100
 
-#define SME_SET_CHANNEL_REG_POWER(reg_info_1, val) do { \
-    reg_info_1 &= 0xff00ffff;             \
-    reg_info_1 |= ((val & 0xff) << 16);   \
-} while(0)
-
-#define SME_SET_CHANNEL_MAX_TX_POWER(reg_info_2, val) do { \
-    reg_info_2 &= 0xffff00ff;             \
-    reg_info_2 |= ((val & 0xff) << 8);   \
-} while(0)
-
-/**
- * ALLOWED_ACTION_FRAMES_BITMAP
- *
- * Bitmask is based on the below.The frames with 0's
- * set to their corresponding bit can be dropped in FW.
- *
- * -----------------------------+-----+-------+
- *         Type                 | Bit | Allow |
- * -----------------------------+-----+-------+
- * SIR_MAC_ACTION_SPECTRUM_MGMT    0      1
- * SIR_MAC_ACTION_QOS_MGMT         1      1
- * SIR_MAC_ACTION_DLP              2      0
- * SIR_MAC_ACTION_BLKACK           3      1
- * SIR_MAC_ACTION_PUBLIC_USAGE     4      1
- * SIR_MAC_ACTION_RRM              5      1
- * SIR_MAC_ACTION_FAST_BSS_TRNST   6      0
- * SIR_MAC_ACTION_HT               7      0
- * SIR_MAC_ACTION_SA_QUERY         8      1
- * SIR_MAC_ACTION_PROT_DUAL_PUB    9      0
- * SIR_MAC_ACTION_WNM             10      1
- * SIR_MAC_ACTION_UNPROT_WNM      11      0
- * SIR_MAC_ACTION_TDLS            12      0
- * SIR_MAC_ACITON_MESH            13      0
- * SIR_MAC_ACTION_MHF             14      0
- * SIR_MAC_SELF_PROTECTED         15      0
- * SIR_MAC_ACTION_WME             17      1
- * SIR_MAC_ACTION_FST             18      0
- * SIR_MAC_ACTION_VHT             21      1
- * ----------------------------+------+-------+
- */
-#define ALLOWED_ACTION_FRAMES_BITMAP \
-             ((1 << SIR_MAC_ACTION_SPECTRUM_MGMT) | \
-              (1 << SIR_MAC_ACTION_QOS_MGMT) | \
-              (1 << SIR_MAC_ACTION_BLKACK) | \
-              (1 << SIR_MAC_ACTION_PUBLIC_USAGE) | \
-              (1 << SIR_MAC_ACTION_RRM) | \
-              (1 << SIR_MAC_ACTION_SA_QUERY) | \
-              (1 << SIR_MAC_ACTION_WNM) | \
-              (1 << SIR_MAC_ACTION_WME) | \
-              (1 << SIR_MAC_ACTION_VHT))
 /*-------------------------------------------------------------------------- 
   Type declarations
   ------------------------------------------------------------------------*/
@@ -293,26 +240,26 @@
 eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
                               tSirEXTScanResetBssidHotlistReqParams *pResetReq);
 
-/**
- * sme_set_ssid_hotlist() - Set the SSID hotlist
- * @hal: SME handle
- * @request: set ssid hotlist request
- *
- * Return: eHalStatus
- */
-eHalStatus sme_set_ssid_hotlist(tHalHandle hal,
-             tSirEXTScanSetSsidHotListReqParams *request);
-
 /* ---------------------------------------------------------------------------
-    \fn sme_ResetBssHotlist
-    \brief  SME API to reset BSSID hotlist
+    \fn sme_SetSignificantChange
+    \brief  SME API to set significant change
     \param  hHal
-    \param  pSetHotListReq: Extented Scan set hotlist structure
+    \param  pSetSignificantChangeReq: Extented Scan set significant
+            change structure
     \- return eHalStatus
     -------------------------------------------------------------------------*/
-eHalStatus sme_reset_ssid_hotlist (tHalHandle hHal,
-                              tSirEXTScanResetSsidHotlistReqParams *pResetReq);
+eHalStatus sme_SetSignificantChange (tHalHandle hHal,
+            tSirEXTScanSetSignificantChangeReqParams* pSetSignificantChangeReq);
 
+/* ---------------------------------------------------------------------------
+    \fn sme_ResetSignificantChange
+    \brief  SME API to reset significant change
+    \param  hHal
+    \param  pResetReq: Extented Scan reset significant change structure
+    \- return eHalStatus
+    -------------------------------------------------------------------------*/
+eHalStatus sme_ResetSignificantChange (tHalHandle hHal,
+              tSirEXTScanResetSignificantChangeReqParams *pResetReq);
 
 /* ---------------------------------------------------------------------------
     \fn sme_getCachedResults
@@ -335,20 +282,7 @@
                           void *);
 
 #endif /* WLAN_FEATURE_EXTSCAN */
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-eHalStatus sme_OemDataRegisterCallback (tHalHandle hHal,
-               void (*pOemDataIndCb)(void *, const tANI_U16, void *, tANI_U32),
-               void *callbackContext);
-#endif
-
-/* ---------------------------------------------------------------------------
-    \fn sme_SpoofMacAddrReq
-    \brief  SME API to send Spoof Mac Addr req to HAL
-    \param  macaddr: mac address to be sent
-    \- return eHalStatus
-    -------------------------------------------------------------------------*/
-eHalStatus  sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr);
+tANI_BOOLEAN  sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr);
 
 typedef enum
 {
@@ -403,21 +337,6 @@
 eHalStatus sme_Close(tHalHandle hHal);
 
 /*--------------------------------------------------------------------------
-
-  \brief sme_PreClose() - Stop SME resources prior to final sme_Stop.
-
-  The function stops resources in SME, PMC, CCM, CSR, etc. as needed
-  to handle fast closure during SSR/unload-load cases.
-
-  \param hHal - The handle returned by macOpen.
-  \return v_VOID_t
-
-  \sa
-
-  --------------------------------------------------------------------------*/
-v_VOID_t sme_PreClose(tHalHandle hHal);
-
-/*--------------------------------------------------------------------------
   
   \brief sme_Start() - Put all SME modules at ready state.
   
@@ -495,26 +414,22 @@
   
   This is a synchronous API.
 
+  
   \param hHal - The handle returned by macOpen.
 
   \param sessionId - A previous opened session's ID.
-
-  \param bPurgeSmeCmdList  - Whether sme cmd list purging is required or not.
-                             TRUE -Purging require FALSE - Purging not require
-
+  
   \return eHAL_STATUS_SUCCESS - session is closed. 
   
           Other status means SME is failed to open the session.  
           eHAL_STATUS_INVALID_PARAMETER - session is not opened. 
   \sa
-
-
+  
   --------------------------------------------------------------------------*/
 eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
-                            tANI_BOOLEAN fSync,
-                            tANI_U8 bPurgeSmeCmdList,
-                            csrRoamSessionCloseCallback callback,
-                            void *pContext);
+                         csrRoamSessionCloseCallback callback, void *pContext);
+
+
 
 /*--------------------------------------------------------------------------
   
@@ -731,16 +646,6 @@
  */
 eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId);
 
-/*
- * ---------------------------------------------------------------------------
- *  \fn sme_FilterScanDFSResults
- *  \brief a wrapper function to request CSR to filter BSSIDs on DFS channels
- *         from the scan results.
- *  \return eHalStatus
- *---------------------------------------------------------------------------
- */
-eHalStatus sme_FilterScanDFSResults(tHalHandle hHal);
-
 eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId);
 
 /* ---------------------------------------------------------------------------
@@ -864,21 +769,6 @@
 eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason);
 
 /* ---------------------------------------------------------------------------
-    \fn.sme_abortConnection
-    \brief a wrapper function to request CSR to stop from connecting a network
-    \retun void.
----------------------------------------------------------------------------*/
-
-void sme_abortConnection(tHalHandle hHal, tANI_U8 sessionId);
-
-/* ---------------------------------------------------------------------------
-    \fn.sme_dhcp_done_ind
-    \brief a wrapper function to set dhcp done ind  in sme session
-    \retun void.
----------------------------------------------------------------------------*/
-void sme_dhcp_done_ind(tHalHandle hal, uint8_t session_id);
-
-/* ---------------------------------------------------------------------------
     \fn sme_RoamStopBss
     \brief a wrapper function to request CSR to stop bss
     \param sessionId    - sessionId of SoftAP
@@ -908,13 +798,7 @@
     \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
     \return eHalStatus  SUCCESS  Roam callback will be called to indicate actual results
   -------------------------------------------------------------------------------*/
-eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                 const tANI_U8 *pPeerMacAddr
-#else
-                                 tANI_U8 *pPeerMacAddr
-#endif
-                                 );
+eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *pPeerMacAddr);
 
 /* ---------------------------------------------------------------------------
     \fn sme_RoamDeauthSta
@@ -1882,40 +1766,6 @@
                                          tANI_U8 *pCountry,
                                          v_REGDOMAIN_t reg_domain);
 
-#ifdef WLAN_FEATURE_RMC
-/* ---------------------------------------------------------------------------
-
-    \fn sme_TXFailMonitorStartStopInd
-
-    \brief Indicate FW about TX Fail Monitor Indication`
-
-    \param hHal - The handle returned by macOpen.
-
-    \param tx_fail_count number of failures after which the firmware sends
-                         an indication to host
-
-    \param txFailIndCallback function to be called after receiving TX Fail
-                             indication
-    \return eHalStatus  SUCCESS.
-
-                         FAILURE or RESOURCES  The API finished and failed.
-
-  -------------------------------------------------------------------------------*/
-eHalStatus sme_TXFailMonitorStartStopInd(tHalHandle hHal,
-                                         tANI_U8 tx_fail_count,
-                                         void * txFailIndCallback);
-#endif /* WLAN_FEATURE_RMC */
-
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-VOS_STATUS sme_set_per_roam_rxconfig (tHalHandle hHal, v_U8_t sessionId,
-                  v_U16_t minRate, v_U16_t maxRate, v_U8_t minPercentage,
-                  v_U16_t minPktRequired, v_U64_t waitPeriodForNextPERScan);
-
-VOS_STATUS sme_unset_per_roam_rxconfig (tHalHandle hHal);
-
-void sme_PERRoamScanStartStop(void *hHal, tANI_U8 start);
-#endif
-
 /* ---------------------------------------------------------------------------
 
     \fn sme_DHCPStartInd
@@ -2157,14 +2007,6 @@
 eHalStatus sme_getOemDataRsp(tHalHandle hHal, 
                                          tOemDataRsp **pOemDataRsp);
 
-/* ---------------------------------------------------------------------------
-    \fn sme_OemDataReqNew
-    \brief a wrapper function for OEM DATA REQ NEW
-    \param pOemDataReqNewConfig - Data to be passed to FW
-  ---------------------------------------------------------------------------*/
-void sme_OemDataReqNew(tHalHandle hHal,
-        tOemDataReqNewConfig *pOemDataReqNewConfig);
-
 #endif /*FEATURE_OEM_DATA_SUPPORT*/
 
 
@@ -2259,9 +2101,6 @@
 -------------------------------------------------------------------------------*/
 eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId);
 
-eHalStatus sme_register_mgmt_frame_ind_callback(tHalHandle hHal,
-      sir_mgmt_frame_ind_callback callback);
-
 /* ---------------------------------------------------------------------------
 
     \fn sme_RegisterMgtFrame
@@ -2289,73 +2128,6 @@
   -------------------------------------------------------------------------------*/
 eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, 
                      tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen);
-/* ---------------------------------------------------------------------------
-    \fn sme_GetFramesLog
-    \brief a wrapper function that client calls to register a callback to get
-           mgmt frames logged
-    \param flag - flag tells to clear OR send the frame log buffer
-    \return eHalStatus
-  ---------------------------------------------------------------------------*/
-eHalStatus sme_GetFramesLog(tHalHandle hHal, tANI_U8 flag);
-/* ---------------------------------------------------------------------------
-
-  \fn    sme_InitMgmtFrameLogging
-
-  \brief
-    SME will pass this request to lower mac to initialize Frame Logging.
-
-  \param
-
-    hHal - The handle returned by macOpen.
-
-    wlanFWLoggingInitParam - Params to initialize frame logging
-
-  \return eHalStatus
---------------------------------------------------------------------------- */
-eHalStatus sme_InitMgmtFrameLogging( tHalHandle hHal,
-                            tpSirFWLoggingInitParam wlanFWLoggingInitParam);
-
-
-/* ---------------------------------------------------------------------------
-
-  \fn    sme_StopRssiMonitoring
-
-  \brief
-    SME will pass this request to lower mac to stop monitoring rssi range on
-    a bssid.
-
-  \param
-
-    hHal - The handle returned by macOpen.
-
-    tSirRssiMonitorReq req- depict the monitor req params.
-
-  \return eHalStatus
-
---------------------------------------------------------------------------- */
-eHalStatus sme_StopRssiMonitoring(tHalHandle hHal,
-                            tSirRssiMonitorReq *req);
-
-/* ---------------------------------------------------------------------------
-
-  \fn    sme_StartRssiMonitoring
-
-  \brief
-    SME will pass this request to lower mac to start monitoring rssi range on
-    a bssid.
-
-  \param
-
-    hHal - The handle returned by macOpen.
-
-    tSirRssiMonitorReq req- depict the monitor req params.
-
-  \return eHalStatus
-
---------------------------------------------------------------------------- */
-eHalStatus sme_StartRssiMonitoring(tHalHandle hHal,
-                            tSirRssiMonitorReq *req);
-
 
 /* ---------------------------------------------------------------------------
 
@@ -2500,11 +2272,12 @@
     \brief  API to cancel MAC scan.
     \param  hHal - The handle returned by macOpen.
     \param  sessionId - sessionId for interface
-    \return tSirAbortScanStatus return status abort scan
-
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE - failure
+            VOS_STATUS_SUCCESS  success
   ---------------------------------------------------------------------------*/
-tSirAbortScanStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
-                                     eCsrAbortReason reason);
+eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
+                            eCsrAbortReason reason);
 
 /* ---------------------------------------------------------------------------
     \fn sme_GetCfgValidChannels
@@ -3355,8 +3128,6 @@
 eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal, v_BOOL_t nRoamScanOffloadEnabled);
 #endif
 
-eHalStatus sme_FwMemDumpReq(tHalHandle hHal, tAniFwrDumpReq *recv_req);
-
 
 /* ---------------------------------------------------------------------------
     \fn sme_IsFeatureSupportedByFW
@@ -3392,13 +3163,9 @@
     -------------------------------------------------------------------------*/
 
 VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
-                                           tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                           const tSirMacAddr peerMac,
-#else
-                                           tSirMacAddr peerMac,
-#endif
-                                           tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams);
+                                                   tANI_U8 sessionId,
+                                                   tSirMacAddr peerMac,
+                                                   tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams);
 
 /* ---------------------------------------------------------------------------
     \fn sme_SendTdlsMgmtFrame
@@ -3414,15 +3181,8 @@
     \param responder - Tdls request type
     \- return VOS_STATUS_SUCCES
     -------------------------------------------------------------------------*/
-VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                 const tSirMacAddr peerMac,
-#else
-                                 tSirMacAddr peerMac,
-#endif
-                                 tANI_U8 frame_type, tANI_U8 dialog,
-                                 tANI_U16 status, tANI_U32 peerCapability,
-                                 tANI_U8 *buf, tANI_U8 len, tANI_U8 responder);
+VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
+      tANI_U8 frame_type, tANI_U8 dialog, tANI_U16 status, tANI_U32 peerCapability, tANI_U8 *buf, tANI_U8 len, tANI_U8 responder);
 /* ---------------------------------------------------------------------------
     \fn sme_ChangeTdlsPeerSta
     \brief  API to Update TDLS peer sta parameters.
@@ -3431,12 +3191,7 @@
     \param  staParams - Peer Station Parameters.
     \- return VOS_STATUS_SUCCES
     -------------------------------------------------------------------------*/
-VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                 const tSirMacAddr peerMac,
-#else
-                                 tSirMacAddr peerMac,
-#endif
+VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
                                  tCsrStaParams *pstaParams);
 /* ---------------------------------------------------------------------------
     \fn sme_AddTdlsPeerSta
@@ -3445,13 +3200,7 @@
     \param  peerMac - peer's Mac Adress.
     \- return VOS_STATUS_SUCCES
     -------------------------------------------------------------------------*/
-VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                              const tSirMacAddr peerMac
-#else
-                              tSirMacAddr peerMac
-#endif
-                              );
+VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac);
 /* ---------------------------------------------------------------------------
     \fn sme_DeleteTdlsPeerSta
     \brief  API to Delete TDLS peer sta entry.
@@ -3459,13 +3208,7 @@
     \param  peerMac - peer's Mac Adress.
     \- return VOS_STATUS_SUCCES
     -------------------------------------------------------------------------*/
-VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                 const tSirMacAddr peerMac
-#else
-                                 tSirMacAddr peerMac
-#endif
-                                );
+VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac);
 /* ---------------------------------------------------------------------------
     \fn sme_SetTdlsPowerSaveProhibited
     \API to set/reset the isTdlsPowerSaveProhibited.
@@ -3482,62 +3225,21 @@
     -------------------------------------------------------------------------*/
 v_BOOL_t sme_IsPmcBmps(tHalHandle hHal);
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+typedef struct smeTdlsDisResult
+{
+      tSirMacAddr tdlsPeerMac;
+          v_S7_t tdlsPeerRssi;
+} tSmeTdlsDisResult;
+
+VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac);
+v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
+                                 tSmeTdlsDisResult *disResult, v_U8_t listType);
+VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac);
+VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac);
+#endif /* FEATURE_WLAN_TDLS */
 eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan);
 
-/* ---------------------------------------------------------------------------
-    \fn sme_UpdateDFSRoamMode
-    \brief  Update DFS roam scan mode
-            This function is called to configure allowDFSChannelRoam
-            dynamically
-    \param  hHal - HAL handle for device
-    \param  allowDFSChannelRoam - DFS roaming scan mode
-            mode 0 disable roam scan on DFS channels
-            mode 1 enables roam scan (passive/active) on DFS channels
-    \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
-            successfully.
-            Other status means SME failed to update DFS roaming scan config.
-    \sa
-    -------------------------------------------------------------------------*/
-eHalStatus sme_UpdateDFSRoamMode(tHalHandle hHal, tANI_U8 allowDFSChannelRoam);
-
-/* ---------------------------------------------------------------------------
-    \fn sme_UpdateDFSScanMode
-    \brief  Update DFS scan mode
-            This function is called to configure fEnableDFSChnlScan.
-    \param  hHal - HAL handle for device
-    \param  dfsScanMode - DFS scan mode
-            mode 0 disable scan on DFS channels
-            mode 1 enables passive scan on DFS channels
-            mode 2 enables active scan on DFS channels for static list
-    \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
-            successfully.
-            Other status means SME failed to update DFS scan config.
-    \sa
-    -------------------------------------------------------------------------*/
-eHalStatus sme_UpdateDFSScanMode(tHalHandle hHal, tANI_U8 dfsScanMode);
-
-/*--------------------------------------------------------------------------
-  \brief sme_GetDFSScanMode() - get DFS scan mode
-  \param hHal - The handle returned by macOpen.
-  \return DFS scan mode
-            mode 0 disable scan on DFS channels
-            mode 1 enables passive scan on DFS channels
-            mode 2 enables active scan on DFS channels for static list
-  \sa
-  --------------------------------------------------------------------------*/
-v_U8_t sme_GetDFSScanMode(tHalHandle hHal);
-
-/* ---------------------------------------------------------------------------
-    \fn sme_HandleDFSChanScan
-    \brief  Gets Valid channel list and updates scan control list according to
-             dfsScanMode
-    \param  hHal - HAL handle for device
-    \return eHAL_STATUS_FAILURE when failed to get valid channel list
-            Otherwise eHAL_STATUS_SUCCESS -
-    \sa
-    -------------------------------------------------------------------------*/
-eHalStatus sme_HandleDFSChanScan(tHalHandle hHal);
-
 /*
  * SME API to enable/disable WLAN driver initiated SSR
  */
@@ -3602,17 +3304,6 @@
   --------------------------------------------------------------------------*/
 VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal);
 
-/*--------------------------------------------------------------------------
-  \brief hdd_is_any_session_connected() - a wrapper function to check if there
-                                           is any connected session .
-  This is a synchronous call
-  \param hHal - The handle returned by macOpen
-  \return VOS_STATUS - SME passed the request to CSR successfully.
-          Other status means SME is failed to send the request.
-  \sa
-  --------------------------------------------------------------------------*/
-VOS_STATUS sme_is_any_session_connected(tHalHandle hHal);
-
 #ifdef FEATURE_WLAN_LPHB
 /* ---------------------------------------------------------------------------
     \fn sme_LPHBConfigReq
@@ -3658,28 +3349,6 @@
 void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
                                     tANI_U8 nNumP2PChan);
 
-#ifdef WLAN_FEATURE_RMC
-/* ---------------------------------------------------------------------------
-    \fn sme_EnableRMC
-    \brief  Used to enable RMC
-    setting will not persist over reboots
-    \param  hHal
-    \param  sessionId
-    \- return eHalStatus
-    -------------------------------------------------------------------------*/
-eHalStatus sme_EnableRMC(tHalHandle hHal, tANI_U32 sessionId);
-
-/* ---------------------------------------------------------------------------
-    \fn sme_DisableRMC
-    \brief  Used to disable RMC
-    setting will not persist over reboots
-    \param  hHal
-    \param  sessionId
-    \- return eHalStatus
-    -------------------------------------------------------------------------*/
-eHalStatus sme_DisableRMC(tHalHandle hHal, tANI_U32 sessionId);
-#endif /* WLAN_FEATURE_RMC */
-
 /* ---------------------------------------------------------------------------
     \fn sme_SendRateUpdateInd
     \brief  API to Update rate
@@ -3689,21 +3358,6 @@
   ---------------------------------------------------------------------------*/
 eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams);
 
-#ifdef WLAN_FEATURE_RMC
-/* ---------------------------------------------------------------------------
-    \fn sme_GetIBSSPeerInfo
-    \brief  Used to disable RMC
-    setting will not persist over reboots
-    \param  hHal
-    \param  ibssPeerInfoReq  multicast Group IP address
-    \- return eHalStatus
-    -------------------------------------------------------------------------*/
-eHalStatus sme_RequestIBSSPeerInfo(tHalHandle hHal, void *pUserData,
-                                            pIbssPeerInfoCb peerInfoCbk,
-                                            tANI_BOOLEAN allPeerInfoReqd,
-                                            tANI_U8 staIdx);
-#endif /* WLAN_FEATURE_RMC */
-
 /*
  * sme API to trigger fast BSS roam to a given BSSID independent of RSSI
  * triggers
@@ -3711,15 +3365,10 @@
 */
 eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
                                             tANI_U8 *bssid,
-                                            tSmeFastRoamTrigger fastRoamTrig,
-                                            tANI_U8 channel);
+                                            tSmeFastRoamTrigger fastRoamTrig);
 
 eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                      const tANI_U8 *pBSSId,
-#else
                                       tANI_U8 *pBSSId,
-#endif
                                       tANI_BOOLEAN flush_cache );
 
 void smeGetCommandQStatus( tHalHandle hHal );
@@ -3795,7 +3444,6 @@
 );
 #endif /* FEATURE_WLAN_CH_AVOID */
 eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value);
-
 /* ---------------------------------------------------------------------------
     \fn sme_requestTypetoString
     \brief API to convert requestType enum values
@@ -3820,34 +3468,16 @@
                                      tANI_S32 tdlsOffCh,
                                      tANI_S32 tdlsOffChBwOffset,
                                      tANI_U8 tdlsSwMode);
-eHalStatus sme_GetFwStats(tHalHandle hHal, tANI_U32 stats,
-                 void *pContext, tSirFWStatsCallback callback);
+
 void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode);
 
 void sme_resetCoexEevent(tHalHandle hHal);
 
 tANI_U32 sme_GetChannelBondingMode5G(tHalHandle hHal);
 tANI_U32 sme_GetChannelBondingMode24G(tHalHandle hHal);
-#ifdef WLAN_FEATURE_AP_HT40_24G
-void sme_UpdateChannelBondingMode24G(tHalHandle hHal,
-                                      tANI_U8 cbMode);
-eHalStatus sme_SetHT2040Mode(tHalHandle hHal,
-                   tANI_U8 sessionId, tANI_U8 cbMode);
-#endif
-
-eHalStatus sme_set_rssi_threshold_breached_cb(tHalHandle hal,
-                        void (*cb)(void *, struct rssi_breach_event *));
 
 void sme_disable_dfs_channel(tHalHandle hHal, bool disable_dfs);
 
-/* HDD Callback function */
-typedef void(*pEncryptMsgRSPCb)(void *pUserData, void *infoParam);
-
-eHalStatus sme_Encryptmsgsend (tHalHandle hHal,
-                               u8 *pCmd,
-                               int length,
-                               pEncryptMsgRSPCb encCB);
-
 /* ---------------------------------------------------------------------------
      \fn sme_RegisterBtCoexTDLSCallback
      \brief  Used to plug in callback function
@@ -3864,100 +3494,15 @@
 );
 
 /* ---------------------------------------------------------------------------
-    \fn smeNeighborMiddleOfRoaming
+    \fn smeNeighborRoamIsHandoffInProgress
 
-    \brief This function is a wrapper to call csrNeighborMiddleOfRoaming
+    \brief This function is a wrapper to call csrNeighborRoamIsHandoffInProgress
 
     \param hHal - The handle returned by macOpen.
 
     \return eANI_BOOLEAN_TRUE if reassoc in progress,
             eANI_BOOLEAN_FALSE otherwise
 ---------------------------------------------------------------------------*/
-tANI_BOOLEAN smeNeighborMiddleOfRoaming(tHalHandle hHal);
+tANI_BOOLEAN smeNeighborRoamIsHandoffInProgress(tHalHandle hHal);
 
-/* ---------------------------------------------------------------------------
-
-    \fn sme_IsTdlsOffChannelValid
-    \brief To check if the channel is valid for currently established domain
-    This is a synchronous API.
-
-    \param hHal - The handle returned by macOpen.
-    \param channel - channel to verify
-
-    \return TRUE/FALSE, TRUE if channel is valid
-
-  -------------------------------------------------------------------------------*/
-tANI_BOOLEAN sme_IsTdlsOffChannelValid(tHalHandle hHal, tANI_U8 channel);
-
-/* --------------------------------------------------------------------------
-
-    \fn sme_IsCoexScoIndicationSet
-    \brief To check if the BTC module in fwr has sent the SCO
-           indication to host or not
-
-    \param hHal - The handle returned by macOpen.
-    \return TRUE - Sco call in progress FALSE- No SCO call in progress
-
-  --------------------------------------------------------------------------*/
-tANI_BOOLEAN sme_IsCoexScoIndicationSet(tHalHandle hHal);
-
-eHalStatus sme_SetMiracastVendorConfig(tHalHandle hHal,
-                               tANI_U32 iniNumBuffAdvert,
-                                      tANI_U32 set_value);
-
-void sme_SetDefDot11Mode(tHalHandle hHal);
-
-/* ---------------------------------------------------------------------------
-    \fn sme_SetTdls2040BSSCoexistence
-    \brief  API to enable or disable 20_40 BSS Coexistence IE in TDLS frames.
-
-    \param  isEnabled - Enable or Disable.
-    \- return VOS_STATUS_SUCCES
-   -------------------------------------------------------------------------*/
-eHalStatus sme_SetTdls2040BSSCoexistence(tHalHandle hHal, tANI_S32 isEnabled);
-
-/* ---------------------------------------------------------------------------
-    \fn sme_SetRtsCtsHtVht
-    \brief  API to to enable/disable RTS/CTS for different modes.
-
-    \param  set_value - Bit mask value to enable RTS/CTS for different modes.
-    \- return VOS_STATUS_SUCCES if INdication is posted to
-       WDA else return eHAL_STATUS_FAILURE
-    -------------------------------------------------------------------------*/
-eHalStatus sme_SetRtsCtsHtVht(tHalHandle hHal, tANI_U32 set_value);
-
-tANI_BOOLEAN sme_handleSetFccChannel(tHalHandle hHal,
-                                      tANI_U8 fcc_constraint,
-                                      v_U32_t scan_pending);
-
-eHalStatus sme_DeleteAllTDLSPeers(tHalHandle hHal, uint8_t sessionId);
-eHalStatus sme_fatal_event_logs_req(tHalHandle hHal, tANI_U32 is_fatal,
-                               tANI_U32 indicator, tANI_U32 reason_code,
-                               tANI_BOOLEAN dump_vos_trace);
-
-eHalStatus sme_enableDisableChanAvoidIndEvent(tHalHandle hHal,
-                                              tANI_U8 set_value);
-
-/* ---------------------------------------------------------------------------
-    \fn sme_set_wificonfig_params
-    \brief  API to set WifiConfiguration Parameters.
-
-    \param  wifi_config_param - Wificonfig parameter 1.Averaging factor 2. Guard time
-    \- return VOS_STATUS_SUCCES if INdication is posted to
-       WDA else return eHAL_STATUS_FAILURE
-    -------------------------------------------------------------------------*/
-
-eHalStatus sme_set_wificonfig_params(tHalHandle hHal, tSetWifiConfigParams *req);
-eHalStatus sme_getRegInfo(tHalHandle hHal, tANI_U8 chanId,
-                          tANI_U32 *regInfo1, tANI_U32 *regInfo2);
-eHalStatus sme_GetCurrentAntennaIndex(tHalHandle hHal,
-                                      tCsrAntennaIndexCallback callback,
-                                      void *pContext, tANI_U8 sessionId);
-
-eHalStatus sme_setBcnMissPenaltyCount(tHalHandle hHal,
-                                      tModifyRoamParamsReqParams *params);
-eHalStatus sme_remove_bssid_from_scan_list(tHalHandle hal,
-	tSirMacAddr bssid);
-void sme_set_mgmt_frm_via_wq5(tHalHandle hHal,
-        tANI_BOOLEAN sendMgmtPktViaWQ5);
 #endif //#if !defined( __SME_API_H )
diff --git a/wlan/prima/CORE/SME/inc/sme_QosApi.h b/wlan/prima/CORE/SME/inc/sme_QosApi.h
index 237a64e..f22528b 100644
--- a/wlan/prima/CORE/SME/inc/sme_QosApi.h
+++ b/wlan/prima/CORE/SME/inc/sme_QosApi.h
@@ -35,6 +35,9 @@
   
   \brief prototype for SME QoS APIs
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/SME/inc/sme_RrmApi.h b/wlan/prima/CORE/SME/inc/sme_RrmApi.h
index 621ac29..d996b30 100644
--- a/wlan/prima/CORE/SME/inc/sme_RrmApi.h
+++ b/wlan/prima/CORE/SME/inc/sme_RrmApi.h
@@ -35,6 +35,9 @@
   
   \brief prototype for SME RRM APIs
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/SME/inc/sme_Trace.h b/wlan/prima/CORE/SME/inc/sme_Trace.h
index 9967cac..e9b1591 100644
--- a/wlan/prima/CORE/SME/inc/sme_Trace.h
+++ b/wlan/prima/CORE/SME/inc/sme_Trace.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -41,7 +41,7 @@
 #include "macTrace.h"
 
 #define NO_SESSION 0xFF
-
+#define TRACE_CODE_SME_COMMAND 0xFF
 enum {
     TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ,
     TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS,
@@ -125,34 +125,15 @@
     TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED,
     TRACE_CODE_SME_RX_HDD_UPDATE_WESMODE,
     TRACE_CODE_SME_RX_HDD_SET_SCANCTRL,
+    TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CAPABILITIES,
     TRACE_CODE_SME_RX_HDD_EXTSCAN_START,
     TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP,
     TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST,
     TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST,
+    TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SIGNF_CHANGE,
+    TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SIGNF_CHANGE,
     TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS,
-    TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SSID_HOTLIST,
-    TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SSID_HOTLIST,
-    TRACE_CODE_SME_RX_HDD_MSG_DEAUTH_STA,
-#ifdef FEATURE_WLAN_TDLS
-    TRACE_CODE_SME_RX_HDD_TDLS_LINK_ESTABLISH_PARAM,
-    TRACE_CODE_SME_RX_HDD_TDLS_CHAN_SWITCH_REQ,
-    TRACE_CODE_SME_RX_HDD_TDLS_SEND_MGMT_FRAME,
-    TRACE_CODE_SME_RX_HDD_TDLS_CHANGE_PEER_STA,
-    TRACE_CODE_SME_RX_HDD_TDLS_ADD_PEER_STA,
-    TRACE_CODE_SME_RX_HDD_TDLS_DEL_PEER_STA,
-#endif
-    TRACE_CODE_SME_RX_HDD_PREF_NET_LIST,
-#ifdef FEATURE_WLAN_LPHB
-    TRACE_CODE_SME_RX_HDD_LPHB_CONFIG_REQ,
-#endif /* FEATURE_WLAN_LPHB */
-    TRACE_CODE_SME_RX_HDD_ROAM_DEL_PMKIDCACHE,
-    /* New trace commands to be added before this comment not at the end */
-    /* Trace codes for SME commands */
-    TRACE_CODE_SME_COMMAND = 250,
-    TRACE_CODE_SME_TX_WDA_MSG,
-    TRACE_CODE_SME_RX_WDA_MSG,
 };
 
 void smeTraceInit(tpAniSirGlobal pMac);
-void sme_register_debug_callback(void);
 #endif //__SME_TRACE_H__
diff --git a/wlan/prima/CORE/SME/src/QoS/sme_Qos.c b/wlan/prima/CORE/SME/src/QoS/sme_Qos.c
index a4fb043..aee50a8 100644
--- a/wlan/prima/CORE/SME/src/QoS/sme_Qos.c
+++ b/wlan/prima/CORE/SME/src/QoS/sme_Qos.c
@@ -53,7 +53,9 @@
 #include <csrEse.h>
 #endif
 
+#ifdef DEBUG_ROAM_DELAY
 #include "vos_utils.h"
+#endif
 
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
 /* TODO : 6Mbps as Cisco APs seem to like only this value; analysis req.   */
@@ -7188,21 +7190,22 @@
       }
    }
 
-   if (pMac->roam.configParam.roamDelayStatsEnabled)
-   {
-       if (pACInfo->curr_QoSInfo[pACInfo->tspec_pending - 1].ts_info.up ==  SME_QOS_WMM_UP_VO ||
-           pACInfo->curr_QoSInfo[pACInfo->tspec_pending - 1].ts_info.up ==  SME_QOS_WMM_UP_NC)
-       {
-           vos_record_roam_event(e_SME_VO_ADDTS_RSP, NULL, 0);
-       }
+#ifdef DEBUG_ROAM_DELAY
 
-       if (pACInfo->curr_QoSInfo[pACInfo->tspec_pending - 1].ts_info.up ==  SME_QOS_WMM_UP_VI ||
-           pACInfo->curr_QoSInfo[pACInfo->tspec_pending - 1].ts_info.up ==  SME_QOS_WMM_UP_CL)
-       {
-           vos_record_roam_event(e_SME_VI_ADDTS_RSP, NULL, 0);
-       }
+   if (pACInfo->curr_QoSInfo[pACInfo->tspec_pending - 1].ts_info.up ==  SME_QOS_WMM_UP_VO ||
+       pACInfo->curr_QoSInfo[pACInfo->tspec_pending - 1].ts_info.up ==  SME_QOS_WMM_UP_NC)
+   {
+      vos_record_roam_event(e_SME_VO_ADDTS_RSP, NULL, 0);
    }
 
+   if (pACInfo->curr_QoSInfo[pACInfo->tspec_pending - 1].ts_info.up ==  SME_QOS_WMM_UP_VI||
+       pACInfo->curr_QoSInfo[pACInfo->tspec_pending - 1].ts_info.up ==  SME_QOS_WMM_UP_CL)
+
+   {
+      vos_record_roam_event(e_SME_VI_ADDTS_RSP, NULL, 0);
+   }
+#endif
+
    if(delete_entry)
    {
       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
@@ -7435,7 +7438,7 @@
       break;
    default:
       status = eHAL_STATUS_SUCCESS;
-      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
                 "%s: %d: nothing to process in PMC state %s (%d)",
                 __func__, __LINE__,
                 sme_PmcStatetoString(pmcState), pmcState);
diff --git a/wlan/prima/CORE/SME/src/btc/btcApi.c b/wlan/prima/CORE/SME/src/btc/btcApi.c
index 4e1e9ea..83cf49d 100644
--- a/wlan/prima/CORE/SME/src/btc/btcApi.c
+++ b/wlan/prima/CORE/SME/src/btc/btcApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -31,6 +31,8 @@
 *
 * Description: Routines that make up the BTC API.
 *
+* Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
+* Qualcomm Confidential and Proprietary.
 *
 ******************************************************************************/
 #include "wlan_qct_wda.h"
@@ -41,7 +43,6 @@
 #include "cfgApi.h"
 #include "pmc.h"
 #include "smeQosInternal.h"
-#include "sme_Trace.h"
 #ifdef FEATURE_WLAN_DIAG_SUPPORT
 #include "vos_diag_core_event.h"
 #include "vos_diag_core_log.h"
@@ -274,8 +275,6 @@
    msg.type = WDA_SIGNAL_BT_EVENT;
    msg.reserved = 0;
    msg.bodyptr = ptrSmeBtEvent;
-   MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
    {
       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
@@ -558,8 +557,6 @@
    msg.type = WDA_BTC_SET_CFG;
    msg.reserved = 0;
    msg.bodyptr = ptrSmeBtcConfig;
-   MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
    {
       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcSendCfgMsg: "
diff --git a/wlan/prima/CORE/SME/src/ccm/ccmLogDump.c b/wlan/prima/CORE/SME/src/ccm/ccmLogDump.c
index ac24fa8..acbf858 100644
--- a/wlan/prima/CORE/SME/src/ccm/ccmLogDump.c
+++ b/wlan/prima/CORE/SME/src/ccm/ccmLogDump.c
@@ -30,6 +30,9 @@
 
 Implements the dump commands specific to the ccm module. 
 
+Copyright (c) 2007 QUALCOMM Incorporated.
+All Rights Reserved.
+Qualcomm Confidential and Proprietary
  ============================================================================*/
 
 
diff --git a/wlan/prima/CORE/SME/src/csr/csrApiRoam.c b/wlan/prima/CORE/SME/src/csr/csrApiRoam.c
index 83fde40..7c7c801 100644
--- a/wlan/prima/CORE/SME/src/csr/csrApiRoam.c
+++ b/wlan/prima/CORE/SME/src/csr/csrApiRoam.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -58,7 +58,6 @@
 #include "palApi.h"
 #include "csrInsideApi.h"
 #include "smsDebug.h"
-#include "sme_Trace.h"
 #include "logDump.h"
 #include "smeQosInternal.h"
 #include "wlan_qct_tl.h"
@@ -75,7 +74,9 @@
 #if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
 #include "csrEse.h"
 #endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
+#ifdef DEBUG_ROAM_DELAY
 #include "vos_utils.h"
+#endif
 #define CSR_NUM_IBSS_START_CHANNELS_50      4
 #define CSR_NUM_IBSS_START_CHANNELS_24      3
 #define CSR_DEF_IBSS_START_CHANNEL_50       36
@@ -108,9 +109,6 @@
 static tANI_BOOLEAN bRoamScanOffloadStarted = VOS_FALSE;
 #endif
 
-#define MAX_PWR_FCC_CHAN_12 8
-#define MAX_PWR_FCC_CHAN_13 2
-
 /*-------------------------------------------------------------------------- 
   Static Type declarations
   ------------------------------------------------------------------------*/
@@ -556,11 +554,7 @@
     tANI_U32 numChan = 0;
     tANI_U32 bufLen ;
     vos_msg_t msg;
-    tANI_U8 i, j;
-    tANI_U8 num_channel = 0;
-    tANI_U8 channel_state;
-    tANI_U8 cfgnumChannels = 0;
-    tANI_U8 *cfgChannelList = NULL;
+    tANI_U8 i;
 
     limInitOperatingClasses((tHalHandle)pMac);
     numChan = sizeof(pMac->roam.validChannelList);
@@ -582,101 +576,25 @@
                 "Failed to allocate memory for tSirUpdateChanList");
         return eHAL_STATUS_FAILED_ALLOC;
     }
-    vos_mem_zero(pChanList, bufLen);
-
-    smsLog(pMac, LOG1, FL("fEnableDFSChnlScan %d"),
-                                  pMac->scan.fEnableDFSChnlScan);
-
-    for (i = 0; i < numChan; i++)
-    {
-        channel_state =
-               vos_nv_getChannelEnabledState(pMac->roam.validChannelList[i]);
-
-        if((pMac->scan.fEnableDFSChnlScan == DFS_CHNL_SCAN_DISABLED)
-           && (channel_state == NV_CHANNEL_DFS))
-        {
-           continue;
-        }
-        pChanList->chanParam[num_channel].chanId =
-                    pMac->roam.validChannelList[i];
-        pChanList->chanParam[num_channel].pwr =
-          cfgGetRegulatoryMaxTransmitPower(pMac,
-                                           pScan->defaultPowerTable[i].chanId);
-        if (pMac->scan.fcc_constraint)
-        {
-            if (pChanList->chanParam[num_channel].chanId == 12)
-            {
-                pChanList->chanParam[num_channel].pwr = MAX_PWR_FCC_CHAN_12;
-                smsLog(pMac, LOG1,
-                      "fcc_constraint is set, txpower for channel 12 is 8db ");
-            }
-            if (pChanList->chanParam[num_channel].chanId == 13)
-            {
-                pChanList->chanParam[num_channel].pwr = MAX_PWR_FCC_CHAN_13;
-                smsLog(pMac, LOG1,
-                      "fcc_constraint is set, txpower for channel 13 is 2db ");
-            }
-        }
-
-        if (!pChanList->chanParam[num_channel].pwr)
-        {
-            smsLog(pMac, LOGE, FL("Power level is zero for channel %d "
-                                               "setting to default %d"),
-                               pChanList->chanParam[num_channel].chanId,
-                                                      TX_POWER_DEFAULT);
-            pChanList->chanParam[num_channel].pwr = TX_POWER_DEFAULT;
-        }
-        if (channel_state == NV_CHANNEL_DFS)
-            pChanList->chanParam[num_channel].dfsSet = VOS_TRUE;
-        else
-            pChanList->chanParam[num_channel].dfsSet = VOS_FALSE;
-
-        /* When DFS mode is 2, mark static channels as active */
-        if (pMac->scan.fEnableDFSChnlScan == DFS_CHNL_SCAN_ENABLED_ACTIVE)
-        {
-            cfgnumChannels =
-               pMac->roam.neighborRoamInfo.cfgParams.channelInfo.numOfChannels;
-            cfgChannelList =
-                 pMac->roam.neighborRoamInfo.cfgParams.channelInfo.ChannelList;
-
-            if (cfgChannelList)
-            {
-                for(j=0; j< cfgnumChannels; j++)
-                {
-                    if (CSR_IS_CHANNEL_DFS(cfgChannelList[j]) &&
-                         (pMac->roam.validChannelList[i] == cfgChannelList[j]))
-                    {
-                        pChanList->chanParam[num_channel].dfsSet = VOS_FALSE;
-                        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                                  "%s Marked DFS ch %d as active\n", __func__,
-                                   cfgChannelList[j]);
-                    }
-                }
-            }
-            else
-                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                                    "%s cfgChannelList is NULL \n", __func__);
-         }
-
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-             "%s Supported Channel: %d dfsSet %d pwr: %d \n", __func__,
-              pChanList->chanParam[num_channel].chanId,
-              pChanList->chanParam[num_channel].dfsSet,
-              pChanList->chanParam[num_channel].pwr);
-        num_channel++;
-    }
-    pChanList->regId = csrGetCurrentRegulatoryDomain(pMac);
-
-    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-             "%s : regID : %d \n", __func__,
-              pChanList->regId);
 
     msg.type = WDA_UPDATE_CHAN_LIST_REQ;
     msg.reserved = 0;
     msg.bodyptr = pChanList;
-    pChanList->numChan = num_channel;
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
+    pChanList->numChan = numChan;
+    for (i = 0; i < pChanList->numChan; i++)
+    {
+        pChanList->chanParam[i].chanId = pMac->roam.validChannelList[i];
+        pChanList->chanParam[i].pwr = cfgGetRegulatoryMaxTransmitPower(pMac,
+                pScan->defaultPowerTable[i].chanId);
+        if (vos_nv_getChannelEnabledState(pChanList->chanParam[i].chanId) ==
+            NV_CHANNEL_DFS)
+            pChanList->chanParam[i].dfsSet = VOS_TRUE;
+        else
+            pChanList->chanParam[i].dfsSet = VOS_FALSE;
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+             "%s Supported Channel: %d\n", __func__, pChanList->chanParam[i].chanId);
+    }
+
     if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
@@ -735,7 +653,7 @@
 
     for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
     {
-        csrRoamCloseSession(pMac, sessionId, TRUE, TRUE, NULL, NULL);
+        csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL);
     }
     csrScanDisable(pMac);
     pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE;
@@ -781,6 +699,14 @@
     //WNI_CFG_VALID_CHANNEL_LIST should be set by this time
     //use it to init the background scan list
     csrInitBGScanChannelList(pMac);
+    /* HDD issues the init scan */
+    csrScanStartResultAgingTimer(pMac);
+    /* If the gScanAgingTime is set to '0' then scan results aging timeout 
+         based  on timer feature is not enabled*/  
+    if(0 != pMac->scan.scanResultCfgAgingTime )
+    {
+       csrScanStartResultCfgAgingTimer(pMac);
+    }
     //Store the AC weights in TL for later use
     WLANTL_GetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights);
     status = csrInitChannelList( pMac );
@@ -821,7 +747,7 @@
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tANI_U32 i;
-    tCsrRoamSession *pSession = NULL;
+    tCsrRoamSession *pSession;
     do
     {
         for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
@@ -856,7 +782,7 @@
     tANI_U32 sessionId;
     for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
     {
-        csrRoamCloseSession(pMac, sessionId, TRUE, TRUE, NULL, NULL);
+        csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL);
     }
     vos_timer_stop(&pMac->roam.hTimerWaitForKey);
     vos_timer_destroy(&pMac->roam.hTimerWaitForKey);
@@ -1066,33 +992,6 @@
     csrReinitRemoveKeyCmd(pMac, pCommand);
     csrReleaseCommand( pMac, pCommand );
 }
-
-/**
- * csr_is_disconnect_full_power_cmd() - Check if command is for
- * disconnect or for fullpower
- * @command: command to check
- *
- * Return: true if disconnect or full power command else false
- */
-bool csr_is_disconnect_full_power_cmd(tSmeCmd *command)
-{
-    switch (command->command) {
-    case eSmeCommandRoam:
-        if (CSR_IS_DISCONNECT_COMMAND(command))
-            return true;
-        break;
-    case eSmeCommandWmStatusChange:
-    case eSmeCommandExitImps:
-    case eSmeCommandExitBmps:
-    case eSmeCommandExitUapsd:
-    case eSmeCommandExitWowl:
-        return true;
-    default:
-        return false;
-    }
-    return false;
-}
-
 void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
 {
 
@@ -1621,46 +1520,45 @@
    ePhyChanBondState phyCbState;
    switch (cbIniValue) {
       // secondary none
-      case eCSR_INI_SINGLE_CHANNEL_CENTERED:
+      case 0:
         phyCbState = PHY_SINGLE_CHANNEL_CENTERED;
         break;
       // secondary LOW
-      case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
+      case 1:
         phyCbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
         break;
       // secondary HIGH
-      case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
+      case 2:
         phyCbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
         break;
 #ifdef WLAN_FEATURE_11AC
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
-        phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED;
+      case 3:
+        phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; 
         break;
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
+      case 4:
         phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED;
         break;
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
-        phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED;
-        break;
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
+      case 5:
+        phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED;
+        break; 
+      case 6:
         phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
         break;
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
+      case 7:
         phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
-        break;
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
+        break; 
+      case 8:
         phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
         break;
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
+      case 9:
         phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
-        break;
-#endif
+        break; 
+#endif 
       default:
         // If an invalid value is passed, disable CHANNEL BONDING
         phyCbState = PHY_SINGLE_CHANNEL_CENTERED;
         break;
    }
-
    return phyCbState;
 }
 
@@ -1671,45 +1569,44 @@
    switch (phyCbState) {
       // secondary none
       case PHY_SINGLE_CHANNEL_CENTERED:
-        cbIniValue = eCSR_INI_SINGLE_CHANNEL_CENTERED;
+        cbIniValue = 0;
         break;
       // secondary LOW
       case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
-        cbIniValue = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
+        cbIniValue = 1;
         break;
       // secondary HIGH
       case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
-        cbIniValue = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
+        cbIniValue = 2;
         break;
 #ifdef WLAN_FEATURE_11AC
       case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
-        cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED;
+        cbIniValue = 3;
         break;
       case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
-        cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED;
+        cbIniValue = 4;
         break;
       case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
-        cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED;
+        cbIniValue = 5;
         break;
       case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
-        cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
+        cbIniValue = 6;
         break;
       case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
-        cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
+        cbIniValue = 7;
         break;
       case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
-        cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
+        cbIniValue = 8;
         break;
       case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
-        cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
+        cbIniValue = 9;
         break;
 #endif
       default:
         // return some invalid value
-        cbIniValue = eCSR_INI_CHANNEL_BONDING_STATE_MAX;
+        cbIniValue = 10;
         break;
    }
-
    return cbIniValue;
 }
 
@@ -1742,9 +1639,6 @@
         {
             smsLog( pMac, LOGW, "Invalid CB value from ini in 5GHz band %d, CB DISABLED", pParam->channelBondingMode5GHz);
         }
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        pMac->roam.configParam.channelBondingAPMode24GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingAPMode24GHz);
-#endif
         pMac->roam.configParam.channelBondingMode5GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode5GHz);
         pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold;
         pMac->roam.configParam.phyMode = pParam->phyMode;
@@ -1790,13 +1684,6 @@
             cfgSetInt(pMac, WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME,
                       pParam->nPassiveMinChnTime);
         }
-        if (pParam->nOBSSScanWidthTriggerInterval)
-        {
-            pMac->roam.configParam.nOBSSScanWidthTriggerInterval =
-                                   pParam->nOBSSScanWidthTriggerInterval;
-            cfgSetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
-                      pParam->nOBSSScanWidthTriggerInterval);
-        }
         if (pParam->nActiveMaxChnTimeBtc)
         {
             pMac->roam.configParam.nActiveMaxChnTimeBtc = pParam->nActiveMaxChnTimeBtc;
@@ -1932,21 +1819,8 @@
         pMac->roam.configParam.nRoamScanHomeAwayTime = pParam->nRoamScanHomeAwayTime;
 #endif
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-        pMac->roam.configParam.isRoamOffloadScanEnabled =
-                pParam->isRoamOffloadScanEnabled;
-        pMac->roam.configParam.bFastRoamInConIniFeatureEnabled =
-                pParam->bFastRoamInConIniFeatureEnabled;
-        pMac->roam.configParam.isPERRoamEnabled =
-                pParam->isPERRoamEnabled;
-        pMac->roam.configParam.rateUpThreshold = pParam->rateUpThreshold;
-        pMac->roam.configParam.rateDownThreshold = pParam->rateDownThreshold;
-        pMac->roam.configParam.waitPeriodForNextPERScan =
-                pParam->waitPeriodForNextPERScan;
-        pMac->roam.configParam.PERtimerThreshold = pParam->PERtimerThreshold;
-        pMac->roam.configParam.isPERRoamCCAEnabled =
-                pParam->isPERRoamCCAEnabled;
-        pMac->roam.configParam.PERroamTriggerPercent =
-                pParam->PERroamTriggerPercent;
+        pMac->roam.configParam.isRoamOffloadScanEnabled = pParam->isRoamOffloadScanEnabled;
+        pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = pParam->bFastRoamInConIniFeatureEnabled;
 #endif
 #ifdef FEATURE_WLAN_LFR
         pMac->roam.configParam.isFastRoamIniFeatureEnabled = pParam->isFastRoamIniFeatureEnabled;
@@ -2010,38 +1884,10 @@
 
         pMac->roam.configParam.isAmsduSupportInAMPDU = pParam->isAmsduSupportInAMPDU;
         pMac->roam.configParam.nSelect5GHzMargin = pParam->nSelect5GHzMargin;
-        pMac->roam.configParam.ignorePeerErpInfo = pParam->ignorePeerErpInfo;
-        pMac->roam.configParam.ignorePeerHTopMode = pParam->ignorePeerHTopMode;
-        pMac->roam.configParam.disableP2PMacSpoofing =
-                                        pParam->disableP2PMacSpoofing;
-        pMac->roam.configParam.enableFatalEvent =
-                                        pParam->enableFatalEvent;
         pMac->roam.configParam.isCoalesingInIBSSAllowed =
                                pParam->isCoalesingInIBSSAllowed;
         pMac->roam.configParam.allowDFSChannelRoam = pParam->allowDFSChannelRoam;
         pMac->roam.configParam.sendDeauthBeforeCon = pParam->sendDeauthBeforeCon;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        pMac->roam.configParam.apHT40_24GEnabled = pParam->apHT40_24GEnabled;
-#endif
-        pMac->roam.configParam.roamDelayStatsEnabled = pParam->roamDelayStatsEnabled;
-        pMac->roam.configParam.max_chan_for_dwell_time_cfg =
-                               pParam->max_chan_for_dwell_time_cfg;
-
-        pMac->roam.configParam.enable_edca_params = pParam->enable_edca_params;
-        pMac->roam.configParam.edca_vo_cwmin = pParam->edca_vo_cwmin;
-        pMac->roam.configParam.edca_vi_cwmin = pParam->edca_vi_cwmin;
-        pMac->roam.configParam.edca_bk_cwmin = pParam->edca_bk_cwmin;
-        pMac->roam.configParam.edca_be_cwmin = pParam->edca_be_cwmin;
-
-        pMac->roam.configParam.edca_vo_cwmax = pParam->edca_vo_cwmax;
-        pMac->roam.configParam.edca_vi_cwmax = pParam->edca_vi_cwmax;
-        pMac->roam.configParam.edca_bk_cwmax = pParam->edca_bk_cwmax;
-        pMac->roam.configParam.edca_be_cwmax = pParam->edca_be_cwmax;
-
-        pMac->roam.configParam.edca_vo_aifs = pParam->edca_vo_aifs;
-        pMac->roam.configParam.edca_vi_aifs = pParam->edca_vi_aifs;
-        pMac->roam.configParam.edca_bk_aifs = pParam->edca_bk_aifs;
-        pMac->roam.configParam.edca_be_aifs = pParam->edca_be_aifs;
     }
     
     return status;
@@ -2059,9 +1905,6 @@
         pParam->Is11dSupportEnabledOriginal = pMac->roam.configParam.Is11dSupportEnabledOriginal;
         pParam->Is11hSupportEnabled = pMac->roam.configParam.Is11hSupportEnabled;
         pParam->channelBondingMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode24GHz);
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        pParam->channelBondingAPMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingAPMode24GHz);
-#endif
         pParam->channelBondingMode5GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode5GHz);
         pParam->RTSThreshold = pMac->roam.configParam.RTSThreshold;
         pParam->phyMode = pMac->roam.configParam.phyMode;
@@ -2154,17 +1997,6 @@
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
         pParam->isRoamOffloadScanEnabled = pMac->roam.configParam.isRoamOffloadScanEnabled;
         pParam->bFastRoamInConIniFeatureEnabled = pMac->roam.configParam.bFastRoamInConIniFeatureEnabled;
-        pParam->isPERRoamEnabled =
-                pMac->roam.configParam.isPERRoamEnabled;
-        pParam->rateUpThreshold = pMac->roam.configParam.rateUpThreshold;
-        pParam->rateDownThreshold = pMac->roam.configParam.rateDownThreshold;
-        pParam->waitPeriodForNextPERScan =
-                pMac->roam.configParam.waitPeriodForNextPERScan;
-        pParam->PERtimerThreshold = pMac->roam.configParam.PERtimerThreshold;
-        pParam->isPERRoamCCAEnabled =
-                pMac->roam.configParam.isPERRoamCCAEnabled;
-        pParam->PERroamTriggerPercent =
-                pMac->roam.configParam.PERroamTriggerPercent;
 #endif
 #ifdef FEATURE_WLAN_LFR
         pParam->isFastRoamIniFeatureEnabled = pMac->roam.configParam.isFastRoamIniFeatureEnabled;
@@ -2191,11 +2023,6 @@
 
         pParam->isAmsduSupportInAMPDU = pMac->roam.configParam.isAmsduSupportInAMPDU;
         pParam->nSelect5GHzMargin = pMac->roam.configParam.nSelect5GHzMargin;
-        pParam->ignorePeerErpInfo = pMac->roam.configParam.ignorePeerErpInfo;
-        pParam->ignorePeerHTopMode = pMac->roam.configParam.ignorePeerHTopMode;
-        pParam->disableP2PMacSpoofing =
-                                pMac->roam.configParam.disableP2PMacSpoofing;
-        pParam->enableFatalEvent = pMac->roam.configParam.enableFatalEvent;
 
         pParam->isCoalesingInIBSSAllowed =
                                 pMac->roam.configParam.isCoalesingInIBSSAllowed;
@@ -2203,27 +2030,6 @@
                                     pMac->roam.configParam.allowDFSChannelRoam;
         pParam->sendDeauthBeforeCon = pMac->roam.configParam.sendDeauthBeforeCon;
         csrSetChannels(pMac, pParam);
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        pParam->apHT40_24GEnabled = pMac->roam.configParam.apHT40_24GEnabled;
-#endif
-        pParam->max_chan_for_dwell_time_cfg =
-                            pMac->roam.configParam.max_chan_for_dwell_time_cfg;
-
-        pParam->enable_edca_params = pMac->roam.configParam.enable_edca_params;
-        pParam->edca_vo_cwmin = pMac->roam.configParam.edca_vo_cwmin;
-        pParam->edca_vi_cwmin = pMac->roam.configParam.edca_vi_cwmin;
-        pParam->edca_bk_cwmin = pMac->roam.configParam.edca_bk_cwmin;
-        pParam->edca_be_cwmin = pMac->roam.configParam.edca_be_cwmin;
-
-        pParam->edca_vo_cwmax = pMac->roam.configParam.edca_vo_cwmax;
-        pParam->edca_vi_cwmax = pMac->roam.configParam.edca_vi_cwmax;
-        pParam->edca_bk_cwmax = pMac->roam.configParam.edca_bk_cwmax;
-        pParam->edca_be_cwmax = pMac->roam.configParam.edca_be_cwmax;
-
-        pParam->edca_vo_aifs = pMac->roam.configParam.edca_vo_aifs;
-        pParam->edca_vi_aifs = pMac->roam.configParam.edca_vi_aifs;
-        pParam->edca_bk_aifs = pMac->roam.configParam.edca_bk_aifs;
-        pParam->edca_be_aifs = pMac->roam.configParam.edca_be_aifs;
 
         status = eHAL_STATUS_SUCCESS;
     }
@@ -2632,117 +2438,72 @@
   return eHAL_STATUS_SUCCESS;
 }
 
-/**
- * csr_roam_remove_duplicate_cmd_from_list()- Remove duplicate roam cmd from
- * list
- *
- * @pMac: pointer to global mac
- * @sessionId: session id for the cmd
- * @pList: pending list from which cmd needs to be removed
- * @pCommand: cmd to be removed, can be NULL
- * @eRoamReason: cmd with reason to be removed
- *
- * Remove duplicate command from the pending list.
- *
- * Return: void
- */
-void csr_roam_remove_duplicate_cmd_from_list(tpAniSirGlobal pMac,
-            tANI_U32 sessionId, tDblLinkList *pList,
-            tSmeCmd *pCommand, eCsrRoamReason eRoamReason)
+//pCommand may be NULL
+//Pass in sessionId in case pCommand is NULL. sessionId is not used in case pCommand is not NULL.
+void csrRoamRemoveDuplicateCommand(tpAniSirGlobal pMac, tANI_U32 sessionId, tSmeCmd *pCommand, eCsrRoamReason eRoamReason)
 {
     tListElem *pEntry, *pNextEntry;
     tSmeCmd *pDupCommand;
     tDblLinkList localList;
 
     vos_mem_zero(&localList, sizeof(tDblLinkList));
-    if (!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
+    if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
     {
-        smsLog(pMac, LOGE, FL("failed to open list"));
+        smsLog(pMac, LOGE, FL(" failed to open list"));
         return;
     }
-    csrLLLock(pList);
-    pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
-    while (pEntry)
+    csrLLLock( &pMac->sme.smeCmdPendingList );
+    pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
+    while( pEntry )
     {
-        pNextEntry = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
-        pDupCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
-        /*
-         * Remove the previous command if..
-         * - the new roam command is for the same RoamReason...
-         * - the new roam command is a NewProfileList.
-         * - the new roam command is a Forced Dissoc
-         * - the new roam command is from an 802.11 OID
-         *   (OID_SSID or OID_BSSID).
-         */
-        if ((pCommand && (pCommand->sessionId == pDupCommand->sessionId) &&
-              ((pCommand->command == pDupCommand->command) &&
-              /*
-               * This peermac check is requried for Softap/GO scenarios
-               * For STA scenario below OR check will suffice as pCommand
-               * will always be NULL for STA scenarios
-               */
-               (vos_mem_compare(pDupCommand->u.roamCmd.peerMac,
-                  pCommand->u.roamCmd.peerMac, sizeof(v_MACADDR_t))) &&
-                ((pCommand->u.roamCmd.roamReason ==
-                          pDupCommand->u.roamCmd.roamReason) ||
-                 (eCsrForcedDisassoc == pCommand->u.roamCmd.roamReason) ||
-                 (eCsrHddIssued == pCommand->u.roamCmd.roamReason)))) ||
-            /* OR if pCommand is NULL */
-            ((sessionId == pDupCommand->sessionId) &&
-             (eSmeCommandRoam == pDupCommand->command) &&
-             ((eCsrForcedDisassoc == eRoamReason) ||
-              (eCsrHddIssued == eRoamReason))))
+        pNextEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
+        pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+        // Remove the previous command if..
+        // - the new roam command is for the same RoamReason...
+        // - the new roam command is a NewProfileList.
+        // - the new roam command is a Forced Dissoc
+        // - the new roam command is from an 802.11 OID (OID_SSID or OID_BSSID).
+        if ( 
+            (pCommand && ( pCommand->sessionId == pDupCommand->sessionId ) &&
+                ((pCommand->command == pDupCommand->command) &&
+                /* This peermac check is requried for Softap/GO scenarios
+                 * For STA scenario below OR check will suffice as pCommand will 
+                 * always be NULL for STA scenarios
+                 */
+                (vos_mem_compare(pDupCommand->u.roamCmd.peerMac, pCommand->u.roamCmd.peerMac, sizeof(v_MACADDR_t))) &&
+                 (pCommand->u.roamCmd.roamReason == pDupCommand->u.roamCmd.roamReason ||
+                    eCsrForcedDisassoc == pCommand->u.roamCmd.roamReason ||
+                    eCsrHddIssued == pCommand->u.roamCmd.roamReason))) 
+                ||
+            //below the pCommand is NULL
+            ( (sessionId == pDupCommand->sessionId) &&
+              (eSmeCommandRoam == pDupCommand->command) &&
+                 ((eCsrForcedDisassoc == eRoamReason) ||
+                    (eCsrHddIssued == eRoamReason))
+               )
+           )
         {
-            smsLog(pMac, LOGW, FL("RoamReason = %d"),
-                           pDupCommand->u.roamCmd.roamReason);
-            /* Remove the 'stale' roam command from the pending list */
-            if (csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
+            smsLog(pMac, LOGW, FL("   roamReason = %d"), pDupCommand->u.roamCmd.roamReason);
+            // Remove the 'stale' roam command from the pending list...
+            if(csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK ))
+            {
                 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
+            }
         }
         pEntry = pNextEntry;
     }
-    csrLLUnlock(pList);
+    csrLLUnlock( &pMac->sme.smeCmdPendingList );
 
-    while ((pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)))
+    while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
     {
         pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
-        /* Tell caller that the command is cancelled */
-        csrRoamCallCallback(pMac, pDupCommand->sessionId, NULL,
-                    pDupCommand->u.roamCmd.roamId,
-                    eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE);
+        //Tell caller that the command is cancelled
+        csrRoamCallCallback(pMac, pDupCommand->sessionId, NULL, pDupCommand->u.roamCmd.roamId,
+                                            eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE);
         csrReleaseCommandRoam(pMac, pDupCommand);
     }
     csrLLClose(&localList);
 }
-
-/**
- * csrRoamRemoveDuplicateCommand()- Remove duplicate roam cmd
- * from pending lists.
- *
- * @pMac: pointer to global mac
- * @sessionId: session id for the cmd
- * @pCommand: cmd to be removed, can be null
- * @eRoamReason: cmd with reason to be removed
- *
- * Remove duplicate command from the sme and roam pending list.
- *
- * Return: void
- */
-void csrRoamRemoveDuplicateCommand(tpAniSirGlobal pMac,
-                 tANI_U32 sessionId, tSmeCmd *pCommand,
-                 eCsrRoamReason eRoamReason)
-{
-    /* Always lock active list before locking pending lists */
-    csrLLLock(&pMac->sme.smeCmdActiveList);
-    csr_roam_remove_duplicate_cmd_from_list(pMac,
-       sessionId, &pMac->sme.smeCmdPendingList,
-       pCommand, eRoamReason);
-    csr_roam_remove_duplicate_cmd_from_list(pMac,
-       sessionId, &pMac->roam.roamCmdPendingList,
-       pCommand, eRoamReason);
-    csrLLUnlock(&pMac->sme.smeCmdActiveList);
-}
-
 eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, 
                                tANI_U32 roamId, eRoamCmdStatus u1, eCsrRoamResult u2)
 {
@@ -2750,7 +2511,7 @@
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
     WLAN_VOS_DIAG_EVENT_DEF(connectionStatus, vos_event_wlan_status_payload_type);
 #endif
-    tCsrRoamSession *pSession = NULL;
+    tCsrRoamSession *pSession;
     if( CSR_IS_SESSION_VALID( pMac, sessionId) )
     {
         pSession = CSR_GET_SESSION( pMac, sessionId );
@@ -2805,8 +2566,8 @@
         status = pSession->callback(pSession->pContext, pRoamInfo, roamId, u1, u2);
         // TODO: revisit: sme_AcquireGlobalLock( &pMac->sme );
     }
-    //EVENT_WLAN_STATUS_V2: eCSR_ROAM_ASSOCIATION_COMPLETION,
-    //                   eCSR_ROAM_LOSTLINK, eCSR_ROAM_DISASSOCIATED,
+    //EVENT_WLAN_STATUS: eCSR_ROAM_ASSOCIATION_COMPLETION, 
+    //                   eCSR_ROAM_LOSTLINK, eCSR_ROAM_DISASSOCIATED, 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR    
     vos_mem_set(&connectionStatus,
                 sizeof(vos_event_wlan_status_payload_type), 0);
@@ -2824,35 +2585,34 @@
        connectionStatus.authType = (v_U8_t)diagAuthTypeFromCSRType(pRoamInfo->u.pConnectedProfile->AuthType);
        connectionStatus.encryptionType = (v_U8_t)diagEncTypeFromCSRType(pRoamInfo->u.pConnectedProfile->EncryptionType);
        vos_mem_copy(connectionStatus.ssid,
-                    pRoamInfo->u.pConnectedProfile->SSID.ssId,
-                    pRoamInfo->u.pConnectedProfile->SSID.length);
+                    pRoamInfo->u.pConnectedProfile->SSID.ssId, 6);
 
        connectionStatus.reason = eCSR_REASON_UNSPECIFIED;
-       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS_V2);
+       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
     }
     if((eCSR_ROAM_MIC_ERROR_IND == u1) || (eCSR_ROAM_RESULT_MIC_FAILURE == u2))
     {
        connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT;
        connectionStatus.reason = eCSR_REASON_MIC_ERROR;
-       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS_V2);
+       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
     }
     if(eCSR_ROAM_RESULT_FORCED == u2)
     {
        connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT;
        connectionStatus.reason = eCSR_REASON_USER_REQUESTED;
-       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS_V2);
+       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
     }
     if(eCSR_ROAM_RESULT_DISASSOC_IND == u2)
     {
        connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT;
        connectionStatus.reason = eCSR_REASON_DISASSOC;
-       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS_V2);
+       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
     }
     if(eCSR_ROAM_RESULT_DEAUTH_IND == u2)
     {
        connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT;
        connectionStatus.reason = eCSR_REASON_DEAUTH;
-       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS_V2);
+       WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
     }
 #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
     
@@ -2956,12 +2716,8 @@
     \return eHalStatus
   ---------------------------------------------------------------------------*/
 eHalStatus csrRoamIssueDisassociateStaCmd( tpAniSirGlobal pMac, 
-                                           tANI_U32 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                           const tANI_U8 *pPeerMacAddr,
-#else
+                                           tANI_U32 sessionId, 
                                            tANI_U8 *pPeerMacAddr,
-#endif
                                            tANI_U32 reason)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -3331,8 +3087,7 @@
         }
         //validate CB
         pBssConfig->cbMode = csrGetCBModeFromIes(pMac, pBssDesc->channelId, pIes);
-        smsLog(pMac, LOG1, FL("Bss Cb is %d, join timeout is %d, HB thresh is %d,"),
-               pBssConfig->cbMode, pBssConfig->uJoinTimeOut,  pBssConfig->uHeartBeatThresh);
+
     }while(0);
     return (status);
 }
@@ -3719,13 +3474,12 @@
     return (status);
 }
 static eHalStatus csrGetRateSet( tpAniSirGlobal pMac,  tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tSirBssDescription *pBssDesc,
-                           tDot11fBeaconIEs *pIes, tSirMacRateSet *pOpRateSet, tSirMacRateSet *pExRateSet, tANI_U16 *pRateBitmap)
+                           tDot11fBeaconIEs *pIes, tSirMacRateSet *pOpRateSet, tSirMacRateSet *pExRateSet)
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
     int i;
     eCsrCfgDot11Mode cfgDot11Mode;
     tANI_U8 *pDstRate;
-    tANI_U16 rateBitmap = 0;
     vos_mem_set(pOpRateSet, sizeof(tSirMacRateSet), 0);
     vos_mem_set(pExRateSet, sizeof(tSirMacRateSet), 0);
     VOS_ASSERT( pIes != NULL );
@@ -3749,38 +3503,32 @@
             {
                 if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) ) 
                 {
-                    if ( !csrIsRateAlreadyPresent(pIes->SuppRates.rates[ i ], rateBitmap) )
-                    {
-                        csrAddRateBitmap(pIes->SuppRates.rates[ i ], &rateBitmap);
-                        *pDstRate++ = pIes->SuppRates.rates[ i ];
-                        pOpRateSet->numRates++;
-                    }
+                    *pDstRate++ = pIes->SuppRates.rates[ i ];
+                    pOpRateSet->numRates++;
                 }
             }
         }
-        /* If there are Extended Rates in the beacon, we will reflect those
-         * extended rates that we support in out Extended Operational Rate
-         * set*/
-        pDstRate = pExRateSet->rate;
-        if(pIes->ExtSuppRates.present)
+        if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || 
+             eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode ||
+             eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode ||
+             eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode )
         {
-            for (i = 0; i < pIes->ExtSuppRates.num_rates; i++)
+            // If there are Extended Rates in the beacon, we will reflect those
+            // extended rates that we support in out Extended Operational Rate
+            // set:
+            pDstRate = pExRateSet->rate;
+            if(pIes->ExtSuppRates.present)
             {
-                if (csrRatesIsDot11RateSupported(pMac,
-                                    pIes->ExtSuppRates.rates[ i ]))
+                for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) 
                 {
-                    if (!csrIsRateAlreadyPresent(pIes->ExtSuppRates.rates[i],
-                                                                  rateBitmap))
+                    if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) ) 
                     {
-                        csrAddRateBitmap(pIes->ExtSuppRates.rates[i],
-                                                               &rateBitmap);
-                        *pDstRate++ = pIes->ExtSuppRates.rates[i];
+                        *pDstRate++ = pIes->ExtSuppRates.rates[ i ];
                         pExRateSet->numRates++;
                     }
                 }
             }
         }
-        *pRateBitmap = rateBitmap;
     }//Parsing BSSDesc
     else
     {
@@ -4875,7 +4623,7 @@
 eHalStatus csrProcessFTReassocRoamCommand ( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
     tANI_U32 sessionId;
-    tCsrRoamSession *pSession = NULL;
+    tCsrRoamSession *pSession;
     tCsrScanResult *pScanResult = NULL;
     tSirBssDescription *pBssDesc = NULL;
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -4924,8 +4672,7 @@
         smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
         return eHAL_STATUS_FAILURE;
     }
-    smsLog(pMac, LOG1, FL("Roam Reason : %d, sessionId: %d"),
-                         pCommand->u.roamCmd.roamReason, sessionId);
+
     switch ( pCommand->u.roamCmd.roamReason )
     {
     case eCsrForcedDisassoc:
@@ -5368,11 +5115,12 @@
                                    pIesLocal->WAPI.multicast_cipher_suite + 4,
                                    2);
                       pIeBuf += 2;
-                      if ( pIesLocal->WAPI.bkid_count )
+                      //bkid_count
+                      vos_mem_copy(pIeBuf, &pIesLocal->WAPI.bkid_count, 2);
+
+                      pIeBuf += 2;
+                      if( pIesLocal->WAPI.bkid_count )
                       {
-                         //bkid_count
-                         vos_mem_copy(pIeBuf, &pIesLocal->WAPI.bkid_count, 2);
-                         pIeBuf += 2;
                          //copy akm_suites
                          vos_mem_copy(pIeBuf, pIesLocal->WAPI.bkid,
                                       pIesLocal->WAPI.bkid_count * 4);
@@ -5714,7 +5462,7 @@
                                                pSirBssDesc, &BroadcastMac,
                                                FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter.
                 }
-                else if (!pSession->abortConnection)
+                else
                 {
                     //Need to wait for supplicant authtication
                     roamInfo.fAuthRequired = eANI_BOOLEAN_TRUE;
@@ -6291,7 +6039,6 @@
                     csrScanStartIdleScan(pMac);
                     break;
                 case eCsrForcedIbssLeave:
-                     csrIbssAgeBss(pMac);
                      csrRoamCallCallback(pMac, sessionId, NULL, 
                                         pCommand->u.roamCmd.roamId, 
                                         eCSR_ROAM_IBSS_LEAVE,
@@ -6452,8 +6199,8 @@
 #endif /* FEATURE_WLAN_WAPI */
         if(pSrcProfile->nAddIEScanLength)
         {
-            memset(pDstProfile->addIEScan, 0 , SIR_MAC_MAX_ADD_IE_LENGTH);
-            if ( SIR_MAC_MAX_ADD_IE_LENGTH >=  pSrcProfile->nAddIEScanLength)
+            memset(pDstProfile->addIEScan, 0 , SIR_MAC_MAX_IE_LENGTH);
+            if ( SIR_MAC_MAX_IE_LENGTH >=  pSrcProfile->nAddIEScanLength)
             {
                 vos_mem_copy(pDstProfile->addIEScan, pSrcProfile->addIEScan,
                          pSrcProfile->nAddIEScanLength);
@@ -6649,12 +6396,6 @@
         pDstProfile->CBMode = pSrcProfile->CBMode;
         vos_mem_copy(&pDstProfile->Keys, &pSrcProfile->Keys,
                      sizeof(pDstProfile->Keys));
-#ifdef WLAN_FEATURE_11W
-        pDstProfile->MFPEnabled = pSrcProfile->MFPEnabled;
-        pDstProfile->MFPRequired = pSrcProfile->MFPRequired;
-        pDstProfile->MFPCapable = pSrcProfile->MFPCapable;
-#endif
-
 #ifdef WLAN_FEATURE_VOWIFI_11R
         if (pSrcProfile->MDID.mdiePresent)
         {
@@ -6899,11 +6640,6 @@
         smsLog(pMac, LOGP, FL("No profile specified"));
         return eHAL_STATUS_FAILURE;
     }
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
     smsLog(pMac, LOG1, FL("called  BSSType = %s (%d) authtype = %d "
                                                     "encryType = %d"),
                 lim_BssTypetoString(pProfile->BSSType),
@@ -6917,9 +6653,6 @@
                pProfile->operationChannel);
         return status;
     }
-    /* Reset abortConnection for the fresh connection */
-    pSession->abortConnection = FALSE;
-    pSession->dhcp_done = false;
     csrRoamCancelRoaming(pMac, sessionId);
     csrScanRemoveFreshScanCommand(pMac, sessionId);
     csrScanCancelIdleScan(pMac);
@@ -6945,19 +6678,6 @@
 #ifdef FEATURE_WLAN_BTAMP_UT_RF
     pSession->maxRetryCount = CSR_JOIN_MAX_RETRY_COUNT; 
 #endif
-    /*
-     * If roamSession.connectState is disconnecting that mean
-     * disconnect/stop adapter was received with scan for ssid
-     * in progress and dropped. This state will ensure that
-     * connect will not be issued from scan for ssid completion.
-     * Thus if this fresh connect also issue scan for ssid the connect
-     * command will be dropped assuming disconnect is in progress.
-     * Thus reset connectState here
-     */
-    if (eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTING ==
-         pMac->roam.roamSession[sessionId].connectState)
-        pMac->roam.roamSession[sessionId].connectState =
-                       eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED;
     if(CSR_INVALID_SCANRESULT_HANDLE != hBssListIn)
     {
         smsLog(pMac, LOG1, FL("is called with BSSList"));
@@ -7354,10 +7074,9 @@
         if( fDisassoc )
         {
             status = csrRoamIssueDisassociate( pMac, sessionId, NewSubstate, fMICFailure );
-            if (pMac->roam.configParam.roamDelayStatsEnabled)
-            {
-                vos_record_roam_event(e_SME_DISASSOC_ISSUE, NULL, 0);
-            }
+#ifdef DEBUG_ROAM_DELAY
+            vos_record_roam_event(e_SME_DISASSOC_ISSUE, NULL, 0);
+#endif /* DEBUG_ROAM_DELAY */
         }
         else
         {
@@ -7401,16 +7120,6 @@
         {
             //Set the state to disconnect here 
             pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED;
-#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
-            //we don't need to run this timer any more
-            if (VOS_TIMER_STATE_RUNNING ==
-                pMac->roam.neighborRoamInfo.forcedInitialRoamTo5GHTimer.state)
-            {
-                status = vos_timer_stop(&pMac->roam.neighborRoamInfo.forcedInitialRoamTo5GHTimer);
-                if (status != eHAL_STATUS_SUCCESS)
-                    smsLog(pMac, LOGE, FL("Failed to Stop Forced 5G timer"));
-            }
-#endif
         }
     }
     else
@@ -7436,9 +7145,10 @@
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tSmeCmd *pCommand;
-
+        tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_FALSE;
     do
     {
+        smsLog( pMac, LOG1, FL("  reason = %d"), reason );
         pCommand = csrGetCommandBuffer( pMac );
         if ( !pCommand ) 
         {
@@ -7454,8 +7164,6 @@
         }
         pCommand->command = eSmeCommandRoam;
         pCommand->sessionId = (tANI_U8)sessionId;
-        smsLog( pMac, LOG1, FL("Disassociate reason: %d, sessionId: %d"),
-                                reason,sessionId);
         switch ( reason )
         {
         case eCSR_DISCONNECT_REASON_MIC_ERROR:
@@ -7465,6 +7173,7 @@
             pCommand->u.roamCmd.roamReason = eCsrForcedDeauth;
             break;
         case eCSR_DISCONNECT_REASON_HANDOFF:
+            fHighPriority = eANI_BOOLEAN_TRUE;
             pCommand->u.roamCmd.roamReason = eCsrSmeIssuedDisassocForHandoff;
             break;
         case eCSR_DISCONNECT_REASON_UNSPECIFIED:
@@ -7480,7 +7189,7 @@
         default:
             break;
         }
-        status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
+        status = csrQueueSmeCommand(pMac, pCommand, fHighPriority);
         if( !HAL_STATUS_SUCCESS( status ) )
         {
             smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status );
@@ -7549,12 +7258,10 @@
     }
     else
     {
-        pMac->roam.roamSession[sessionId].connectState =
-            eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTING;
         csrScanAbortScanForSSID(pMac, sessionId);
         status = eHAL_STATUS_CMD_NOT_QUEUED;
-        smsLog(pMac, LOGE,
-             FL("Disconnect not queued, Abort Scan for SSID"));
+        smsLog( pMac, LOG1, FL(" Disconnect cmd not queued, Roam command is not present"
+                               " return with status %d"), status);
     }
     return (status);
 }
@@ -7575,18 +7282,6 @@
     return (csrRoamDisconnectInternal(pMac, sessionId, reason));
 }
 
-void csr_abortConnection(tpAniSirGlobal pMac, tANI_U32 sessionId)
-{
-    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
-        return;
-    }
-    pSession->abortConnection = TRUE;
-    return;
-}
-
 eHalStatus csrRoamSaveConnectedInfomation(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
                                           tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes)
 {
@@ -7640,12 +7335,6 @@
         vos_mem_copy(pConnectProfile->pAddIEAssoc, pProfile->pAddIEAssoc,
                      pProfile->nAddIEAssocLength);
     }
-
-#ifdef WLAN_FEATURE_11W
-    pConnectProfile->MFPEnabled = pProfile->MFPEnabled;
-    pConnectProfile->MFPRequired = pProfile->MFPRequired;
-    pConnectProfile->MFPCapable = pProfile->MFPCapable;
-#endif
     
     //Save bssid
     csrGetBssIdBssDesc(pMac, pSirBssDesc, &pConnectProfile->bssid);
@@ -7733,14 +7422,12 @@
 {
    tListElem *pEntry = NULL;
    tSmeCmd *pCommand = NULL;
-   tCsrRoamSession *pSession = NULL;
    //The head of the active list is the request we sent
    pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
    if(pEntry)
    {
        pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
    }
-   pSession = CSR_GET_SESSION( pMac, pSmeJoinRsp->sessionId );
    if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) 
    {
             if(pCommand && eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason)
@@ -7750,31 +7437,18 @@
 #endif
             }
             csrRoamComplete( pMac, eCsrJoinSuccess, (void *)pSmeJoinRsp );
-        if(!pSession)
-        {
-            smsLog(pMac, LOGE, FL(" session %d not found "),
-                                    pSmeJoinRsp->sessionId);
-            return;
-        }
-        pSession->abortConnection = FALSE;
    }
    else
    {
         tANI_U32 roamId = 0;
+        tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pSmeJoinRsp->sessionId );
         if(!pSession)
         {
-            smsLog(pMac, LOGE, FL(" session %d not found "),
-                                    pSmeJoinRsp->sessionId);
+            smsLog(pMac, LOGE, FL("  session %d not found "), pSmeJoinRsp->sessionId);
             return;
         }
-        if (pSession->abortConnection)
-        {
-            smsLog(pMac, LOG1, FL("Disconnection in progess"
-                                  "abort Join request"));
-            csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
-            pSession->abortConnection = FALSE;
-            return;
-        }
+        
+        
         //The head of the active list is the request we sent
         //Try to get back the same profile and roam again
         if(pCommand)
@@ -7841,11 +7515,11 @@
 
      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
                FL(" calling csrSendJoinReqMsg (eWNI_SME_REASSOC_REQ)"));
-     if (pMac->roam.configParam.roamDelayStatsEnabled)
-     {
-         vos_record_roam_event(e_SME_ISSUE_REASSOC_REQ, NULL, pProfile->negotiatedAuthType);
-         vos_record_roam_event(e_CACHE_ROAM_PEER_MAC, (void *)pSirBssDesc->bssId, 6);
-     }
+#ifdef DEBUG_ROAM_DELAY
+    //HACK usign buff len as Auth type
+    vos_record_roam_event(e_SME_ISSUE_REASSOC_REQ, NULL, pProfile->negotiatedAuthType);
+    vos_record_roam_event(e_CACHE_ROAM_PEER_MAC, (void *)pSirBssDesc->bssId, 6);
+#endif
     // attempt to Join this BSS...
     return csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_REASSOC_REQ);
 }
@@ -7856,7 +7530,7 @@
     tSmeCmd *pCommand;
     tCsrRoamInfo roamInfo;
     tANI_U32 sessionId;
-    tCsrRoamSession *pSession = NULL;
+    tCsrRoamSession *pSession;
             
     pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
     if(pEntry)
@@ -8093,7 +7767,7 @@
     tSirBssDescription *pBssDesc = NULL;
     tSmeCmd *pCommand = NULL;
     tANI_U32 sessionId;
-    tCsrRoamSession *pSession = NULL;
+    tCsrRoamSession *pSession;
     if(NULL == pEntry)
     {
         smsLog(pMac, LOGE, "   CFG_CNF with active list empty");
@@ -8289,6 +7963,8 @@
 
 static void csrRoamRoamingStateAuthRspProcessor( tpAniSirGlobal pMac, tSirSmeAuthRsp *pSmeAuthRsp )
 {
+    //No one is sending eWNI_SME_AUTH_REQ to PE.
+    smsLog(pMac, LOGW, FL("is no-op"));
     if ( eSIR_SME_SUCCESS == pSmeAuthRsp->statusCode ) 
     {
         smsLog( pMac, LOGW, "CSR SmeAuthReq Successful" );
@@ -8311,11 +7987,8 @@
     tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
     tCsrRoamInfo roamInfo;
     tANI_U32 roamId = 0;
-    tANI_U32 current_timestamp, max_time = -1;
-    tANI_U32 candidateApCnt, oldestIndex;
-    tANI_U8 nilMac[6] = {0};
-
-    if (eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode)
+    
+    if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) 
     {
         smsLog( pMac, LOGW, "CSR SmeReassocReq Successful" );
         result = eCsrReassocSuccess;
@@ -8328,73 +8001,6 @@
             /* Need to dig more on indicating events to SME QoS module */
             sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL);
             csrRoamComplete( pMac, result, pSmeJoinRsp);
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-            /* Add previous BSSID to blacklist ; this will be in blacklised for
-             * some period and score of this AP will be reduced if black listed
-             * to avoid ping pong */
-            if (pMac->PERroamCandidatesCnt)
-            {
-              current_timestamp = jiffies_to_msecs(jiffies);
-              for (candidateApCnt = 0; candidateApCnt <
-                   SIR_PER_ROAM_MAX_CANDIDATE_CNT; candidateApCnt++)
-              {
-                  /* Find one blank entry */
-                  if (sirCompareMacAddr(nilMac,
-                          pMac->previousRoamApInfo[candidateApCnt].bssAddr))
-                  {
-                      vos_mem_copy(pMac->previousRoamApInfo[candidateApCnt].
-                                   bssAddr,
-                                   pNeighborRoamInfo->prevConnProfile.bssid,
-                                   sizeof(tSirMacAddr));
-                      pMac->previousRoamApInfo[candidateApCnt].timeStamp =
-                          current_timestamp;
-                      smsLog(pMac, LOG1, FL("added bssid=" MAC_ADDRESS_STR " at index %d"),
-                             MAC_ADDR_ARRAY(
-                                 pNeighborRoamInfo->prevConnProfile.bssid),
-                             candidateApCnt);
-                      break;
-                  }
-                  /* if already in the list */
-                  if (sirCompareMacAddr(pMac->previousRoamApInfo
-                      [candidateApCnt].bssAddr,
-                      pNeighborRoamInfo->prevConnProfile.bssid) &&
-                      ((current_timestamp -
-                          pMac->previousRoamApInfo[candidateApCnt].timeStamp) >
-                          pMac->PERroamTimeout))
-                  {
-                      vos_mem_copy(pMac->previousRoamApInfo[candidateApCnt].
-                                   bssAddr,
-                                   pNeighborRoamInfo->prevConnProfile.bssid,
-                                   sizeof(tSirMacAddr));
-                      pMac->previousRoamApInfo[candidateApCnt].timeStamp =
-                          current_timestamp;
-                      break;
-                  } else
-                  {
-                      /* find oldest BSSID entry in the blacklist */
-                      if (max_time <
-                             pMac->previousRoamApInfo[candidateApCnt].timeStamp)
-                      {
-                          max_time =
-                             pMac->previousRoamApInfo[candidateApCnt].timeStamp;
-                          oldestIndex = candidateApCnt;
-                      }
-                  }
-              }
-              if (candidateApCnt == SIR_PER_ROAM_MAX_CANDIDATE_CNT)
-              {
-                 smsLog(pMac, LOGW,
-                        "%s: Clearing out oldest roam results bssid="
-                        MAC_ADDRESS_STR,
-                        __func__,
-                        MAC_ADDR_ARRAY(pMac->previousRoamApInfo[oldestIndex].bssAddr));
-                  pMac->previousRoamApInfo[oldestIndex].timeStamp = current_timestamp;
-                  vos_mem_copy(pMac->previousRoamApInfo[oldestIndex].bssAddr,
-                       pNeighborRoamInfo->prevConnProfile.bssid,
-                       sizeof(tSirMacAddr));
-              }
-            }
-#endif
         }
         else
 #endif
@@ -8408,10 +8014,6 @@
     {
         smsLog( pMac, LOGW, "CSR SmeReassocReq failed with statusCode= 0x%08X [%d]", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode );
         result = eCsrReassocFailure;
-        vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                          WLAN_LOG_INDICATOR_HOST_DRIVER,
-                          WLAN_LOG_REASON_ROAM_FAIL,
-                          FALSE, TRUE);
 #ifdef WLAN_FEATURE_VOWIFI_11R
         if ((eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE == pSmeJoinRsp->statusCode) ||
             (eSIR_SME_FT_REASSOC_FAILURE == pSmeJoinRsp->statusCode) ||
@@ -8493,7 +8095,7 @@
     tSmeCmd *pCommand = NULL;
 #endif
     tANI_U32 sessionId;
-    tCsrRoamSession *pSession = NULL;
+    tCsrRoamSession *pSession;
 
     tSirSmeDisassocRsp SmeDisassocRsp;
 
@@ -8517,7 +8119,6 @@
     
     if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, sessionId ) )
     {
-        smsLog( pMac, LOG2, "***eCsrNothingToJoin***");
         csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
     }
     else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, sessionId ) ||
@@ -8646,7 +8247,6 @@
         
             /* Notify sub-modules like QoS etc. that handoff happening */
             sme_QosCsrEventInd(pMac, sessionId, SME_QOS_CSR_HANDOFF_ASSOC_REQ, NULL);
-            pmcStopTrafficTimer(pMac);
             csrReleaseProfile(pMac, pCurRoamProfile);
             vos_mem_free(pCurRoamProfile);
             csrFreeScanFilter(pMac, pScanFilter);
@@ -8717,6 +8317,8 @@
 static void csrRoamRoamingStateDeauthRspProcessor( tpAniSirGlobal pMac, tSirSmeDeauthRsp *pSmeRsp )
 {
     tSirResultCodes statusCode;
+    //No one is sending eWNI_SME_DEAUTH_REQ to PE.
+    smsLog(pMac, LOGW, FL("is no-op"));
     statusCode = csrGetDeAuthRspStatusCode( pSmeRsp );
     pMac->roam.deauthRspStatus = statusCode;
     if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId) )
@@ -8825,10 +8427,9 @@
                        macTraceGetcsrRoamSubState(
                        pMac->roam.curSubState[pSmeRsp->sessionId]));
                 csrRoamRoamingStateDisassocRspProcessor( pMac, (tSirSmeDisassocRsp *)pSmeRsp );
-                if (pMac->roam.configParam.roamDelayStatsEnabled)
-                {
-                    vos_record_roam_event(e_SME_DISASSOC_COMPLETE, NULL, 0);
-                }
+#ifdef DEBUG_ROAM_DELAY
+                vos_record_roam_event(e_SME_DISASSOC_COMPLETE, NULL, 0);
+#endif
             }
             break;
                    
@@ -8866,18 +8467,6 @@
                                 eCSR_ROAM_CONNECT_STATUS_UPDATE, 
                                 eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED);
             break;
-        case eWNI_SME_LOST_LINK_PARAMS_IND:
-            {
-                tpSirSmeLostLinkParamsInd pLostLinkParamsInd = (tpSirSmeLostLinkParamsInd)pSmeRsp;
-                tCsrRoamInfo roamInfo, *pRoamInfo = NULL;
-                eCsrRoamResult result = eCSR_ROAM_RESULT_NONE;
-                vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0);
-                roamInfo.u.pLostLinkParams = &pLostLinkParamsInd->info;
-                pRoamInfo = &roamInfo;
-                csrRoamCallCallback(pMac, pLostLinkParamsInd->sessionId,
-                               pRoamInfo, 0, eCSR_ROAM_LOST_LINK_PARAMS_IND, result);
-                break;
-            }
         default:
             smsLog(pMac, LOG1,
                    FL("Unexpected message type = %d[0x%X] received in substate %s"),
@@ -8905,7 +8494,7 @@
           break;
         case eWNI_SME_UPPER_LAYER_ASSOC_CNF:
         {
-            tCsrRoamSession *pSession = NULL;
+            tCsrRoamSession  *pSession;
             tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf;
             tCsrRoamInfo roamInfo;
             tCsrRoamInfo *pRoamInfo = NULL;
@@ -8936,13 +8525,6 @@
             vos_mem_copy(&pRoamInfo->bssid, pUpperLayerAssocCnf->bssId,
                          sizeof(tCsrBssid));
             pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-            pRoamInfo->HT40MHzIntoEnabledSta =
-                       pUpperLayerAssocCnf->HT40MHzIntoEnabledSta;
-            smsLog( pMac, LOGW, FL("HT40MHzIntoEnabledSta: %d \n"),
-                                    pRoamInfo->HT40MHzIntoEnabledSta);
-#endif
-            pRoamInfo->maxRateFlags = pUpperLayerAssocCnf->rate_flags;
             if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) )
             {
                 pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED;
@@ -9226,13 +8808,13 @@
                     sizeof(vos_event_wlan_security_payload_type), 0);
         if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 )
         {
-            setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_BCAST_REQ;
+            setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_REQ;
             setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType);
             setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType);
         }
         else
         {
-            setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_UNICAST_REQ;
+            setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_REQ;
             setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType);
             setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType);
         }
@@ -9278,11 +8860,11 @@
         {
             if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 )
             {
-                setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_BCAST_RSP;
+                setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP;
             }
             else
             {
-                setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_UNICAST_RSP;
+                setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP;
             }
             setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE;
             WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY);
@@ -9833,7 +9415,6 @@
     tSirSmeAssocInd *pAssocInd;
     tSirSmeDisassocInd *pDisassocInd;
     tSirSmeDeauthInd *pDeauthInd;
-    tSirSmeDisConDoneInd *pDisConDoneInd;
     tSirSmeWmStatusChangeNtf *pStatusChangeMsg;
     tSirSmeNewBssInfo *pNewBss;
     tSmeIbssPeerInd *pIbssPeerInd;
@@ -9859,8 +9440,8 @@
     {
         case eWNI_SME_ASSOC_IND:
             {
-                tCsrRoamSession *pSession = NULL;
-                smsLog( pMac, LOG1, FL("Receive WNI_SME_ASSOC_IND from SME"));
+                tCsrRoamSession  *pSession;
+                smsLog( pMac, LOG1, FL("ASSOCIATION Indication from SME"));
                 pAssocInd = (tSirSmeAssocInd *)pSirMsg;
                 status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pAssocInd->bssId, &sessionId );
                 if( HAL_STATUS_SUCCESS( status ) )
@@ -9895,13 +9476,6 @@
                     vos_mem_copy(&pRoamInfo->bssid, pAssocInd->bssId,
                                  sizeof(tCsrBssid));
                     pRoamInfo->wmmEnabledSta = pAssocInd->wmmEnabledSta;
-                    pRoamInfo->maxRateFlags =  pAssocInd->rate_flags;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-                    pRoamInfo->HT40MHzIntoEnabledSta =
-                               pAssocInd->HT40MHzIntoEnabledSta;
-                    smsLog(pMac, LOGW, FL("HT40MHzIntoEnabledSta: %d \n"),
-                                       pRoamInfo->HT40MHzIntoEnabledSta);
-#endif
                     if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile))
                         status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta
                     if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile))
@@ -10001,6 +9575,19 @@
                     csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDisassociated, pSirMsg );
                     if (CSR_IS_INFRA_AP(&pSession->connectedProfile))
                     {
+                        pRoamInfo = &roamInfo;
+                        pRoamInfo->statusCode = pDisassocInd->statusCode;
+                        pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile;
+                        pRoamInfo->staId = (tANI_U8)pDisassocInd->staId;
+
+                        vos_mem_copy(pRoamInfo->peerMac, pDisassocInd->peerMacAddr,
+                                     sizeof(tSirMacAddr));
+                        vos_mem_copy(&pRoamInfo->bssid, pDisassocInd->bssId,
+                                     sizeof(tCsrBssid));
+
+                        status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0,
+                                        eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DISASSOC_IND);
+
                         /*
                          *  STA/P2P client got  disassociated so remove any pending deauth
                          *  commands in sme pending list
@@ -10075,33 +9662,26 @@
 #endif
                 csrRoamLinkDown(pMac, sessionId);
                 csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDeauthenticated, pSirMsg );
+                if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
+                {
+
+                    pRoamInfo = &roamInfo;
+
+                    pRoamInfo->statusCode = pDeauthInd->statusCode;
+                    pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile;
+
+                    pRoamInfo->staId = (tANI_U8)pDeauthInd->staId;
+
+                    vos_mem_copy(pRoamInfo->peerMac, pDeauthInd->peerMacAddr,
+                                 sizeof(tSirMacAddr));
+                    vos_mem_copy(&pRoamInfo->bssid, pDeauthInd->bssId,
+                                 sizeof(tCsrBssid));
+
+                    status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DEAUTH_IND);
+                }
             }
             break;
-
-        case eWNI_SME_DISCONNECT_DONE_IND:
-            pDisConDoneInd = (tSirSmeDisConDoneInd *)(pSirMsg);
-            smsLog( pMac, LOG1,
-                    FL("eWNI_SME_DISCONNECT_DONE_IND RC:%d"),
-                        pDisConDoneInd->reasonCode);
-            if( CSR_IS_SESSION_VALID(pMac, pDisConDoneInd->sessionId))
-            {
-                roamInfo.reasonCode = pDisConDoneInd->reasonCode;
-                roamInfo.statusCode = eSIR_SME_STA_DISASSOCIATED;
-                vos_mem_copy(roamInfo.peerMac, pDisConDoneInd->peerMacAddr,
-                             sizeof(tSirMacAddr));
-                status = csrRoamCallCallback(pMac,
-                                     pDisConDoneInd->sessionId,
-                                     &roamInfo, 0,
-                                     eCSR_ROAM_LOSTLINK,
-                                     eCSR_ROAM_RESULT_DISASSOC_IND);
-            }
-            else
-            {
-                smsLog(pMac, LOGE, FL("Inactive session %d"),
-                        pDisConDoneInd->sessionId);
-            }
-            break;
-
+        
         case eWNI_SME_SWITCH_CHL_REQ:        // in case of STA, the SWITCH_CHANNEL originates from its AP
             smsLog( pMac, LOGW, FL("eWNI_SME_SWITCH_CHL_REQ from SME"));
             pSwitchChnInd = (tpSirSmeSwitchChannelInd)pSirMsg;
@@ -10168,18 +9748,6 @@
                 }
             }
             break;
-        case eWNI_SME_LOST_LINK_PARAMS_IND:
-            {
-                tpSirSmeLostLinkParamsInd pLostLinkParamsInd = (tpSirSmeLostLinkParamsInd)pSirMsg;
-                tCsrRoamInfo roamInfo, *pRoamInfo = NULL;
-                eCsrRoamResult result = eCSR_ROAM_RESULT_NONE;
-                vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0);
-                roamInfo.u.pLostLinkParams = &pLostLinkParamsInd->info;
-                pRoamInfo = &roamInfo;
-                csrRoamCallCallback(pMac, pLostLinkParamsInd->sessionId,
-                                   pRoamInfo, 0, eCSR_ROAM_LOST_LINK_PARAMS_IND, result);
-                break;
-            }
         case eWNI_SME_MIC_FAILURE_IND:
             {
                 tpSirSmeMicFailureInd pMicInd = (tpSirSmeMicFailureInd)pSirMsg;
@@ -10575,19 +10143,11 @@
                                         sizeof(vos_event_wlan_security_payload_type), 0);
                             if( pRsp->peerMacAddr[0] & 0x01 )
                             {
-                                setKeyEvent.eventId =
-                                           WLAN_SECURITY_EVENT_SET_BCAST_RSP;
+                                setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP;
                             }
                             else
                             {
-                                setKeyEvent.eventId =
-                                           WLAN_SECURITY_EVENT_SET_UNICAST_RSP;
-                            }
-                            if( pRsp->peerMacAddr[0] & 0x01 )
-                            {
-                                pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
-                                smsLog(pMac, LOG1, FL("Reset"
-                                "remainInPowerActiveTillDHCP to allow BMPS"));
+                                setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP;
                             }
                             setKeyEvent.encryptionModeMulticast = 
                                 (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType);
@@ -10632,21 +10192,14 @@
                                        tpSirSetActiveModeSetBncFilterReq pMsg;
                                        pMsg = vos_mem_malloc(sizeof(tSirSetActiveModeSetBncFilterReq));
                                        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SET_BCN_FILTER_REQ);
-                                       pMsg->length = pal_cpu_to_be16(sizeof(
-                                           tSirSetActiveModeSetBncFilterReq));
+                                       pMsg->length = pal_cpu_to_be16(sizeof( tANI_U8));
                                        pMsg->seesionId = sessionId;
-                                       vos_mem_copy(pMsg->bssid,
-                                           pSession->connectedProfile.bssid,
-                                           sizeof(tSirMacAddr));
                                        status = palSendMBMessage(pMac->hHdd, pMsg ); 
                                     }
 #endif
                          /* OBSS SCAN Indication will be sent to Firmware to start OBSS Scan */
                                     if( CSR_IS_CHANNEL_24GHZ(pSession->connectedProfile.operationChannel)
                                        && IS_HT40_OBSS_SCAN_FEATURE_ENABLE
-                                       && (pSession->connectState ==
-                                           eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED)
-                                       && pSession->pCurRoamProfile
                                        && (VOS_P2P_GO_MODE !=
                                                pSession->pCurRoamProfile->csrPersona
                                            && VOS_STA_SAP_MODE !=
@@ -10664,20 +10217,6 @@
                                          status = palSendMBMessage(pMac->hHdd,
                                                                      pMsg );
                                     }
-                                    else
-                                    {
-                                         smsLog( pMac, LOG1,FL("OBSS SCAN"
-                                                 "Indication not sent to FW"
-                                                 "channel %d OBSS_SCAN: %d"),
-                                                 pSession->connectedProfile.
-                                                 operationChannel,
-                                                 IS_HT40_OBSS_SCAN_FEATURE_ENABLE);
-                                         smsLog( pMac, LOG1,FL("connectState %d"
-                                                 "pCurRoamProfile %p"),
-                                                 pSession->connectState,
-                                                 pSession->pCurRoamProfile);
-                                    }
-
                                     result = eCSR_ROAM_RESULT_AUTHENTICATED;
                                 }
                                 else
@@ -10693,7 +10232,6 @@
                                    "command failed(%d) PeerMac "MAC_ADDRESS_STR,
                                    pRsp->statusCode, MAC_ADDR_ARRAY(pRsp->peerMacAddr));
                         }
-                        roamInfo.is11rAssoc = csrRoamIs11rAssoc(pMac);
                         csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, 
                                             eCSR_ROAM_SET_KEY_COMPLETE, result);
                         // Indicate SME_QOS that the SET_KEY is completed, so that SME_QOS
@@ -11047,7 +10585,7 @@
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pInfo->sessionId );
     eHalStatus status = eHAL_STATUS_FAILURE;
 
-    smsLog(pMac, LOGE, FL("WaitForKey timer expired in state=%s sub-state=%s"),
+    smsLog(pMac, LOGW, FL("WaitForKey timer expired in state=%s sub-state=%s"),
            macTraceGetNeighbourRoamState(
            pMac->roam.neighborRoamInfo.neighborRoamState),
            macTraceGetcsrRoamSubState(
@@ -11070,7 +10608,7 @@
                     NULL, eANI_BOOLEAN_FALSE);
         }
 #endif
-        smsLog(pMac, LOGE, " SME pre-auth state timeout. ");
+        smsLog(pMac, LOGW, " SME pre-auth state timeout. ");
 
         //Change the substate so command queue is unblocked.
         if (CSR_ROAM_SESSION_MAX > pInfo->sessionId)
@@ -11085,18 +10623,26 @@
             {
                 csrRoamLinkUp(pMac, pSession->connectedProfile.bssid);
                 smeProcessPendingQueue(pMac);
-                status = sme_AcquireGlobalLock(&pMac->sme);
-                if (HAL_STATUS_SUCCESS(status))
+                if( (pSession->connectedProfile.AuthType ==
+                                           eCSR_AUTH_TYPE_SHARED_KEY) &&
+                    ( (pSession->connectedProfile.EncryptionType ==
+                                           eCSR_ENCRYPT_TYPE_WEP40) ||
+                      (pSession->connectedProfile.EncryptionType ==
+                                           eCSR_ENCRYPT_TYPE_WEP104) ))
                 {
-                    csrRoamDisconnect(pMac, pInfo->sessionId,
-                            eCSR_DISCONNECT_REASON_UNSPECIFIED);
-                    sme_ReleaseGlobalLock(&pMac->sme);
+                    status = sme_AcquireGlobalLock( &pMac->sme );
+                    if ( HAL_STATUS_SUCCESS( status ) )
+                    {
+                        csrRoamDisconnect( pMac, pInfo->sessionId,
+                                      eCSR_DISCONNECT_REASON_UNSPECIFIED );
+                        sme_ReleaseGlobalLock( &pMac->sme );
+                    }
                 }
             }
             else
             {
-                smsLog(pMac, LOGE, FL("Session id %d is disconnected"),
-                        pInfo->sessionId);
+                smsLog(pMac, LOGW, "%s: could not post link up",
+                        __func__);
             }
         }
         else
@@ -11216,7 +10762,17 @@
         result = eCSR_ROAM_RESULT_DEAUTH_IND;
         pDeauthIndMsg = (tSirSmeDeauthInd *)pSirMsg;
         pSession->roamingStatusCode = pDeauthIndMsg->statusCode;
-        pSession->joinFailStatusCode.reasonCode = pDeauthIndMsg->reasonCode;
+        /* Convert into proper reason code */
+        if ((pDeauthIndMsg->reasonCode == eSIR_BEACON_MISSED) ||
+                (pDeauthIndMsg->reasonCode ==
+                 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON))
+            pSession->joinFailStatusCode.reasonCode = 0;
+        else
+            pSession->joinFailStatusCode.reasonCode = pDeauthIndMsg->reasonCode;
+
+       /* cfg layer expects 0 as reason code if
+          the driver dosent know the reason code
+          eSIR_BEACON_MISSED is defined as locally */
     }
     else
     {
@@ -11311,6 +10867,16 @@
     }
     if(!fToRoam)
     {
+        //Tell HDD about the lost link
+        if(!CSR_IS_INFRA_AP(&pSession->connectedProfile))
+        {
+            /* Don't call csrRoamCallCallback for GO/SoftAp case as this indication
+             * was already given as part of eWNI_SME_DISASSOC_IND msg handling in
+             * csrRoamCheckForLinkStatusChange API.
+             */
+            csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result);
+        }
+
        /*No need to start idle scan in case of IBSS/SAP 
          Still enable idle scan for polling in case concurrent sessions are running */
         if(CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile))
@@ -11415,9 +10981,7 @@
         smsLog(pMac, LOGE, FL("  session %d not found "), pCommand->sessionId);
         return;
     }
-    smsLog(pMac, LOG1, FL("session:%d, CmdType : %d"),
-                       pCommand->sessionId,
-                       pCommand->u.wmStatusChangeCmd.Type);
+    
     switch ( pCommand->u.wmStatusChangeCmd.Type )
     {
         case eCsrDisassociated:
@@ -12466,14 +12030,10 @@
         {
             if(CSR_IS_CHANNEL_24GHZ(Channel) )
             {
-#ifdef WLAN_FEATURE_AP_HT40_24G
-                if (CSR_IS_INFRA_AP(pProfile))
-                    cbMode = pMac->roam.configParam.channelBondingAPMode24GHz;
-                else
-                    cbMode = PHY_SINGLE_CHANNEL_CENTERED;
-#else
+                /* TODO- SAP: HT40 Support in SAP 2.4Ghz mode is not enabled.
+                    so channel bonding in 2.4Ghz is configured as 20MHZ
+                    irrespective of the 'channelBondingMode24GHz' Parameter */
                 cbMode = PHY_SINGLE_CHANNEL_CENTERED;
-#endif
             }
             else
             {
@@ -12574,7 +12134,7 @@
                                  tANI_U32 numItems )
 {
    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
-   tCsrRoamSession *pSession = NULL;
+   tCsrRoamSession *pSession;
    if(!CSR_IS_SESSION_VALID( pMac, sessionId ))
    {
        smsLog(pMac, LOGE, FL("  Invalid session ID"));
@@ -12600,7 +12160,7 @@
                                 tBkidCacheInfo *pBkidCache)
 {
    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
-   tCsrRoamSession *pSession = NULL;
+   tCsrRoamSession *pSession;
    if(!CSR_IS_SESSION_VALID( pMac, sessionId ))
    {
        smsLog(pMac, LOGE, FL("  Invalid session ID"));
@@ -12671,40 +12231,44 @@
 #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR
         status = eHAL_STATUS_SUCCESS;
         if (update_entire_cache) {
+            pSession->NumPmkidCache = (tANI_U16)numItems;
             if (numItems && pPMKIDCache)
             {
-                pSession->NumPmkidCache = (tANI_U16)numItems;
                 vos_mem_copy(pSession->PmkidCacheInfo, pPMKIDCache,
                              sizeof(tPmkidCacheInfo) * numItems);
-                pSession->CurCacheIndex = (tANI_U16)numItems;
             }
         } else {
-            tANI_U32 i = 0;
+            tANI_U32 i = 0, j = 0;
+            tANI_U8 BSSIDMatched = 0;
             tPmkidCacheInfo *pmksa;
 
             for (i = 0; i < numItems; i++) {
                 pmksa = &pPMKIDCache[i];
+                for (j = 0; j < CSR_MAX_PMKID_ALLOWED; j++) {
+                    if (vos_mem_compare(pSession->PmkidCacheInfo[j].BSSID,
+                        pmksa->BSSID, VOS_MAC_ADDR_SIZE)) {
+                        /* If a matching BSSID found, update it */
+                        BSSIDMatched = 1;
+                        vos_mem_copy(pSession->PmkidCacheInfo[j].PMKID,
+                                     pmksa->PMKID, CSR_RSN_PMKID_SIZE);
+                        break;
+                    }
+                }
 
-                /* Delete the entry if present */
-                csrRoamDelPMKIDfromCache(pMac,sessionId,pmksa->BSSID,FALSE);
-
-                /* Add entry to the cache */
-                vos_mem_copy(
-                   pSession->PmkidCacheInfo[pSession->CurCacheIndex].BSSID,
-                   pmksa->BSSID, VOS_MAC_ADDR_SIZE);
-                vos_mem_copy(
-                   pSession->PmkidCacheInfo[pSession->CurCacheIndex].PMKID,
-                   pmksa->PMKID, CSR_RSN_PMKID_SIZE);
-
-                /* Increment the CSR local cache index */
-                if (pSession->CurCacheIndex < (CSR_MAX_PMKID_ALLOWED - 1))
-                    pSession->CurCacheIndex++;
-                else
-                    pSession->CurCacheIndex = 0;
-
-                pSession->NumPmkidCache++;
-                if(pSession->NumPmkidCache > CSR_MAX_PMKID_ALLOWED)
-                    pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED;
+                if (!BSSIDMatched) {
+                    vos_mem_copy(
+                       pSession->PmkidCacheInfo[pSession->NumPmkidCache].BSSID,
+                       pmksa->BSSID, VOS_MAC_ADDR_SIZE);
+                    vos_mem_copy(
+                       pSession->PmkidCacheInfo[pSession->NumPmkidCache].PMKID,
+                       pmksa->PMKID, CSR_RSN_PMKID_SIZE);
+                    /* Increment the CSR local cache index */
+                    if (pSession->NumPmkidCache < (CSR_MAX_PMKID_ALLOWED - 1))
+                        pSession->NumPmkidCache++;
+                    else
+                        pSession->NumPmkidCache = 0;
+                }
+                BSSIDMatched = 0;
             }
         }
     }
@@ -12712,18 +12276,13 @@
 }
 
 eHalStatus csrRoamDelPMKIDfromCache( tpAniSirGlobal pMac, tANI_U32 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                     const tANI_U8 *pBSSId,
-#else
                                      tANI_U8 *pBSSId,
-#endif
                                      tANI_BOOLEAN flush_cache )
 {
+    eHalStatus status = eHAL_STATUS_FAILURE;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     tANI_BOOLEAN fMatchFound = FALSE;
     tANI_U32 Index;
-    tANI_U32 CurIndex;
-    tANI_U32 i;
 
     if(!pSession)
     {
@@ -12746,6 +12305,7 @@
                 /* Clear this - the matched entry */
                 vos_mem_zero(&pSession->PmkidCacheInfo[Index],
                              sizeof(tPmkidCacheInfo));
+                status = eHAL_STATUS_SUCCESS;
                 break;
             }
         }
@@ -12753,37 +12313,17 @@
         if (Index == CSR_MAX_PMKID_ALLOWED && !fMatchFound) {
             smsLog(pMac, LOG1, FL("No such PMKSA entry exists "MAC_ADDRESS_STR),
                    MAC_ADDR_ARRAY(pBSSId));
+            return status;
         }
-        else {
-            /* Match Found */
-            CurIndex = pSession->CurCacheIndex;
-            if(Index < CurIndex) {
-                for(i = Index; i < (CurIndex-1); i++) {
-                    vos_mem_copy(&pSession->PmkidCacheInfo[i],
-                        &pSession->PmkidCacheInfo[i+1],sizeof(tPmkidCacheInfo));
-                }
-                pSession->CurCacheIndex--;
-                vos_mem_zero(&pSession->PmkidCacheInfo[pSession->CurCacheIndex],
-                    sizeof(tPmkidCacheInfo));
-            } else if(Index > CurIndex) {
-                for(i = Index; i > (CurIndex); i--) {
-                    vos_mem_copy(&pSession->PmkidCacheInfo[i],
-                        &pSession->PmkidCacheInfo[i-1],sizeof(tPmkidCacheInfo));
-                }
-                vos_mem_zero(&pSession->PmkidCacheInfo[pSession->CurCacheIndex],
-                    sizeof(tPmkidCacheInfo));
-            }
-            pSession->NumPmkidCache--;
-        }
+
+        return status;
     } else {
         /* Flush the entire cache */
         vos_mem_zero(pSession->PmkidCacheInfo,
                      sizeof(tPmkidCacheInfo) * CSR_MAX_PMKID_ALLOWED);
         pSession->NumPmkidCache = 0;
-        pSession->CurCacheIndex = 0;
+        return eHAL_STATUS_SUCCESS;
     }
-
-    return eHAL_STATUS_SUCCESS;
 }
 
 tANI_U32 csrRoamGetNumPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId)
@@ -12795,8 +12335,6 @@
 {
     eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-    tPmkidCacheInfo *pmksa;
-    tANI_U16 i,j;
 
     if(!pSession)
     {
@@ -12819,16 +12357,8 @@
                   pSession->NumPmkidCache);
                 pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED;
             }
-
-            for(i = 0,j = 0; (j<pSession->NumPmkidCache)&&(i<CSR_MAX_PMKID_ALLOWED); i++) {
-                pmksa = &pSession->PmkidCacheInfo[i];
-                if(!csrIsMacAddressZero(pMac, &pmksa->BSSID)) {
-                    vos_mem_copy(pPmkidCache,pmksa,sizeof(tPmkidCacheInfo));
-                    pPmkidCache++;
-                    j++;
-                }
-            }
-
+            vos_mem_copy(pPmkidCache, pSession->PmkidCacheInfo,
+                         sizeof(tPmkidCacheInfo) * pSession->NumPmkidCache);
             *pNum = pSession->NumPmkidCache;
             status = eHAL_STATUS_SUCCESS;
         }
@@ -13204,18 +12734,12 @@
     }
     size = sizeof(pMac->roam.validChannelList);
     if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &size)))
-    {
-        tANI_U8 *actualSize = pBuf++;
-        *actualSize = 0;
-
-        for ( i = 0; i < size; i++)
+    { 
+        *pBuf++ = (tANI_U8)size;        //tSirSupChnl->numChnl        
+        for ( i = 0; i < size; i++) 
         {
-            /* Only add 5ghz channels*/
-            if (CSR_IS_CHANNEL_5GHZ(pMac->roam.validChannelList[ i ]))
-            {
-                 *actualSize +=1;
-                 *pBuf++ = pMac->roam.validChannelList[ i ];
-            }
+            *pBuf++ = pMac->roam.validChannelList[ i ];   //tSirSupChnl->channelList[ i ]
+             
         }
     }
     else
@@ -13267,7 +12791,6 @@
     tANI_U8 wpaRsnIE[DOT11F_IE_RSN_MAX_LEN];    //RSN MAX is bigger than WPA MAX
     tANI_U32 ucDot11Mode = 0;
     tANI_U8 txBFCsnValue = 0;
-    tANI_U16 rateBitmap = 0;
 
     if(!pSession)
     {
@@ -13350,10 +12873,6 @@
         //Persona
         *pBuf = (tANI_U8)pProfile->csrPersona;
         pBuf++;
-        *pBuf = (tANI_U8)pProfile->bOSENAssociation;
-        pBuf++;
-        *pBuf = (tANI_U8)pProfile->bWPSAssociation;
-        pBuf++;
         //CBMode
         *pBuf = (tANI_U8)pSession->bssParams.cbMode;
         pBuf++;
@@ -13367,7 +12886,7 @@
 
 
 
-        status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, pBssDescription, pIes, &OpRateSet, &ExRateSet,&rateBitmap);
+        status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, pBssDescription, pIes, &OpRateSet, &ExRateSet);
         if (HAL_STATUS_SUCCESS(status) )
         {
             // OperationalRateSet
@@ -13388,11 +12907,6 @@
             *pBuf++ = 0;
             *pBuf++ = 0;
         }
-
-        //rateBitmap
-        vos_mem_copy(pBuf, &rateBitmap, sizeof(tANI_U16));
-        pBuf += sizeof(tANI_U16);
-
         // rsnIE
         if ( csrIsProfileWpa( pProfile ) )
         {
@@ -13823,12 +13337,10 @@
         pBuf++;
 
         // txBFCsnValue
-        if (IS_BSS_VHT_CAPABLE(pIes->VHTCaps))
+        txBFCsnValue = (tANI_U8)pMac->roam.configParam.txBFCsnValue;
+        if (pIes->VHTCaps.present)
         {
-            txBFCsnValue = (tANI_U8)pMac->roam.configParam.txBFCsnValue;
-            if (pIes->VHTCaps.numSoundingDim)
-               txBFCsnValue = CSR_ROAM_MIN
-                  (txBFCsnValue, pIes->VHTCaps.numSoundingDim);
+            txBFCsnValue = CSR_ROAM_MIN(txBFCsnValue, pIes->VHTCaps.numSoundingDim);
         }
         *pBuf = txBFCsnValue;
         pBuf++;
@@ -14166,58 +13678,6 @@
      return status;
 }
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-eHalStatus csrSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U8 cbMode)
-{
-    tpSirSetHT2040Mode pMsg;
-    tANI_U16 len = 0;
-    eHalStatus status   = eHAL_STATUS_SUCCESS;
-    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-
-     /* Create the message and send to lim */
-     len = sizeof(tSirSetHT2040Mode);
-     pMsg = vos_mem_malloc(len);
-
-     if ( NULL == pMsg )
-     {
-         smsLog( pMac, LOGE, FL("Memory Allocation Fail !!!"));
-         status = eHAL_STATUS_FAILURE;
-     }
-     else
-         status = eHAL_STATUS_SUCCESS;
-
-     if(HAL_STATUS_SUCCESS(status))
-     {
-         vos_mem_set(pMsg, sizeof(tSirSetHT2040Mode), 0);
-         pMsg->messageType     = eWNI_SME_SET_HT_2040_MODE;
-         pMsg->length          = len;
-
-        // bssId
-        vos_mem_copy((tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr,
-                     sizeof(tSirMacAddr));
-
-        smsLog( pMac, LOGW, FL("CSR Attempting to set "
-                      "HT20/40 mode for Bssid= "MAC_ADDRESS_STR),
-                      MAC_ADDR_ARRAY(pMsg->bssId));
-
-        pMsg->sessionId = sessionId;
-        pMsg->cbMode    = cbMode;
-
-        smsLog(pMac, LOGW, FL("session %d Channel Bonding: %d"),
-                                               sessionId, cbMode);
-
-        status = palSendMBMessage(pMac->hHdd, pMsg);
-     }
-     return status;
-}
-#endif
-
 eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -14303,7 +13763,6 @@
         pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_CNF);
         pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS);
         pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocCnf ));
-        pMsg->assocId = pal_cpu_to_be16((tANI_U16)pDisassocInd->assocId);
         vos_mem_copy(pMsg->peerMacAddr, pDisassocInd->peerMacAddr,
                      sizeof(pMsg->peerMacAddr));
         status = eHAL_STATUS_SUCCESS;
@@ -14341,7 +13800,6 @@
         pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_CNF);
         pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS);
         pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthCnf ));
-        pMsg->assocId = pal_cpu_to_be16((tANI_U16)pDeauthInd->assocId);
         vos_mem_copy(pMsg->bssId, pDeauthInd->bssId, sizeof(pMsg->bssId));
         status = eHAL_STATUS_SUCCESS;
         if(!HAL_STATUS_SUCCESS(status))
@@ -14368,10 +13826,6 @@
     tANI_U8 *pBuf;
     tSirResultCodes statusCode;
     tANI_U16 wTmp;
-
-    smsLog( pMac, LOG1, FL("Posting eWNI_SME_ASSOC_CNF to LIM. "
-                           "HalStatus : %d"),
-                            Halstatus);
     do {
         pMsg = vos_mem_malloc(sizeof( tSirSmeAssocCnf ));
         if ( NULL == pMsg )
@@ -14474,13 +13928,6 @@
         //reassocReq
         *pBuf = pAssocInd->reassocReq;
         pBuf += sizeof (tANI_U8);
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        // 40 MHz Intolerant
-        *pBuf = pAssocInd->HT40MHzIntoEnabledSta;
-        pBuf += sizeof (tANI_U8);
-#endif
-        *pBuf = pAssocInd->rate_flags;
-        pBuf += sizeof (uint32_t);
         msgQ.type = eWNI_SME_UPPER_LAYER_ASSOC_CNF;
         msgQ.bodyptr = pMsg;
         msgQ.bodyval = 0;
@@ -14774,9 +14221,6 @@
                          pParam->extendedRateSet.numRates);
             pBuf += pParam->extendedRateSet.numRates;
         }
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        *pBuf++ = (tANI_U8)pMac->roam.configParam.apHT40_24GEnabled;
-#endif
 
         msgLen = (tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)); //msg_header + msg
         pMsg->length = pal_cpu_to_be16(msgLen);
@@ -14800,37 +14244,60 @@
         return eHAL_STATUS_FAILURE;
     }
     
-    pMsg = vos_mem_malloc(sizeof(tSirSmeStopBssReq));
-    if ( NULL == pMsg ) return eHAL_STATUS_FAILURE;
-    vos_mem_set(pMsg, sizeof( tSirSmeStopBssReq ), 0);
-    pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ);
-    pBuf = &pMsg->sessionId;
-    //sessionId
-    *pBuf = (tANI_U8)sessionId;
-    pBuf++;
-    // transactionId
-    *pBuf = 0;
-    pBuf += sizeof(tANI_U16);
-    //reason code
-    *pBuf  = 0;
-    pBuf += sizeof(tSirResultCodes);
-    // bssid
-    // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile
-    if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) )
-    {
-        vos_mem_copy(pBuf, (tANI_U8 *)&pSession->selfMacAddr,
-                    sizeof(tSirMacAddr));
-    }
-    else
-    {
-        vos_mem_copy(pBuf, (tANI_U8 *)&pSession->connectedProfile.bssid,
-                    sizeof(tSirMacAddr));
-    }
-    pBuf += sizeof(tSirMacAddr);
-    msgLen = sizeof(tANI_U16) + sizeof(tANI_U16) + 1 + sizeof(tANI_U16) + sizeof(tSirResultCodes) + sizeof(tSirMacAddr);
-    pMsg->length =  pal_cpu_to_be16(msgLen);
-    status =  palSendMBMessage( pMac->hHdd, pMsg );
-
+    do {
+        pMsg = vos_mem_malloc(sizeof(tSirSmeStopBssReq));
+        if ( NULL == pMsg ) return eHAL_STATUS_FAILURE;
+        vos_mem_set(pMsg, sizeof( tSirSmeStopBssReq ), 0);
+        pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ);
+        pBuf = &pMsg->sessionId;
+        //sessionId
+        *pBuf = (tANI_U8)sessionId;
+        pBuf++;
+        // transactionId
+        *pBuf = 0;
+        pBuf += sizeof(tANI_U16);
+        //reason code
+        *pBuf  = 0;
+        pBuf += sizeof(tSirResultCodes);
+        // bssid 
+        // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile
+        if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) )
+        {
+            vos_mem_copy(pBuf, (tANI_U8 *)&pSession->selfMacAddr,
+                         sizeof(tSirMacAddr));
+        }
+        else
+        {
+            vos_mem_copy(pBuf, (tANI_U8 *)&pSession->connectedProfile.bssid,
+                         sizeof(tSirMacAddr));
+        }
+       pBuf += sizeof(tSirMacAddr);
+       msgLen = sizeof(tANI_U16) + sizeof(tANI_U16) + 1 + sizeof(tANI_U16) + sizeof(tSirResultCodes) + sizeof(tSirMacAddr);
+       pMsg->length =  pal_cpu_to_be16(msgLen);
+       status =  palSendMBMessage( pMac->hHdd, pMsg );
+#if 0            
+        pMsg = vos_mem_malloc(sizeof(tSirSmeStopBssReq));
+        if ( NULL == pMsg ) return eHAL_STATUS_FAILURE;
+        vos_mem_set(pMsg, sizeof( tSirSmeStopBssReq ), 0);
+                pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ);
+                pMsg->reasonCode = 0;
+        // bssid
+        // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile
+        if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) )
+        {
+            pbBssid = (tANI_U8 *)&pSession->selfMacAddr;
+        }
+        else
+        {
+            pbBssid = (tANI_U8 *)&pSession->connectedProfile.bssid;
+        }
+        vos_mem_copy(&pMsg->bssId, pbBssid, sizeof(tSirMacAddr));
+        pMsg->transactionId = 0;
+        pMsg->sessionId = (tANI_U8)sessionId;
+                pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeStopBssReq ));
+                status = palSendMBMessage( pMac->hHdd, pMsg );
+#endif                
+        } while( 0 );
     return( status );
 }
 
@@ -14983,7 +14450,7 @@
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tANI_U32 i;
-    tCsrRoamSession *pSession = NULL;
+    tCsrRoamSession *pSession;
     *pbSessionId = CSR_SESSION_ID_INVALID;
     for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
     {
@@ -15118,7 +14585,6 @@
    return( status );
 }
 eHalStatus csrIssueDelStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId,
-                                       tANI_BOOLEAN fHighPriority,
                                        tSirMacAddr sessionMacAddr,
                                        csrRoamSessionCloseCallback callback,
                                        void *pContext)
@@ -15138,7 +14604,7 @@
       pCommand->u.delStaSessionCmd.pContext = pContext;
       vos_mem_copy(pCommand->u.delStaSessionCmd.selfMacAddr, sessionMacAddr,
                    sizeof( tSirMacAddr ));
-      status = csrQueueSmeCommand(pMac, pCommand, fHighPriority);
+      status = csrQueueSmeCommand(pMac, pCommand, TRUE);
       if( !HAL_STATUS_SUCCESS( status ) )
       {
          //Should be panic??
@@ -15152,8 +14618,7 @@
    return csrSendMBDelSelfStaReqMsg( pMac, 
          pCommand->u.delStaSessionCmd.selfMacAddr );
 }
-static void purgeCsrSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
-   bool flush_all)
+static void purgeCsrSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     tDblLinkList *pList = &pMac->roam.roamCmdPendingList;
     tListElem *pEntry, *pNext;
@@ -15172,13 +14637,6 @@
     {
         pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
         pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
-
-        if (!flush_all &&
-            csr_is_disconnect_full_power_cmd(pCommand)) {
-            smsLog(pMac, LOGW, FL(" Ignore disconnect"));
-            pEntry = pNext;
-            continue;
-        }
         if(pCommand->sessionId == sessionId)
         {
             if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
@@ -15211,29 +14669,20 @@
 #ifdef FEATURE_WLAN_BTAMP_UT_RF
         vos_timer_destroy(&pSession->hTimerJoinRetry);
 #endif
-        csrPurgeSmeCmdList(pMac, sessionId, true);
+        purgeSmeSessionCmdList(pMac, sessionId, &pMac->sme.smeCmdPendingList);
+        if (pMac->fScanOffload)
+        {
+            purgeSmeSessionCmdList(pMac, sessionId,
+                    &pMac->sme.smeScanCmdPendingList);
+        }
+
+        purgeCsrSessionCmdList(pMac, sessionId);
         csrInitSession(pMac, sessionId);
     }
 }
 
-void csrPurgeSmeCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
-     bool flush_all)
-{
-    purgeSmeSessionCmdList(pMac, sessionId,
-            &pMac->sme.smeCmdPendingList,
-            flush_all);
-    if (pMac->fScanOffload)
-    {
-        purgeSmeSessionCmdList(pMac, sessionId,
-                &pMac->sme.smeScanCmdPendingList,
-                flush_all);
-    }
-    purgeCsrSessionCmdList(pMac, sessionId,
-                           flush_all);
-}
-
 eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId,
-                                tANI_BOOLEAN fSync, tANI_U8 bPurgeList,
+                                tANI_BOOLEAN fSync, 
                                 csrRoamSessionCloseCallback callback,
                                 void *pContext )
 {
@@ -15246,14 +14695,16 @@
             csrCleanupSession(pMac, sessionId);
         }
         else
-        {
-            csrPurgeSmeCmdList(pMac, sessionId, bPurgeList);
-           /*  If bPurgeList is FALSE, it means HDD already free all the
-            *  cmd and later queue few essential cmd. Now sme should process
-            *  the cmd in  pending queue order only.Hence we should
-            *  avoid DEL_SELF_STA as high priority cmd.
-            */
-            status = csrIssueDelStaForSessionReq( pMac, sessionId, bPurgeList,
+        { 
+            purgeSmeSessionCmdList(pMac, sessionId,
+                    &pMac->sme.smeCmdPendingList);
+            if (pMac->fScanOffload)
+            {
+                purgeSmeSessionCmdList(pMac, sessionId,
+                        &pMac->sme.smeScanCmdPendingList);
+            }
+            purgeCsrSessionCmdList(pMac, sessionId);
+            status = csrIssueDelStaForSessionReq( pMac, sessionId,
                                         pSession->selfMacAddr, callback, pContext);
         }
     }
@@ -15314,7 +14765,7 @@
 #endif /* FEATURE_WLAN_WAPI */
     if (pSession->nAddIEScanLength)
     {
-       memset(pSession->addIEScan, 0 , SIR_MAC_MAX_ADD_IE_LENGTH);
+       memset(pSession->addIEScan, 0 , SIR_MAC_MAX_IE_LENGTH);
     }
     pSession->nAddIEScanLength = 0;
 
@@ -15388,46 +14839,27 @@
 #if   defined WLAN_FEATURE_NEIGHBOR_ROAMING
     {
         tANI_U32 sessionId = 0;
-        tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
         /* Indicate the neighbor roal algorithm about the connect indication */
         csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssid, &sessionId);
         csrNeighborRoamIndicateConnect(pMac, sessionId, VOS_STATUS_SUCCESS);
 
-        /* Making sure we are roaming force fully to 5GHz AP only once and
-         * only when we connected to 2.4GH AP only during initial association.
-         */
-        if(pNeighborRoamInfo->cfgParams.neighborInitialForcedRoamTo5GhEnable &&
-          (GetRFBand(pNeighborRoamInfo->currAPoperationChannel) ==
-          SIR_BAND_2_4_GHZ)
-          )
+        // Making sure we are roaming force fully to 5GHz AP only once and
+        // only when we connected to 2.4GH AP only during initial association.
+        if(pMac->roam.neighborRoamInfo.cfgParams.neighborInitialForcedRoamTo5GhEnable &&
+               GetRFBand(pMac->roam.neighborRoamInfo.currAPoperationChannel) == SIR_BAND_2_4_GHZ)
         {
-            status = vos_timer_start(
-                         &pNeighborRoamInfo->forcedInitialRoamTo5GHTimer,
-                         INITIAL_FORCED_ROAM_TO_5G_TIMER_PERIOD);
+            //Making ini value to false here only so we just roam to
+            //only once for whole driver load to unload tenure
+            pMac->roam.neighborRoamInfo.cfgParams.neighborInitialForcedRoamTo5GhEnable = VOS_FALSE;
+
+            status = vos_timer_start(&pMac->roam.neighborRoamInfo.forcedInitialRoamTo5GHTimer,
+                                     INITIAL_FORCED_ROAM_TO_5G_TIMER_PERIOD);
+            //MUKUL TODO: change the neighborResultsRefreshPeriod to some ini value reuqired ??
             if ( status != VOS_STATUS_SUCCESS )
             {
-                smsLog(pMac, LOGE,
-                       FL("forcedInitialRoamTo5GHTimer start failed status %d"),
-                       status);
-                //Send RSO start because in case 5G roaming
-                //host have not enabled at initial connection
-                csrRoamOffloadScan(pMac,ROAM_SCAN_OFFLOAD_START,REASON_CONNECT);
+                smsLog(pMac, LOGE, FL("%s Neighbor forcedInitialRoamTo5GHTimer start failed with status %d"), __func__, status);
             }
-            else
-            {
-                smsLog(pMac, LOG1, FL("%s: Forced roam to 5G  started Timer"),
-                       __func__);
-            }
-        }
-        /*
-         * Making ini value to false here only so we just roam to
-         * only once for whole driver load to unload tenure
-         * This feature is only applicable for first connection only
-         */
-        if(pNeighborRoamInfo->cfgParams.neighborInitialForcedRoamTo5GhEnable)
-        {
-            pNeighborRoamInfo->cfgParams.neighborInitialForcedRoamTo5GhEnable
-            = VOS_FALSE;
+            smsLog(pMac, LOGE, FL("%s: Forced roam to 5G  started Timer"), __func__);
         }
     }
 #endif
@@ -15604,8 +15036,6 @@
 {
    tAniGetPEStatsReq *pMsg;
    eHalStatus status = eHAL_STATUS_SUCCESS;
-   tSirMsgQ msgQ;
-
    pMsg = vos_mem_malloc(sizeof(tAniGetPEStatsReq));
    if ( NULL == pMsg )
    {
@@ -15613,20 +15043,14 @@
       return eHAL_STATUS_FAILURE;
    }
    // need to initiate a stats request to PE
-   pMsg->msgType = pal_cpu_to_be16((tANI_U16)WDA_GET_STATISTICS_REQ);
+   pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_STATISTICS_REQ);
    pMsg->msgLen = (tANI_U16)sizeof(tAniGetPEStatsReq);
    pMsg->staId = staId;
    pMsg->statsMask = statsMask;
-
-   msgQ.type = WDA_GET_STATISTICS_REQ;
-   msgQ.reserved = 0;
-   msgQ.bodyptr = pMsg;
-   msgQ.bodyval = 0;
-   status = wdaPostCtrlMsg(pMac, &msgQ);
+   status = palSendMBMessage(pMac->hHdd, pMsg );    
    if(!HAL_STATUS_SUCCESS(status))
    {
       smsLog(pMac, LOG1, FL("Failed to send down the stats req "));
-      vos_mem_free(pMsg);
    }
    return status;
 }
@@ -15644,7 +15068,6 @@
    v_PVOID_t  pvosGCtx;
    v_S7_t     rssi = 0, snr = 0;
    tANI_U32   *pRssi = NULL, *pSnr = NULL;
-   tAniPerTxPktStatsInfo * txPacketInfo;
    tANI_U32   linkCapacity;
    pSmeStatsRsp = (tAniGetPEStatsRsp *)pSirMsg;
    if(pSmeStatsRsp->rc)
@@ -15698,7 +15121,6 @@
             smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:PerSta stats"));
             if( CSR_MAX_STA > pSmeStatsRsp->staId )
             {
-               status = eHAL_STATUS_SUCCESS;
                vos_mem_copy((tANI_U8 *)&pMac->roam.perStaStatsInfo[pSmeStatsRsp->staId],
                             pStats, sizeof(tCsrPerStaStatsInfo));
             }
@@ -15715,19 +15137,6 @@
             pStats += sizeof(tCsrPerStaStatsInfo);
             length -= sizeof(tCsrPerStaStatsInfo);
             break;
-         case eCsrPerPktStats:
-            smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:PerPkt stats"));
-            vos_mem_zero(&pMac->roam.perPktStatsInfo, sizeof(tPerTxPacketFrmFw));
-            if (IS_FEATURE_SUPPORTED_BY_FW(PER_PKT_STATS_SUPPORTED))
-            {
-                txPacketInfo = (tAniPerTxPktStatsInfo *)pStats;
-                pMac->roam.perPktStatsInfo.lastTxRate = txPacketInfo->lastTxRate;
-                pMac->roam.perPktStatsInfo.txAvgRetry = txPacketInfo->txAvgRetry;
-                /* for reserved bytes */
-                pStats += (sizeof(tAniPerTxPktStatsInfo) + 2*sizeof(tANI_U32));
-                length -= (sizeof(tAniPerTxPktStatsInfo) + 2*sizeof(tANI_U32));
-            }
-            break;
          default:
             smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:unknown stats type"));
             break;
@@ -15749,9 +15158,7 @@
        /* If riva is not sending rssi, continue to use the hack */
        rssi = RSSI_HACK_BMPS;
    }
-   /* send positive value of rssi to wifi_hal */
-   pMac->roam.perPktStatsInfo.avgRssi = (-1)*rssi;
-   vos_updatePktStatsInfo(&pMac->roam.perPktStatsInfo);
+
    WDA_UpdateRssiBmps(pvosGCtx, pSmeStatsRsp->staId, rssi);
 
    if (length != 0)
@@ -16310,15 +15717,12 @@
             pMac->roam.tlStatsReqInfo.periodicity = 0;
             pMac->roam.tlStatsReqInfo.timerRunning = FALSE;
          }
-         if (periodicity)
+         vos_timer_stop( &pStaEntry->timer );
+         // Destroy the vos timer...      
+         vosStatus = vos_timer_destroy( &pStaEntry->timer );
+         if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
          {
-            vos_timer_stop(&pStaEntry->timer);
-            // Destroy the vos timer
-            vosStatus = vos_timer_destroy(&pStaEntry->timer);
-            if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-            {
-                smsLog(pMac, LOGE, FL("Failed to destroy Client req timer"));
-            }
+            smsLog(pMac, LOGE, FL("csrGetStatistics:failed to destroy Client req timer"));
          }
          csrRoamRemoveStatListEntry(pMac, pEntry);
          pStaEntry = NULL;
@@ -16632,70 +16036,15 @@
         return eSIR_SUCCESS;
 }
 
-/*
- * Below Table describe whether RSO command can be send down to fimrware or not.
- * Host check it on the basis of previous RSO command sent down to firmware.
-||===========================================================================||
-|| New cmd        |            LAST SENT COMMAND --->                        ||
-||====|======================================================================||
-||    V           |  RSO_START  |  RSO_STOP  |  RSO_RESTART | RSO_UPDATE_CFG ||
-|| --------------------------------------------------------------------------||
-|| RSO_START      |     NO      |   YES      |     NO       |      NO        ||
-|| RSO_STOP       |    YES      |   YES      |     YES      |      YES       ||
-|| RSO_RESTART    |    YES      |   NO       |     NO       |      YES       ||
-|| RSO_UPDATE_CFG |    YES      |   NO       |     YES      |      YES       ||
-||===========================================================================||
-*/
-
-#define RSO_START_BIT       (1<<ROAM_SCAN_OFFLOAD_START)
-#define RSO_STOP_BIT        (1<<ROAM_SCAN_OFFLOAD_STOP)
-#define RSO_RESTART_BIT     (1<<ROAM_SCAN_OFFLOAD_RESTART)
-#define RSO_UPDATE_CFG_BIT  (1<<ROAM_SCAN_OFFLOAD_UPDATE_CFG)
-
-#define RSO_START_ALLOW_MASK   ( RSO_STOP_BIT )
-#define RSO_STOP_ALLOW_MASK    ( RSO_UPDATE_CFG_BIT | RSO_RESTART_BIT | \
-                                 RSO_STOP_BIT | RSO_START_BIT )
-#define RSO_RESTART_ALLOW_MASK ( RSO_UPDATE_CFG_BIT | RSO_START_BIT )
-#define RSO_UPDATE_CFG_ALLOW_MASK  (RSO_UPDATE_CFG_BIT | RSO_STOP_BIT | \
-                                    RSO_START_BIT)
-
-tANI_BOOLEAN CsrIsRSOCommandAllowed(tpAniSirGlobal pMac, tANI_U8 command)
-{
-    tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
-    tANI_U8 desiredMask = 0;
-    switch(command)
-    {
-        case ROAM_SCAN_OFFLOAD_START:
-             desiredMask = RSO_START_ALLOW_MASK;
-             break;
-        case ROAM_SCAN_OFFLOAD_STOP:
-             desiredMask = RSO_STOP_ALLOW_MASK;
-             break;
-        case ROAM_SCAN_OFFLOAD_RESTART:
-             desiredMask = RSO_RESTART_ALLOW_MASK;
-             break;
-        case ROAM_SCAN_OFFLOAD_UPDATE_CFG:
-             desiredMask = RSO_UPDATE_CFG_ALLOW_MASK;
-             break;
-        default:
-             VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                       FL("Wrong RSO command %d, not allowed"), command);
-             return 0;/*Cmd Not allowed*/
-    }
-    return ( desiredMask & ( 1 << pNeighborRoamInfo->lastSentCmd) );
-}
-
 eHalStatus csrRoamOffloadScan(tpAniSirGlobal pMac, tANI_U8 command, tANI_U8 reason)
 {
    vos_msg_t msg;
-   vos_msg_t PERroamScanConfigMsg = {0};
    tSirRoamOffloadScanReq *pRequestBuf;
-   tSirPERRoamOffloadScanReq *PERRoamReqBuf;
    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
-   tCsrRoamSession *pSession = NULL;
+   tCsrRoamSession *pSession;
    tANI_U8 i,j,num_channels = 0, ucDot11Mode;
    tANI_U8 *ChannelList = NULL;
-   tANI_U32 sessionId = 0;
+   tANI_U32 sessionId;
    eHalStatus status = eHAL_STATUS_SUCCESS;
    tpCsrChannelInfo    currChannelListInfo;
    tANI_U32 host_channels = 0;
@@ -16736,25 +16085,18 @@
       return eHAL_STATUS_FAILURE;
    }
 
-   if (!CsrIsRSOCommandAllowed(pMac, command))
-   {
-       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-            FL("RSO command %d lastSentCmd %d, RSO is out of sync in HOST-FWR"),
-            command, pNeighborRoamInfo->lastSentCmd);
-       return eHAL_STATUS_FAILURE;
-   }
-
    /* We dont need psession during ROAM_SCAN_OFFLOAD_STOP
     * Also there are cases where pNeighborRoamInfo->currAPbssid
     * is set to 0 during disconnect and so we might return without stopping
     * the roam scan. So no need to find the session if command is
     * ROAM_SCAN_OFFLOAD_STOP.
     */
-   status = csrRoamGetSessionIdFromBSSID(pMac,
-                         (tCsrBssid *)pNeighborRoamInfo->currAPbssid,
-                                     &sessionId);
    if( ROAM_SCAN_OFFLOAD_STOP != command )
    {
+      status = csrRoamGetSessionIdFromBSSID(pMac,
+                            (tCsrBssid *)pNeighborRoamInfo->currAPbssid,
+                                        &sessionId);
+
       if ( !HAL_STATUS_SUCCESS( status ) )
       {
           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
@@ -16784,11 +16126,6 @@
       return eHAL_STATUS_FAILED_ALLOC;
    }
 
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-   limDiagEventReport(pMac, WLAN_PE_DIAG_ROAM_REQUESTED, NULL,
-                      eSIR_SUCCESS, eSIR_SUCCESS);
-#endif
-
    vos_mem_zero(pRequestBuf, sizeof(tSirRoamOffloadScanReq));
    /* If command is STOP, then pass down ScanOffloadEnabled as Zero.This will handle the case of
     * host driver reloads, but Riva still up and running*/
@@ -16796,7 +16133,6 @@
    if(command == ROAM_SCAN_OFFLOAD_STOP)
    {
       pRequestBuf->RoamScanOffloadEnabled = 0;
-      pRequestBuf->StartScanReason = reason;
       /*For a STOP Command, there is no need to
        * go through filling up all the below parameters
        * since they are not required for the STOP command*/
@@ -16976,7 +16312,6 @@
     /* MAWC feature */
     pRequestBuf->MAWCEnabled =
             pMac->roam.configParam.MAWCEnabled;
-
 #ifdef FEATURE_WLAN_ESE
     pRequestBuf->IsESEEnabled = pMac->roam.configParam.isEseIniFeatureEnabled;
 #endif
@@ -17011,10 +16346,9 @@
               ((eCSR_BAND_5G == eBand) && CSR_IS_CHANNEL_5GHZ(*ChannelList)) ||
               (eCSR_BAND_ALL == eBand))
             {
-             if(*ChannelList && csrRoamIsChannelValid(pMac, *ChannelList) &&
-                ((pMac->roam.configParam.allowDFSChannelRoam) ||
-                (!CSR_IS_CHANNEL_DFS(*ChannelList))) &&
-                (num_channels < SIR_ROAM_MAX_CHANNELS))
+              if(!CSR_IS_CHANNEL_DFS(*ChannelList) &&
+                 csrRoamIsChannelValid(pMac, *ChannelList) &&
+                 *ChannelList && (num_channels < SIR_ROAM_MAX_CHANNELS))
               {
                  pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList;
               }
@@ -17030,9 +16364,9 @@
           for(i=0; i<pMac->scan.occupiedChannels.numChannels; i++)
           {
              /*Allow DFS channels only if the DFS channel roam flag is enabled */
-             if(*ChannelList && ((pMac->roam.configParam.allowDFSChannelRoam) ||
+             if(((pMac->roam.configParam.allowDFSChannelRoam) ||
                 (!CSR_IS_CHANNEL_DFS(*ChannelList))) &&
-                (num_channels < SIR_ROAM_MAX_CHANNELS))
+                *ChannelList && (num_channels < SIR_ROAM_MAX_CHANNELS))
              {
                 pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList;
              }
@@ -17063,21 +16397,19 @@
           ChannelList = currChannelListInfo->ChannelList;
           for (i=0;i<currChannelListInfo->numOfChannels;i++)
           {
-             if(*ChannelList && ((pMac->roam.configParam.allowDFSChannelRoam) ||
-                (!CSR_IS_CHANNEL_DFS(*ChannelList))))
-             {
-                pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] =
-                                                                *ChannelList;
-             }
-             ChannelList++;
+           if(((pMac->roam.configParam.allowDFSChannelRoam) ||
+                (!CSR_IS_CHANNEL_DFS(*ChannelList))) && *ChannelList)
+           {
+            pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList;
+           }
+           ChannelList++;
           }
           pRequestBuf->ConnectedNetwork.ChannelCount = num_channels;
           pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_UPDATE;
        }
      }
 #endif
-    for (i = 0, j = 0;j < (sizeof(ChannelCacheStr)/sizeof(ChannelCacheStr[0]))
-                      && i < pRequestBuf->ConnectedNetwork.ChannelCount; i++)
+    for (i = 0, j = 0;j < (sizeof(ChannelCacheStr)/sizeof(ChannelCacheStr[0])) && i < pRequestBuf->ConnectedNetwork.ChannelCount; i++)
     {
         if (j < sizeof(ChannelCacheStr))
         {
@@ -17113,8 +16445,8 @@
     }
     for(i=0; i<pMac->roam.numValidChannels; i++)
     {
-        if(*ChannelList && ((pMac->roam.configParam.allowDFSChannelRoam) ||
-            (!CSR_IS_CHANNEL_DFS(*ChannelList))))
+        if(((pMac->roam.configParam.allowDFSChannelRoam) ||
+            (!CSR_IS_CHANNEL_DFS(*ChannelList))) && *ChannelList)
         {
             pRequestBuf->ValidChannelList[num_channels++] = *ChannelList;
         }
@@ -17155,8 +16487,6 @@
    msg.type     = WDA_ROAM_SCAN_OFFLOAD_REQ;
    msg.reserved = 0;
    msg.bodyptr  = pRequestBuf;
-   MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
    if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
    {
        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_ROAM_SCAN_OFFLOAD_REQ message to WDA", __func__);
@@ -17169,59 +16499,9 @@
             bRoamScanOffloadStarted = VOS_TRUE;
         else if (ROAM_SCAN_OFFLOAD_STOP == command)
             bRoamScanOffloadStarted = VOS_FALSE;
-
-        /*update the last sent cmd*/
-        pNeighborRoamInfo->lastSentCmd = command;
     }
 
    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Roam Scan Offload Command %d, Reason %d", command, reason);
-
-   if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) &&
-      (command != ROAM_SCAN_OFFLOAD_STOP) &&
-      pMac->roam.configParam.isPERRoamEnabled)
-   {
-
-      /* PER ROAM SCAN */
-      PERRoamReqBuf = vos_mem_malloc(sizeof(*PERRoamReqBuf));
-      if (!PERRoamReqBuf)
-      {
-          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Not able to allocate mem for PERRoamReqBuf", __func__);
-          return eHAL_STATUS_FAILURE;
-      }
-      /* PER Roam Config */
-      PERRoamReqBuf->rateUpThreshold =
-              pMac->roam.configParam.rateUpThreshold;
-      PERRoamReqBuf->rateDownThreshold =
-              pMac->roam.configParam.rateDownThreshold;
-      PERRoamReqBuf->waitPeriodForNextPERScan =
-              pMac->roam.configParam.waitPeriodForNextPERScan;
-      PERRoamReqBuf->PERtimerThreshold =
-              pMac->roam.configParam.PERtimerThreshold;
-      PERRoamReqBuf->isPERRoamCCAEnabled =
-              pMac->roam.configParam.isPERRoamCCAEnabled;
-      PERRoamReqBuf->PERroamTriggerPercent =
-              pMac->roam.configParam.PERroamTriggerPercent;
-      PERRoamReqBuf->sessionId = sessionId;
-
-      PERroamScanConfigMsg.type = WDA_PER_ROAM_SCAN_OFFLOAD_REQ;
-      PERroamScanConfigMsg.reserved = 0;
-      PERroamScanConfigMsg.bodyptr = PERRoamReqBuf;
-      if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA,
-                                     &PERroamScanConfigMsg))) {
-          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-               FL("Not able to post WDA_PER_ROAM_SCAN_OFFLOAD_REQ msg to WDA"));
-          vos_mem_free(PERRoamReqBuf);
-          return eHAL_STATUS_FAILURE;
-      }
-      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
-                FL("rateUpThreshold =%x rateDownThreshold =%x waitPeriodForNextPERScan=%u PERtimerThreshold=%u"),
-                PERRoamReqBuf->rateUpThreshold,
-                PERRoamReqBuf->rateDownThreshold,
-                PERRoamReqBuf->waitPeriodForNextPERScan,
-                PERRoamReqBuf->PERtimerThreshold);
-   }
-
    return status;
 }
 
@@ -17512,12 +16792,6 @@
                          sizeof(tCsrPerStaStatsInfo));
             pStats += sizeof(tCsrPerStaStatsInfo);
             break;
-         case eCsrPerPktStats:
-            smsLog( pMac, LOG2, FL("PerPkt stats"));
-            vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.perPktStatsInfo,
-                         sizeof(tPerTxPacketFrmFw));
-            pStats += sizeof(tPerTxPacketFrmFw);
-            break;
          default:
             smsLog( pMac, LOGE, FL("Unknown stats type and counter %d"), counter);
             break;
@@ -17746,12 +17020,6 @@
             reason = eSME_FULL_PWR_NEEDED_BY_TDLS_PEER_SETUP;
         }
 #endif
-        else if (eSmeCommandDelStaSession == pCommand->command)
-        {
-            //need full power for all
-            fNeedFullPower = eANI_BOOLEAN_TRUE;
-        }
-
         break;
     case REQUEST_STOP_UAPSD:
     case REQUEST_EXIT_WOWL:
@@ -18085,18 +17353,16 @@
     {
         sme_QosCsrEventInd(pMac, pMac->ft.ftSmeContext.smeSessionId, SME_QOS_CSR_PREAUTH_SUCCESS_IND, NULL);
     }
-    if (pMac->roam.configParam.roamDelayStatsEnabled)
-    {
-        vos_record_roam_event(e_CACHE_ROAM_DELAY_DATA, NULL, 0);
-    }
+#ifdef DEBUG_ROAM_DELAY
+    vos_record_roam_event(e_CACHE_ROAM_DELAY_DATA, NULL, 0);
+#endif
     /* Start the pre-auth reassoc interval timer with a period of 400ms. When this expires, 
      * actual transition from the current to handoff AP is triggered */
     status = vos_timer_start(&pMac->ft.ftSmeContext.preAuthReassocIntvlTimer,
                                                             60);
-    if (pMac->roam.configParam.roamDelayStatsEnabled)
-    {
-        vos_record_roam_event(e_SME_PREAUTH_REASSOC_START, NULL, 0);
-    }
+#ifdef DEBUG_ROAM_DELAY
+    vos_record_roam_event(e_SME_PREAUTH_REASSOC_START, NULL, 0);
+#endif
     if (eHAL_STATUS_SUCCESS != status)
     {
         smsLog(pMac, LOGE, FL("Preauth reassoc interval timer start failed to start with status %d"), status);
@@ -18333,11 +17599,8 @@
        }
        vos_mem_zero((void *)pMsg, sizeof(tSirSmeHT40OBSSStopScanInd));
        pMsg->messageType     = eWNI_SME_HT40_STOP_OBSS_SCAN_IND;
-       pMsg->length          =
-           pal_cpu_to_be16(sizeof(tSirSmeHT40OBSSStopScanInd));
+       pMsg->length          = sizeof(tANI_U8);
        pMsg->seesionId       = sessionId;
-       vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
-           sizeof(tSirMacAddr));
        status = palSendMBMessage(pMac->hHdd, pMsg);
        if (!HAL_STATUS_SUCCESS(status))
        {
@@ -18392,27 +17655,6 @@
   return eANI_BOOLEAN_FALSE;
 }
 
-/**
- * csr_set_src_handoff_request() - Set handoff source to
- *                                   SME handoff request
- * @pHandoffInfo: Pointer to Handoff info
- * @pMsg: Pointer to SME handoff request message
- *
- * Return: None
- */
-#ifndef QCA_WIFI_ISOC
-static inline void csr_set_src_handoff_request(tAniHandoffReq *pMsg,
-					tCsrHandoffRequest *pHandoffInfo)
-{
-	pMsg->handoff_src = pHandoffInfo->src;
-}
-#else
-static inline void csr_set_src_handoff_request(tAniHandoffReq *pMsg,
-					tCsrHandoffRequest *pHandoffInfo)
-{
-}
-#endif
-
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
 eHalStatus csrHandoffRequest(tpAniSirGlobal pMac,
                              tCsrHandoffRequest *pHandoffInfo)
@@ -18431,7 +17673,6 @@
    pMsg->msgLen = (tANI_U16)sizeof(tAniHandoffReq);
    pMsg->sessionId = pMac->roam.neighborRoamInfo.csrSessionId;
    pMsg->channel = pHandoffInfo->channel;
-   csr_set_src_handoff_request(pMsg, pHandoffInfo);
    vos_mem_copy(pMsg->bssid,
                        pHandoffInfo->bssid,
                        6);
@@ -18448,79 +17689,6 @@
 }
 #endif /* WLAN_FEATURE_ROAM_SCAN_OFFLOAD */
 
-#ifdef WLAN_FEATURE_RMC
-eHalStatus csrEnableRMC(tpAniSirGlobal pMac, tANI_U32 sessionId)
-{
-   tSirSetRMCReq *pMsg = NULL;
-   eHalStatus status = eHAL_STATUS_SUCCESS;
-   tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
-
-   if (!pSession)
-   {
-       smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-       return eHAL_STATUS_FAILURE;
-   }
-
-   pMsg = vos_mem_malloc(sizeof(tSirSetRMCReq));
-   if (NULL != pMsg)
-   {
-       vos_mem_set((void *)pMsg, sizeof(tSirSetRMCReq), 0);
-       pMsg->msgType = eWNI_SME_ENABLE_RMC_REQ;
-       pMsg->msgLen  = sizeof(tSirSetRMCReq);
-       vos_mem_copy((v_U8_t *)pMsg->mcastTransmitter,
-             &pSession->selfMacAddr, sizeof(tSirMacAddr));
-
-       status = palSendMBMessage(pMac->hHdd, pMsg);
-       if (!HAL_STATUS_SUCCESS(status))
-       {
-           smsLog(pMac, LOGE, FL(" csr enable RMC Post MSG Fail %d "), status);
-           //pMsg is freed by palSendMBMessage
-       }
-   }
-   else
-   {
-       return eHAL_STATUS_FAILURE;
-   }
-   return status;
-}
-
-eHalStatus csrDisableRMC(tpAniSirGlobal pMac, tANI_U32 sessionId)
-{
-   tSirSetRMCReq *pMsg = NULL;
-   eHalStatus status = eHAL_STATUS_SUCCESS;
-   tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
-
-   if (!pSession)
-   {
-       smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-       return eHAL_STATUS_FAILURE;
-   }
-
-   pMsg = vos_mem_malloc(sizeof(tSirSetRMCReq));
-   if (NULL != pMsg)
-   {
-       vos_mem_set((void *)pMsg, sizeof(tSirSetRMCReq), 0);
-       pMsg->msgType = eWNI_SME_DISABLE_RMC_REQ;
-       pMsg->msgLen  = sizeof(tSirSetRMCReq);
-       vos_mem_copy((v_U8_t *)pMsg->mcastTransmitter,
-             &pSession->selfMacAddr, sizeof(tSirMacAddr));
-
-       status = palSendMBMessage(pMac->hHdd, pMsg);
-       if (!HAL_STATUS_SUCCESS(status))
-       {
-           smsLog(pMac, LOGE, FL(" csr disable RMC Post MSG Fail %d "), status);
-           //pMsg is freed by palSendMBMessage
-       }
-   }
-   else
-   {
-       return eHAL_STATUS_FAILURE;
-   }
-   return status;
-}
-
-#endif /* WLAN_FEATURE_RMC */
-
 
 #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
 /* ---------------------------------------------------------------------------
@@ -18598,30 +17766,3 @@
      csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels,
                   pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE);
 }
-
-/* ---------------------------------------------------------------------------
-    \fn csrGetStaticUapsdMask
-    \brief  This function will get the static uapsd settings for an existing
-    \ Infra session.
-    \param  pMac - pMac global structure
-    \- return void
-    -------------------------------------------------------------------------*/
-void csrGetStaticUapsdMask(tpAniSirGlobal pMac, tANI_U8 *staticUapsdMask)
-{
-    tANI_S8 sessionId;
-    tCsrRoamSession *pSession = NULL;
-
-    *staticUapsdMask = 0;
-    sessionId = csrGetInfraSessionId(pMac);
-    if(sessionId == -1)
-       smsLog(pMac, LOGE, FL("Valid session not present."));
-    else
-       pSession = CSR_GET_SESSION(pMac, sessionId);
-
-    if(!pSession || !pSession->pCurRoamProfile)
-       smsLog(pMac, LOGE, FL("Either pSession or Roam profile is NULL,"
-           " pSession:%p"), pSession);
-    else
-       *staticUapsdMask = pSession->pCurRoamProfile->uapsd_mask;
-}
-
diff --git a/wlan/prima/CORE/SME/src/csr/csrApiScan.c b/wlan/prima/CORE/SME/src/csr/csrApiScan.c
index 623ff6d..c6a3668 100644
--- a/wlan/prima/CORE/SME/src/csr/csrApiScan.c
+++ b/wlan/prima/CORE/SME/src/csr/csrApiScan.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -90,12 +90,6 @@
 #define CSR_SCAN_HANDOFF_DELTA 10
 #define MAX_ACTIVE_SCAN_FOR_ONE_CHANNEL 140
 #define MIN_ACTIVE_SCAN_FOR_ONE_CHANNEL 120
-
-#ifndef QCA_WIFI_ISOC
-#define MAX_ACTIVE_SCAN_FOR_ONE_CHANNEL_FASTREASSOC 30
-#define MIN_ACTIVE_SCAN_FOR_ONE_CHANNEL_FASTREASSOC 20
-#endif
-
 #define CSR_SCAN_OVERALL_SCORE( rssi )                          \
     (( rssi < CSR_SCAN_MAX_SCORE_VAL )                          \
      ? (CSR_SCAN_MAX_SCORE_VAL-rssi) : CSR_SCAN_MIN_SCORE_VAL)
@@ -125,7 +119,8 @@
 extern tSirRetStatus wlan_cfgGetStr(tpAniSirGlobal, tANI_U16, tANI_U8*, tANI_U32*);
 
 void csrScanGetResultTimerHandler(void *);
-static void csrPurgeScanResultByAge(void *pv);
+void csrScanResultAgingTimerHandler(void *pv);
+static void csrScanResultCfgAgingTimerHandler(void *pv);
 void csrScanIdleScanTimerHandler(void *);
 static void csrSetDefaultScanTiming( tpAniSirGlobal pMac, tSirScanType scanType, tCsrScanRequest *pScanRequest);
 #ifdef WLAN_AP_STA_CONCURRENCY
@@ -148,7 +143,6 @@
 void csrReleaseCmdSingle(tpAniSirGlobal pMac, tSmeCmd *pCommand);
 tANI_BOOLEAN csrRoamIsValidChannel( tpAniSirGlobal pMac, tANI_U8 channel );
 void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList );
-void csrPurgeOldScanResults(tpAniSirGlobal pMac);
 
 
 
@@ -236,6 +230,19 @@
             smsLog(pMac, LOGE, FL("cannot allocate memory for idleScan timer"));
             break;
         }
+        status = vos_timer_init(&pMac->scan.hTimerResultAging, VOS_TIMER_TYPE_SW, csrScanResultAgingTimerHandler, pMac);
+        if (!HAL_STATUS_SUCCESS(status))
+        {
+            smsLog(pMac, LOGE, FL("cannot allocate memory for ResultAging timer"));
+            break;
+        }
+        status = vos_timer_init(&pMac->scan.hTimerResultCfgAging, VOS_TIMER_TYPE_SW,
+                                csrScanResultCfgAgingTimerHandler, pMac);
+        if (!HAL_STATUS_SUCCESS(status))
+        {
+            smsLog(pMac, LOGE, FL("cannot allocate memory for CFG ResultAging timer"));
+            break;
+        }
     }while(0);
     
     return (status);
@@ -259,6 +266,8 @@
     csrLLClose(&pMac->scan.channelPowerInfoList24);
     csrLLClose(&pMac->scan.channelPowerInfoList5G);
     csrScanDisable(pMac);
+    vos_timer_destroy(&pMac->scan.hTimerResultAging);
+    vos_timer_destroy(&pMac->scan.hTimerResultCfgAging);
     vos_timer_destroy(&pMac->scan.hTimerGetResult);
 #ifdef WLAN_AP_STA_CONCURRENCY
     vos_timer_destroy(&pMac->scan.hTimerStaApConcTimer);
@@ -612,7 +621,7 @@
     eHalStatus status = eHAL_STATUS_FAILURE;
     tSmeCmd *pScanCmd = NULL;
     eCsrConnectState ConnectState;
-
+    
     if(pScanRequest == NULL)
     {
         smsLog( pMac, LOGE, FL(" pScanRequest is NULL"));
@@ -802,24 +811,6 @@
                                    "dwell time for first scan %u"),
                                     scanReq.maxChnTime);
                         }
-                        if ((pScanCmd->u.scanCmd.reason == eCsrScanUserRequest)
-                           && !(pScanRequest->p2pSearch)
-                           &&(pScanRequest->ChannelInfo.numOfChannels
-                           < pMac->roam.configParam.
-                                 max_chan_for_dwell_time_cfg))
-                        {
-                            pScanRequest->maxChnTime =
-                                    pScanRequest->maxChnTime << 1;
-                            pScanRequest->minChnTime =
-                                    pScanRequest->minChnTime << 1;
-                            smsLog(pMac, LOG1,
-                                    FL("Double ChnTime (Max=%d Min=%d) numOfChannels=%d max_chan_for_dwell_time_cfg=%d"),
-                                    pScanRequest->maxChnTime,
-                                    pScanRequest->minChnTime,
-                                    pScanRequest->ChannelInfo.numOfChannels,
-                                    pMac->roam.configParam.
-                                        max_chan_for_dwell_time_cfg);
-                        }
 
                         status = csrScanCopyRequest(pMac, &p11dScanCmd->u.scanCmd.u.scanRequest, &scanReq);
                         //Free the channel list
@@ -880,20 +871,6 @@
                                  pScanRequest->maxChnTime);
                 }
 
-                if ((pScanCmd->u.scanCmd.reason == eCsrScanUserRequest)
-                         && !(pScanRequest->p2pSearch)
-                         && (pScanRequest->ChannelInfo.numOfChannels
-                         < pMac->roam.configParam.max_chan_for_dwell_time_cfg))
-                {
-                    pScanRequest->maxChnTime = pScanRequest->maxChnTime << 1;
-                    pScanRequest->minChnTime = pScanRequest->minChnTime << 1;
-                    smsLog(pMac, LOG1,
-                            FL("Double ChnTime (Max=%d Min=%d) numOfChannels=%d max_chan_for_dwell_time_cfg=%d"),
-                            pScanRequest->maxChnTime,
-                            pScanRequest->minChnTime,
-                            pScanRequest->ChannelInfo.numOfChannels,
-                            pMac->roam.configParam.max_chan_for_dwell_time_cfg);
-                }
                 status = csrScanCopyRequest(pMac, &pScanCmd->u.scanCmd.u.scanRequest, pScanRequest);
                 if(HAL_STATUS_SUCCESS(status))
                 {
@@ -1165,7 +1142,8 @@
 }
 
 
-eHalStatus csrScanGetScanChnInfo(tpAniSirGlobal pMac, tSmeCmd *pCommand)
+eHalStatus csrScanGetScanChnInfo(tpAniSirGlobal pMac, tANI_U8 sessionId,
+                                 void *pContext, void *callback)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tSmeCmd *pScanCmd;
@@ -1177,20 +1155,12 @@
         {
             pScanCmd->command = eSmeCommandScan;
             vos_mem_set(&pScanCmd->u.scanCmd, sizeof(tScanCmd), 0);
+            pScanCmd->u.scanCmd.callback = callback;
+            pScanCmd->u.scanCmd.pContext = pContext;
             pScanCmd->u.scanCmd.reason = eCsrScanGetScanChnInfo;
             //Need to make the following atomic
             pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around
-            pScanCmd->sessionId = pCommand->sessionId;
-            if( pCommand->u.scanCmd.reason == eCsrScanUserRequest)
-            {
-                 pScanCmd->u.scanCmd.callback = NULL;
-                 pScanCmd->u.scanCmd.pContext = NULL;
-            } else {
-                 pScanCmd->u.scanCmd.callback = pCommand->u.scanCmd.callback;
-                 pScanCmd->u.scanCmd.pContext = pCommand->u.scanCmd.pContext;
-                 pScanCmd->u.scanCmd.abortScanIndication =
-                           pCommand->u.scanCmd.abortScanIndication;
-            }
+            pScanCmd->sessionId = sessionId;
             status = csrQueueSmeCommand(pMac, pScanCmd, eANI_BOOLEAN_FALSE);
             if( !HAL_STATUS_SUCCESS( status ) )
             {
@@ -1676,8 +1646,9 @@
     tCsrScanResultFilter *pScanFilter = NULL;
     tCsrRoamProfile *pProfile = pCommand->u.scanCmd.pToRoamProfile;
     tANI_U32 sessionId = pCommand->sessionId;
-    tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
-
+#ifdef FEATURE_WLAN_BTAMP_UT_RF
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+#endif
     do
     {
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
@@ -1693,23 +1664,6 @@
             break;
         }
 #endif
-        if (!pSession)
-        {
-            smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
-            break;
-        }
-        /* If Disconnect is already issued from HDD no need to issue connect
-         * pSession->abortConnection will not be set in case of try
-         * disconnect or hdd stop adaptor use connectState for these cases.
-         */
-        if (pSession->abortConnection ||
-            (pMac->roam.roamSession[sessionId].connectState ==
-            eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTING))
-        {
-           smsLog(pMac, LOGE,
-              FL("Disconnect in progress, no need to issue connect"));
-           break;
-        }
         //If there is roam command waiting, ignore this roam because the newer roam command is the one to execute
         if(csrIsRoamCommandWaitingForSession(pMac, sessionId))
         {
@@ -1746,10 +1700,8 @@
             csrScanResultPurge(pMac, hBSSList);
         }
         //We haven't done anything to this profile
-        csrRoamCallCallback(pMac, sessionId, NULL,
-                     pCommand->u.scanCmd.roamId,
-                     eCSR_ROAM_ASSOCIATION_FAILURE,
-                     eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE);
+        csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.scanCmd.roamId,
+                     eCSR_ROAM_ASSOCIATION_FAILURE, eCSR_ROAM_RESULT_FAILURE);
         //In case we have nothing else to do, restart idle scan
         if(csrIsConnStateDisconnected(pMac, sessionId) && !csrIsRoamCommandWaiting(pMac))
         {
@@ -1857,14 +1809,14 @@
                 csrRoamCallCallback(pMac, sessionId, pRoamInfo,
                                     pCommand->u.scanCmd.roamId,
                                     eCSR_ROAM_ASSOCIATION_COMPLETION,
-                                    eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE);
+                                    eCSR_ROAM_RESULT_FAILURE);
             }
             else
             {
                 csrRoamCallCallback(pMac, sessionId, NULL,
                                     pCommand->u.scanCmd.roamId,
                                     eCSR_ROAM_ASSOCIATION_FAILURE,
-                                    eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE);
+                                    eCSR_ROAM_RESULT_FAILURE);
             }
 #ifdef FEATURE_WLAN_BTAMP_UT_RF
             //In case of WDS station, let it retry.
@@ -2045,259 +1997,6 @@
     return (ret);
 }
 
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-
-/* Calculate channel weight based on other APs RSSI and count for
- * PER based roaming */
-static tANI_U32 GetPERRoamRssiCountWeight(tANI_S32 rssi, tANI_S32 count)
-{
-    tANI_S32 rssiWeight=0;
-    tANI_S32 countWeight=0;
-    tANI_S32 rssicountWeight=0;
-
-    rssiWeight = ROAMING_RSSI_WEIGHT * (rssi - MIN_RSSI)
-                 /(MAX_RSSI - MIN_RSSI);
-
-    if(rssiWeight > ROAMING_RSSI_WEIGHT)
-        rssiWeight = ROAMING_RSSI_WEIGHT;
-    else if (rssiWeight < 0)
-        rssiWeight = 0;
-
-    countWeight = ROAM_AP_COUNT_WEIGHT * (count + ROAM_MIN_COUNT)
-                  /(ROAM_MAX_COUNT + ROAM_MIN_COUNT);
-
-    if(countWeight > ROAM_AP_COUNT_WEIGHT)
-        countWeight = ROAM_AP_COUNT_WEIGHT;
-
-    rssicountWeight =  ROAM_MAX_WEIGHT - (rssiWeight + countWeight);
-
-    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
-       FL("rssiWeight=%d, countWeight=%d, rssicountWeight=%d rssi=%d count=%d"),
-       rssiWeight, countWeight, rssicountWeight, rssi, count);
-
-    return rssicountWeight;
-}
-
-/* Calculate BSS score based on AP capabilty and channel condition
- * for PER based roaming */
-static tANI_U32 calculateBssScore(tSirBssDescription *bssInfo,
-                             tANI_S32 best_rssi, tANI_S32 ap_cnt, tANI_S32 cca)
-{
-    tANI_S32 score = 0;
-    tANI_S32 ap_load = 0;
-    tANI_S32 normalised_width = PER_ROAM_20MHZ;
-    tANI_S32 normalised_rssi;
-    tANI_S32 channel_weight;
-    if (bssInfo->rssi) {
-        /* Calculate % of rssi we are getting
-         * max = 100
-         * min = 0
-         * less than -40 = 100%
-         * -40 - -55 = 80%
-         * -55 - -65 = 60%
-         * below that = 100 - value
-         * TODO: a linear decrement function after PER_ROAM_GOOD_RSSI_WEIGHT
-         * since throughput decrements linearly after PER_ROAM_GOOD_RSSI_WEIGHT
-         **/
-        if (bssInfo->rssi >= PER_EXCELENT_RSSI)
-            normalised_rssi = PER_ROAM_EXCELLENT_RSSI_WEIGHT;
-        else if (bssInfo->rssi >= PER_GOOD_RSSI)
-            normalised_rssi = PER_ROAM_GOOD_RSSI_WEIGHT;
-        else if (bssInfo->rssi >= PER_POOR_RSSI)
-            normalised_rssi = PER_ROAM_BAD_RSSI_WEIGHT;
-        else
-            normalised_rssi = bssInfo->rssi - MIN_RSSI;
-
-        /* Calculate score part for rssi */
-        score += (normalised_rssi * RSSI_WEIGHTAGE);
-    }
-
-    if (bssInfo->HTCapsPresent) {
-        score += PER_ROAM_MAX_WEIGHT * HT_CAPABILITY_WEIGHTAGE;
-    }
-    /* VHT caps are available */
-    if (bssInfo->vhtCapsPresent) {
-        score += PER_ROAM_MAX_WEIGHT * VHT_CAP_WEIGHTAGE;
-    }
-
-    if (bssInfo->beacomformingCapable)
-        score += PER_ROAM_MAX_WEIGHT * BEAMFORMING_CAP_WEIGHTAGE;
-
-    /* Channel width  20Mhz=30, 40Mhz=70, 80Mhz=100 */
-    if (bssInfo->chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
-        normalised_width = PER_ROAM_80MHZ;
-    else if (bssInfo->chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
-        normalised_width = PER_ROAM_40MHZ;
-    else
-        normalised_width = PER_ROAM_20MHZ;
-    score += normalised_width * CHAN_WIDTH_WEIGHTAGE;
-
-    /* Channel Band, Channel Number */
-    if (GetRFBand(bssInfo->channelId) == SIR_BAND_5_GHZ)
-        score += PER_ROAM_MAX_WEIGHT * CHAN_BAND_WEIGHTAGE;
-
-    /* WMM emabled */
-    if (bssInfo->wmeInfoPresent)
-        score += PER_ROAM_MAX_WEIGHT * WMM_WEIGHTAGE;
-
-#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_ROAM_SCAN_OFFLOAD)
-    /* AP load Ie */
-    if (bssInfo->QBSSLoad_present) {
-        /* calculate value in % */
-        ap_load = (bssInfo->QBSS_ChanLoad * PER_ROAM_MAX_WEIGHT) / MAX_AP_LOAD;
-    }
-#endif
-    //TODO we don't have this info for current AP, need to check
-    /* if CCA consideration is off in configuration, FW will send 50% for
-       every channel which should be considered as it is */
-    if (ap_load)
-        score += (100 - ap_load) * CCA_WEIGHTAGE;
-    else
-        score +=  (100 - cca) * CCA_WEIGHTAGE;
-
-    channel_weight = GetPERRoamRssiCountWeight(best_rssi, ap_cnt);
-
-    score += channel_weight * OTHER_AP_WEIGHT;
-
-    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_LOW,
-        FL("rssi=%d normalized_rssi=%d htcaps=%d vht=%d bw=%d channel=%d wmm=%d beamforming=%d ap_load=%d channel_weight=%d"),
-                 bssInfo->rssi, normalised_rssi, bssInfo->HTCapsPresent,
-                 bssInfo->vhtCapsPresent, bssInfo->chanWidth,
-                 bssInfo->channelId, bssInfo->wmeInfoPresent,
-                 bssInfo->beacomformingCapable, ap_load, channel_weight);
-    return score;
-}
-
-/* Calculate candidate AP score for PER based roaming */
-static tANI_S32 csrFindCongestionScore (tpAniSirGlobal pMac, tCsrScanResult *pBss)
-{
-    tANI_S32 score = 0;
-    tANI_S32 i;
-    tANI_S32 candidateApCnt, best_rssi, other_ap_cnt;
-    tANI_U32 current_timestamp;
-    tpCsrNeighborRoamControlInfo pNeighborRoamInfo =
-        &pMac->roam.neighborRoamInfo;
-
-    tSirBssDescription *bssInfo = &(pBss->Result.BssDescriptor);
-    pBss->congestionScore = 0;
-    for (i = 0; i < pMac->PERroamCandidatesCnt; i++)
-        if (pMac->candidateChannelInfo[i].channelNumber ==
-            pBss->Result.BssDescriptor.channelId)
-            break;
-
-    if (i == SIR_PER_ROAM_MAX_CANDIDATE_CNT) {
-        smsLog(pMac, LOGE,
-               FL("candidate chan info not found for channel %d bssid "
-               MAC_ADDRESS_STR), pBss->Result.BssDescriptor.channelId,
-               MAC_ADDR_ARRAY(pBss->Result.BssDescriptor.bssId));
-        return -1;
-    }
-
-    /* find best RSSI of other AP in this channel */
-    best_rssi = MIN_RSSI;
-    for (other_ap_cnt = 0; other_ap_cnt <
-             pMac->candidateChannelInfo[i].otherApCount; other_ap_cnt++) {
-        if (pMac->candidateChannelInfo[i].otherApRssi[other_ap_cnt] > best_rssi)
-            best_rssi = pMac->candidateChannelInfo[i].otherApRssi[other_ap_cnt];
-    }
-
-    score = calculateBssScore(bssInfo, best_rssi,
-                              pMac->candidateChannelInfo[i].otherApCount,
-                              pMac->candidateChannelInfo[i].channelCCA);
-    current_timestamp = jiffies_to_msecs(jiffies);
-
-    /* penalty logic */
-
-    /* In the previous list */
-    for (candidateApCnt = 0; candidateApCnt <
-             SIR_PER_ROAM_MAX_CANDIDATE_CNT; candidateApCnt++) {
-        if (sirCompareMacAddr(pMac->previousRoamApInfo[candidateApCnt].bssAddr,
-                pBss->Result.BssDescriptor.bssId) &&
-           ((current_timestamp - pMac->previousRoamApInfo[candidateApCnt].timeStamp) <
-                PENALTY_TIMEOUT)) {
-            score = (score * PENALTY_REMAINING_SCORE)/PENALTY_TOTAL_SCORE;
-            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                 FL("AP BSSID " MAC_ADDRESS_STR "adding penalty(in previous list)new score %d"),
-                 MAC_ADDR_ARRAY(pBss->Result.BssDescriptor.bssId),
-                 score);
-            break;
-        }
-    }
-    /* preauth failed last time */
-    for (candidateApCnt = 0; candidateApCnt <
-             MAX_NUM_PREAUTH_FAIL_LIST_ADDRESS; candidateApCnt++) {
-        if (sirCompareMacAddr(pNeighborRoamInfo->FTRoamInfo.
-                preAuthFailList.macAddress[candidateApCnt],
-                pBss->Result.BssDescriptor.bssId)) {
-            score = (score * PENALTY_REMAINING_SCORE)/PENALTY_TOTAL_SCORE;
-            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                 FL("AP BSSID " MAC_ADDRESS_STR "adding penalty(previously auth failed)new score %d"),
-                 MAC_ADDR_ARRAY(pBss->Result.BssDescriptor.bssId),
-                 score);
-            break;
-        }
-    }
-    pBss->congestionScore = score;
-
-    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                 FL("AP BSSID " MAC_ADDRESS_STR " score  %d channel %d"),
-                 MAC_ADDR_ARRAY(pBss->Result.BssDescriptor.bssId),
-                 score, pBss->Result.BssDescriptor.channelId);
-    return 0;
-}
-
-/* Calculate current AP score for PER based roaming */
-static tANI_S32 csrFindSelfCongestionScore(tpAniSirGlobal pMac,
-                                      tSirBssDescription *bssInfo)
-{
-    tANI_S32 i, best_rssi, other_ap_cnt;
-    tANI_S32 score = 0;
-
-    for (i = 0; i <= pMac->PERroamCandidatesCnt; i++)
-        if (pMac->candidateChannelInfo[i].channelNumber == bssInfo->channelId)
-            break;
-    if (i > pMac->PERroamCandidatesCnt) {
-        /* home channel info is not present, no need to roam */
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                  FL("home channel %d congestion info not present"),
-                  bssInfo->channelId);
-        pMac->currentBssScore = PER_ROAM_MAX_BSS_SCORE;
-        return -1;
-    }
-
-    /* find best RSSI of other AP in this channel */
-    best_rssi = MIN_RSSI;
-    for (other_ap_cnt = 0; other_ap_cnt <
-             pMac->candidateChannelInfo[i].otherApCount; other_ap_cnt++) {
-        if (pMac->candidateChannelInfo[i].otherApRssi[other_ap_cnt] > best_rssi)
-            best_rssi = pMac->candidateChannelInfo[i].otherApRssi[other_ap_cnt];
-    }
-
-    score = calculateBssScore(bssInfo, best_rssi,
-                              pMac->candidateChannelInfo[i].otherApCount,
-                              pMac->candidateChannelInfo[i].channelCCA);
-    pMac->currentBssScore = score;
-    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                 FL("PER Roam Current AP score  %d channel %d"),
-                 score, bssInfo->channelId);
-    return 0;
-}
-
-
-static tANI_BOOLEAN csrIsBetterBssInCongestion(tCsrScanResult *pBss1,
-                                               tCsrScanResult *pBss2)
-{
-    tANI_BOOLEAN ret;
-
-    if(CSR_IS_BETTER_PREFER_VALUE(pBss1->congestionScore,
-                                  pBss2->congestionScore))
-        ret = eANI_BOOLEAN_TRUE;
-    else
-        ret = eANI_BOOLEAN_FALSE;
-
-    return (ret);
-}
-#endif
 
 //To check whther pBss1 is better than pBss2
 static tANI_BOOLEAN csrIsBetterBss(tCsrScanResult *pBss1, tCsrScanResult *pBss2)
@@ -2357,35 +2056,6 @@
         } 
     }
 }
-
-void csrAddChannelToOccupiedChannelList(tpAniSirGlobal pMac,
-                                     tANI_U8   channel)
-{
-    eHalStatus status;
-    tCsrChannel *pOccupiedChannels = &pMac->scan.occupiedChannels;
-    tANI_U8 numOccupiedChannels = pOccupiedChannels->numChannels;
-    tANI_U8 *pOccupiedChannelList = pOccupiedChannels->channelList;
-    if (!csrIsChannelPresentInList(pOccupiedChannelList,
-         numOccupiedChannels, channel))
-    {
-        status = csrAddToChannelListFront(pOccupiedChannelList,
-                                          numOccupiedChannels, channel);
-        if(HAL_STATUS_SUCCESS(status))
-        {
-            pOccupiedChannels->numChannels++;
-            smsLog(pMac, LOG2, FL("added channel %d to the list (count=%d)"),
-                channel, pOccupiedChannels->numChannels);
-            if (pOccupiedChannels->numChannels >
-                CSR_BG_SCAN_OCCUPIED_CHANNEL_LIST_LEN)
-            {
-                pOccupiedChannels->numChannels =
-                    CSR_BG_SCAN_OCCUPIED_CHANNEL_LIST_LEN;
-                smsLog(pMac, LOG2,
-                       FL("trim no of Channels for Occ channel list"));
-            }
-        }
-    }
-}
 #endif
 
 //Put the BSS into the scan result list
@@ -2423,9 +2093,7 @@
     tDot11fBeaconIEs *pIes, *pNewIes;
     tANI_BOOLEAN fMatch;
     tANI_U16 i = 0;
-    tCsrRoamSession *pSession = CSR_GET_SESSION(pMac,
-                                    pMac->roam.roamSession->sessionId);
-
+    
     if(phResult)
     {
         *phResult = CSR_INVALID_SCANRESULT_HANDLE;
@@ -2542,13 +2210,7 @@
         vos_mem_set(pRetList, sizeof(tScanResultList), 0);
         csrLLOpen(pMac->hHdd, &pRetList->List);
         pRetList->pCurEntry = NULL;
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-        if (pFilter && pFilter->isPERRoamScan)
-            if (pSession && pSession->pConnectBssDesc)
-               csrFindSelfCongestionScore(pMac,
-                                          pSession->pConnectBssDesc);
-#endif
-
+        
         csrLLLock(&pMac->scan.scanResultList);
         pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK );
         while( pEntry ) 
@@ -2631,7 +2293,7 @@
                 pResult->mcEncryptionType = mc;
                 pResult->authType = auth;
                 pResult->Result.ssId = pBssDesc->Result.ssId;
-                pResult->Result.timer = pBssDesc->Result.timer;
+                pResult->Result.timer = 0;
                 //save the pIes for later use
                 pResult->Result.pvIes = pNewIes;
                 //save bss description
@@ -2640,22 +2302,7 @@
                 //No need to lock pRetList because it is locally allocated and no outside can access it at this time
                 if(csrLLIsListEmpty(&pRetList->List, LL_ACCESS_NOLOCK))
                 {
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-                    if (pFilter && pFilter->isPERRoamScan) {
-                         csrFindCongestionScore(pMac, pResult);
-                         if (pResult->congestionScore > pMac->currentBssScore) {
-                             csrLLInsertTail(&pRetList->List, &pResult->Link,
-                                             LL_ACCESS_NOLOCK);
-                             smsLog(pMac, LOGW,
-                                  FL("added one entry in LL in PER Roam list"));
-                         }
-                    }
-                    else
-#endif
-                    {
-                        csrLLInsertTail(&pRetList->List, &pResult->Link,
-                                        LL_ACCESS_NOLOCK);
-                    }
+                    csrLLInsertTail(&pRetList->List, &pResult->Link, LL_ACCESS_NOLOCK);
                 }
                 else
                 {
@@ -2667,48 +2314,20 @@
                     while(pTmpEntry)
                     {
                         pTmpResult = GET_BASE_ADDR( pTmpEntry, tCsrScanResult, Link );
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-                        if (pFilter && pFilter->isPERRoamScan) {
-                            csrFindCongestionScore(pMac, pResult);
-                            if(csrIsBetterBssInCongestion(pResult, pTmpResult)&&
-                             (pResult->congestionScore > pMac->currentBssScore))
-                            {
-                                csrLLInsertEntry(&pRetList->List, pTmpEntry,
-                                              &pResult->Link, LL_ACCESS_NOLOCK);
-                                smsLog(pMac, LOGW,
-                                    FL("added another entry in LL in PER Roam list"));
-                                pResult = NULL;
-                                break;
-                            }
-                            pTmpEntry = csrLLNext(&pRetList->List,
-                                                  pTmpEntry, LL_ACCESS_NOLOCK);
-                        }
-                        else
-#endif
+                        if(csrIsBetterBss(pResult, pTmpResult))
                         {
-                            if(csrIsBetterBss(pResult, pTmpResult))
-                            {
-                                csrLLInsertEntry(&pRetList->List, pTmpEntry,
-                                              &pResult->Link, LL_ACCESS_NOLOCK);
-                                //To indicate we are done
-                                pResult = NULL;
-                                break;
-                            }
-                            pTmpEntry = csrLLNext(&pRetList->List,
-                                                  pTmpEntry, LL_ACCESS_NOLOCK);
-                       }
+                            csrLLInsertEntry(&pRetList->List, pTmpEntry, &pResult->Link, LL_ACCESS_NOLOCK);
+                            //To indicate we are done
+                            pResult = NULL;
+                            break;
+                        }
+                        pTmpEntry = csrLLNext(&pRetList->List, pTmpEntry, LL_ACCESS_NOLOCK);
                     }
                     if(pResult != NULL)
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-                        if ((pFilter && !pFilter->isPERRoamScan) ||
-                            (pFilter == NULL) ||
-                            (pResult->congestionScore > pMac->currentBssScore))
-#endif
-                        {
-                            //This one is not better than any one
-                            csrLLInsertTail(&pRetList->List,
-                                            &pResult->Link, LL_ACCESS_NOLOCK);
-                        }
+                    {
+                        //This one is not better than any one
+                        csrLLInsertTail(&pRetList->List, &pResult->Link, LL_ACCESS_NOLOCK);
+                    }
                 }
                 count++;
             }
@@ -2731,8 +2350,6 @@
                 csrLLClose(&pRetList->List);
                 vos_mem_free(pRetList);
                 status = eHAL_STATUS_E_NULL_VALUE;
-                smsLog(pMac, LOGW,
-                       FL("Nil scan results or no matching AP found"));
             }
             else if(phResult)
             {
@@ -2935,6 +2552,11 @@
                 csrFreeScanResultEntry( pMac, pBssDesc );
             }
         }
+        else
+        {
+            smsLog( pMac, LOG1, FL("%d is a Valid channel"),
+                    pBssDesc->Result.BssDescriptor.channelId);
+        }
         pEntry = pTempEntry;
     }
 
@@ -2964,88 +2586,6 @@
     return status;
 }
 
-/**
- * csrScanFilterDFSResults
- *
- *FUNCTION:
- * This function filter BSSIDs on DFS channels from the scan results.
- *
- *LOGIC:
- * Get scan result from scan list and Check Scan result channel number
- * with 11d channel list if channel number is found in 11d channel list
- * and if fEnableDFSChnlScan is zero and if channel is DFS, then
- * remove scan result entry from scan list
- *
- *ASSUMPTIONS:
- *
- *NOTE:
- *
- * @param  pMac        Pointer to Global MAC structure
- *
- * @return Status
- */
-
-eHalStatus csrScanFilterDFSResults(tpAniSirGlobal pMac)
-{
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    tListElem *pEntry,*pTempEntry;
-    tCsrScanResult *pBssDesc;
-
-    pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_LOCK );
-    while( pEntry )
-    {
-        pBssDesc = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
-        pTempEntry = csrLLNext( &pMac->scan.scanResultList, pEntry,
-                                                            LL_ACCESS_LOCK );
-        if((pMac->scan.fEnableDFSChnlScan == DFS_CHNL_SCAN_DISABLED) &&
-                  CSR_IS_CHANNEL_DFS(pBssDesc->Result.BssDescriptor.channelId))
-        {
-            smsLog( pMac, LOG1, FL("%d is a DFS ch filtered from scan list"),
-                    pBssDesc->Result.BssDescriptor.channelId);
-            /* Remove Scan result which does not have 11d channel */
-            if( csrLLRemoveEntry( &pMac->scan.scanResultList, pEntry,
-                                                              LL_ACCESS_LOCK ))
-            {
-                csrFreeScanResultEntry( pMac, pBssDesc );
-            }
-        }
-        else
-        {
-            smsLog( pMac, LOG1, FL("%d is a Valid channel"),
-                    pBssDesc->Result.BssDescriptor.channelId);
-        }
-        pEntry = pTempEntry;
-    }
-
-    pEntry = csrLLPeekHead( &pMac->scan.tempScanResults, LL_ACCESS_LOCK );
-    while( pEntry )
-    {
-        pBssDesc = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
-        pTempEntry = csrLLNext( &pMac->scan.tempScanResults, pEntry,
-                                                            LL_ACCESS_LOCK );
-
-        if((pMac->scan.fEnableDFSChnlScan == DFS_CHNL_SCAN_DISABLED) &&
-                  CSR_IS_CHANNEL_DFS(pBssDesc->Result.BssDescriptor.channelId))
-        {
-           smsLog( pMac, LOG1, FL("%d is a DFS ch filtered from scan list"),
-                    pBssDesc->Result.BssDescriptor.channelId);
-            /* Remove Scan result which does not have 11d channel */
-            if( csrLLRemoveEntry( &pMac->scan.tempScanResults, pEntry,
-                        LL_ACCESS_LOCK ))
-            {
-                csrFreeScanResultEntry( pMac, pBssDesc );
-            }
-        }
-        else
-        {
-            smsLog( pMac, LOG1, FL("%d is a Valid channel"),
-                    pBssDesc->Result.BssDescriptor.channelId);
-        }
-        pEntry = pTempEntry;
-    }
-    return status;
-}
-
 
 eHalStatus csrScanCopyResultList(tpAniSirGlobal pMac, tScanResultHandle hIn, tScanResultHandle *phResult)
 {
@@ -3139,121 +2679,70 @@
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tSirMbMsg *pMsg = (tSirMbMsg *)pMsgBuf;
-    tSirSmeDisConDoneInd *pDisConDoneInd;
-    tCsrRoamInfo roamInfo = {0};
 
-    if((eWNI_SME_SCAN_RSP == pMsg->type) ||
-       (eWNI_SME_GET_SCANNED_CHANNEL_RSP == pMsg->type))
+    if((eWNI_SME_SCAN_RSP == pMsg->type) || (eWNI_SME_GET_SCANNED_CHANNEL_RSP == pMsg->type))
     {
         status = csrScanSmeScanResponse( pMac, pMsgBuf );
     }
     else
     {
-        switch (pMsg->type)
+        if(pMsg->type == eWNI_SME_UPPER_LAYER_ASSOC_CNF) 
         {
-            case eWNI_SME_UPPER_LAYER_ASSOC_CNF:
+            tCsrRoamSession  *pSession;
+            tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf;
+            tCsrRoamInfo roamInfo;
+            tCsrRoamInfo *pRoamInfo = NULL;
+            tANI_U32 sessionId;
+            eHalStatus status;
+            smsLog( pMac, LOG1, FL("Scanning : ASSOCIATION confirmation can be given to upper layer "));
+            vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0);
+            pRoamInfo = &roamInfo;
+            pUpperLayerAssocCnf = (tSirSmeAssocIndToUpperLayerCnf *)pMsgBuf;
+            status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pUpperLayerAssocCnf->bssId, &sessionId );
+            pSession = CSR_GET_SESSION(pMac, sessionId);
+
+            if(!pSession)
             {
-                tCsrRoamSession  *pSession;
-                tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf;
-                tCsrRoamInfo *pRoamInfo = NULL;
-                tANI_U32 sessionId;
-                eHalStatus status;
+                smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
+                return eHAL_STATUS_FAILURE;
+            }
 
-                smsLog( pMac, LOG1,
-                        FL("Scanning : ASSOCIATION confirmation can be given to upper layer "));
-                pRoamInfo = &roamInfo;
-                pUpperLayerAssocCnf = (tSirSmeAssocIndToUpperLayerCnf *)pMsgBuf;
-                status = csrRoamGetSessionIdFromBSSID( pMac,
-                                      (tCsrBssid *)pUpperLayerAssocCnf->bssId,
-                                      &sessionId );
-                pSession = CSR_GET_SESSION(pMac, sessionId);
+            pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success 
+            pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile;
+            pRoamInfo->staId = (tANI_U8)pUpperLayerAssocCnf->aid;
+            pRoamInfo->rsnIELen = (tANI_U8)pUpperLayerAssocCnf->rsnIE.length;
+            pRoamInfo->prsnIE = pUpperLayerAssocCnf->rsnIE.rsnIEdata;
+            pRoamInfo->addIELen = (tANI_U8)pUpperLayerAssocCnf->addIE.length;
+            pRoamInfo->paddIE = pUpperLayerAssocCnf->addIE.addIEdata;           
+            vos_mem_copy(pRoamInfo->peerMac, pUpperLayerAssocCnf->peerMacAddr, sizeof(tSirMacAddr));
+            vos_mem_copy(&pRoamInfo->bssid, pUpperLayerAssocCnf->bssId, sizeof(tCsrBssid));
+            pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta;
+            if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) )
+            {
+                pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED;
+                pRoamInfo->fReassocReq = pUpperLayerAssocCnf->reassocReq;
+                status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF);
+            }
+            if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile))
+            {
+                vos_sleep( 100 );
+                pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;//Sta
+                status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta
+            }
 
-                if(!pSession)
-                {
-                    smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
-                    return eHAL_STATUS_FAILURE;
-                }
-
-                //send the status code as Success
-                pRoamInfo->statusCode = eSIR_SME_SUCCESS;
-                pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile;
-                pRoamInfo->staId = (tANI_U8)pUpperLayerAssocCnf->aid;
-                pRoamInfo->rsnIELen =
-                            (tANI_U8)pUpperLayerAssocCnf->rsnIE.length;
-                pRoamInfo->prsnIE = pUpperLayerAssocCnf->rsnIE.rsnIEdata;
-                pRoamInfo->addIELen =
-                            (tANI_U8)pUpperLayerAssocCnf->addIE.length;
-                pRoamInfo->paddIE = pUpperLayerAssocCnf->addIE.addIEdata;
-                vos_mem_copy(pRoamInfo->peerMac,
-                             pUpperLayerAssocCnf->peerMacAddr,
-                             sizeof(tSirMacAddr));
-                vos_mem_copy(&pRoamInfo->bssid,
-                             pUpperLayerAssocCnf->bssId,
-                             sizeof(tCsrBssid));
-                pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-                pRoamInfo->HT40MHzIntoEnabledSta =
-                           pUpperLayerAssocCnf->HT40MHzIntoEnabledSta;
-#endif
-                if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) )
-                {
-                    pMac->roam.roamSession[sessionId].connectState =
-                                        eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED;
-                    pRoamInfo->fReassocReq = pUpperLayerAssocCnf->reassocReq;
-                    status = csrRoamCallCallback(pMac, sessionId, pRoamInfo,
-                                       0, eCSR_ROAM_INFRA_IND,
-                                       eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF);
-                }
-                if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile))
-                {
-                    vos_sleep( 100 );
-                    pMac->roam.roamSession[sessionId].connectState =
-                                    eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;//Sta
-                    status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0,
-                                    eCSR_ROAM_WDS_IND,
-                                    eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta
-                }
-                break;
         }
-        case eWNI_SME_DISCONNECT_DONE_IND:
-            pDisConDoneInd = (tSirSmeDisConDoneInd *)(pMsg);
+        else
+        {
 
-            smsLog( pMac, LOG1,
-                FL("eWNI_SME_DISCONNECT_DONE_IND RC:%d"),
-                    pDisConDoneInd->reasonCode);
-            if( CSR_IS_SESSION_VALID(pMac, pDisConDoneInd->sessionId))
-            {
-                roamInfo.reasonCode = pDisConDoneInd->reasonCode;
-                roamInfo.statusCode = eSIR_SME_STA_DISASSOCIATED;
-                vos_mem_copy(roamInfo.peerMac, pDisConDoneInd->peerMacAddr,
-                             sizeof(tSirMacAddr));
-                status = csrRoamCallCallback(pMac,
-                                 pDisConDoneInd->sessionId,
-                                &roamInfo, 0,
-                                 eCSR_ROAM_LOSTLINK,
-                                 eCSR_ROAM_RESULT_DISASSOC_IND);
-            }
-            else
-            {
-                smsLog(pMac, LOGE, FL("Inactive session %d"),
-                        pDisConDoneInd->sessionId);
-                status = eHAL_STATUS_FAILURE;
-            }
-            break;
-
-        default :
             if( csrIsAnySessionInConnectState( pMac ) )
             {
-                /*In case of we are connected, we need to check whether connect
-                 * status changes because scan may also run while connected.
-                 */
-                csrRoamCheckForLinkStatusChange( pMac, (tSirSmeRsp *)pMsgBuf );
+                //In case of we are connected, we need to check whether connect status changes
+                //because scan may also run while connected.
+                csrRoamCheckForLinkStatusChange( pMac, ( tSirSmeRsp * )pMsgBuf );
             }
             else
             {
-                smsLog( pMac, LOGW,
-                        "Message [0x%04x] received in state, when expecting Scan Response",
-                         pMsg->type );
+                smsLog( pMac, LOGW, "Message [0x%04x] received in state, when expecting Scan Response", pMsg->type );
             }
         }
     }
@@ -3569,7 +3058,7 @@
     {
         pBssDescription = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
 
-        smsLog( pMac, LOG2, "...Bssid= "MAC_ADDRESS_STR" chan= %d, rssi = -%d",
+        smsLog( pMac, LOGW, "...Bssid= "MAC_ADDRESS_STR" chan= %d, rssi = -%d",
                       MAC_ADDR_ARRAY(pBssDescription->Result.BssDescriptor.bssId),
                       pBssDescription->Result.BssDescriptor.channelId,
                 pBssDescription->Result.BssDescriptor.rssi * (-1) );
@@ -3590,8 +3079,16 @@
 #endif
           )
         {
-            smsLog(pMac, LOG1, FL("########## BSS Limit reached ###########"));
-            csrPurgeOldScanResults(pMac);
+            //Limit reach
+            smsLog(pMac, LOGW, FL("  BSS limit reached"));
+            //Free the resources
+            if( (pBssDescription->Result.pvIes == NULL) && pIesLocal )
+            {
+                vos_mem_free(pIesLocal);
+            }
+            csrFreeScanResultEntry(pMac, pBssDescription);
+            //Continue because there may be duplicated BSS
+            continue;
         }
         // check for duplicate scan results
         if ( !fDupBss )
@@ -3649,7 +3146,6 @@
         }
     }
 
-    pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_LOCK );
     //we don't need to update CC while connected to an AP which is advertising CC already
     if (csrIs11dSupported(pMac))
     {
@@ -3669,9 +3165,8 @@
                 }
             }
         }
-        if (csrElectedCountryInfo(pMac))
-            csrLearnCountryInformation(pMac, NULL, NULL,
-                    eANI_BOOLEAN_TRUE);
+        csrElectedCountryInfo(pMac);
+        csrLearnCountryInformation( pMac, NULL, NULL, eANI_BOOLEAN_TRUE );
     }
 
 end:
@@ -3697,43 +3192,6 @@
     return;
 }
 
-void csrPurgeOldScanResults(tpAniSirGlobal pMac)
-{
-    tListElem *pEntry, *tmpEntry;
-    tCsrScanResult *pResult, *oldest_bss = NULL;
-    v_TIME_t oldest_entry = 0;
-    v_TIME_t curTime = vos_timer_get_system_time();
-
-    csrLLLock(&pMac->scan.scanResultList);
-    pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK );
-    while( pEntry )
-    {
-        tmpEntry = csrLLNext(&pMac->scan.scanResultList, pEntry,
-                LL_ACCESS_NOLOCK);
-        pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
-        if((curTime -
-                 pResult->Result.BssDescriptor.nReceivedTime) > oldest_entry)
-        {
-            oldest_entry =  curTime -
-                                pResult->Result.BssDescriptor.nReceivedTime;
-            oldest_bss = pResult;
-        }
-        pEntry = tmpEntry;
-    }
-    if (oldest_bss)
-    {
-        //Free the old BSS Entries
-        if( csrLLRemoveEntry(&pMac->scan.scanResultList,
-                               &oldest_bss->Link, LL_ACCESS_NOLOCK) )
-        {
-            smsLog(pMac, LOG1, FL(" Current time delta (%lu) of BSSID to be removed" MAC_ADDRESS_STR ),
-                    (curTime - oldest_bss->Result.BssDescriptor.nReceivedTime),
-                    MAC_ADDR_ARRAY(oldest_bss->Result.BssDescriptor.bssId));
-            csrFreeScanResultEntry(pMac, oldest_bss);
-        }
-    }
-    csrLLUnlock(&pMac->scan.scanResultList);
-}
 
 static tCsrScanResult *csrScanSaveBssDescription( tpAniSirGlobal pMac, tSirBssDescription *pBSSDescription,
                                                   tDot11fBeaconIEs *pIes)
@@ -3741,7 +3199,6 @@
     tCsrScanResult *pCsrBssDescription = NULL;
     tANI_U32 cbBSSDesc;
     tANI_U32 cbAllocated;
-    tListElem *pEntry;
 
     // figure out how big the BSS description is (the BSSDesc->length does NOT
     // include the size of the length field itself).
@@ -3759,7 +3216,6 @@
         VOS_ASSERT( pCsrBssDescription->Result.pvIes == NULL );
 #endif
         csrScanAddResult(pMac, pCsrBssDescription, pIes);
-        pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_LOCK );
     }
 
     return( pCsrBssDescription );
@@ -3946,6 +3402,7 @@
 void csrApplyChannelPowerCountryInfo( tpAniSirGlobal pMac, tCsrChannel *pChannelList, tANI_U8 *countryCode, tANI_BOOLEAN updateRiva)
 {
     int i, j, count, countryIndex = -1;
+    eNVChannelEnabledType channelEnabledType;
     tANI_U8 numChannels = 0;
     tANI_U8 tempNumChannels = 0;
     tANI_U8 channelIgnore = FALSE;
@@ -3963,26 +3420,39 @@
             }
         }
         tempNumChannels = CSR_MIN(pChannelList->numChannels, WNI_CFG_VALID_CHANNEL_LIST_LEN);
-
+        /* If user doesn't want to scan the DFS channels lets trim them from 
+        the valid channel list*/
         for(i=0; i < tempNumChannels; i++)
         {
             channelIgnore = FALSE;
-            if( countryIndex != -1 )
+            if( FALSE == pMac->scan.fEnableDFSChnlScan )
             {
-                for(j=0; j < countryIgnoreList[countryIndex].channelCount; j++)
+                channelEnabledType =
+                    vos_nv_getChannelEnabledState(pChannelList->channelList[i]);
+            }
+            else
+            {
+                channelEnabledType = NV_CHANNEL_ENABLE;
+            }
+            if( NV_CHANNEL_ENABLE == channelEnabledType )
+            {
+                if( countryIndex != -1 )
                 {
-                    if( pChannelList->channelList[i] ==
-                            countryIgnoreList[countryIndex].channelList[j] )
+                    for(j=0; j < countryIgnoreList[countryIndex].channelCount; j++)
                     {
-                        channelIgnore = TRUE;
-                        break;
+                        if( pChannelList->channelList[i] ==
+                                countryIgnoreList[countryIndex].channelList[j] )
+                        {
+                            channelIgnore = TRUE;
+                            break;
+                        }
                     }
                 }
-            }
-            if( FALSE == channelIgnore )
-            {
-                ChannelList.channelList[numChannels] = pChannelList->channelList[i];
-                numChannels++;
+                if( FALSE == channelIgnore )
+                {
+                   ChannelList.channelList[numChannels] = pChannelList->channelList[i];
+                   numChannels++;
+                }
             }
         }
         ChannelList.numChannels = numChannels;
@@ -4009,6 +3479,7 @@
     csrSetCfgCountryCode(pMac, countryCode);
 }
 
+
 void csrResetCountryInformation( tpAniSirGlobal pMac, tANI_BOOLEAN fForce, tANI_BOOLEAN updateRiva )
 {
     if( fForce || (csrIs11dSupported( pMac ) && (!pMac->scan.f11dInfoReset)))
@@ -4171,8 +3642,6 @@
 
     if (!pMac->scan.countryCodeCount)
     {
-        VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
-                "No AP with 11d Country code is present in scan list");
         return fRet;
     }
     maxVotes = pMac->scan.votes11d[0].votes;
@@ -4992,8 +4461,7 @@
                 //This check only valid here because csrSaveScanresults is not yet called
                 fSuccess = (!csrLLIsListEmpty(&pMac->scan.tempScanResults, LL_ACCESS_LOCK));
             }
-            if (pCommand->u.scanCmd.abortScanIndication &
-                                   eCSR_SCAN_ABORT_DUE_TO_BAND_CHANGE)
+            if (pCommand->u.scanCmd.abortScanDueToBandChange)
             {
                 /*
                  * Scan aborted due to band change
@@ -5011,15 +4479,11 @@
                     smsLog(pMac, LOG1, FL("11d_scan_done will flush the scan"
                                           " results"));
                 }
+                pCommand->u.scanCmd.abortScanDueToBandChange
+                    = eANI_BOOLEAN_FALSE;
             }
             csrSaveScanResults(pMac, pCommand->u.scanCmd.reason);
 
-            /* filter scan result based on valid channel list number */
-            if (pMac->scan.fcc_constraint)
-            {
-                smsLog(pMac, LOG1, FL("Clear BSS from invalid channels"));
-                csrScanFilterResults(pMac);
-            }
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
             {
                 vos_log_scan_pkt_type *pScanLog = NULL;
@@ -5458,7 +4922,6 @@
     tANI_U32 cbParsed;
     tSirBssDescription *pSirBssDescription;
     tANI_U32 cbBssDesc;
-    eHalStatus status;
     tANI_U32 cbScanResult = GET_FIELD_OFFSET( tSirSmeScanRsp, bssDescription ) 
                             + sizeof(tSirBssDescription);    //We need at least one CB
 
@@ -5592,22 +5055,6 @@
         *pfRemoveCommand = fRemoveCommand;
     }
 
-    /*
-     * Currently SET_FCC_CHANNEL issues updated channel list to fw.
-     * At the time of driver load, if scan is issued followed with
-     * SET_FCC_CHANNEL, driver will send update channel list to fw.
-     * Fw will stop ongoing scan because of that GUI will have very less
-     * scan list.
-     * Update channel list should be sent to fw once scan is done
-     */
-    if (pMac->scan.defer_update_channel_list) {
-        status = csrUpdateChannelList(pMac);
-        if (eHAL_STATUS_SUCCESS != status)
-            smsLog(pMac, LOGE,
-                   FL( "failed to update the supported channel list"));
-            pMac->scan.defer_update_channel_list = false;
-    }
-
 #ifdef WLAN_AP_STA_CONCURRENCY
     if (pMac->fScanOffload)
         return fRet;
@@ -5670,7 +5117,7 @@
     tListElem *pEntry;
     tSmeCmd *pCommand;
     eCsrScanStatus scanStatus;
-    tSirSmeScanRsp *pScanRsp;
+    tSirSmeScanRsp *pScanRsp = (tSirSmeScanRsp *)pMsgBuf;
     tSmeGetScanChnRsp *pScanChnInfo;
     tANI_BOOLEAN fRemoveCommand = eANI_BOOLEAN_TRUE;
     eCsrScanReason reason = eCsrScanOther;
@@ -5686,9 +5133,7 @@
         pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
         if ( eSmeCommandScan == pCommand->command )
         {
-            /* Purge the scan results based on Aging */
-            if (pEntry && pMac->scan.scanResultCfgAgingTime)
-                csrPurgeScanResultByAge(pMac);
+            scanStatus = (eSIR_SME_SUCCESS == pScanRsp->statusCode) ? eCSR_SCAN_SUCCESS : eCSR_SCAN_FAILURE;
             reason = pCommand->u.scanCmd.reason;
             switch(pCommand->u.scanCmd.reason)
             {
@@ -5696,9 +5141,6 @@
             case eCsrScanAbortNormalScan:
             case eCsrScanBGScanAbort:
             case eCsrScanBGScanEnable:
-                pScanRsp = (tSirSmeScanRsp *)pMsgBuf;
-                scanStatus = (eSIR_SME_SUCCESS == pScanRsp->statusCode) ?
-                              eCSR_SCAN_SUCCESS : eCSR_SCAN_FAILURE;
                 break;
             case eCsrScanGetScanChnInfo:
                 pScanChnInfo = (tSmeGetScanChnRsp *)pMsgBuf;
@@ -5710,34 +5152,38 @@
                 csrScanAgeResults(pMac, pScanChnInfo);
                 break;
             case eCsrScanForCapsChange:
-                pScanRsp = (tSirSmeScanRsp *)pMsgBuf;
-                scanStatus = (eSIR_SME_SUCCESS == pScanRsp->statusCode) ?
-                              eCSR_SCAN_SUCCESS : eCSR_SCAN_FAILURE;
                 csrScanProcessScanResults( pMac, pCommand, pScanRsp, &fRemoveCommand );
                 break;
             case eCsrScanP2PFindPeer:
-                pScanRsp = (tSirSmeScanRsp *)pMsgBuf;
-                scanStatus = ((eSIR_SME_SUCCESS == pScanRsp->statusCode) &&
-                             (pScanRsp->length > 50)) ? eCSR_SCAN_FOUND_PEER : eCSR_SCAN_FAILURE;
-                csrScanProcessScanResults( pMac, pCommand, pScanRsp, NULL );
-                break;
+              scanStatus = ((eSIR_SME_SUCCESS == pScanRsp->statusCode) && (pScanRsp->length > 50)) ? eCSR_SCAN_FOUND_PEER : eCSR_SCAN_FAILURE;
+              csrScanProcessScanResults( pMac, pCommand, pScanRsp, NULL );
+              break;
             case eCsrScanSetBGScanParam:
             default:
-                pScanRsp = (tSirSmeScanRsp *)pMsgBuf;
-                scanStatus = (eSIR_SME_SUCCESS == pScanRsp->statusCode) ?
-                              eCSR_SCAN_SUCCESS : eCSR_SCAN_FAILURE;
                 if(csrScanProcessScanResults( pMac, pCommand, pScanRsp, &fRemoveCommand ))
                 {
                     //Not to get channel info if the scan is not a wildcard scan because
                     //it may cause scan results got aged out incorrectly.
-                    if(csrScanIsWildCardScan( pMac, pCommand ) &&
-                             (!pCommand->u.scanCmd.u.scanRequest.p2pSearch)
+                    if( csrScanIsWildCardScan( pMac, pCommand ) && (!pCommand->u.scanCmd.u.scanRequest.p2pSearch)
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
                         && (pCommand->u.scanCmd.reason != eCsrScanGetLfrResult)
 #endif
                       )
                     {
-                         csrScanGetScanChnInfo(pMac, pCommand);
+                        //Get the list of channels scanned
+                       if( pCommand->u.scanCmd.reason != eCsrScanUserRequest)
+                       {
+                           csrScanGetScanChnInfo(pMac, pCommand->sessionId,
+                                                 NULL, NULL);
+                       }
+                       else
+                       {
+                           csrScanGetScanChnInfo(pMac,
+                                   pCommand->sessionId,
+                                   pCommand->u.scanCmd.pContext,
+                                   pCommand->u.scanCmd.callback);
+                           pCommand->u.scanCmd.callback = NULL;
+                       }
                     }
                 }
                 break;
@@ -5747,7 +5193,7 @@
 
                 csrReleaseScanCommand(pMac, pCommand, scanStatus);
 
-            }
+                }
             smeProcessPendingQueue( pMac );
         }
         else
@@ -5885,8 +5331,7 @@
     {
         //Reset the counter so that aging out of connected BSS won't hapeen too soon
         pResult->AgingCount = (tANI_S32)pMac->roam.configParam.agingCount;
-        pResult->Result.BssDescriptor.nReceivedTime =
-                                        vos_timer_get_system_time();
+        pResult->Result.BssDescriptor.nReceivedTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
 
         return (fRet);
     }
@@ -5952,64 +5397,6 @@
     return (status);
 }
 
-eHalStatus csrIbssAgeBss(tpAniSirGlobal pMac)
-{
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    tListElem *pEntry, *tmpEntry;
-    tCsrScanResult *pResult;
-
-    csrLLLock(&pMac->scan.scanResultList);
-    pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK );
-    while( pEntry )
-    {
-       tmpEntry = csrLLNext(&pMac->scan.scanResultList,
-                                             pEntry, LL_ACCESS_NOLOCK);
-       pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
-
-       smsLog(pMac, LOGW, FL(" age out due Forced IBSS leave"));
-       csrScanAgeOutBss(pMac, pResult);
-       pEntry = tmpEntry;
-    }
-    csrLLUnlock(&pMac->scan.scanResultList);
-
-    return (status);
-}
-
-/**
- * csr_remove_bssid_from_scan_list() - remove the bssid from
- * scan list
- * @pMac: mac context.
- * @bssid: bssid to be removed
- *
- * This function remove the given bssid from scan list.
- *
- * Return: void.
- */
-void csr_remove_bssid_from_scan_list(tpAniSirGlobal pMac,
-     tSirMacAddr bssid)
-{
-    tListElem *entry,*free_elem;
-    tCsrScanResult *bss_desc;
-    tDblLinkList *list = &pMac->scan.scanResultList;
-
-    csrLLLock(list);
-    entry = csrLLPeekHead(list, LL_ACCESS_NOLOCK);
-    while (entry != NULL) {
-        bss_desc = GET_BASE_ADDR( entry, tCsrScanResult, Link);
-        if (vos_mem_compare(bss_desc->Result.BssDescriptor.bssId,
-           bssid, sizeof(tSirMacAddr))) {
-            free_elem = entry;
-            entry = csrLLNext(list, entry, LL_ACCESS_NOLOCK);
-            csrLLRemoveEntry(list, free_elem, LL_ACCESS_NOLOCK);
-            csrFreeScanResultEntry(pMac, bss_desc);
-            smsLog(pMac, LOGW, FL("Removed BSS entry:%pM"),
-                   bssid);
-            continue;
-        }
-        entry = csrLLNext(list, entry, LL_ACCESS_NOLOCK);
-    }
-    csrLLUnlock(list);
-}
 
 eHalStatus csrSendMBScanReq( tpAniSirGlobal pMac, tANI_U16 sessionId, 
                     tCsrScanRequest *pScanReq, tScanReqParam *pScanReqParam )
@@ -6378,26 +5765,7 @@
     return (status);
 }
 
-eHalStatus csrProcessMacAddrSpoofCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
-{
-   tSirSpoofMacAddrReq *pMsg;
-   tANI_U16 msgLen;
-   eHalStatus status = eHAL_STATUS_FAILURE;
-   do {
-      msgLen = sizeof(tSirSpoofMacAddrReq);
 
-      pMsg = vos_mem_malloc(msgLen);
-      if ( NULL == pMsg )
-          return eHAL_STATUS_FAILURE;
-      pMsg->messageType= pal_cpu_to_be16((tANI_U16)eWNI_SME_MAC_SPOOF_ADDR_IND);
-      pMsg->length= pal_cpu_to_be16(msgLen);
-      // spoof mac address
-      vos_mem_copy((tANI_U8 *)pMsg->macAddr,
-           (tANI_U8 *)pCommand->u.macAddrSpoofCmd.macAddr, sizeof(tSirMacAddr));
-      status = palSendMBMessage(pMac->hHdd, pMsg);
-   } while( 0 );
-   return( status );
-}
 
 eHalStatus csrProcessScanCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
@@ -6648,12 +6016,19 @@
                 break;
             }
         }while(0);
+        //BG scan results are reported automatically by PE to SME once the scan is done.
+        //No need to fetch the results explicitly.
+        //csrScanStartGetResultTimer(pMac);
+        csrScanStartResultAgingTimer(pMac);
     }
     else
     {
-       smsLog(pMac, LOGE, FL("cannot continue because the bgscan interval is 0"));
-       status = eHAL_STATUS_INVALID_PARAMETER;
+        //We don't have BG scan so stop the aging timer
+        csrScanStopResultAgingTimer(pMac);
+        smsLog(pMac, LOGE, FL("cannot continue because the bgscan interval is 0"));
+        status = eHAL_STATUS_INVALID_PARAMETER;
     }
+    
     return (status);
 }
 
@@ -6728,16 +6103,6 @@
                           /* Skip CH 144 if firmware support not present */
                           if (pSrcReq->ChannelInfo.ChannelList[index] == 144 && !ch144_support)
                               continue;
-                          /* Skip channel 12 and 13 when FCC constraint is true */
-                          if ((pMac->scan.fcc_constraint) &&
-                                 ((pSrcReq->ChannelInfo.ChannelList[index] ==12) ||
-                                 (pSrcReq->ChannelInfo.ChannelList[index] ==13)))
-                          {
-                              VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                                  FL("Ignoring channel : %d "),
-                                  pSrcReq->ChannelInfo.ChannelList[index]);
-                              continue;
-                          }
 
                           NVchannel_state = vos_nv_getChannelEnabledState(
                                   pSrcReq->ChannelInfo.ChannelList[index]);
@@ -6759,15 +6124,10 @@
                      /* Since in CsrScanRequest,value of pMac->scan.nextScanID
                       * is incremented before calling CsrScanCopyRequest, as a
                       * result pMac->scan.nextScanID is equal to ONE for the
-                      * first scan. If number of channels is less than
-                      * max chan for dwell time no need to skip dfs
-                      * in first scan as anyway few channels will be scanned and
-                      * it will not take much time to display results on GUI.
+                      * first scan.
                       */
-                     if (((pSrcReq->ChannelInfo.numOfChannels >=
-                          pMac->roam.configParam.max_chan_for_dwell_time_cfg) &&
-                         (pMac->roam.configParam.initialScanSkipDFSCh &&
-                           1 == pMac->scan.nextScanID)) ||(pMac->miracast_mode))
+                     if ((pMac->roam.configParam.initialScanSkipDFSCh &&
+                              1 == pMac->scan.nextScanID) ||(pMac->miracast_mode))
                      {
                        smsLog(pMac, LOG1,
                               FL("Initial scan, scan only non-DFS channels"));
@@ -6805,9 +6165,7 @@
                              */
                             if ( ( csrRoamIsValidChannel(pMac, pSrcReq->ChannelInfo.ChannelList[index]) ) )
                             {
-                                if( ((pSrcReq->skipDfsChnlInP2pSearch ||
-                                     (pMac->scan.fEnableDFSChnlScan ==
-                                     DFS_CHNL_SCAN_DISABLED)) &&
+                                if( (pSrcReq->skipDfsChnlInP2pSearch && 
                                     (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(pSrcReq->ChannelInfo.ChannelList[index])) )
 #ifdef FEATURE_WLAN_LFR
                                      /* 
@@ -6954,10 +6312,6 @@
 {
     if(pCommand->u.scanCmd.callback)
     {
-        if (pCommand->u.scanCmd.abortScanIndication){
-             smsLog( pMac, LOG1, FL("scanDone due to abort"));
-             scanStatus = eCSR_SCAN_ABORT;
-        }
 //        sme_ReleaseGlobalLock( &pMac->sme );
         pCommand->u.scanCmd.callback(pMac, pCommand->u.scanCmd.pContext, pCommand->u.scanCmd.scanID, scanStatus); 
 //        sme_AcquireGlobalLock( &pMac->sme );
@@ -6969,8 +6323,14 @@
 
 void csrScanStopTimers(tpAniSirGlobal pMac)
 {
+    csrScanStopResultAgingTimer(pMac);
     csrScanStopIdleScanTimer(pMac);
     csrScanStopGetResultTimer(pMac);
+    if(0 != pMac->scan.scanResultCfgAgingTime )
+    {
+        csrScanStopResultCfgAgingTimer(pMac);
+    }
+
 }
 
 
@@ -7145,6 +6505,38 @@
 }
 #endif
 
+eHalStatus csrScanStartResultAgingTimer(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+    
+    if(pMac->scan.fScanEnable)
+    {
+        status = vos_timer_start(&pMac->scan.hTimerResultAging, CSR_SCAN_RESULT_AGING_INTERVAL/PAL_TIMER_TO_MS_UNIT);
+    }
+    return (status);
+}
+
+eHalStatus csrScanStartResultCfgAgingTimer(tpAniSirGlobal pMac)
+{
+    eHalStatus status = eHAL_STATUS_FAILURE;
+
+    if(pMac->scan.fScanEnable)
+    {
+        status = vos_timer_start(&pMac->scan.hTimerResultCfgAging, CSR_SCAN_RESULT_CFG_AGING_INTERVAL/PAL_TIMER_TO_MS_UNIT);
+    }
+    return (status);
+}
+
+eHalStatus csrScanStopResultAgingTimer(tpAniSirGlobal pMac)
+{
+    return (vos_timer_stop(&pMac->scan.hTimerResultAging));
+}
+
+eHalStatus csrScanStopResultCfgAgingTimer(tpAniSirGlobal pMac)
+{
+    return (vos_timer_stop(&pMac->scan.hTimerResultCfgAging));
+}
+
 //This function returns the maximum time a BSS is allowed in the scan result.
 //The time varies base on connection and power saving factors.
 //Not connected, No PS
@@ -7208,31 +6600,65 @@
     return (nRet);
 }
 
-static void csrPurgeScanResultByAge(void *pv)
+
+void csrScanResultAgingTimerHandler(void *pv)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( pv );
+    tANI_BOOLEAN fDisconnected = csrIsAllSessionDisconnected(pMac);
+    
+    //no scan, no aging
+    if (pMac->scan.fScanEnable &&
+        (((eANI_BOOLEAN_FALSE == fDisconnected) && pMac->roam.configParam.bgScanInterval)    
+        || (fDisconnected && (pMac->scan.fCancelIdleScan == eANI_BOOLEAN_FALSE))
+        || (pMac->fScanOffload))
+        )
+    {
+        tListElem *pEntry, *tmpEntry;
+        tCsrScanResult *pResult;
+        tANI_TIMESTAMP ageOutTime = (tANI_TIMESTAMP)(csrScanGetAgeOutTime(pMac) * PAL_TICKS_PER_SECOND); //turn it into 10ms units
+        tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
+
+        csrLLLock(&pMac->scan.scanResultList);
+        pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK );
+        while( pEntry ) 
+        {
+            tmpEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK);
+            pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+            if((curTime - pResult->Result.BssDescriptor.nReceivedTime) > ageOutTime)
+            {
+                smsLog(pMac, LOGW, " age out due to time out");
+                csrScanAgeOutBss(pMac, pResult);
+            }
+            pEntry = tmpEntry;
+        }
+        csrLLUnlock(&pMac->scan.scanResultList);
+    }
+    vos_timer_start(&pMac->scan.hTimerResultAging, CSR_SCAN_RESULT_AGING_INTERVAL/PAL_TIMER_TO_MS_UNIT);
+}
+
+static void csrScanResultCfgAgingTimerHandler(void *pv)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( pv );
     tListElem *pEntry, *tmpEntry;
     tCsrScanResult *pResult;
-    v_TIME_t ageOutTime =
-       (v_TIME_t)(pMac->scan.scanResultCfgAgingTime * SYSTEM_TIME_SEC_TO_MSEC);
-    v_TIME_t curTime = vos_timer_get_system_time();
+    tANI_TIMESTAMP ageOutTime =  pMac->scan.scanResultCfgAgingTime * PAL_TICKS_PER_SECOND;
+    tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
   
     csrLLLock(&pMac->scan.scanResultList);
     pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK );
-    smsLog(pMac, LOG1, FL("Ageout time=%lu"),ageOutTime);
     while( pEntry ) 
     {
         tmpEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK);
         pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
         if((curTime - pResult->Result.BssDescriptor.nReceivedTime) > ageOutTime)
         {
-            smsLog(pMac, LOG1, FL("age out due to time out for BSSID" MAC_ADDRESS_STR),
-                             MAC_ADDR_ARRAY(pResult->Result.BssDescriptor.bssId));
+            smsLog(pMac, LOGW, " age out due to time out");
             csrScanAgeOutBss(pMac, pResult);
         }
         pEntry = tmpEntry;
     }
     csrLLUnlock(&pMac->scan.scanResultList);
+    vos_timer_start(&pMac->scan.hTimerResultCfgAging, CSR_SCAN_RESULT_CFG_AGING_INTERVAL/PAL_TIMER_TO_MS_UNIT);
 }
 
 eHalStatus csrScanStartIdleScanTimer(tpAniSirGlobal pMac, tANI_U32 interval)
@@ -7455,6 +6881,8 @@
         csrScanBGScanAbort(pMac);
         //Stop get result timer because idle scan gets scan result out of PE
         csrScanStopGetResultTimer(pMac);
+        //Enable aging timer since idle scan is going on
+        csrScanStartResultAgingTimer(pMac);
     }
     pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE;
     status = csrScanTriggerIdleScan(pMac, &nTime);
@@ -7813,42 +7241,7 @@
 }
 #endif /* FEATURE_WLAN_WAPI */
 
-/**
- * csr_scan_request_set_chan_time() - Populate max and min
- *                            channel time in Scan request
- * @pMac - pointer to mac context
- * @pScanCmd - pointer to the Scan command
- *
- * Return - None
- */
-#ifndef QCA_WIFI_ISOC
-static void csr_scan_request_set_chan_time(tpAniSirGlobal pMac,
-						tSmeCmd *pScanCmd)
-{
-	if (pMac->roam.neighborRoamInfo.handoffReqInfo.src
-							== FASTREASSOC) {
-		pScanCmd->u.scanCmd.u.scanRequest.maxChnTime
-			= MAX_ACTIVE_SCAN_FOR_ONE_CHANNEL_FASTREASSOC;
-		pScanCmd->u.scanCmd.u.scanRequest.minChnTime
-			= MIN_ACTIVE_SCAN_FOR_ONE_CHANNEL_FASTREASSOC;
-		pMac->roam.neighborRoamInfo.handoffReqInfo.src = 0;
-	} else {
-		pScanCmd->u.scanCmd.u.scanRequest.maxChnTime
-			= MAX_ACTIVE_SCAN_FOR_ONE_CHANNEL;
-		pScanCmd->u.scanCmd.u.scanRequest.minChnTime
-			= MIN_ACTIVE_SCAN_FOR_ONE_CHANNEL;
-	}
-}
-#else
-static void csr_scan_request_set_chan_time(tpAniSirGlobal pMac,
-						tSmeCmd *pScanCmd)
-{
-	pScanCmd->u.scanCmd.u.scanRequest.maxChnTime
-			= MAX_ACTIVE_SCAN_FOR_ONE_CHANNEL;
-	pScanCmd->u.scanCmd.u.scanRequest.minChnTime
-			= MIN_ACTIVE_SCAN_FOR_ONE_CHANNEL;
-}
-#endif
+
 
 //This function is usually used for BSSs that suppresses SSID so the profile 
 //shall have one and only one SSID
@@ -7931,8 +7324,11 @@
             /* For one channel be good enpugh time to receive beacon atleast */
             if(  1 == pProfile->ChannelInfo.numOfChannels )
             {
-                 csr_scan_request_set_chan_time(pMac, pScanCmd);
-            } else {
+                 pScanCmd->u.scanCmd.u.scanRequest.maxChnTime = MAX_ACTIVE_SCAN_FOR_ONE_CHANNEL;
+                 pScanCmd->u.scanCmd.u.scanRequest.minChnTime = MIN_ACTIVE_SCAN_FOR_ONE_CHANNEL;
+            }
+            else
+            {
                  pScanCmd->u.scanCmd.u.scanRequest.maxChnTime =
                                    pMac->roam.configParam.nActiveMaxChnTime;
                  pScanCmd->u.scanCmd.u.scanRequest.minChnTime =
@@ -8345,12 +7741,10 @@
 
 void csrSetCfgScanControlList( tpAniSirGlobal pMac, tANI_U8 *countryCode, tCsrChannel *pChannelList  )
 {   
-    tANI_U8 i, j, k;
+    tANI_U8 i, j;
     tANI_BOOLEAN found=FALSE;  
     tANI_U8 *pControlList = NULL;
     tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
-    tANI_U8 cfgActiveDFSChannels = 0;
-    tANI_U8 *cfgActiveDFSChannelLIst = NULL;
 
     if ( (pControlList = vos_mem_malloc(WNI_CFG_SCAN_CONTROL_LIST_LEN)) != NULL )
     {
@@ -8372,38 +7766,10 @@
                 {
                     pControlList[j+1] = csrGetScanType(pMac, pControlList[j]);
                     found = FALSE;  // reset the flag
-
-                    // When DFS mode is 2, mark static channels as active
-                    if (pMac->scan.fEnableDFSChnlScan ==
-                                   DFS_CHNL_SCAN_ENABLED_ACTIVE)
-                    {
-                        cfgActiveDFSChannels =
-                          pMac->roam.neighborRoamInfo.cfgParams.
-                                               channelInfo.numOfChannels;
-                        cfgActiveDFSChannelLIst =
-                          pMac->roam.neighborRoamInfo.cfgParams.
-                                               channelInfo.ChannelList;
-                        if (cfgActiveDFSChannelLIst)
-                        {
-                           for (k=0; k < cfgActiveDFSChannels; k++)
-                           {
-                               if(CSR_IS_CHANNEL_DFS(cfgActiveDFSChannelLIst[k])
-                                   && (pControlList[j] ==
-                                                  cfgActiveDFSChannelLIst[k]))
-                               {
-                                   pControlList[j+1] = eSIR_ACTIVE_SCAN;
-                                   smsLog(pMac, LOG1, FL("Marked DFS ch %d"
-                                          " as active"),
-                                          cfgActiveDFSChannelLIst[k]);
-                               }
-                           }
-                        }
-                    }
                 }
-            }
+                       
+            }            
 
-            smsLog(pMac, LOG1, FL("fEnableDFSChnlScan %d"),
-                                       pMac->scan.fEnableDFSChnlScan);
             VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
                       "%s: dump scan control list",__func__);
             VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
@@ -8415,6 +7781,7 @@
     }//AllocateMemory
 }
 
+
 //if bgPeriod is 0, background scan is disabled. It is in millisecond units
 eHalStatus csrSetCfgBackgroundScanPeriod(tpAniSirGlobal pMac, tANI_U32 bgPeriod)
 {
@@ -8463,6 +7830,12 @@
     //Not set the background scan interval if not connected because bd scan should not be run if not connected
     if(!csrIsAllSessionDisconnected(pMac))
     {
+        //If disbaling BG scan here, we need to stop aging as well
+        if(pScanReq->scanInterval == 0)
+        {
+            //Stop aging because no new result is coming in
+            csrScanStopResultAgingTimer(pMac);
+        }
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
         {
@@ -8509,11 +7882,10 @@
 }
 
 
-tSirAbortScanStatus csrScanAbortMacScan(tpAniSirGlobal pMac,
-                                        tANI_U8 sessionId,
-                                        eCsrAbortReason reason)
+eHalStatus csrScanAbortMacScan(tpAniSirGlobal pMac, tANI_U8 sessionId,
+                               eCsrAbortReason reason)
 {
-    tSirAbortScanStatus abortScanStatus = eSIR_ABORT_ACTIVE_SCAN_LIST_EMPTY;
+    eHalStatus status = eHAL_STATUS_FAILURE;
     tSirSmeScanAbortReq *pMsg;
     tANI_U16 msgLen;
     tListElem *pEntry;
@@ -8564,37 +7936,26 @@
             pMsg = vos_mem_malloc(msgLen);
             if ( NULL == pMsg )
             {
+               status = eHAL_STATUS_FAILURE;
                smsLog(pMac, LOGE, FL("Failed to allocate memory for SmeScanAbortReq"));
-               abortScanStatus = eSIR_ABORT_SCAN_FAILURE;
             }
             else
             {
-                pCommand->u.scanCmd.abortScanIndication = eCSR_SCAN_ABORT_DEFAULT;
                 if(reason == eCSR_SCAN_ABORT_DUE_TO_BAND_CHANGE)
                 {
-                    pCommand->u.scanCmd.abortScanIndication
-                        = eCSR_SCAN_ABORT_DUE_TO_BAND_CHANGE;
+                    pCommand->u.scanCmd.abortScanDueToBandChange
+                        = eANI_BOOLEAN_TRUE;
                 }
                 vos_mem_set((void *)pMsg, msgLen, 0);
                 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_SCAN_ABORT_IND);
                 pMsg->msgLen = pal_cpu_to_be16(msgLen);
                 pMsg->sessionId = sessionId;
-                if (eHAL_STATUS_SUCCESS != palSendMBMessage(pMac->hHdd, pMsg))
-                {
-                    smsLog(pMac, LOGE,
-                           FL("Failed to post eWNI_SME_SCAN_ABORT_IND"));
-                    abortScanStatus = eSIR_ABORT_SCAN_FAILURE;
-                    pCommand->u.scanCmd.abortScanIndication = 0;
-                }
-                else
-                {
-                    abortScanStatus = eSIR_ABORT_ACTIVE_SCAN_LIST_NOT_EMPTY;
-                }
+                status = palSendMBMessage(pMac->hHdd, pMsg);
             }
         }
     }
 
-    return(abortScanStatus);
+    return(status);
 }
 
 void csrRemoveCmdWithSessionIdFromPendingList(tpAniSirGlobal pMac,
@@ -8813,12 +8174,7 @@
     if( !csrIsScanForRoamCommandActive( pMac ) )
     {
         //Only abort the scan if it is not used for other roam/connect purpose
-        if (eSIR_ABORT_SCAN_FAILURE ==
-                csrScanAbortMacScan(pMac, sessionId, eCSR_SCAN_ABORT_DEFAULT))
-        {
-            smsLog(pMac, LOGE, FL("fail to abort scan"));
-            status = eHAL_STATUS_FAILURE;
-        }
+        status = csrScanAbortMacScan(pMac, sessionId, eCSR_SCAN_ABORT_DEFAULT);
     }
 
     return (status);
@@ -8887,11 +8243,10 @@
    v_U32_t indx;
    u8 channelsAllowed[WNI_CFG_VALID_CHANNEL_LIST_LEN];
    v_U32_t numChannelsAllowed = WNI_CFG_VALID_CHANNEL_LIST_LEN;
-   tListElem *pEntry;
 
 
    pParsedFrame =
-       (tpSirProbeRespBeacon)vos_mem_vmalloc(sizeof(tSirProbeRespBeacon));
+       (tpSirProbeRespBeacon)vos_mem_malloc(sizeof(tSirProbeRespBeacon));
 
    if (NULL == pParsedFrame)
    {
@@ -8904,7 +8259,7 @@
       smsLog(pMac, LOGE,
          FL("Not enough bytes in PNO indication probe resp frame! length=%d"),
          pPrefNetworkFoundInd->frameLength);
-      vos_mem_vfree(pParsedFrame);
+      vos_mem_free(pParsedFrame);
       return eHAL_STATUS_FAILURE;
    }
 
@@ -8917,7 +8272,7 @@
       smsLog(pMac, LOGE,
          FL("Parse error ProbeResponse, length=%d"),
          pPrefNetworkFoundInd->frameLength);
-      vos_mem_vfree(pParsedFrame);
+      vos_mem_free(pParsedFrame);
       return eHAL_STATUS_FAILURE;
    }
    //24 byte MAC header and 12 byte to ssid IE
@@ -8984,7 +8339,7 @@
    {
       smsLog(pMac, LOGE, FL(" sme_GetCfgValidChannels failed "));
       csrFreeScanResultEntry(pMac, pScanResult);
-      vos_mem_vfree(pParsedFrame);
+      vos_mem_free(pParsedFrame);
       return eHAL_STATUS_FAILURE;
    }
    /* Checking chhanelId with allowed channel list */
@@ -9005,7 +8360,7 @@
       smsLog(pMac, LOGW, FL(" prefered network found on invalid channel = %d"),
                                                          pBssDescr->channelId);
       csrFreeScanResultEntry(pMac, pScanResult);
-      vos_mem_vfree(pParsedFrame);
+      vos_mem_free(pParsedFrame);
       return eHAL_STATUS_FAILURE;
    }
 
@@ -9048,7 +8403,7 @@
    pBssDescr->timeStamp[1]   = pParsedFrame->timeStamp[1];
    pBssDescr->capabilityInfo = *((tANI_U16 *)&pParsedFrame->capabilityInfo);
    vos_mem_copy((tANI_U8 *) &pBssDescr->bssId, (tANI_U8 *) macHeader->bssId, sizeof(tSirMacAddr));
-   pBssDescr->nReceivedTime = vos_timer_get_system_time();
+   pBssDescr->nReceivedTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
 
    smsLog( pMac, LOG1, FL("Bssid= "MAC_ADDRESS_STR
                        " chan= %d, rssi = %d "),
@@ -9071,7 +8426,7 @@
    {
       smsLog(pMac, LOGE, FL("  Cannot parse IEs"));
       csrFreeScanResultEntry(pMac, pScanResult);
-      vos_mem_vfree(pParsedFrame);
+      vos_mem_free(pParsedFrame);
       return eHAL_STATUS_RESOURCES;
    }
 
@@ -9091,21 +8446,15 @@
       vos_mem_free(pParsedFrame);
       return eHAL_STATUS_RESOURCES;
    }
-
-    if ((macHeader->fc.type == SIR_MAC_MGMT_FRAME) &&
-        (macHeader->fc.subType == SIR_MAC_MGMT_PROBE_RSP))
-    {
-        pScanResult->Result.BssDescriptor.fProbeRsp = 1;
-    }
    //Add to scan cache
    csrScanAddResult(pMac, pScanResult, pIesLocal);
-   pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_LOCK );
+
    if( (pScanResult->Result.pvIes == NULL) && pIesLocal )
    {
        vos_mem_free(pIesLocal);
    }
 
-   vos_mem_vfree(pParsedFrame);
+   vos_mem_free(pParsedFrame);
 
    return eHAL_STATUS_SUCCESS;
 }
diff --git a/wlan/prima/CORE/SME/src/csr/csrInsideApi.h b/wlan/prima/CORE/SME/src/csr/csrInsideApi.h
index f9a38bf..6ac04ed 100644
--- a/wlan/prima/CORE/SME/src/csr/csrInsideApi.h
+++ b/wlan/prima/CORE/SME/src/csr/csrInsideApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -37,7 +37,6 @@
 #define CSR_INSIDE_API_H__
 
 
-#include <linux/version.h>
 #include "csrSupport.h"
 #include "smeInside.h"
 #include "vos_nvitem.h"
@@ -68,9 +67,8 @@
 
 #define CSR_MAX_2_4_GHZ_SUPPORTED_CHANNELS 14
 
-#define CSR_MAX_BSS_SUPPORT            512
+#define CSR_MAX_BSS_SUPPORT            250
 #define SYSTEM_TIME_MSEC_TO_USEC      1000
-#define SYSTEM_TIME_SEC_TO_MSEC       1000
 
 //This number minus 1 means the number of times a channel is scanned before a BSS is remvoed from
 //cache scan result
@@ -86,6 +84,7 @@
 #define CSR_MIC_ERROR_TIMEOUT  (60 * PAL_TIMER_TO_SEC_UNIT)     //60 seconds
 #define CSR_TKIP_COUNTER_MEASURE_TIMEOUT  (60 * PAL_TIMER_TO_SEC_UNIT)     //60 seconds
 #define CSR_SCAN_RESULT_AGING_INTERVAL    (5 * PAL_TIMER_TO_SEC_UNIT)     //5 seconds
+#define CSR_SCAN_RESULT_CFG_AGING_INTERVAL    (PAL_TIMER_TO_SEC_UNIT)     // 1  second
 //the following defines are NOT used by palTimer
 #define CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS 50     //50 seconds
 #define CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS 300     //300 seconds
@@ -112,43 +111,6 @@
 #define CSR_JOIN_RETRY_TIMEOUT_PERIOD        ( 1 *  PAL_TIMER_TO_SEC_UNIT )  // 1 second
 #endif
 
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-#define ROAMING_RSSI_WEIGHT 50
-#define MIN_RSSI (-100)
-#define MAX_RSSI 0
-#define ROAM_AP_COUNT_WEIGHT 50
-#define ROAM_MAX_COUNT 30
-#define ROAM_MIN_COUNT 0
-#define ROAM_MAX_WEIGHT 100
-
-#define RSSI_WEIGHTAGE 25
-#define HT_CAPABILITY_WEIGHTAGE 10
-#define VHT_CAP_WEIGHTAGE 6
-#define BEAMFORMING_CAP_WEIGHTAGE 2
-#define CHAN_WIDTH_WEIGHTAGE 10
-#define CHAN_BAND_WEIGHTAGE 5
-#define WMM_WEIGHTAGE 2
-#define CCA_WEIGHTAGE 10
-#define OTHER_AP_WEIGHT 30
-
-#define MAX_AP_LOAD 255
-#define PENALTY_TIMEOUT (30 * 60 * 1000)
-#define PENALTY_REMAINING_SCORE (7)
-#define PENALTY_TOTAL_SCORE (10)
-#define PER_EXCELENT_RSSI -40
-#define PER_GOOD_RSSI -55
-#define PER_POOR_RSSI -65
-#define PER_ROAM_EXCELLENT_RSSI_WEIGHT 100
-#define PER_ROAM_GOOD_RSSI_WEIGHT 80
-#define PER_ROAM_BAD_RSSI_WEIGHT 60
-#define PER_ROAM_MAX_WEIGHT 100
-#define PER_ROAM_80MHZ 100
-#define PER_ROAM_40MHZ 70
-#define PER_ROAM_20MHZ 30
-#define PER_ROAM_PENALTY (3/10)
-#define PER_ROAM_MAX_BSS_SCORE 10000
-#endif
-
 typedef enum 
 {
     eCsrNextScanNothing,
@@ -207,9 +169,7 @@
     eCsrEncryptionType ucEncryptionType; //Preferred Encryption type that matched with profile.
     eCsrEncryptionType mcEncryptionType; 
     eCsrAuthType authType; //Preferred auth type that matched with the profile.
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-    int congestionScore;
-#endif
+
     tCsrScanResultInfo Result;
 }tCsrScanResult;
 
@@ -295,6 +255,10 @@
 eHalStatus csrScanForCapabilityChange(tpAniSirGlobal pMac, tSirSmeApNewCaps *pNewCaps);
 eHalStatus csrScanStartGetResultTimer(tpAniSirGlobal pMac);
 eHalStatus csrScanStopGetResultTimer(tpAniSirGlobal pMac);
+eHalStatus csrScanStartResultAgingTimer(tpAniSirGlobal pMac);
+eHalStatus csrScanStopResultAgingTimer(tpAniSirGlobal pMac);
+eHalStatus csrScanStartResultCfgAgingTimer(tpAniSirGlobal pMac);
+eHalStatus csrScanStopResultCfgAgingTimer(tpAniSirGlobal pMac);
 eHalStatus csrScanBGScanEnable(tpAniSirGlobal pMac);
 eHalStatus csrScanStartIdleScanTimer(tpAniSirGlobal pMac, tANI_U32 interval);
 eHalStatus csrScanStopIdleScanTimer(tpAniSirGlobal pMac);
@@ -309,9 +273,8 @@
 tANI_BOOLEAN csrScanRemoveNotRoamingScanCommand(tpAniSirGlobal pMac);
 //To remove fresh scan commands from the pending queue
 tANI_BOOLEAN csrScanRemoveFreshScanCommand(tpAniSirGlobal pMac, tANI_U8 sessionId);
-tSirAbortScanStatus csrScanAbortMacScan(tpAniSirGlobal pMac,
-                                        tANI_U8 sessionId,
-                                        eCsrAbortReason reason);
+eHalStatus csrScanAbortMacScan(tpAniSirGlobal pMac, tANI_U8 sessionId,
+                               eCsrAbortReason reason);
 void csrRemoveCmdFromPendingList(tpAniSirGlobal pMac, tDblLinkList *pList, 
                                               eSmeCommandType commandType );
 void csrRemoveCmdWithSessionIdFromPendingList(tpAniSirGlobal pMac,
@@ -331,8 +294,6 @@
 //The BSS is remove if the count reaches 0.
 eHalStatus csrScanAgeResults(tpAniSirGlobal pMac, tSmeGetScanChnRsp *pScanChnInfo);
 
-eHalStatus csrIbssAgeBss(tpAniSirGlobal pMac);
-
 //If fForce is TRUE we will save the new String that is learn't.
 //Typically it will be true in case of Join or user initiated ioctl
 tANI_BOOLEAN csrLearnCountryInformation( tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc,
@@ -456,11 +417,9 @@
                               tANI_U8 *pbSessionId);
 //fSync: TRUE means cleanupneeds to handle synchronously.
 eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId,
-                                tANI_BOOLEAN fSync, tANI_U8 bPurgeList,
+                                tANI_BOOLEAN fSync, 
                                 csrRoamSessionCloseCallback callback,
                                 void *pContext );
-void csrPurgeSmeCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
-                        bool flush_all);
 void csrCleanupSession(tpAniSirGlobal pMac, tANI_U32 sessionId);
 eHalStatus csrRoamGetSessionIdFromBSSID( tpAniSirGlobal pMac, tCsrBssid *bssid, tANI_U32 *pSessionId );
 eCsrCfgDot11Mode csrFindBestPhyMode( tpAniSirGlobal pMac, tANI_U32 phyMode );
@@ -513,15 +472,6 @@
   -------------------------------------------------------------------------------*/
 eHalStatus csrScanGetResult(tpAniSirGlobal, tCsrScanResultFilter *pFilter, tScanResultHandle *phResult);
 
-#ifdef FEATURE_WLAN_LFR
-/* ---------------------------------------------------------------------------
-    \fn csrAddChannelToOccupiedChannelList
-    \brief Add channel no given by fast reassoc cmd into occ chn list
-    \param channel - channel no passed by fast reassoc cmd
-    \return void
-  -------------------------------------------------------------------------------*/
-void csrAddChannelToOccupiedChannelList(tpAniSirGlobal pMac, tANI_U8 channel);
-#endif
 /* ---------------------------------------------------------------------------
     \fn csrScanFlushResult
     \brief Clear scan results.
@@ -536,14 +486,6 @@
  */
 eHalStatus csrScanFilterResults(tpAniSirGlobal pMac);
 
-/* ---------------------------------------------------------------------------
- *  \fn csrScanFilterDFSResults
- *  \brief Filter BSSIDs on DFS channels from the scan results.
- *  \return eHalStatus
- *-------------------------------------------------------------------------------
- */
-eHalStatus csrScanFilterDFSResults(tpAniSirGlobal pMac);
-
 eHalStatus csrScanFlushSelectiveResult(tpAniSirGlobal, v_BOOL_t flushP2P);
 
 eHalStatus csrScanFlushSelectiveResultForBand(tpAniSirGlobal, v_BOOL_t flushP2P, tSirRFBand band);
@@ -682,11 +624,6 @@
 #define WLAN_SECURITY_EVENT_PMKID_CANDIDATE_FOUND  7
 #define WLAN_SECURITY_EVENT_PMKID_UPDATE    8
 #define WLAN_SECURITY_EVENT_MIC_ERROR       9   
-#define WLAN_SECURITY_EVENT_SET_UNICAST_REQ  10
-#define WLAN_SECURITY_EVENT_SET_UNICAST_RSP  11
-#define WLAN_SECURITY_EVENT_SET_BCAST_REQ    12
-#define WLAN_SECURITY_EVENT_SET_BCAST_RSP    13
-
 
 #define AUTH_OPEN       0
 #define AUTH_SHARED     1
@@ -926,14 +863,6 @@
 eHalStatus csrRoamDisconnect(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason);
 
 /* ---------------------------------------------------------------------------
-    \fn csr_abortConnection
-    \brief To disconnect from a connecting network
-    \retutn void.
-----------------------------------------------------------------------------*/
-
-void csr_abortConnection(tpAniSirGlobal pMac, tANI_U32 sessionId);
-
-/* ---------------------------------------------------------------------------
     \fn csrScanGetPMKIDCandidateList
     \brief return the PMKID candidate list
     \param pPmkidList - caller allocated buffer point to an array of tPmkidCandidateInfo
@@ -962,12 +891,8 @@
     \return eHalStatus
   ---------------------------------------------------------------------------*/
 eHalStatus csrRoamIssueDisassociateStaCmd( tpAniSirGlobal pMac, 
-                                           tANI_U32 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                           const tANI_U8 *pPeerMacAddr,
-#else
+                                           tANI_U32 sessionId, 
                                            tANI_U8 *pPeerMacAddr,
-#endif
                                            tANI_U32 reason);
 
 /* ---------------------------------------------------------------------------
@@ -1073,20 +998,9 @@
 
 eHalStatus csrUpdateChannelList(tpAniSirGlobal pMac);
 eHalStatus csrRoamDelPMKIDfromCache( tpAniSirGlobal pMac, tANI_U32 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                     const tANI_U8 *pBSSId,
-#else
-                                     tANI_U8 *pBSSId,
-#endif
-                                     tANI_BOOLEAN flush_cache );
+                                     tANI_U8 *pBSSId, tANI_BOOLEAN flush_cache );
 tANI_BOOLEAN csrElectedCountryInfo(tpAniSirGlobal pMac);
 void csrAddVoteForCountryInfo(tpAniSirGlobal pMac, tANI_U8 *pCountryCode);
 void csrClearVotesForCountryInfo(tpAniSirGlobal pMac);
-void csr_remove_bssid_from_scan_list(tpAniSirGlobal pMac,
-       tSirMacAddr bssid);
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-eHalStatus csrSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U8 cbMode);
-#endif
 #endif
 
diff --git a/wlan/prima/CORE/SME/src/csr/csrLogDump.c b/wlan/prima/CORE/SME/src/csr/csrLogDump.c
index a216bb4..bedb6a6 100644
--- a/wlan/prima/CORE/SME/src/csr/csrLogDump.c
+++ b/wlan/prima/CORE/SME/src/csr/csrLogDump.c
@@ -26,6 +26,9 @@
  */
 
 /*============================================================================
+Copyright (c) 2007 QUALCOMM Incorporated.
+All Rights Reserved.
+Qualcomm Confidential and Proprietary
 csrLogDump.c
 Implements the dump commands specific to the csr module. 
 ============================================================================*/
diff --git a/wlan/prima/CORE/SME/src/csr/csrNeighborRoam.c b/wlan/prima/CORE/SME/src/csr/csrNeighborRoam.c
index 14f6756..2bae9e3 100644
--- a/wlan/prima/CORE/SME/src/csr/csrNeighborRoam.c
+++ b/wlan/prima/CORE/SME/src/csr/csrNeighborRoam.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -249,10 +249,9 @@
     return;
 }
 
-static eHalStatus csrNeighborRoamTriggerHandoff(tpAniSirGlobal pMac,
+static void csrNeighborRoamTriggerHandoff(tpAniSirGlobal pMac, 
                                           tpCsrNeighborRoamControlInfo pNeighborRoamInfo)
 {
-    eHalStatus status = eHAL_STATUS_SUCCESS;
 #ifdef WLAN_FEATURE_VOWIFI_11R
     if ((pNeighborRoamInfo->is11rAssoc)
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
@@ -263,7 +262,7 @@
         if ((eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState) ||
             (eSME_ROAM_TRIGGER_FAST_ROAM == pNeighborRoamInfo->cfgRoamEn))
         {
-            status = csrNeighborRoamIssuePreauthReq(pMac);
+            csrNeighborRoamIssuePreauthReq(pMac);
             pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_NONE;
             vos_mem_set(&pNeighborRoamInfo->cfgRoambssId[0],
                         sizeof(pNeighborRoamInfo->cfgRoambssId),
@@ -290,7 +289,7 @@
         {
             if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
             {
-                status = csrNeighborRoamIssuePreauthReq(pMac);
+                csrNeighborRoamIssuePreauthReq(pMac);
             }
             else
             {
@@ -311,7 +310,7 @@
 #endif
                 )
                 {
-                    status = csrNeighborRoamIssuePreauthReq(pMac);
+                    csrNeighborRoamIssuePreauthReq(pMac);
                     pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_NONE;
                     vos_mem_set(&pNeighborRoamInfo->cfgRoambssId[0],
                                 sizeof(pNeighborRoamInfo->cfgRoambssId),
@@ -341,7 +340,6 @@
                            pNeighborRoamInfo->neighborRoamState));
                 }
             }
-    return status;
 }
 
 VOS_STATUS csrNeighborRoamUpdateFastRoamingEnabled(tpAniSirGlobal pMac, const v_BOOL_t fastRoamEnabled)
@@ -661,7 +659,6 @@
 #endif
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
     pNeighborRoamInfo->uOsRequestedHandoff = 0;
-    pNeighborRoamInfo->isForcedInitialRoamTo5GH = 0;
     vos_mem_zero(&pNeighborRoamInfo->handoffReqInfo, sizeof(tCsrHandoffRequest));
 #endif
 
@@ -771,7 +768,6 @@
 #endif
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
     pNeighborRoamInfo->uOsRequestedHandoff = 0;
-    pNeighborRoamInfo->isForcedInitialRoamTo5GH = 0;
     vos_mem_zero(&pNeighborRoamInfo->handoffReqInfo, sizeof(tCsrHandoffRequest));
 #endif
 }
@@ -781,6 +777,8 @@
     tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
     pNeighborRoamInfo->csrSessionId            =   CSR_SESSION_ID_INVALID;
     vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
+    pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
+    pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
 #ifdef FEATURE_WLAN_ESE
     pNeighborRoamInfo->isESEAssoc = eANI_BOOLEAN_FALSE;
     pNeighborRoamInfo->isVOAdmitted = eANI_BOOLEAN_FALSE;
@@ -1076,7 +1074,7 @@
     VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
     eHalStatus  preauthProcessed = eHAL_STATUS_SUCCESS;
     tpCsrNeighborRoamBSSInfo pPreauthRspNode = NULL;
-    tCsrRoamSession *pSession;
+
 #ifdef FEATURE_WLAN_LFR_METRICS
     tCsrRoamInfo *roamInfo;
 #endif
@@ -1204,18 +1202,11 @@
             csrNeighborRoamFreeNeighborRoamBSSNode(pMac, pNeighborBssNode);
             }
         }
-        pSession = CSR_GET_SESSION(pMac, pNeighborRoamInfo->csrSessionId);
-        if ((NULL != pSession) && pSession->abortConnection)
-        {
-           smsLog(pMac, LOGE, FL(" Deauth in progress Abort preauth"));
-           goto abort_preauth;
-        }
 
         /* Issue preauth request for the same/next entry */
         if (eHAL_STATUS_SUCCESS == csrNeighborRoamIssuePreauthReq(pMac))
         goto DEQ_PREAUTH; 
 
-abort_preauth:
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
         if (csrRoamIsRoamOffloadScanEnabled(pMac))
         {
@@ -1224,13 +1215,6 @@
              pNeighborRoamInfo->uOsRequestedHandoff = 0;
              csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_PREAUTH_FAILED_FOR_ALL);
           }
-          else if(pNeighborRoamInfo->isForcedInitialRoamTo5GH)
-          {
-             pNeighborRoamInfo->isForcedInitialRoamTo5GH = 0;
-             smsLog(pMac, LOGE, FL("Forced 5G roaming preauth got failed"
-                    "send RSO START cmd to fwr."));
-             csrRoamOffloadScan(pMac,ROAM_SCAN_OFFLOAD_START,REASON_CONNECT);
-          }
           else
           {
              csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART, REASON_PREAUTH_FAILED_FOR_ALL);
@@ -1307,8 +1291,6 @@
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
     if (pNeighborRoamInfo->uOsRequestedHandoff)
     {
-
-        smsLog(pMac, LOG1, FL("OS Requested Handoff"));
         pScanFilter->BSSIDs.numOfBSSIDs = 1;
         pScanFilter->BSSIDs.bssid = vos_mem_malloc(sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
         if (NULL == pScanFilter->BSSIDs.bssid)
@@ -1356,35 +1338,21 @@
 
     pScanFilter->BSSType = pCurProfile->BSSType;
 
-    if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels)
+    /* We are intrested only in the scan results on channels that we scanned  */
+    pScanFilter->ChannelInfo.numOfChannels = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels;
+    pScanFilter->ChannelInfo.ChannelList = vos_mem_malloc(pScanFilter->ChannelInfo.numOfChannels * sizeof(tANI_U8));
+    if (NULL == pScanFilter->ChannelInfo.ChannelList)
     {
-       /* We are intrested only in the scan results on channels that we scanned  */
-       pScanFilter->ChannelInfo.numOfChannels =
-        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels;
-       pScanFilter->ChannelInfo.ChannelList =
-        vos_mem_malloc(pScanFilter->ChannelInfo.numOfChannels * sizeof(tANI_U8));
-       if (NULL == pScanFilter->ChannelInfo.ChannelList)
-       {
-          smsLog(pMac, LOGE, FL("Scan Filter Channel list mem alloc failed"));
-          vos_mem_free(pScanFilter->SSIDs.SSIDList);
-          pScanFilter->SSIDs.SSIDList = NULL;
-          return eHAL_STATUS_FAILED_ALLOC;
-       }
-       for (i = 0; i < pScanFilter->ChannelInfo.numOfChannels; i++)
-       {
-          pScanFilter->ChannelInfo.ChannelList[i] =
-            pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i];
-       }
+        smsLog(pMac, LOGE, FL("Scan Filter Channel list mem alloc failed"));
+        vos_mem_free(pScanFilter->SSIDs.SSIDList);
+        pScanFilter->SSIDs.SSIDList = NULL;
+        return eHAL_STATUS_FAILED_ALLOC;
     }
-    else
+    for (i = 0; i < pScanFilter->ChannelInfo.numOfChannels; i++)
     {
-       pScanFilter->ChannelInfo.numOfChannels = 0;
-       pScanFilter->ChannelInfo.ChannelList = NULL;
+        pScanFilter->ChannelInfo.ChannelList[i] = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i];
     }
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-    if (pMac->PERroamCandidatesCnt)
-       pScanFilter->isPERRoamScan = true;
-#endif
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
     if (pNeighborRoamInfo->is11rAssoc)
     {
@@ -1394,12 +1362,6 @@
     }
 #endif
 
-#ifdef WLAN_FEATURE_11W
-    pScanFilter->MFPEnabled = pCurProfile->MFPEnabled;
-    pScanFilter->MFPRequired = pCurProfile->MFPRequired;
-    pScanFilter->MFPCapable = pCurProfile->MFPCapable;
-#endif
-
     return eHAL_STATUS_SUCCESS;
 }
 
@@ -1502,15 +1464,6 @@
             continue;
         }
 
-       if (vos_concurrent_open_sessions_running() &&
-          !pMac->roam.configParam.fenableMCCMode &&
-            (pScanResult->BssDescriptor.channelId !=
-            csrGetConcurrentOperationChannel(pMac))) {
-          smsLog(pMac, LOG1, FL("MCC not supported so Ignore AP on channel %d"),
-                    pScanResult->BssDescriptor.channelId);
-          continue;
-       }
-
 #ifdef FEATURE_WLAN_LFR
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
        /* In case of reassoc requested by upper layer, look for exact match of bssid & channel;
@@ -1569,7 +1522,7 @@
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
        && !csrRoamIsRoamOffloadScanEnabled(pMac)
 #endif
-       && ((eSME_ROAM_TRIGGER_SCAN != pNeighborRoamInfo->cfgRoamEn) &&
+       && ((eSME_ROAM_TRIGGER_SCAN != pNeighborRoamInfo->cfgRoamEn) ||
            (eSME_ROAM_TRIGGER_FAST_ROAM != pNeighborRoamInfo->cfgRoamEn)))
        {
                /*
@@ -2145,14 +2098,7 @@
                 }
 #endif
 
-                hstatus = csrNeighborRoamTriggerHandoff(pMac,pNeighborRoamInfo);
-                if(eHAL_STATUS_SUCCESS != hstatus)
-                {
-                    smsLog(pMac, LOGE,
-                           FL("csrNeighborRoamTriggerHandoff fail status = %d"),
-                           hstatus);
-                    return eHAL_STATUS_FAILURE;
-                }
+                csrNeighborRoamTriggerHandoff(pMac, pNeighborRoamInfo);
                 return eHAL_STATUS_SUCCESS;
             }
 
@@ -2198,13 +2144,6 @@
                             "tempVal = %u, roamNow = %d uOsRequestedHandoff = %d",
                             tempVal, roamNow, pNeighborRoamInfo->uOsRequestedHandoff);
                 }
-                else if (pNeighborRoamInfo->isForcedInitialRoamTo5GH)
-                {
-                    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                              "No 5G candidate found tempVal=%u, roamNow=%d",
-                               tempVal, roamNow);
-                    return eHAL_STATUS_FAILURE;
-                }
                 else
                 {
                     if (pNeighborRoamInfo->uOsRequestedHandoff)
@@ -2213,18 +2152,17 @@
                             REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW);
                         pNeighborRoamInfo->uOsRequestedHandoff = 0;
                     }
-
+                    else if (pNeighborRoamInfo->isForcedInitialRoamTo5GH)
+                    {
+                        smsLog(pMac, LOGE, FL("Forced roam to 5G No candidate found, starting fw offload scan again, status = %d"), hstatus);
+                        csrNeighborRoamStartLfrScan(pMac, REASON_INITIAL_FORCED_ROAM_TO_5G);
+                    }
                     else
                     {
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-                        if (pMac->PERroamCandidatesCnt == 0)
-#endif
-                        {
-                            /* There is no candidate or We are not roaming Now.
-                             * Inform the FW to restart Roam Offload Scan  */
-                            csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART,
-                                REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW);
-                        }
+                        /* There is no candidate or We are not roaming Now.
+                         * Inform the FW to restart Roam Offload Scan  */
+                        csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART,
+                            REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW);
                     }
                 }
                 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
@@ -2426,31 +2364,31 @@
 
     pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE;
 
-    if (eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN != pNeighborRoamInfo->neighborRoamState)
+    /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */
+    if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
     {
-        smsLog(pMac, LOGE, FL("Received in neighborRoamState %d . Ignore it"),
-                pNeighborRoamInfo->neighborRoamState);
+        smsLog(pMac, LOGE, FL("Received in CONNECTED state. Must be because a UP event from TL after issuing scan request. Ignore it"));
         hstatus = eHAL_STATUS_FAILURE;
         goto end;
     }
 
-    //keep track of forced 5G scan & roam is due to Forced initial roam to 5GHz
-    pNeighborRoamInfo->isForcedInitialRoamTo5GH = 1;
+    if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
+    {
+        smsLog(pMac, LOGE, FL("Received in INIT state. Must have disconnected. Ignore it"));
+        hstatus = eHAL_STATUS_FAILURE;
+        goto end;
+    }
 
     NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: process scan results", __func__);
     hstatus = csrNeighborRoamProcessScanComplete(pMac);
 
+    //Clear off the isForcedInitialRoamTo5GH
+    pNeighborRoamInfo->isForcedInitialRoamTo5GH = 0;
+
     if (eHAL_STATUS_SUCCESS != hstatus)
     {
-        smsLog(pMac, LOGE, FL("Force Roam To 5GhScanCb failed with status %d"),
-        hstatus);
-        pNeighborRoamInfo->isForcedInitialRoamTo5GH = 0;
-        /*
-         * Send RSO start because in case 5G roaming host have
-         * not enabled at initial connection
-         */
-        csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_CONNECT);
-        CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
+        smsLog(pMac, LOGE, FL("Force Roam To 5GhScanCb failed with status %d"), hstatus);
+        goto end;
     }
 
     if (NULL != pContext)
@@ -2460,6 +2398,8 @@
 end:
     if (NULL != pContext)
         vos_mem_free(pContext);
+    if (hstatus != eHAL_STATUS_SUCCESS)
+          csrNeighborRoamStartLfrScan(pMac, REASON_INITIAL_FORCED_ROAM_TO_5G);
     return hstatus;
 }
 #endif
@@ -2805,6 +2745,7 @@
     {
         smsLog(pMac, LOGE, FL("Forced intial roam to 5Gh request failed: Status = %d"), status);
     }
+
     return status;
 }
 #endif
@@ -2893,14 +2834,10 @@
 ---------------------------------------------------------------------------*/
 void csrNeighborRoamNeighborScanTimerCallback(void *pv)
 {
-    tpAniSirGlobal pMac = PMAC_STRUCT( pv );
-    tpCsrNeighborRoamControlInfo  pNeighborRoamInfo;
-    if(!pMac)
-    {
-        VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("pMac is Null"));
-        return;
-    }
-    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
+    tpAniSirGlobal pMac = pInfo->pMac;
+    tANI_U32         sessionId = pInfo->sessionId;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
 
     // check if bg scan is on going, no need to send down the new params if true
     if(eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending)
@@ -2910,6 +2847,8 @@
        return;
     }
 
+    VOS_ASSERT(sessionId == pNeighborRoamInfo->csrSessionId);
+
     switch (pNeighborRoamInfo->neighborRoamState)
     {
 #ifdef WLAN_FEATURE_VOWIFI_11R
@@ -2917,7 +2856,7 @@
             switch(pNeighborRoamInfo->prevNeighborRoamState)
             {
                 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY:
-                    csrNeighborRoamPerformBgScan(pMac, pNeighborRoamInfo->csrSessionId);
+                    csrNeighborRoamPerformBgScan(pMac, sessionId);
                     break;
                 default:
                     smsLog(pMac, LOGE, FL("Neighbor scan callback received in"
@@ -2931,7 +2870,7 @@
             break;
 #endif /* WLAN_FEATURE_VOWIFI_11R */
         case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:     
-            csrNeighborRoamPerformBgScan(pMac, pNeighborRoamInfo->csrSessionId );
+            csrNeighborRoamPerformBgScan(pMac, sessionId);
             break;
         default:
             break;
@@ -2941,15 +2880,10 @@
 
 void csrNeighborRoamEmptyScanRefreshTimerCallback(void *context)
 {
-    tpAniSirGlobal pMac = PMAC_STRUCT( context );
+    tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context;
+    tpAniSirGlobal pMac = pInfo->pMac;
     VOS_STATUS     vosStatus = VOS_STATUS_SUCCESS;
-    tpCsrNeighborRoamControlInfo  pNeighborRoamInfo;
-    if(!pMac)
-    {
-        VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("pMac is Null"));
-        return;
-    }
-    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
 
     /* Reset all the variables just as no scan had happened before */
     csrNeighborRoamResetConnectedStateControlInfo(pMac);
@@ -2998,17 +2932,11 @@
 ---------------------------------------------------------------------------*/
 void csrNeighborRoamResultsRefreshTimerCallback(void *context)
 {
-    tpAniSirGlobal pMac = PMAC_STRUCT( context );
+    tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context;
+    tpAniSirGlobal pMac = pInfo->pMac;
     VOS_STATUS     vosStatus = VOS_STATUS_SUCCESS;
-    tpCsrNeighborRoamControlInfo  pNeighborRoamInfo;
-
-    if(!pMac)
-    {
-        VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("pMac is Null"));
-        return;
-    }
-    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
-
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+     
     NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
 
     /* Deregister reassoc callback. Ignore return status */
@@ -3069,15 +2997,10 @@
 
 void csrForcedInitialRoamTo5GHTimerCallback(void *context)
 {
-    tpAniSirGlobal pMac = PMAC_STRUCT( context );
+    tCsrTimerInfo  *pInfo = (tCsrTimerInfo *)context;
+    tpAniSirGlobal pMac = pInfo->pMac;
     eHalStatus status = eHAL_STATUS_SUCCESS;
-    tpCsrNeighborRoamControlInfo  pNeighborRoamInfo;
-    if(!pMac)
-    {
-        VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("pMac is Null"));
-        return;
-    }
-    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
 
     NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("forcedInitialRoamTo5GHTimer timer expired"));
 
@@ -3100,25 +3023,29 @@
         return;
     }
 
-    pNeighborRoamInfo->scanRequestTimeStamp = vos_timer_get_system_time();
-    /*
-     * We are about to start a fresh scan cycle for all valid channles for 5Ghz
-     * purge non-P2P results from the past for 5Ghz band
-     */
-    csrScanFlushSelectiveResultForBand(pMac, VOS_FALSE, SIR_BAND_5_GHZ);
-    status = csrNeighborRoamScanForInitialForced5GRoaming(
-                 pMac, pNeighborRoamInfo->csrSessionId);
-    if(status != eHAL_STATUS_SUCCESS)
+    //keep track this scan & roam is due to Forced initial roam to 5GHz
+    pNeighborRoamInfo->isForcedInitialRoamTo5GH = 1;
+
+    //keep firmware shut-up for any roaming related scan during
+    //this tenure.
+    status = csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP,
+                                REASON_INITIAL_FORCED_ROAM_TO_5G);
+    if (eHAL_STATUS_SUCCESS != status)
     {
-        smsLog(pMac, LOGE,
-               FL("csrNeighborRoamScanForInitialForced5GRoaming failed status=%d"), status);
-        //Send RSO start because in case 5G roaming host have not enabled at initial connection
-        csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_CONNECT);
+        smsLog(pMac, LOGE, FL("csrRoamOffloadScan stop scan cmd got failed status = %d"), status);
         return;
     }
 
-    /* Transition to CFG_CHAN_LIST_SCAN */
-    CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN);
+    // MUKUL TODO: whatever we are doing should we need to move
+    // it after offload scan response comes from firmware ???
+    status = csrNeighborRoamTransitToCFGChanScan(pMac);
+    if (eHAL_STATUS_SUCCESS != status)
+    {
+        smsLog(pMac, LOGE,
+               FL("csrNeighborRoamTransitToCFGChanScan failed status=%d"), status);
+         //restart scan offload to firmware
+         csrNeighborRoamStartLfrScan(pMac, REASON_INITIAL_FORCED_ROAM_TO_5G);
+    }
 }
 
 #if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
@@ -3472,8 +3399,7 @@
                 }
 
                 /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */
-                pNeighborRoamInfo->scanRequestTimeStamp =
-                                              vos_timer_get_system_time();
+                pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
                 
                 /* Now ready for neighbor scan based on the channel list created */
                 /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is 
@@ -3840,12 +3766,6 @@
                           numOfChannels * sizeof(tANI_U8));
                 outputNumOfChannels = numOfChannels;
             }
-
-            if (outputNumOfChannels == 0)
-            {
-                smsLog(pMac, LOGE, FL("No channels to scan"));
-                return VOS_STATUS_E_FAILURE;
-            }
             currChannelListInfo->ChannelList =
                 vos_mem_malloc(outputNumOfChannels*sizeof(tANI_U8));
             if (NULL == currChannelListInfo->ChannelList)
@@ -3853,12 +3773,27 @@
                 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
                 return VOS_STATUS_E_RESOURCES;
             }
-            currChannelListInfo->numOfChannels = outputNumOfChannels;
             vos_mem_copy(currChannelListInfo->ChannelList,
                   scanChannelList, outputNumOfChannels * sizeof(tANI_U8));
         } 
+        else if(pNeighborRoamInfo->isForcedInitialRoamTo5GH)
+        {
+            NEIGHBOR_ROAM_DEBUG(pMac, LOG1, "Forced roam to 5G cfg chain list");
 
+            pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
+            /* We are about to start a fresh scan cycle for all valid channles for 5Ghz
+                    * purge non-P2P results from the past for 5Ghz band */
+            csrScanFlushSelectiveResultForBand(pMac, VOS_FALSE, SIR_BAND_5_GHZ);
 
+            status = csrNeighborRoamScanForInitialForced5GRoaming(pMac, sessionId);
+            if(status != eHAL_STATUS_SUCCESS)
+                return VOS_STATUS_E_FAILURE;
+
+            /* Transition to CFG_CHAN_LIST_SCAN */
+            CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN);
+
+            return VOS_STATUS_SUCCESS;
+        }
 #ifdef FEATURE_WLAN_LFR
         else if ((pNeighborRoamInfo->uScanMode == DEFAULT_SCAN) &&
                  (abs(pNeighborRoamInfo->lookupDOWNRssi) >
@@ -3875,8 +3810,7 @@
                 pNeighborRoamInfo->lookupDOWNRssi,
                 pNeighborRoamInfo->cfgParams.neighborReassocThreshold*(-1));
 
-            pNeighborRoamInfo->scanRequestTimeStamp =
-                                          vos_timer_get_system_time();
+            pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
 
             vos_timer_stop(&pNeighborRoamInfo->neighborScanTimer);
 
@@ -3954,18 +3888,12 @@
                     outputNumOfChannels = numOfChannels;
                 }
 
-                if (outputNumOfChannels == 0)
-                {
-                    smsLog(pMac, LOGE, FL("No channels to scan"));
-                    return VOS_STATUS_E_FAILURE;
-                }
                 currChannelListInfo->ChannelList = vos_mem_malloc(outputNumOfChannels * sizeof(tANI_U8));
                 if (NULL == currChannelListInfo->ChannelList)
                 {
                     smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
                     return VOS_STATUS_E_RESOURCES;
                 }
-                currChannelListInfo->numOfChannels = outputNumOfChannels;
                 vos_mem_copy(currChannelListInfo->ChannelList,
                         scanChannelList,
                         outputNumOfChannels * sizeof(tANI_U8));
@@ -4024,12 +3952,6 @@
             {
                 numOfChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
             }
-
-            if (numOfChannels == 0)
-            {
-                smsLog(pMac, LOGE, FL("No channels to scan"));
-                return VOS_STATUS_E_FAILURE;
-            }
             currChannelListInfo->ChannelList =
                 vos_mem_malloc(numOfChannels*sizeof(tANI_U8));
 
@@ -4038,7 +3960,6 @@
                 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
                 return VOS_STATUS_E_RESOURCES;
             }
-            currChannelListInfo->numOfChannels = numOfChannels;
 #ifdef FEATURE_WLAN_LFR
             vos_mem_copy(currChannelListInfo->ChannelList,
                     channelList, numOfChannels * sizeof(tANI_U8));
@@ -4050,6 +3971,8 @@
             }
         }
 
+        /* Adjust for the actual number that are used */
+        currChannelListInfo->numOfChannels = numOfChannels;
         NEIGHBOR_ROAM_DEBUG(pMac, LOGW, 
             "Number of channels from CFG (or) (non-)occupied list=%d",
             currChannelListInfo->numOfChannels);
@@ -4061,7 +3984,7 @@
     }
 
     /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */
-    pNeighborRoamInfo->scanRequestTimeStamp = vos_timer_get_system_time();
+    pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
     
     vos_timer_stop(&pNeighborRoamInfo->neighborScanTimer);
     /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is 
@@ -4593,6 +4516,8 @@
             vos_mem_copy(pNeighborRoamInfo->currAPbssid, 
                         pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tCsrBssid));
             pNeighborRoamInfo->currAPoperationChannel = pMac->roam.roamSession[sessionId].connectedProfile.operationChannel;
+            pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
+            pNeighborRoamInfo->neighborScanTimerInfo.sessionId = sessionId;
             pNeighborRoamInfo->currentNeighborLookupThreshold =
                 pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
 #ifdef FEATURE_WLAN_LFR
@@ -4659,21 +4584,6 @@
                  if(csrRoamIsStaMode(pMac, sessionId))
                  {
                      pNeighborRoamInfo->uOsRequestedHandoff = 0;
-                     pNeighborRoamInfo->isForcedInitialRoamTo5GH = 0;
-                     if(pNeighborRoamInfo->cfgParams.neighborInitialForcedRoamTo5GhEnable &&
-                       (GetRFBand(pNeighborRoamInfo->currAPoperationChannel) ==
-                        SIR_BAND_2_4_GHZ))
-                     {
-                         /*
-                          * Keep 5G and Fwr roaming mutually exclusive so do not
-                          * send RSO start Note we have to send RSO start in all
-                          * errro case.
-                          */
-                         smsLog(pMac, LOG1,
-                                FL("Do not send RSO start"
-                                   "because 5G force roaming is enabled"));
-                         break;
-                     }
                      csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_CONNECT);
                  }
               } else {
@@ -4807,28 +4717,19 @@
     pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels   =
                         pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels;
 
-    if (pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels != 0)
-    {
-        pNeighborRoamInfo->cfgParams.channelInfo.ChannelList =
+    pNeighborRoamInfo->cfgParams.channelInfo.ChannelList =
                 vos_mem_malloc(pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
 
-        if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
-        {
-            smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed"));
-            return eHAL_STATUS_RESOURCES;
-        }
+    if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
+    {
+        smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed"));
+        return eHAL_STATUS_RESOURCES;
+    }
 
-        /* Update the roam global structure from CFG */
-        vos_mem_copy(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
+    /* Update the roam global structure from CFG */
+    vos_mem_copy(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
                         pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList,
                         pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
-    }
-    else
-    {
-         smsLog(pMac, LOGW,
-                FL("invalid neighbor roam channel list: %u"),
-                    pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels);
-    }
 
     vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
     pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
@@ -4840,8 +4741,10 @@
 #endif
     pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
 
+    pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
+    pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
     status = vos_timer_init(&pNeighborRoamInfo->neighborScanTimer, VOS_TIMER_TYPE_SW,
-                    csrNeighborRoamNeighborScanTimerCallback, (void *)pMac);
+                    csrNeighborRoamNeighborScanTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
 
     if (eHAL_STATUS_SUCCESS != status)
     {
@@ -4852,7 +4755,7 @@
     }
 
     status = vos_timer_init(&pNeighborRoamInfo->neighborResultsRefreshTimer, VOS_TIMER_TYPE_SW,
-                    csrNeighborRoamResultsRefreshTimerCallback, (void *)pMac);
+                    csrNeighborRoamResultsRefreshTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
 
     if (eHAL_STATUS_SUCCESS != status)
     {
@@ -4865,7 +4768,7 @@
 
     status = vos_timer_init(&pNeighborRoamInfo->emptyScanRefreshTimer, VOS_TIMER_TYPE_SW,
                 csrNeighborRoamEmptyScanRefreshTimerCallback,
-                (void *)pMac);
+                (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
 
     if (eHAL_STATUS_SUCCESS != status)
     {
@@ -4878,7 +4781,7 @@
     }
 
     status = vos_timer_init(&pNeighborRoamInfo->forcedInitialRoamTo5GHTimer, VOS_TIMER_TYPE_SW,
-                csrForcedInitialRoamTo5GHTimerCallback, (void *)pMac);
+                csrForcedInitialRoamTo5GHTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
 
     if (eHAL_STATUS_SUCCESS != status)
     {
@@ -4926,13 +4829,10 @@
     }
 #endif
     /* Initialize this with the current tick count */
-    pNeighborRoamInfo->scanRequestTimeStamp = vos_timer_get_system_time();
+    pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
 
     CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
     pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
-
-    //Set the Last Sent Cmd as RSO_STOP
-    pNeighborRoamInfo->lastSentCmd = ROAM_SCAN_OFFLOAD_STOP;
     return eHAL_STATUS_SUCCESS;
 }
 
@@ -4962,6 +4862,8 @@
    
     pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
     
+    pNeighborRoamInfo->neighborScanTimerInfo.pMac = NULL;
+    pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
     vos_timer_destroy(&pNeighborRoamInfo->neighborScanTimer);
     vos_timer_destroy(&pNeighborRoamInfo->neighborResultsRefreshTimer);
     vos_timer_destroy(&pNeighborRoamInfo->emptyScanRefreshTimer);
@@ -5351,10 +5253,6 @@
     tCsrRoamProfile *pProfile = NULL;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pNeighborRoamInfo->csrSessionId );
     tANI_U8 i = 0;
-    uint8_t roam_now = 0;
-    uint8_t roamable_ap_count = 0;
-    tCsrScanResultFilter    scan_filter;
-    tScanResultHandle       scan_result;
 
     if (NULL == pSession)
     {
@@ -5410,30 +5308,13 @@
         }
         pProfile->ChannelInfo.ChannelList[0] = pNeighborRoamInfo->handoffReqInfo.channel;
 
-        /*
-         * For User space connect requests, the scan has already been done.
-         * So, check if the BSS descriptor exists in the scan cache and
-         * proceed with the handoff instead of a redundant scan again.
-         */
-        if (pNeighborRoamInfo->handoffReqInfo.src == CONNECT_CMD_USERSPACE) {
-            smsLog(pMac, LOG1, FL("Connect cmd with bssid within same ESS"));
-            status = csrNeighborRoamPrepareScanProfileFilter(
-                                               pMac, &scan_filter);
-            smsLog(pMac, LOG1, FL("Filter creation status = %d"), status);
-            status = csrScanGetResult(pMac, &scan_filter, &scan_result);
-            roam_now = csrNeighborRoamProcessScanResults(pMac, &scan_result);
-            roamable_ap_count = csrLLCount(&pNeighborRoamInfo->roamableAPList);
-            csrFreeScanFilter(pMac, &scan_filter);
-            smsLog(pMac, LOG1, FL("roam_now=%d, roamable_ap_count=%d"),
-                   roam_now, roamable_ap_count);
-        }
-        if (roam_now && roamable_ap_count) {
-            csrNeighborRoamTriggerHandoff(pMac, pNeighborRoamInfo);
-        } else {
-            status = csrScanForSSID(pMac, pSession->sessionId,
-                                           pProfile, roamId, FALSE);
-            if(!HAL_STATUS_SUCCESS(status))
-               smsLog(pMac, LOGE, FL("SSID scan failed"));
+        //clean up csr cache first
+        //csrScanFlushSelectiveResult(pMac, VOS_FALSE);
+        //do a SSID scan
+        status = csrScanForSSID(pMac, pNeighborRoamInfo->csrSessionId, pProfile, roamId, FALSE);
+        if(!HAL_STATUS_SUCCESS(status))
+        {
+            smsLog(pMac, LOGE, FL("SSID scan failed"));
         }
     }while(0);
 
@@ -5498,30 +5379,6 @@
     return eHAL_STATUS_SUCCESS;
 }
 
-/**
- * csr_neighbor_roam_handler_assign_handoff_src() - Assign source of
- *							roam handoff
- * @pNeighborRoamInfo: Pointer to csr neighbor roam control info
- * @pHandoffReqInfo: Pointer to the Handoff request
- *
- * Return: None
- */
-#ifndef QCA_WIFI_ISOC
-static inline void csr_neighbor_roam_handler_assign_handoff_src(
-			tpCsrNeighborRoamControlInfo  pNeighborRoamInfo,
-			tAniHandoffReq *pHandoffReqInfo)
-{
-	pNeighborRoamInfo->handoffReqInfo.src
-		= pHandoffReqInfo->handoff_src;
-}
-#else
-static inline void csr_neighbor_roam_handler_assign_handoff_src(
-			tpCsrNeighborRoamControlInfo  pNeighborRoamInfo,
-			tAniHandoffReq *pHandoffReqInfo)
-{
-}
-#endif
-
 /* ---------------------------------------------------------------------------
 
     \fn csrNeighborRoamHandoffReqHdlr
@@ -5559,8 +5416,6 @@
             {
 
                 pNeighborRoamInfo->handoffReqInfo.channel = pHandoffReqInfo->channel;
-                csr_neighbor_roam_handler_assign_handoff_src(pNeighborRoamInfo,
-                                                               pHandoffReqInfo);
                 vos_mem_copy(pNeighborRoamInfo->handoffReqInfo.bssid,
                              pHandoffReqInfo->bssid,
                              6);
diff --git a/wlan/prima/CORE/SME/src/csr/csrTdlsProcess.c b/wlan/prima/CORE/SME/src/csr/csrTdlsProcess.c
index 77a084d..0bf09ef 100644
--- a/wlan/prima/CORE/SME/src/csr/csrTdlsProcess.c
+++ b/wlan/prima/CORE/SME/src/csr/csrTdlsProcess.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -54,6 +54,20 @@
 #include "csrInternal.h"
 
 
+
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/*
+ * initialize Discovery list 
+ */
+eHalStatus csrTdlsInitPeerList(tpAniSirGlobal pMac )
+{
+    tCsrTdlsCtxStruct *tdlsDisInfo = &pMac->tdlsCtx ;
+    csrLLOpen(pMac->hHdd, &tdlsDisInfo->tdlsPotentialPeerList) ;
+
+    return eHAL_STATUS_SUCCESS ;
+}
+#endif
+
 /*
  * common routine to remove TDLS cmd from SME command list..
  * commands are removed after getting reponse from PE.
@@ -144,8 +158,6 @@
             tdlsSendMgmtCmd->u.tdlsCmd.size = sizeof(tTdlsSendMgmtCmdInfo) ;
             smePushCommand(pMac, tdlsSendMgmtCmd, FALSE) ;
             status = eHAL_STATUS_SUCCESS ;
-            smsLog( pMac, LOG1,
-                        FL("Successfully posted tdlsSendMgmtCmd to SME"));
         }
     }
 
@@ -155,12 +167,7 @@
 /*
  * TDLS request API, called from HDD to modify an existing TDLS peer
  */
-eHalStatus csrTdlsChangePeerSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                const tSirMacAddr peerMac,
-#else
-                                tSirMacAddr peerMac,
-#endif
+eHalStatus csrTdlsChangePeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
                                 tCsrStaParams *pstaParams)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
@@ -221,8 +228,6 @@
             tdlsAddStaCmd->command = eSmeCommandTdlsAddPeer;
             tdlsAddStaCmd->u.tdlsCmd.size = sizeof(tTdlsAddStaCmdInfo) ;
             smePushCommand(pMac, tdlsAddStaCmd, FALSE) ;
-            smsLog( pMac, LOG1,
-                        FL("Successfully posted tdlsAddStaCmd to SME to modify peer "));
             status = eHAL_STATUS_SUCCESS ;
         }
     }
@@ -233,13 +238,9 @@
  * TDLS request API, called from HDD to Send Link Establishment Parameters
  */
 VOS_STATUS csrTdlsSendLinkEstablishParams(tHalHandle hHal,
-                                          tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                          const tSirMacAddr peerMac,
-#else
-                                          tSirMacAddr peerMac,
-#endif
-                                          tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
+                                                 tANI_U8 sessionId,
+                                                 tSirMacAddr peerMac,
+                                                 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     tSmeCmd *tdlsLinkEstablishCmd;
@@ -287,8 +288,6 @@
             tdlsLinkEstablishCmd->u.tdlsCmd.size = sizeof(tTdlsLinkEstablishCmdInfo) ;
             smePushCommand(pMac, tdlsLinkEstablishCmd, FALSE) ;
             status = eHAL_STATUS_SUCCESS ;
-            smsLog( pMac, LOG1,
-                        FL("Successfully posted tdlsLinkEstablishCmd to SME"));
         }
     }
 
@@ -298,13 +297,7 @@
 /*
  * TDLS request API, called from HDD to add a TDLS peer
  */
-eHalStatus csrTdlsAddPeerSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                             const tSirMacAddr peerMac
-#else
-                             tSirMacAddr peerMac
-#endif
-                             )
+eHalStatus csrTdlsAddPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     tSmeCmd *tdlsAddStaCmd ;
@@ -334,8 +327,6 @@
             tdlsAddStaCmd->u.tdlsCmd.size = sizeof(tTdlsAddStaCmdInfo) ;
             smePushCommand(pMac, tdlsAddStaCmd, FALSE) ;
             status = eHAL_STATUS_SUCCESS ;
-            smsLog( pMac, LOG1,
-                        FL("Successfully posted tdlsAddStaCmd to SME"));
         }
     }
 
@@ -345,13 +336,7 @@
 /*
  * TDLS request API, called from HDD to delete a TDLS peer
  */
-eHalStatus csrTdlsDelPeerSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                             const tSirMacAddr peerMac
-#else
-                             tSirMacAddr peerMac
-#endif
-)
+eHalStatus csrTdlsDelPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     tSmeCmd *tdlsDelStaCmd ;
@@ -380,8 +365,6 @@
             tdlsDelStaCmd->u.tdlsCmd.size = sizeof(tTdlsDelStaCmdInfo) ;
             smePushCommand(pMac, tdlsDelStaCmd, FALSE) ;
             status = eHAL_STATUS_SUCCESS ;
-            smsLog( pMac, LOG1,
-                        FL("Successfully posted tdlsDelStaCmd to SME"));
         }
     }
 
@@ -429,8 +412,6 @@
             tdlsChanSwitchCmd->u.tdlsCmd.size = sizeof(tTdlsChanSwitchCmdInfo) ;
             smePushCommand(pMac, tdlsChanSwitchCmd, FALSE) ;
             status = eHAL_STATUS_SUCCESS ;
-            smsLog( pMac, LOG1,
-                        FL("Successfully posted tdlsChanSwitchCmd to SME"));
         }
     }
 
@@ -438,6 +419,116 @@
 }
 
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/*
+ * TDLS request API, called from HDD to enable TDLS discovery request
+ * in SME/CSR and send message to PE to trigger TDLS discovery procedure.
+ */
+eHalStatus csrTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tCsrTdlsDisRequest *tdlsDisReq)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tSmeCmd *tdlsDisReqCmd ;
+    eHalStatus status = eHAL_STATUS_FAILURE ;
+ 
+    if(tdlsDisReq)
+    {
+        tdlsDisReqCmd = csrGetCommandBuffer(pMac) ;
+
+        if(tdlsDisReqCmd)
+        {
+            tTdlsDisReqCmdinfo *disReqCmdInfo = 
+                            &tdlsDisReqCmd->u.tdlsCmd.u.tdlsDisReqCmdInfo ;
+
+            vos_mem_zero(&tdlsDisReqCmd->u.tdlsCmd, sizeof(tTdlsCmd));
+
+            tdlsDisReqCmd->sessionId = sessionId;
+
+            disReqCmdInfo->tdlsDisType = tdlsDisReq->disType ;   
+            vos_mem_copy(disReqCmdInfo->peerMac,
+                                   tdlsDisReq->peerMac, sizeof(tSirMacAddr)) ; 
+            tdlsDisReqCmd->command = eSmeCommandTdlsDiscovery ;
+            tdlsDisReqCmd->u.tdlsCmd.size = sizeof(tTdlsDisReqCmdinfo) ;
+            smePushCommand(pMac, tdlsDisReqCmd, FALSE) ;
+            status = eHAL_STATUS_SUCCESS ;
+        }
+    }
+
+    return status ;
+}
+
+/*
+ * TDLS request API, called from HDD to enable TDLS link setup request
+ * in SME/CSR and send message to PE to trigger TDLS link setup procedure.
+ */
+eHalStatus csrTdlsSetupReq(tHalHandle hHal, tANI_U8 sessionId, tCsrTdlsSetupRequest *tdlsSetupReq)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tSmeCmd *tdlsSetupReqCmd ;
+    eHalStatus status = eHAL_STATUS_FAILURE ;
+ 
+    if(tdlsSetupReq)
+    {
+        tdlsSetupReqCmd = csrGetCommandBuffer(pMac) ;
+
+        if(tdlsSetupReqCmd)
+        {
+           tTdlsLinkSetupReqCmdinfo *setupCmdInfo = 
+                        &tdlsSetupReqCmd->u.tdlsCmd.u.tdlsLinkSetupReqCmdInfo ;
+
+            vos_mem_zero(&tdlsSetupReqCmd->u.tdlsCmd, sizeof(tTdlsCmd));
+
+            tdlsSetupReqCmd->sessionId = sessionId;
+
+            vos_mem_copy(setupCmdInfo->peerMac,
+                                tdlsSetupReq->peerMac, sizeof(tSirMacAddr)) ; 
+            tdlsSetupReqCmd->command = eSmeCommandTdlsLinkSetup ;
+            tdlsSetupReqCmd->u.tdlsCmd.size = sizeof(tTdlsLinkSetupReqCmdinfo) ;
+            smePushCommand(pMac, tdlsSetupReqCmd, FALSE) ;
+            status = eHAL_STATUS_SUCCESS ;
+        }
+    }
+
+    return status ;
+}
+/*
+ * TDLS request API, called from HDD to enable TDLS link teardown request
+ * in SME/CSR and send message to PE to trigger TDLS link teardown procedure.
+ */
+eHalStatus csrTdlsTeardownReq(tHalHandle hHal, tANI_U8 sessionId, 
+                                 tCsrTdlsTeardownRequest *tdlsTeardownReq)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tSmeCmd *tdlsTeardownReqCmd ;
+    eHalStatus status = eHAL_STATUS_FAILURE ;
+ 
+    if(tdlsTeardownReq)
+    {
+        tdlsTeardownReqCmd = csrGetCommandBuffer(pMac) ;
+        
+        if(tdlsTeardownReqCmd)
+        {
+            tTdlsLinkTeardownCmdinfo *teardownCmdInfo = 
+                   &tdlsTeardownReqCmd->u.tdlsCmd.u.tdlsLinkTeardownCmdInfo ;
+
+            vos_mem_zero(&tdlsTeardownReqCmd->u.tdlsCmd, sizeof(tTdlsCmd));
+
+            tdlsTeardownReqCmd->sessionId = sessionId;
+
+            vos_mem_copy(teardownCmdInfo->peerMac,
+                         tdlsTeardownReq->peerMac, sizeof(tSirMacAddr)) ; 
+            tdlsTeardownReqCmd->command = eSmeCommandTdlsLinkTear ;
+            tdlsTeardownReqCmd->u.tdlsCmd.size = 
+                                        sizeof(tTdlsLinkTeardownCmdinfo) ;
+            smePushCommand(pMac, tdlsTeardownReqCmd, FALSE) ;
+            status = eHAL_STATUS_SUCCESS ;
+        }
+    }
+
+    return status ;
+}
+
+#endif
+
 /*
  * TDLS messages sent to PE .
  */
@@ -450,7 +541,7 @@
     pMsg->msgLen = (tANI_U16) (msg_size) ;
 
     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                              FL("sending msg = %d"), pMsg->type) ;
+                              ("sending msg = %d"), pMsg->type) ;
       /* Send message. */
     if (palSendMBMessage(pMac->hHdd, pMsg) != eHAL_STATUS_SUCCESS)
     {
@@ -514,7 +605,7 @@
 
     }
     // Send the request to PE.
-    smsLog( pMac, LOG1, FL("sending TDLS Mgmt Frame req to PE " ));
+    smsLog( pMac, LOG1, "sending TDLS Mgmt Frame req to PE " );
     status = tdlsSendMessage(pMac, eWNI_SME_TDLS_SEND_MGMT_REQ, 
             (void *)tdlsSendMgmtReq , sizeof(tSirTdlsSendMgmtReq)+tdlsSendMgmtCmdInfo->len) ;
     if(!HAL_STATUS_SUCCESS( status ) )
@@ -647,7 +738,11 @@
             tdlsDelStaCmdInfo->peerMac, sizeof(tSirMacAddr)) ;
 
     // Send the request to PE.
+#ifdef WLAN_FEATURE_TDLS_DEBUG
+    smsLog( pMac, LOGE,
+#else
     smsLog( pMac, LOG1,
+#endif
         "sending TDLS Del Sta "MAC_ADDRESS_STR" req to PE",
          MAC_ADDR_ARRAY(tdlsDelStaCmdInfo->peerMac));
     status = tdlsSendMessage(pMac, eWNI_SME_TDLS_DEL_STA_REQ, 
@@ -664,29 +759,180 @@
 eHalStatus csrTdlsProcessCmd(tpAniSirGlobal pMac, tSmeCmd *cmd)
 {
     eSmeCommandType  cmdType = cmd->command ;
-    eHalStatus status = eHAL_STATUS_SUCCESS;
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+    tTdlsCmd tdlsCmd = cmd->u.tdlsCmd ;
+#endif
+    tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
     switch(cmdType)
     {
         case eSmeCommandTdlsSendMgmt:
-            status = csrTdlsProcessSendMgmt(pMac, cmd);
+        {
+            status = csrTdlsProcessSendMgmt( pMac, cmd );
+            if(HAL_STATUS_SUCCESS( status ) )
+            {
+               status = eANI_BOOLEAN_FALSE ;
+            }
+        }
         break ;
         case eSmeCommandTdlsAddPeer:
-            status = csrTdlsProcessAddSta(pMac, cmd);
+        {
+            status = csrTdlsProcessAddSta( pMac, cmd );
+            if(HAL_STATUS_SUCCESS( status ) )
+            {
+               status = eANI_BOOLEAN_FALSE ;
+            }
+        }
         break;
         case eSmeCommandTdlsDelPeer: 
-            status = csrTdlsProcessDelSta(pMac, cmd);
+        {
+            status = csrTdlsProcessDelSta( pMac, cmd );
+            if(HAL_STATUS_SUCCESS( status ) )
+            {
+               status = eANI_BOOLEAN_FALSE ;
+            }
+        }
         break;
         case eSmeCommandTdlsLinkEstablish:
-            status = csrTdlsProcessLinkEstablish(pMac, cmd);
+        {
+            status = csrTdlsProcessLinkEstablish( pMac, cmd );
+            if(HAL_STATUS_SUCCESS( status ) )
+            {
+               status = eANI_BOOLEAN_FALSE ;
+            }
+        }
         break;
 // tdlsoffchan
         case eSmeCommandTdlsChannelSwitch:
-            status = csrTdlsProcessChanSwitchReq(pMac, cmd);
+        {
+             status = csrTdlsProcessChanSwitchReq( pMac, cmd );
+             if(HAL_STATUS_SUCCESS( status ) )
+             {
+               status = eANI_BOOLEAN_FALSE ;
+             }
+        }
         break;
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+        case eSmeCommandTdlsDiscovery:
+        {
+            tTdlsDisReqCmdinfo *disReqCmdInfo = &tdlsCmd.u.tdlsDisReqCmdInfo ;
+            tSirTdlsDisReq *disReq = NULL ;
+            tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId );
+            
+            disReq = vos_mem_malloc(sizeof(tSirTdlsDisReq));
+            if ( NULL == disReq )
+                status = eHAL_STATUS_FAILURE;
+            else
+                status = eHAL_STATUS_SUCCESS;
+
+            if(!HAL_STATUS_SUCCESS( status ) )
+            {
+                smsLog( pMac, LOGE, "dis Req alloc failed " );
+                VOS_ASSERT(0) ;
+                break ;
+            }
+            disReq->sessionId = cmd->sessionId;
+            disReq->transactionId = 0;  /* TODO ? */
+            disReq->reqType =  disReqCmdInfo->tdlsDisType ;
+            vos_mem_copy( disReq->bssid, pSession->pConnectBssDesc->bssId,
+                                 sizeof (tSirMacAddr));
+            vos_mem_copy( disReq->peerMac,
+                                 disReqCmdInfo->peerMac, sizeof(tSirMacAddr)) ;
+            smsLog( pMac, LOGE, "sending TDLS discovery to PE " );
+            status = tdlsSendMessage(pMac, eWNI_SME_TDLS_DISCOVERY_START_REQ, 
+                          (void *)disReq , sizeof(tSirTdlsDisReq)) ;
+            if(HAL_STATUS_SUCCESS( status ) )
+            {
+               status = eANI_BOOLEAN_FALSE ;
+            }
+                /* TODO: Add error handling */
+
+            break ;
+        }
+        case eSmeCommandTdlsLinkSetup:
+        {
+            tTdlsLinkSetupReqCmdinfo *linkSetupReqCmdInfo = 
+                                         &tdlsCmd.u.tdlsLinkSetupReqCmdInfo ;   
+            tSirTdlsSetupReq *setupReq = NULL ;
+            tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId );
+
+            setupReq = vos_mem_malloc(sizeof(tSirTdlsSetupReq));
+            if ( NULL == setupReq )
+                status = eHAL_STATUS_FAILURE;
+            else
+                status = eHAL_STATUS_SUCCESS;
+
+
+            if(!HAL_STATUS_SUCCESS( status ) )
+            {
+                smsLog( pMac, LOGE, "dis Req alloc failed " );
+                VOS_ASSERT(0) ;
+                break ;
+            }
+            setupReq->sessionId = cmd->sessionId;
+            setupReq->transactionId = 0;  /* TODO ? */
+            
+            vos_mem_copy( setupReq->bssid, pSession->pConnectBssDesc->bssId,
+                                 sizeof (tSirMacAddr));
+            vos_mem_copy( setupReq->peerMac,
+                           linkSetupReqCmdInfo->peerMac, sizeof(tSirMacAddr)) ;
+    
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                             ("sending TDLS link setup to PE "));
+            status = tdlsSendMessage(pMac, eWNI_SME_TDLS_LINK_START_REQ,    
+                          (void *)setupReq , sizeof(tSirTdlsSetupReq) ) ;
+
+            if(HAL_STATUS_SUCCESS( status ) )
+            {
+               status = eANI_BOOLEAN_FALSE ;
+            }
+                /* TODO: Add error handling */
+            break ;
+        }
+        case eSmeCommandTdlsLinkTear:
+        {
+            tTdlsLinkTeardownCmdinfo *linkTeardownCmdInfo = 
+                                        &tdlsCmd.u.tdlsLinkTeardownCmdInfo ;
+            tSirTdlsTeardownReq *teardownReq = NULL ;
+            tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId );
+
+            teardownReq = vos_mem_malloc(sizeof(tSirTdlsTeardownReq));
+            if ( NULL == teardownReq )
+                status = eHAL_STATUS_FAILURE;
+            else
+                status = eHAL_STATUS_SUCCESS;
+
+            if(!HAL_STATUS_SUCCESS( status ) )
+            {
+                smsLog( pMac, LOGE, "teardown Req alloc failed " );
+                VOS_ASSERT(0) ;
+                break ;
+            }
+            teardownReq->sessionId = cmd->sessionId;
+            teardownReq->transactionId = 0;  /* TODO ? */
+
+            vos_mem_copy( teardownReq->bssid, pSession->pConnectBssDesc->bssId,
+                                 sizeof (tSirMacAddr));
+            vos_mem_copy( &teardownReq->peerMac,
+                           linkTeardownCmdInfo->peerMac, sizeof(tSirMacAddr)) ;
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                                                ("teardown request..")) ;
+            status = tdlsSendMessage(pMac, eWNI_SME_TDLS_TEARDOWN_REQ,
+                          (void *)teardownReq , sizeof(tSirTdlsTeardownReq)) ;
+
+            if(HAL_STATUS_SUCCESS( status ) )
+            {
+               status = eANI_BOOLEAN_FALSE ;
+            }
+                /* TODO: Add error handling */
+            break ;
+        }
+#endif
        default:
-           status = eHAL_STATUS_FAILURE;
+       {
             /* TODO: Add defualt handling */  
            break ;
+       } 
+             
     }
     return status ; 
 }
@@ -733,8 +979,7 @@
     tdlsLinkEstablishReq->isResponder= tdlsLinkEstablishCmdInfo->isResponder;
     tdlsLinkEstablishReq->uapsdQueues= tdlsLinkEstablishCmdInfo->uapsdQueues;
     tdlsLinkEstablishReq->maxSp= tdlsLinkEstablishCmdInfo->maxSp;
-    tdlsLinkEstablishReq->isOffChannelSupported =
-        tdlsLinkEstablishCmdInfo->isOffChannelSupported;
+
 
     // Send the request to PE.
     smsLog( pMac, LOGE, "sending TDLS Link Establish Request to PE \n" );
@@ -793,6 +1038,137 @@
     return status;
 }
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/*
+ * Find specific TDLS peer (based on peer MAC address).
+ */
+tCsrTdlsPeerLinkinfo *findTdlsPeer(tpAniSirGlobal pMac, 
+                                tDblLinkList *peerList, tSirMacAddr peerMac)
+{
+    tListElem *pEntry = NULL ;
+    tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ; 
+    tSirTdlsPeerInfo *peerInfo = NULL ;
+
+    pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
+    while(pEntry)
+    {
+        peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo, 
+                                                        tdlsPeerStaLink) ;
+        peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
+ 
+        if ( vos_mem_compare( (tANI_U8 *)peerInfo->peerMac,
+                              (tANI_U8 *) peerMac, sizeof(tSirMacAddr)) )
+        {
+            break ;
+        }
+
+        pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
+    }
+ 
+    return ((pEntry) ? peerLinkInfo: NULL) ; 
+}
+/*
+ * Delete TDLD peer info, called from TDLS teardown request.
+ */
+static eHalStatus tdlsDeleteTdlsPeerInfo(tpAniSirGlobal pMac,
+                                              tSirMacAddr peerMac)
+{
+    tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
+    tCsrTdlsPeerLinkinfo *peerInfo = 
+               findTdlsPeer(pMac, &disInfo->tdlsPotentialPeerList, peerMac) ;
+    eHalStatus status = eHAL_STATUS_FAILURE ;
+
+    if((csrLLRemoveEntry(&disInfo->tdlsPotentialPeerList, 
+                        &peerInfo->tdlsPeerStaLink, LL_ACCESS_NOLOCK)))
+    {
+       vos_mem_free((void *)peerInfo) ;
+       status = eHAL_STATUS_SUCCESS;
+
+    }
+
+    return status ; 
+}
+
+/*
+ * UPDATE TDLS peer state to TDLS LINK STATE, this will be called after
+ * link is successfully setup with TDLS Peer.
+ */
+static eHalStatus tdlsUpdateTdlsPeerState(tpAniSirGlobal pMac,
+                                          tSirMacAddr peerMac,tANI_U8 state )
+{
+    tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
+    tCsrTdlsPeerLinkinfo *peerLinkInfo = 
+                findTdlsPeer(pMac, &disInfo->tdlsPotentialPeerList, peerMac) ;
+    eHalStatus status = eHAL_STATUS_FAILURE ;
+
+    if(peerLinkInfo)
+    {
+        tSirTdlsPeerInfo *peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
+        peerInfo->tdlsPeerState = state ;  
+        status = eHAL_STATUS_SUCCESS ;
+    }
+    else
+    {
+        /* TODO: update this peer found in link setup in peer list */
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                       ("This TDLS client is not in discovery list ") );
+        status = eHAL_STATUS_SUCCESS ;
+    }
+
+    return status ;
+}
+
+/*
+ * save TDLS peer info, this will be called after successfull completion
+ * of TDLS discovery procedure.
+ */
+static eHalStatus tdlsSaveTdlsPeerInfo(tpAniSirGlobal pMac, 
+                                          tSirTdlsPeerInfo *disPeerInfo)
+{
+    tCsrTdlsPeerLinkinfo *peerInfo = NULL ; 
+    tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
+    eHalStatus status = eHAL_STATUS_FAILURE ;
+    /* 
+     * Ok, allocate memory for peer info here
+     * we allocate memory for each peer here and free his memory
+     * at the time the peer node is getting deleted, possible case is 
+     * teardown
+     */
+    peerInfo = vos_mem_malloc(sizeof(tCsrTdlsPeerLinkinfo));
+    if ( NULL = peerInfo )
+        status = eHAL_STATUS_FAILURE;
+    else
+        status = eHAL_STATUS_SUCCESS;
+
+    /* 
+     * go ahead and copy peerInfo and insert this node info discovery rsp
+     * database.
+     */ 
+    if (HAL_STATUS_SUCCESS(status))
+    {
+        vos_mem_set( &peerInfo->tdlsDisPeerInfo,
+                                            sizeof(tSirTdlsPeerInfo), 0);
+        vos_mem_copy( &peerInfo->tdlsDisPeerInfo, disPeerInfo,
+                                             sizeof(tSirTdlsPeerInfo));
+
+        /*
+         * update TDLS client count to indicate there is tdls client
+         * in tdls potential peer list.
+         */
+        disInfo->tdlsPeerCount++ ;
+
+        /*
+         * finally insert this tdls peer info into tdls potential peer list
+         */
+        csrLLInsertTail( &disInfo->tdlsPotentialPeerList, 
+                                 &peerInfo->tdlsPeerStaLink, LL_ACCESS_LOCK );
+    }
+
+    return status ;
+
+}
+
+#endif
 /*
  * TDLS Message processor, will be called after TDLS message recieved from
  * PE
@@ -804,20 +1180,8 @@
     {
         case eWNI_SME_TDLS_SEND_MGMT_RSP:
         {
-            tSirSmeRsp *pMsg = (tSirSmeRsp*) pMsgBuf;
-            tCsrRoamInfo roamInfo = {0} ;
-
             /* remove pending eSmeCommandTdlsDiscovery command */
             csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsSendMgmt) ;
-
-            if (eSIR_SME_SUCCESS != pMsg->statusCode)
-            {
-                /* Tx failed, so there wont be any ack confirmation*/
-                /* Indicate ack failure to upper layer */
-                roamInfo.reasonCode = 0;
-                csrRoamCallCallback(pMac, pMsg->sessionId, &roamInfo,
-                        0, eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND, 0);
-            }
         }
         break;
         case eWNI_SME_TDLS_ADD_STA_RSP:
@@ -913,11 +1277,6 @@
             roamInfo.staId = delStaRsp->staId ;
             roamInfo.statusCode = delStaRsp->statusCode ;
 #endif
-            vos_mem_copy(&roamInfo.peerMac, linkEstablishReqRsp->peerMac,
-                                         sizeof(tSirMacAddr)) ;
-            roamInfo.staId  = (tANI_U8)linkEstablishReqRsp->sta_idx;
-            roamInfo.statusCode = linkEstablishReqRsp->statusCode;
-
             csrRoamCallCallback(pMac, linkEstablishReqRsp->sessionId, &roamInfo, 0,
                          eCSR_ROAM_TDLS_STATUS_UPDATE,
                                eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP);
@@ -939,23 +1298,158 @@
                                 eCSR_ROAM_TDLS_STATUS_UPDATE,
                                 eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP);
 #endif
-            tSirTdlsChanSwitchReqRsp *ChanSwitchReqRsp =
-                            (tSirTdlsChanSwitchReqRsp *) pMsgBuf ;
-            tCsrRoamInfo roamInfo = {0} ;
-
-            vos_mem_copy(&roamInfo.peerMac, ChanSwitchReqRsp->peerMac,
-                         sizeof(tSirMacAddr));
-            roamInfo.staId  = (tANI_U8)ChanSwitchReqRsp->sta_idx;
-            roamInfo.statusCode = ChanSwitchReqRsp->statusCode;
-
-            csrRoamCallCallback(pMac, ChanSwitchReqRsp->sessionId, &roamInfo, 0,
-                                eCSR_ROAM_TDLS_STATUS_UPDATE,
-                                eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP);
-
             /* remove pending eSmeCommandTdlsChanSwitch command */
             csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsChannelSwitch);
             break;
         }
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+        case eWNI_SME_TDLS_DISCOVERY_START_RSP:
+        {
+            /* remove pending eSmeCommandTdlsDiscovery command */
+            csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsDiscovery) ;
+        }
+        /* fall through .. */
+        case eWNI_SME_TDLS_DISCOVERY_START_IND:
+        {
+            tSirTdlsDisRsp *disRsp = (tSirTdlsDisRsp *)pMsgBuf ;
+
+            if(eSIR_SME_SUCCESS == disRsp->statusCode)
+            {
+                tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
+                tANI_U16  disStaCount = disRsp->numDisSta ;
+                tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
+                tANI_U8 i = 0 ;
+  
+                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                ("DIS START RSP/IND recieved sta count = %d"), disStaCount) ;
+                for( ; i < disStaCount ; i++)
+                {
+                    tSirTdlsPeerInfo *peerInfo = &disRsp->tdlsDisPeerInfo[i] ;
+                    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                              ("SME, peer MAC: "MAC_ADDRESS_STR),
+                               MAC_ADDR_ARRAY(peerInfo->peerMac));
+
+                    peerLinkInfo = findTdlsPeer(pMac,
+                                   &disInfo->tdlsPotentialPeerList,
+                                                     peerInfo->peerMac) ; 
+
+                    if(NULL == peerLinkInfo)
+                    {
+                        /* update discovery data base, if this is new entry */
+                        tdlsSaveTdlsPeerInfo(pMac, peerInfo) ;
+                    }
+                    else
+                    {
+                        /* update RSSI of existing peer */
+                        tSirTdlsPeerInfo *newPeerInfo = 
+                                            &peerLinkInfo->tdlsDisPeerInfo ; 
+                        newPeerInfo->tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
+                    }
+                }
+                if(0 == i)
+                {
+                    smsLog( pMac, LOGW, "there is no tdls client \
+                                                      discovered .." ) ;
+                }
+            }
+            else
+            {
+                smsLog( pMac, LOGW, "there is no tdls client discovered .." );
+            }
+            /* Now free the memory for this message */
+            break ;    
+        }    
+        case eWNI_SME_TDLS_LINK_START_RSP:
+        {
+            /* remove pending eSmeCommandTdlsLinkSetup command */
+            csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsLinkSetup) ;
+        }
+        /* fall through .. */
+        case eWNI_SME_TDLS_LINK_START_IND:
+        {
+            tSirTdlsLinksetupRsp *linkSetupRsp = 
+                                        (tSirTdlsLinksetupRsp *) pMsgBuf ;
+
+            if(eSIR_SME_SUCCESS == linkSetupRsp->statusCode)
+            {
+                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                      ("Link setup for Peer "MAC_ADDRESS_STR),
+                                 MAC_ADDR_ARRAY(linkSetupRsp->peerMac));
+       
+                tdlsUpdateTdlsPeerState(pMac, linkSetupRsp->peerMac, 
+                                                  TDLS_LINK_SETUP_STATE) ;
+            }
+            else
+            {
+                smsLog( pMac, LOGW, "failure receieved in link setup .." );
+            }
+            break ;       
+        }
+
+        case eWNI_SME_TDLS_TEARDOWN_RSP:
+        {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                                          ("TEARDOWN RSP from PE ")) ;
+            /* remove pending eSmeCommandTdlsLinkTear command */
+            csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsLinkTear) ;
+        }
+        /* fall through .. */
+        case eWNI_SME_TDLS_TEARDOWN_IND:
+        {
+            tSirTdlsTeardownRsp *linkTearRsp = 
+                                        (tSirTdlsTeardownRsp *) pMsgBuf ;
+            if(eSIR_SME_SUCCESS == linkTearRsp->statusCode)
+            {
+            
+                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                 ("Teardown peer MAC = "MAC_ADDRESS_STR),
+                            MAC_ADDR_ARRAY(linkTearRsp->peerMac));
+                tdlsDeleteTdlsPeerInfo(pMac, linkTearRsp->peerMac) ;
+            }
+            else
+            {
+                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                                   ("failure receieved in Teardown .." ));
+            }
+            break ;
+        }
+        case eWNI_SME_ADD_TDLS_PEER_IND:
+        {
+            tSirTdlsPeerInd *peerInd = (tSirTdlsPeerInd *) pMsgBuf ;
+            tCsrRoamInfo roamInfo = {0} ;
+            vos_mem_copy( &roamInfo.peerMac, peerInd->peerMac,
+                                         sizeof(tSirMacAddr)) ;
+            roamInfo.staId = peerInd->staId ;
+            roamInfo.ucastSig = peerInd->ucastSig ;
+            roamInfo.bcastSig = peerInd->bcastSig ;
+            /*
+             * register peer with TL, we have to go through HDD as this is
+             * the only way to register any STA with TL.
+             */
+            csrRoamCallCallback(pMac, peerInd->sessionId, &roamInfo, 0, 
+                         eCSR_ROAM_TDLS_STATUS_UPDATE, 
+                               eCSR_ROAM_RESULT_ADD_TDLS_PEER);
+            break ;
+ 
+        }
+        case eWNI_SME_DELETE_TDLS_PEER_IND:
+        {
+            tSirTdlsPeerInd *peerInd = (tSirTdlsPeerInd *) pMsgBuf ;
+            tCsrRoamInfo roamInfo = {0} ;
+            vos_mem_copy( &roamInfo.peerMac, peerInd->peerMac,
+                                         sizeof(tSirMacAddr)) ;
+            roamInfo.staId = peerInd->staId ;
+            /*
+             * register peer with TL, we have to go through HDD as this is
+             * the only way to register any STA with TL.
+             */
+            csrRoamCallCallback(pMac, peerInd->sessionId, &roamInfo, 0, 
+                         eCSR_ROAM_TDLS_STATUS_UPDATE, 
+                               eCSR_ROAM_RESULT_DELETE_TDLS_PEER);
+            break ;
+
+        }
+#endif
         default:
         {
             break ;
diff --git a/wlan/prima/CORE/SME/src/csr/csrUtil.c b/wlan/prima/CORE/SME/src/csr/csrUtil.c
index 3e2732f..01086a3 100644
--- a/wlan/prima/CORE/SME/src/csr/csrUtil.c
+++ b/wlan/prima/CORE/SME/src/csr/csrUtil.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1243,67 +1243,14 @@
     switch (val)
     {
         CASE_RETURN_STR(eCSR_ROAM_CANCELLED);
-        CASE_RETURN_STR(eCSR_ROAM_FAILED);
         CASE_RETURN_STR(eCSR_ROAM_ROAMING_START);
         CASE_RETURN_STR(eCSR_ROAM_ROAMING_COMPLETION);
-        CASE_RETURN_STR(eCSR_ROAM_CONNECT_COMPLETION);
         CASE_RETURN_STR(eCSR_ROAM_ASSOCIATION_START);
         CASE_RETURN_STR(eCSR_ROAM_ASSOCIATION_COMPLETION);
         CASE_RETURN_STR(eCSR_ROAM_DISASSOCIATED);
         CASE_RETURN_STR(eCSR_ROAM_SHOULD_ROAM);
         CASE_RETURN_STR(eCSR_ROAM_SCAN_FOUND_NEW_BSS);
         CASE_RETURN_STR(eCSR_ROAM_LOSTLINK);
-        CASE_RETURN_STR(eCSR_ROAM_LOSTLINK_DETECTED);
-        CASE_RETURN_STR(eCSR_ROAM_MIC_ERROR_IND);
-        CASE_RETURN_STR(eCSR_ROAM_IBSS_IND);
-        CASE_RETURN_STR(eCSR_ROAM_CONNECT_STATUS_UPDATE);
-        CASE_RETURN_STR(eCSR_ROAM_GEN_INFO);
-        CASE_RETURN_STR(eCSR_ROAM_SET_KEY_COMPLETE);
-        CASE_RETURN_STR(eCSR_ROAM_REMOVE_KEY_COMPLETE);
-        CASE_RETURN_STR(eCSR_ROAM_IBSS_LEAVE);
-        CASE_RETURN_STR(eCSR_ROAM_WDS_IND);
-        CASE_RETURN_STR(eCSR_ROAM_INFRA_IND);
-        CASE_RETURN_STR(eCSR_ROAM_WPS_PBC_PROBE_REQ_IND);
-#ifdef WLAN_FEATURE_VOWIFI_11R
-        CASE_RETURN_STR(eCSR_ROAM_FT_RESPONSE);
-#endif
-        CASE_RETURN_STR(eCSR_ROAM_FT_START);
-        CASE_RETURN_STR(eCSR_ROAM_REMAIN_CHAN_READY);
-        CASE_RETURN_STR(eCSR_ROAM_SEND_ACTION_CNF);
-        CASE_RETURN_STR(eCSR_ROAM_SESSION_OPENED);
-        CASE_RETURN_STR(eCSR_ROAM_FT_REASSOC_FAILED);
-#ifdef FEATURE_WLAN_LFR
-        CASE_RETURN_STR(eCSR_ROAM_PMK_NOTIFY);
-#endif
-#ifdef FEATURE_WLAN_LFR_METRICS
-        CASE_RETURN_STR(eCSR_ROAM_PREAUTH_INIT_NOTIFY);
-        CASE_RETURN_STR(eCSR_ROAM_PREAUTH_STATUS_SUCCESS);
-        CASE_RETURN_STR(eCSR_ROAM_PREAUTH_STATUS_FAILURE);
-        CASE_RETURN_STR(eCSR_ROAM_HANDOVER_SUCCESS);
-#endif
-#ifdef FEATURE_WLAN_TDLS
-        CASE_RETURN_STR(eCSR_ROAM_TDLS_STATUS_UPDATE);
-        CASE_RETURN_STR(eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND);
-#endif
-        CASE_RETURN_STR(eCSR_ROAM_DISCONNECT_ALL_P2P_CLIENTS);
-        CASE_RETURN_STR(eCSR_ROAM_SEND_P2P_STOP_BSS);
-#ifdef WLAN_FEATURE_11W
-        CASE_RETURN_STR(eCSR_ROAM_UNPROT_MGMT_FRAME_IND);
-#endif
-#ifdef WLAN_FEATURE_RMC
-        CASE_RETURN_STR(eCSR_ROAM_IBSS_PEER_INFO_COMPLETE);
-#endif
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        CASE_RETURN_STR(eCSR_ROAM_2040_COEX_INFO_IND);
-#endif
-#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
-        CASE_RETURN_STR(eCSR_ROAM_TSM_IE_IND);
-        CASE_RETURN_STR(eCSR_ROAM_CCKM_PREAUTH_NOTIFY);
-        CASE_RETURN_STR(eCSR_ROAM_ESE_ADJ_AP_REPORT_IND);
-        CASE_RETURN_STR(eCSR_ROAM_ESE_BCN_REPORT_IND);
-#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
-        CASE_RETURN_STR(eCSR_ROAM_UPDATE_MAX_RATE_IND);
-        CASE_RETURN_STR(eCSR_ROAM_LOST_LINK_PARAMS_IND);
     default:
         return "unknown";
     }
@@ -2109,37 +2056,8 @@
     return (status);
 }
 
-eHalStatus csrProcessGetFrameLogCommand( tpAniSirGlobal pMac,
-                                         tSmeCmd *pCommand )
-{
-   tAniGetFrameLogReq *pMsg;
-   tANI_U16 msgLen;
-   eHalStatus status = eHAL_STATUS_FAILURE;
 
-   msgLen = sizeof(tAniGetFrameLogReq);
 
-   if ( NULL == pCommand )
-   {
-       smsLog( pMac, LOGE, FL("cannot process. cmd is null") );
-       return eHAL_STATUS_FAILURE;
-   }
-
-   pMsg = vos_mem_malloc(msgLen);
-   if ( NULL == pMsg )
-   {
-       smsLog( pMac, LOGE, FL("fail to allocate memory") );
-       return eHAL_STATUS_FAILURE;
-   }
-
-   pMsg->msgType= pal_cpu_to_be16((tANI_U16)WDA_GET_FRAME_LOG_REQ);
-   pMsg->msgLen= pal_cpu_to_be16(msgLen);
-
-   pMsg->getFrameLogCmdFlag = pCommand->u.getFramelogCmd.getFrameLogCmdFlag;
-
-   status = palSendMBMessage(pMac->hHdd, pMsg);
-
-   return( status );
-}
 
 tANI_BOOLEAN csrIsNULLSSID( tANI_U8 *pBssSsid, tANI_U8 len )
 {
@@ -2251,15 +2169,7 @@
         }
         else
         {
-#ifdef WLAN_FEATURE_11AC
-            if ( IS_FEATURE_SUPPORTED_BY_DRIVER(DOT11AC) &&
-                     IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
-                ret = WNI_CFG_DOT11_MODE_11AC;
-            else
-                ret = WNI_CFG_DOT11_MODE_11N;
-#else
-            ret = WNI_CFG_DOT11_MODE_11N;
-#endif
+            ret = WNI_CFG_DOT11_MODE_11AC;
         }
         break;
     case eCSR_CFG_DOT11_MODE_TAURUS:
@@ -2284,27 +2194,19 @@
         ret = WNI_CFG_DOT11_MODE_TITAN;
         break;
     case eCSR_CFG_DOT11_MODE_11G_ONLY:
-        ret = WNI_CFG_DOT11_MODE_11G_ONLY;
-        break;
+       ret = WNI_CFG_DOT11_MODE_11G_ONLY;
+       break;
     case eCSR_CFG_DOT11_MODE_11N_ONLY:
-        ret = WNI_CFG_DOT11_MODE_11N_ONLY;
-        break;
+       ret = WNI_CFG_DOT11_MODE_11N_ONLY;
+       break;
 
 #ifdef WLAN_FEATURE_11AC
-    case eCSR_CFG_DOT11_MODE_11AC_ONLY:
-        if ( IS_FEATURE_SUPPORTED_BY_DRIVER(DOT11AC) &&
-             IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
-            ret = WNI_CFG_DOT11_MODE_11AC_ONLY;
-        else
-            ret = WNI_CFG_DOT11_MODE_11N;
+     case eCSR_CFG_DOT11_MODE_11AC_ONLY:
+        ret = WNI_CFG_DOT11_MODE_11AC_ONLY;
         break;
-    case eCSR_CFG_DOT11_MODE_11AC:
-        if ( IS_FEATURE_SUPPORTED_BY_DRIVER(DOT11AC) &&
-             IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
-             ret = WNI_CFG_DOT11_MODE_11AC;
-        else
-            ret = WNI_CFG_DOT11_MODE_11N;
-        break;
+     case eCSR_CFG_DOT11_MODE_11AC:
+        ret = WNI_CFG_DOT11_MODE_11AC;
+       break;
 #endif
     default:
         smsLog(pMac, LOGW, FL("doesn't expect %d as csrDo11Mode"), csrDot11Mode);
@@ -2340,18 +2242,19 @@
                 {
                     phyMode = eCSR_DOT11_MODE_TAURUS;
                 }
-            }
-        }
+                }
+                }
         if(pIes->HTCaps.present && (eCSR_DOT11_MODE_TAURUS != phyMode))
         {
             phyMode = eCSR_DOT11_MODE_11n;
-#ifdef WLAN_FEATURE_11AC
-            if (IS_BSS_VHT_CAPABLE(pIes->VHTCaps))
-            {
-                phyMode = eCSR_DOT11_MODE_11ac;
-            }
-#endif
         }
+
+#ifdef WLAN_FEATURE_11AC
+        if ( pIes->VHTCaps.present && (eCSR_DOT11_MODE_TAURUS != phyMode))
+        {
+             phyMode = eCSR_DOT11_MODE_11ac;
+        }
+#endif
         *pPhyMode = phyMode;
     }
 
@@ -3829,14 +3732,8 @@
             Capabilities->NoPairwise = (pRSNIe->RSN_Cap[0] >> 1) & 0x1 ; // Bit 1 No Pairwise
             Capabilities->PTKSAReplayCounter = (pRSNIe->RSN_Cap[0] >> 2) & 0x3 ; // Bit 2, 3 PTKSA Replay Counter
             Capabilities->GTKSAReplayCounter = (pRSNIe->RSN_Cap[0] >> 4) & 0x3 ; // Bit 4, 5 GTKSA Replay Counter
-#ifdef WLAN_FEATURE_11W
             Capabilities->MFPRequired = (pRSNIe->RSN_Cap[0] >> 6) & 0x1 ; // Bit 6 MFPR
             Capabilities->MFPCapable = (pRSNIe->RSN_Cap[0] >> 7) & 0x1 ; // Bit 7 MFPC
-#else
-            Capabilities->MFPRequired = 0 ; // Bit 6 MFPR
-            Capabilities->MFPCapable = 0 ; // Bit 7 MFPC
-#endif
-
             Capabilities->Reserved = pRSNIe->RSN_Cap[1]  & 0xff ; // remaining reserved
         }
     }
@@ -3997,7 +3894,7 @@
         fRC = TRUE;
     }
     while( 0 );
-    smsLog(pMac, LOG1, "csrLookupPMKID called return match = %d pMac->roam.NumPmkidCache = %d",
+    smsLog(pMac, LOGW, "csrLookupPMKID called return match = %d pMac->roam.NumPmkidCache = %d",
         fRC, pSession->NumPmkidCache);
 
     return fRC;
@@ -4021,7 +3918,6 @@
     tANI_U8 *pGroupMgmtCipherSuite;
 #endif
     tDot11fBeaconIEs *pIesLocal = pIes;
-    eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
 
     smsLog(pMac, LOGW, "%s called...", __func__);
 
@@ -4037,7 +3933,7 @@
         // See if the cyphers in the Bss description match with the settings in the profile.
         fRSNMatch = csrGetRSNInformation( hHal, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType, 
                                             &pProfile->mcEncryptionType, &pIesLocal->RSN,
-                                            UnicastCypher, MulticastCypher, AuthSuite, &RSNCapabilities, &negAuthType, NULL );
+                                            UnicastCypher, MulticastCypher, AuthSuite, &RSNCapabilities, NULL, NULL );
         if ( !fRSNMatch ) break;
 
         pRSNIe->IeHeader.ElementID = SIR_MAC_RSN_EID;
@@ -4069,11 +3965,7 @@
 
         pPMK = (tCsrRSNPMKIe *)( ((tANI_U8 *)(&pAuthSuite->AuthOui[ 1 ])) + sizeof(tANI_U16) );
 
-        if (
-#ifdef FEATURE_WLAN_ESE
-        (eCSR_AUTH_TYPE_CCKM_RSN != negAuthType) &&
-#endif
-        csrLookupPMKID( pMac, sessionId, pSirBssDesc->bssId, &(PMKId[0]) ) )
+        if( csrLookupPMKID( pMac, sessionId, pSirBssDesc->bssId, &(PMKId[0]) ) )
         {
             pPMK->cPMKIDs = 1;
 
@@ -5265,14 +5157,6 @@
     tANI_BOOLEAN fMatch = FALSE;
 
     do {
-        // Check for the specification of the Broadcast SSID at the beginning
-        // of the list. If specified, then all SSIDs are matches
-        // (broadcast SSID means accept all SSIDs).
-        if ( ssid1Len == 0 )
-        {
-            fMatch = TRUE;
-            break;
-        }
 
         // There are a few special cases.  If the Bss description has a Broadcast SSID,
         // then our Profile must have a single SSID without Wildcards so we can program
@@ -5289,6 +5173,14 @@
             break;
         }
 
+        // Check for the specification of the Broadcast SSID at the beginning of the list.
+        // If specified, then all SSIDs are matches (broadcast SSID means accept all SSIDs).
+        if ( ssid1Len == 0 )
+        {
+            fMatch = TRUE;
+            break;
+        }
+
         if(ssid1Len != bssSsidLen) break;
         if (vos_mem_compare(bssSsid, ssid1, bssSsidLen))
         {
@@ -5832,7 +5724,7 @@
             break;
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
-        if (pFilter->MDID.mdiePresent && csrRoamIs11rAssoc(pMac))
+        if (pFilter->MDID.mdiePresent)
         {
             if (pBssDesc->mdiePresent)
             {
@@ -5929,103 +5821,6 @@
 
 
 
-void csrAddRateBitmap(tANI_U8 rate, tANI_U16 *pRateBitmap)
-{
-    tANI_U16 rateBitmap;
-    tANI_U16 n = BITS_OFF( rate, CSR_DOT11_BASIC_RATE_MASK );
-    rateBitmap = *pRateBitmap;
-    switch(n)
-    {
-       case SIR_MAC_RATE_1:
-            rateBitmap |= SIR_MAC_RATE_1_BITMAP;
-            break;
-        case SIR_MAC_RATE_2:
-            rateBitmap |= SIR_MAC_RATE_2_BITMAP;
-            break;
-        case SIR_MAC_RATE_5_5:
-            rateBitmap |= SIR_MAC_RATE_5_5_BITMAP;
-            break;
-        case SIR_MAC_RATE_11:
-            rateBitmap |= SIR_MAC_RATE_11_BITMAP;
-            break;
-        case SIR_MAC_RATE_6:
-            rateBitmap |= SIR_MAC_RATE_6_BITMAP;
-            break;
-        case SIR_MAC_RATE_9:
-            rateBitmap |= SIR_MAC_RATE_9_BITMAP;
-            break;
-        case SIR_MAC_RATE_12:
-            rateBitmap |= SIR_MAC_RATE_12_BITMAP;
-            break;
-        case SIR_MAC_RATE_18:
-            rateBitmap |= SIR_MAC_RATE_18_BITMAP;
-            break;
-        case SIR_MAC_RATE_24:
-            rateBitmap |= SIR_MAC_RATE_24_BITMAP;
-            break;
-        case SIR_MAC_RATE_36:
-            rateBitmap |= SIR_MAC_RATE_36_BITMAP;
-            break;
-        case SIR_MAC_RATE_48:
-            rateBitmap |= SIR_MAC_RATE_48_BITMAP;
-            break;
-        case SIR_MAC_RATE_54:
-            rateBitmap |= SIR_MAC_RATE_54_BITMAP;
-            break;
-    }
-    *pRateBitmap = rateBitmap;
-}
-
-
-
-tANI_BOOLEAN csrIsRateAlreadyPresent(tANI_U8 rate, tANI_U16 rateBitmap)
-{
-    tANI_U16 n = BITS_OFF( rate, CSR_DOT11_BASIC_RATE_MASK );
-
-    switch(n)
-    {
-        case SIR_MAC_RATE_1:
-            rateBitmap &= SIR_MAC_RATE_1_BITMAP;
-            break;
-        case SIR_MAC_RATE_2:
-            rateBitmap &= SIR_MAC_RATE_2_BITMAP;
-            break;
-        case SIR_MAC_RATE_5_5:
-            rateBitmap &= SIR_MAC_RATE_5_5_BITMAP;
-            break;
-        case SIR_MAC_RATE_11:
-            rateBitmap &= SIR_MAC_RATE_11_BITMAP;
-            break;
-        case SIR_MAC_RATE_6:
-            rateBitmap &= SIR_MAC_RATE_6_BITMAP;
-            break;
-        case SIR_MAC_RATE_9:
-            rateBitmap &= SIR_MAC_RATE_9_BITMAP;
-            break;
-        case SIR_MAC_RATE_12:
-            rateBitmap &= SIR_MAC_RATE_12_BITMAP;
-            break;
-        case SIR_MAC_RATE_18:
-            rateBitmap &= SIR_MAC_RATE_18_BITMAP;
-            break;
-        case SIR_MAC_RATE_24:
-            rateBitmap &= SIR_MAC_RATE_24_BITMAP;
-            break;
-        case SIR_MAC_RATE_36:
-            rateBitmap &= SIR_MAC_RATE_36_BITMAP;
-            break;
-        case SIR_MAC_RATE_48:
-            rateBitmap &= SIR_MAC_RATE_48_BITMAP;
-            break;
-        case SIR_MAC_RATE_54:
-            rateBitmap &= SIR_MAC_RATE_54_BITMAP;
-            break;
-    }
-    return !!rateBitmap;
-}
-
-
-
 tANI_BOOLEAN csrRatesIsDot11RateSupported( tHalHandle hHal, tANI_U8 rate )
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
@@ -6193,7 +5988,7 @@
 
         if (pProfile->nAddIEScanLength)
         {
-           memset(pProfile->addIEScan, 0 , SIR_MAC_MAX_ADD_IE_LENGTH+2);
+           memset(pProfile->addIEScan, 0 , SIR_MAC_MAX_IE_LENGTH+2);
            pProfile->nAddIEScanLength = 0;
         }
 
diff --git a/wlan/prima/CORE/SME/src/nan/nan_Api.c b/wlan/prima/CORE/SME/src/nan/nan_Api.c
deleted file mode 100644
index 3ccf954..0000000
--- a/wlan/prima/CORE/SME/src/nan/nan_Api.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * This file was originally distributed by Qualcomm Atheros, Inc.
- * under proprietary terms before Copyright ownership was assigned
- * to the Linux Foundation.
- */
-
-#include "sme_Api.h"
-#include "smsDebug.h"
-#include "csrInsideApi.h"
-#include "smeInside.h"
-#include "limApi.h"
-#include "cfgApi.h"
-
-/******************************************************************************
- * Function: sme_NanRegisterCallback
- *
- * Description:
- * This function gets called when HDD wants register nan rsp callback with
- * sme layer.
- *
- * Args:
- * hHal and callback which needs to be registered.
- *
- * Returns:
- * void
- *****************************************************************************/
-void sme_NanRegisterCallback(tHalHandle hHal, NanCallback callback)
-{
-    tpAniSirGlobal pMac = NULL;
-
-    if (NULL == hHal)
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                FL("hHal is not valid"));
-        return;
-    }
-    pMac = PMAC_STRUCT(hHal);
-    pMac->sme.nanCallback = callback;
-}
-
-/******************************************************************************
- * Function: sme_NanRequest
- *
- * Description:
- * This function gets called when HDD receives NAN vendor command
- * from userspace
- *
- * Args:
- * hHal, Nan Request structure ptr and sessionId
- *
- * Returns:
- * VOS_STATUS
- *****************************************************************************/
-VOS_STATUS sme_NanRequest(tHalHandle hHalHandle, tpNanRequestReq input,
-        tANI_U32 sessionId)
-{
-    tNanRequest *pNanReq = NULL;
-    size_t data_len;
-    tSmeCmd *pCommand;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHalHandle);
-
-    pCommand = csrGetCommandBuffer(pMac);
-    if (NULL == pCommand)
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                FL("Failed to get command buffer for nan req"));
-        return eHAL_STATUS_RESOURCES;
-    }
-
-    data_len = sizeof(tNanRequest) - sizeof(pNanReq->request_data)
-                 + input->request_data_len;
-    pNanReq = vos_mem_malloc(data_len);
-
-    if (pNanReq == NULL)
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                FL("Memory allocation failure, size : %zu"), data_len);
-        csrReleaseCommand(pMac, pCommand);
-        return eHAL_STATUS_RESOURCES;
-    }
-
-    smsLog(pMac, LOG1, "Posting NAN command to csr queue");
-    vos_mem_zero(pNanReq, data_len);
-    pNanReq->request_data_len = input->request_data_len;
-    vos_mem_copy(pNanReq->request_data,
-                 input->request_data,
-                 input->request_data_len);
-
-    pCommand->command = eSmeCommandNanReq;
-    pCommand->sessionId = sessionId;
-    pCommand->u.pNanReq = pNanReq;
-
-    if (!HAL_STATUS_SUCCESS(csrQueueSmeCommand(pMac, pCommand, TRUE)))
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                 FL("failed to post eSmeCommandNanReq command"));
-        csrReleaseCommand(pMac, pCommand);
-        vos_mem_free(pNanReq);
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    return VOS_STATUS_SUCCESS;
-}
-
-/******************************************************************************
- * Function: sme_NanEvent
- *
- * Description:
- * This callback function will be called when SME received eWNI_SME_NAN_EVENT
- * event from WMA
- *
- * Args:
- * hHal - HAL handle for device
- * pMsg - Message body passed from WDA; includes NAN header
- *
- * Returns:
- * VOS_STATUS
-******************************************************************************/
-VOS_STATUS sme_NanEvent(tHalHandle hHal, void* pMsg)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    VOS_STATUS status = VOS_STATUS_SUCCESS;
-
-    if (NULL == pMsg)
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                FL("msg ptr is NULL"));
-        status = VOS_STATUS_E_FAILURE;
-    }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_MED,
-                FL("SME: Received sme_NanEvent"));
-        if (pMac->sme.nanCallback)
-        {
-            pMac->sme.nanCallback(pMac->hHdd, (tSirNanEvent *)pMsg);
-        }
-        else
-        {
-            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                    FL("nanCallback is NULL"));
-        }
-    }
-
-    return status;
-}
diff --git a/wlan/prima/CORE/SME/src/oemData/oemDataApi.c b/wlan/prima/CORE/SME/src/oemData/oemDataApi.c
index 2227b60..d709d47 100644
--- a/wlan/prima/CORE/SME/src/oemData/oemDataApi.c
+++ b/wlan/prima/CORE/SME/src/oemData/oemDataApi.c
@@ -272,12 +272,6 @@
     else
     {
         smsLog(pMac, LOG1, "%s: OEM_DATA REQ not allowed in the current mode", __func__);
-        status = eHAL_STATUS_FAILURE;
-    }
-
-    if(!HAL_STATUS_SUCCESS(status))
-    {
-        smsLog(pMac, LOG1, "%s: OEM_DATA Failure, Release command", __func__);
         oemData_ReleaseOemDataReqCommand(pMac, pOemDataReqCmd, eOEM_DATA_REQ_INVALID_MODE);
         pMac->oemData.oemDataReqActive = eANI_BOOLEAN_FALSE;
     }
diff --git a/wlan/prima/CORE/SME/src/p2p/p2p_Api.c b/wlan/prima/CORE/SME/src/p2p/p2p_Api.c
index 58bb906..18c54c9 100644
--- a/wlan/prima/CORE/SME/src/p2p/p2p_Api.c
+++ b/wlan/prima/CORE/SME/src/p2p/p2p_Api.c
@@ -188,10 +188,9 @@
 
 eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg)
 {
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    tListElem  *pEntry = NULL;
-    tSmeCmd    *pCommand = NULL;
-    tSirSmeRsp *pRsp = (tSirSmeRsp *)pMsg;
+    eHalStatus                         status = eHAL_STATUS_SUCCESS;
+    tListElem                          *pEntry = NULL;
+    tSmeCmd                            *pCommand = NULL;
 
     pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
     if( pEntry )
@@ -202,9 +201,8 @@
             remainOnChanCallback callback = pCommand->u.remainChlCmd.callback;
             /* process the msg */
             if( callback )
-                callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
-                                                        pRsp->statusCode);
-
+                callback(pMac, pCommand->u.remainChlCmd.callbackCtx, 0);
+             
             if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) )
             {
                 //Now put this command back on the avilable command list
@@ -216,6 +214,60 @@
     return status;
 }
 
+
+/*------------------------------------------------------------------
+ *
+ * Handle the Mgmt frm ind from LIM and forward to HDD.
+ *
+ *------------------------------------------------------------------*/
+
+eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    eHalStatus  status = eHAL_STATUS_SUCCESS;
+    tCsrRoamInfo pRoamInfo = {0};
+#ifndef WLAN_FEATURE_P2P_INTERNAL
+    tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
+#endif
+
+#ifdef WLAN_FEATURE_P2P_INTERNAL
+    tANI_U8 i;
+
+    //For now, only action frames are needed.
+    if(SIR_MAC_MGMT_ACTION == pSmeMgmtFrm->frameType)
+    {
+       pRoamInfo.nFrameLength = pSmeMgmtFrm->mesgLen - sizeof(tSirSmeMgmtFrameInd);
+       pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
+       pRoamInfo.frameType = pSmeMgmtFrm->frameType;
+       pRoamInfo.rxChan   = pSmeMgmtFrm->rxChan;
+       pRoamInfo.rxRssi   = pSmeMgmtFrm->rxRssi;
+
+       //Somehow we don't get the right sessionId.
+       for(i = 0; i < CSR_ROAM_SESSION_MAX; i++)
+       {
+          if( CSR_IS_SESSION_VALID( pMac, i ) )
+          {
+              status = eHAL_STATUS_SUCCESS;
+              /* forward the mgmt frame to all active sessions*/
+              csrRoamCallCallback(pMac, i, &pRoamInfo, 0, eCSR_ROAM_INDICATE_MGMT_FRAME, 0);
+          }
+       }
+    }
+#else
+    pRoamInfo.nFrameLength = pSmeMgmtFrm->mesgLen - sizeof(tSirSmeMgmtFrameInd);
+    pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
+    pRoamInfo.frameType = pSmeMgmtFrm->frameType;
+    pRoamInfo.rxChan   = pSmeMgmtFrm->rxChan;
+    pRoamInfo.rxRssi   = pSmeMgmtFrm->rxRssi;
+
+    /* forward the mgmt frame to HDD */
+    csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_INDICATE_MGMT_FRAME, 0);
+#endif
+
+    return status;
+}
+
+
 /*------------------------------------------------------------------
  *
  * Handle the remain on channel ready indication from PE
diff --git a/wlan/prima/CORE/SME/src/pmc/pmc.c b/wlan/prima/CORE/SME/src/pmc/pmc.c
index 66474d7..cdb0236 100644
--- a/wlan/prima/CORE/SME/src/pmc/pmc.c
+++ b/wlan/prima/CORE/SME/src/pmc/pmc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -163,7 +163,7 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    pmcLog(pMac, LOG1, FL("PMC state is %d"), pMac->pmc.pmcState);
+    pmcLog(pMac, LOG2, FL("Entering pmcEnterFullPowerState"));
 
     /* Take action based on the current state. */
     switch (pMac->pmc.pmcState)
@@ -230,7 +230,7 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    pmcLog(pMac, LOG1, FL("Enter. PMC state is %d"), pMac->pmc.pmcState);
+    pmcLog(pMac, LOG2, FL("Entering pmcEnterRequestFullPowerState"));
 
     /* Take action based on the current state of the device. */
     switch (pMac->pmc.pmcState)
@@ -276,8 +276,6 @@
 
         if (pmcIssueCommand( pMac, eSmeCommandExitImps, NULL, 0, FALSE ) != eHAL_STATUS_SUCCESS)
         {
-            pmcLog(pMac, LOGE, FL("PMC: failure to send message "
-                                  "eSmeCommandExitImps"));
             return eHAL_STATUS_FAILURE;
         }
         return eHAL_STATUS_SUCCESS;
@@ -291,8 +289,6 @@
         if (pmcIssueCommand(hHal, eSmeCommandExitBmps, &exitBmpsInfo, sizeof(tExitBmpsInfo), FALSE)
                != eHAL_STATUS_SUCCESS)
         {
-            pmcLog(pMac, LOGE, FL("PMC: failure to send message "
-                                  "eSmeCommandExitBmps"));
             return eHAL_STATUS_FAILURE;
         }
         return eHAL_STATUS_SUCCESS;
@@ -311,8 +307,8 @@
         if (pmcIssueCommand(hHal, eSmeCommandExitImps, NULL, 0, FALSE) !=
             eHAL_STATUS_SUCCESS)
         {
-            pmcLog(pMac, LOGE, FL("PMC: failure to send message "
-                                  "eWNI_PMC_EXIT_IMPS_REQ"));
+            pmcLog(pMac, LOGE, "PMC: failure to send message "
+            "eWNI_PMC_EXIT_IMPS_REQ");
             return eHAL_STATUS_FAILURE;
         }
 
@@ -324,8 +320,8 @@
         if (pmcIssueCommand(hHal, eSmeCommandExitUapsd, &fullPowerReason, sizeof(tRequestFullPowerReason), FALSE) !=
             eHAL_STATUS_SUCCESS)
         {
-            pmcLog(pMac, LOGE, FL("PMC: failure to send message "
-                                  "eWNI_PMC_EXIT_UAPSD_REQ"));
+            pmcLog(pMac, LOGE, "PMC: failure to send message "
+            "eWNI_PMC_EXIT_UAPSD_REQ");
             return eHAL_STATUS_FAILURE;
         }
         return eHAL_STATUS_SUCCESS;
@@ -335,8 +331,8 @@
         if (pmcIssueCommand(hHal, eSmeCommandExitWowl, &fullPowerReason, sizeof(tRequestFullPowerReason), FALSE) !=
             eHAL_STATUS_SUCCESS)
         {
-            pmcLog(pMac, LOGE, FL("PMC: failure to send message "
-                                  "eWNI_PMC_EXIT_WOWL_REQ"));
+            pmcLog(pMac, LOGP, "PMC: failure to send message "
+            "eWNI_PMC_EXIT_WOWL_REQ");
             return eHAL_STATUS_FAILURE;
         }
         return eHAL_STATUS_SUCCESS;
@@ -517,7 +513,7 @@
         pMac->pmc.bmpsRequestQueued = eANI_BOOLEAN_TRUE;
         if(pmcIssueCommand(hHal, eSmeCommandEnterBmps, NULL, 0, FALSE) != eHAL_STATUS_SUCCESS)
         {
-            pmcLog(pMac, LOGE, FL("PMC: failure to send message eWNI_PMC_ENTER_BMPS_REQ"));
+            pmcLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_BMPS_REQ");
             pMac->pmc.bmpsRequestQueued = eANI_BOOLEAN_FALSE;
             pMac->pmc.pmcState = FULL_POWER;
             if(pmcShouldBmpsTimerRun(pMac))
@@ -529,7 +525,7 @@
     }
     else
     {
-        pmcLog(pMac, LOG1, FL("PMC: enter BMPS command already queued"));
+        pmcLog(pMac, LOGE, "PMC: enter BMPS command already queued");
         //restart the timer if needed
         if(pmcShouldBmpsTimerRun(pMac))
         {
@@ -538,7 +534,7 @@
         return eHAL_STATUS_SUCCESS;
     }
 
-    pmcLog(pMac, LOG1, FL("eWNI_PMC_ENTER_BMPS_REQ sent to PE"));
+    pmcLog(pMac, LOGW, FL("eWNI_PMC_ENTER_BMPS_REQ sent to PE"));
 
     return eHAL_STATUS_SUCCESS;
 }
@@ -563,7 +559,7 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    pmcLog(pMac, LOG1, FL("Enter. PMC state is %d"), pMac->pmc.pmcState);
+    pmcLog(pMac, LOG2, FL("Entering pmcEnterBmpsState"));
 
     /* Can enter BMPS State only from 5 states. */
     if (pMac->pmc.pmcState != REQUEST_BMPS &&
@@ -663,7 +659,7 @@
         {
             if (!checkRoutine(pPowerSaveCheckEntry->checkContext))
             {
-                pmcLog(pMac, LOG1, FL("pmcPowerSaveCheck fail!"));
+                pmcLog(pMac, LOGE, FL("pmcPowerSaveCheck fail!"));
                 bResult = FALSE;
                 break;
             }
@@ -841,7 +837,7 @@
     tListElem *pEntry;
     tpRequestFullPowerEntry pRequestFullPowerEntry;
 
-    pmcLog(pMac, LOG2, FL("Enter"));
+    pmcLog(pMac, LOG2, FL("Entering pmcDoCallbacks"));
 
     /* Call IMPS callback routine. */
     if (pMac->pmc.impsCallbackRoutine != NULL)
@@ -883,7 +879,7 @@
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
     VOS_STATUS vosStatus;
 
-    pmcLog(pMac, LOG1, FL("Enter. Timer duration is %d"), expirationTime);
+    pmcLog(pMac, LOG2, FL("Entering pmcStartTrafficTimer"));
 
     vosStatus = vos_timer_start(&pMac->pmc.hTrafficTimer, expirationTime);
     if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
@@ -992,8 +988,7 @@
     /* Untill DHCP is not completed remain in power active */
     if(pMac->pmc.remainInPowerActiveTillDHCP)
     {
-        pmcLog(pMac, LOG1, FL("BMPS Traffic Timer expired before DHCP"
-                              " completion ignore enter BMPS"));
+        pmcLog(pMac, LOG2, FL("BMPS Traffic Timer expired before DHCP completion ignore enter BMPS"));
         pMac->pmc.remainInPowerActiveThreshold++;
         if( pMac->pmc.remainInPowerActiveThreshold >= DHCP_REMAIN_POWER_ACTIVE_THRESHOLD)
         {
@@ -1032,16 +1027,13 @@
 
     if (pmcPowerSaveCheck(hHal))
     {
-        pmcLog(pMac, LOG1, FL("BMPS entry criteria satisfied. Requesting BMPS state"));
+        pmcLog(pMac, LOGW, FL("BMPS entry criteria satisfied. Requesting BMPS state"));
         (void)pmcEnterRequestBmpsState(hHal);
     }
     else
     {
-        /*Some module voted against Power Save.
-         * So timer should be restarted again to retry BMPS
-         */
-        pmcLog(pMac, LOGW,
-             FL("Power Save check failed. Retry BMPS again later"));
+        /*Some module voted against Power Save. So timer should be restarted again to retry BMPS */
+        pmcLog(pMac, LOGE, FL("Power Save check failed. Retry BMPS again later"));
         //Since hTrafficTimer is a vos_timer now, we need to restart the timer here
         vosStatus = vos_timer_start(&pMac->pmc.hTrafficTimer, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
         if ( !VOS_IS_STATUS_SUCCESS(vosStatus) && (VOS_STATUS_E_ALREADY != vosStatus) )
@@ -1102,7 +1094,7 @@
    tListElem *pEntry;
    tpRequestBmpsEntry pRequestBmpsEntry;
 
-   pmcLog(pMac, LOG1, FL("Enter"));
+   pmcLog(pMac, LOG2, "PMC: entering pmcDoBmpsCallbacks");
 
    /* Call the routines in the request BMPS callback routine list. */
    csrLLLock(&pMac->pmc.requestBmpsList);
@@ -1144,7 +1136,7 @@
    tListElem *pEntry;
    tpStartUapsdEntry pStartUapsdEntry;
 
-   pmcLog(pMac, LOG1, FL("Enter"));
+   pmcLog(pMac, LOG2, "PMC: entering pmcDoStartUapsdCallbacks");
    csrLLLock(&pMac->pmc.requestStartUapsdList);
    /* Call the routines in the request start UAPSD callback routine list. */
    pEntry = csrLLRemoveHead(&pMac->pmc.requestStartUapsdList, FALSE);
@@ -1177,49 +1169,59 @@
 eHalStatus pmcEnterRequestStartUapsdState (tHalHandle hHal)
 {
    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+   v_BOOL_t fFullPower = VOS_FALSE;     //need to get back to full power state
 
-   pmcLog(pMac, LOG1, FL("Enter. PMC State is %d"), pMac->pmc.pmcState);
+   pmcLog(pMac, LOG2, "PMC: entering pmcEnterRequestStartUapsdState");
 
    /* Can enter UAPSD State only from FULL_POWER or BMPS State. */
    switch (pMac->pmc.pmcState)
    {
       case FULL_POWER:
-         /* UAPSD mode will be attempted when we enter BMPS later */
-         pMac->pmc.uapsdSessionRequired = TRUE;
-
          /* Check that entry into a power save mode is allowed at this time. */
          if (!pmcPowerSaveCheck(hHal))
          {
             pmcLog(pMac, LOGW, "PMC: Power save check failed. UAPSD request "
                       "will be accepted and buffered");
+            /* UAPSD mode will be attempted when we enter BMPS later */
+            pMac->pmc.uapsdSessionRequired = TRUE;
             /* Make sure the BMPS retry timer is running */
             if(pmcShouldBmpsTimerRun(pMac))
                (void)pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+            break;
          }
          else
          {
-            /*  PowerSaveCheck passed, put the device into BMPS first */
-            if(pmcEnterRequestBmpsState(hHal) != eHAL_STATUS_SUCCESS)
+            pMac->pmc.uapsdSessionRequired = TRUE;
+            //Check BTC state
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+            if( btcIsReadyForUapsd( pMac ) )
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
             {
-                pmcLog(pMac, LOGE, "PMC: Device in Full Power. Enter Request Bmps failed. "
-                        "UAPSD request will be dropped ");
-                return eHAL_STATUS_FAILURE;
+               /* Put device in BMPS mode first. This step should NEVER fail.
+                  That is why no need to buffer the UAPSD request*/
+               if(pmcEnterRequestBmpsState(hHal) != eHAL_STATUS_SUCCESS)
+               {
+                   pmcLog(pMac, LOGE, "PMC: Device in Full Power. Enter Request Bmps failed. "
+                            "UAPSD request will be dropped ");
+                  return eHAL_STATUS_FAILURE;
+               }
             }
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+            else
+            {
+               (void)pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
+            }
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
          }
          break;
 
       case BMPS:
-      {
-         tANI_U8 staticUapsdMask = 0;
-         csrGetStaticUapsdMask(pMac, &staticUapsdMask);
-
          //It is already in BMPS mode, check BTC state
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
-         if (btcIsReadyForUapsd(pMac) || staticUapsdMask)
+         if( btcIsReadyForUapsd(pMac) )
 #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
          {
-            /* BTC is OK with Uapsd or static Uapsd is configured, then tell
-               MAC to have device enter UAPSD mode. */
+            /* Tell MAC to have device enter UAPSD mode. */
             if (pmcIssueCommand(hHal, eSmeCommandEnterUapsd, NULL, 0, FALSE) !=
                eHAL_STATUS_SUCCESS)
             {
@@ -1232,24 +1234,36 @@
          else
          {
             //Not ready for UAPSD at this time, save it first and wake up the chip
-            pmcLog(pMac, LOGE, "Uapsd not needed now, PMC state = %d"
-                   "btcIsUapsdOk:%d staticUapsdMask:0x%x",pMac->pmc.pmcState,
-                   btcIsReadyForUapsd(pMac), staticUapsdMask);
+            pmcLog(pMac, LOGE, " PMC state = %d",pMac->pmc.pmcState);
             pMac->pmc.uapsdSessionRequired = TRUE;
+            /* While BTC traffic is going on, STA can be in BMPS
+             * and need not go to Full Power */
+            //fFullPower = VOS_TRUE;
          }
 #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
-      }
-      break;
+         break;
 
       case REQUEST_START_UAPSD:
-         pmcLog(pMac, LOGE, "Request Uapsd in progress");
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+         if( !btcIsReadyForUapsd(pMac) )
+         {
+            //BTC rejects UAPSD, bring it back to full power
+            fFullPower = VOS_TRUE;
+         }
+#endif
          break;
 
       case REQUEST_BMPS:
-         /* Buffer request for UAPSD mode. */
-         pMac->pmc.uapsdSessionRequired = TRUE;
-         pmcLog(pMac, LOGE, "Request BMPS in progress");
-         break;
+        /* Buffer request for UAPSD mode. */
+        pMac->pmc.uapsdSessionRequired = TRUE;
+#ifndef WLAN_MDM_CODE_REDUCTION_OPT
+        if( !btcIsReadyForUapsd(pMac) )
+         {
+            //BTC rejects UAPSD, bring it back to full power
+            fFullPower = VOS_TRUE;
+         }
+#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+        break;
 
       default:
          pmcLog(pMac, LOGE, "PMC: trying to enter UAPSD State from state %d",
@@ -1257,6 +1271,15 @@
          return eHAL_STATUS_FAILURE;
    }
 
+   if(fFullPower)
+   {
+      if( eHAL_STATUS_PMC_PENDING != pmcRequestFullPower( pMac, NULL, NULL, eSME_REASON_OTHER ) )
+      {
+         //This is an error
+         pmcLog(pMac, LOGE, FL(" fail to request full power because BTC"));
+      }
+   }
+
    return eHAL_STATUS_SUCCESS;
 }
 
@@ -1279,12 +1302,12 @@
 {
    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-   pmcLog(pMac, LOG2, FL("Enter"));
+   pmcLog(pMac, LOG2, "PMC: entering pmcEnterUapsdState");
 
    /* Can enter UAPSD State only from Request UAPSD State. */
    if (pMac->pmc.pmcState != REQUEST_START_UAPSD )
    {
-      pmcLog(pMac, LOGE, FL("PMC: trying to enter UAPSD State from state %d"),
+      pmcLog(pMac, LOGE, "PMC: trying to enter UAPSD State from state %d",
       pMac->pmc.pmcState);
       return eHAL_STATUS_FAILURE;
    }
@@ -1302,7 +1325,6 @@
    if (pMac->pmc.requestFullPowerPending)
    {
       /* Start exit UAPSD sequence now. */
-      pmcLog(pMac, LOG1, FL("Full power request pending. Exit UAPSD"));
       return pmcEnterRequestFullPowerState(hHal, pMac->pmc.requestFullPowerReason);
    }
 
@@ -1381,8 +1403,8 @@
    /* Can enter Standby State only from Full Power State. */
    if (pMac->pmc.pmcState != FULL_POWER)
    {
-      pmcLog(pMac, LOGE, FL("PMC: trying to enter Standby State from "
-         "state %d"), pMac->pmc.pmcState);
+      pmcLog(pMac, LOGE, "PMC: trying to enter Standby State from "
+         "state %d", pMac->pmc.pmcState);
       return eHAL_STATUS_FAILURE;
    }
 
@@ -1394,8 +1416,8 @@
    if (pmcIssueCommand(hHal, eSmeCommandEnterStandby, NULL, 0, FALSE) !=
       eHAL_STATUS_SUCCESS)
    {
-      pmcLog(pMac, LOGE, FL("PMC: failure to send message "
-                            "eWNI_PMC_ENTER_IMPS_REQ"));
+      pmcLog(pMac, LOGE, "PMC: failure to send message "
+         "eWNI_PMC_ENTER_IMPS_REQ");
       pMac->pmc.pmcState = FULL_POWER;
 
       if(pmcShouldBmpsTimerRun(pMac))
@@ -1425,13 +1447,13 @@
 {
    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-   pmcLog(pMac, LOG2, FL("Enter"));
+   pmcLog(pMac, LOG2, "PMC: entering pmcEnterStandbyState");
 
    /* Can enter STANDBY State only from REQUEST_STANDBY State. */
    if (pMac->pmc.pmcState != REQUEST_STANDBY)
    {
-      pmcLog(pMac, LOGE, FL("PMC: trying to enter STANDBY State from state %d"),
-             pMac->pmc.pmcState);
+      pmcLog(pMac, LOGE, "PMC: trying to enter STANDBY State from state %d",
+         pMac->pmc.pmcState);
       return eHAL_STATUS_FAILURE;
    }
 
@@ -1443,7 +1465,6 @@
    if (pMac->pmc.requestFullPowerPending)
    {
       /* Start exit STANDBY sequence now. */
-       pmcLog(pMac, LOG1, FL("Full power req pending. Exit Standby"));
       return pmcEnterRequestFullPowerState(hHal, pMac->pmc.requestFullPowerReason);
    }
 
@@ -1550,7 +1571,7 @@
     tpDeviceStateUpdateIndEntry pDeviceStateUpdateIndEntry;
     void (*callbackRoutine) (void *callbackContext, tPmcState pmcState);
 
-    pmcLog(pMac, LOG1, FL("PMC - Update registered modules of new device "
+    pmcLog(pMac, LOG2, FL("PMC - Update registered modules of new device "
            "state: %s"), pmcGetPmcStateStr(state));
 
     /* Call the routines in the update device state routine list. */
@@ -1582,7 +1603,7 @@
 eHalStatus pmcRequestEnterWowlState(tHalHandle hHal, tpSirSmeWowlEnterParams wowlEnterParams)
 {
    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-   pmcLog(pMac, LOG1, FL("Enter. PMC State is %d"),pMac->pmc.pmcState);
+   pmcLog(pMac, LOG2, "PMC: entering pmcRequestEnterWowlState");
 
    switch (pMac->pmc.pmcState)
    {
@@ -1590,15 +1611,15 @@
          /* Put device in BMPS mode first. This step should NEVER fail. */
          if(pmcEnterRequestBmpsState(hHal) != eHAL_STATUS_SUCCESS)
          {
-            pmcLog(pMac, LOGE, FL("PMC: Device in Full Power. pmcEnterRequestBmpsState failed. "
-                                  "Cannot enter WOWL"));
+            pmcLog(pMac, LOGE, "PMC: Device in Full Power. pmcEnterRequestBmpsState failed. "
+                    "Cannot enter WOWL");
             return eHAL_STATUS_FAILURE;
          }
          break;
 
       case REQUEST_BMPS:
-         pmcLog(pMac, LOGW, FL("PMC: BMPS transaction going on. WOWL request "
-                               "will be buffered"));
+         pmcLog(pMac, LOGW, "PMC: BMPS transaction going on. WOWL request "
+                    "will be buffered");
          break;
 
       case BMPS:
@@ -1609,24 +1630,24 @@
          if (pmcIssueCommand(hHal, eSmeCommandEnterWowl, wowlEnterParams, sizeof(tSirSmeWowlEnterParams), FALSE) !=
             eHAL_STATUS_SUCCESS)
          {
-            pmcLog(pMac, LOGE, FL("PMC: failure to send message eWNI_PMC_ENTER_WOWL_REQ"));
+            pmcLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_WOWL_REQ");
             return eHAL_STATUS_FAILURE;
          }
          break;
 
       case REQUEST_ENTER_WOWL:
          //Multiple enter WOWL requests at the same time are not accepted
-         pmcLog(pMac, LOGE, FL("PMC: Enter WOWL transaction already going on. New WOWL request "
-                               "will be rejected"));
+         pmcLog(pMac, LOGE, "PMC: Enter WOWL transaction already going on. New WOWL request "
+                    "will be rejected");
          return eHAL_STATUS_FAILURE;
 
       case REQUEST_EXIT_WOWL:
-         pmcLog(pMac, LOGW, FL("PMC: Exit WOWL transaction going on. New WOWL request "
-                               "will be buffered"));
+         pmcLog(pMac, LOGW, "PMC: Exit WOWL transaction going on. New WOWL request "
+                   "will be buffered");
          break;
 
       default:
-         pmcLog(pMac, LOGE, FL("PMC: Trying to enter WOWL State from state %s"),
+         pmcLog(pMac, LOGE, "PMC: Trying to enter WOWL State from state %s",
             pmcGetPmcStateStr(pMac->pmc.pmcState));
          return eHAL_STATUS_FAILURE;
    }
@@ -1658,7 +1679,7 @@
    /* Can enter WOWL State only from Request WOWL State. */
    if (pMac->pmc.pmcState != REQUEST_ENTER_WOWL )
    {
-      pmcLog(pMac, LOGE, FL("PMC: trying to enter WOWL State from state %d"),
+      pmcLog(pMac, LOGP, "PMC: trying to enter WOWL State from state %d",
         pMac->pmc.pmcState);
       return eHAL_STATUS_FAILURE;
    }
@@ -1674,7 +1695,6 @@
    if (pMac->pmc.requestFullPowerPending)
    {
       /* Start exit Wowl sequence now. */
-       pmcLog(pMac, LOG1, FL("Full power req pending. Exit Wowl"));
       return pmcEnterRequestFullPowerState(hHal, pMac->pmc.requestFullPowerReason);
    }
 
@@ -1709,18 +1729,18 @@
             if (pmcIssueCommand(hHal, eSmeCommandExitWowl, NULL, 0, FALSE) !=
                 eHAL_STATUS_SUCCESS)
             {
-                pmcLog(pMac, LOGP, FL("PMC: failure to send message eWNI_PMC_EXIT_WOWL_REQ"));
+                pmcLog(pMac, LOGP, "PMC: failure to send message eWNI_PMC_EXIT_WOWL_REQ");
                 return eHAL_STATUS_FAILURE;
             }
             break;
 
         case REQUEST_ENTER_WOWL:
-            pmcLog(pMac, LOGP, FL("PMC: Rcvd exit WOWL even before enter WOWL was completed"));
+            pmcLog(pMac, LOGP, "PMC: Rcvd exit WOWL even before enter WOWL was completed");
             return eHAL_STATUS_FAILURE;
 
         default:
-            pmcLog(pMac, LOGW, FL("PMC: Got exit WOWL in state %s(%d). Nothing to do as already out of WOWL"),
-            pmcGetPmcStateStr(pMac->pmc.pmcState), pMac->pmc.pmcState);
+            pmcLog(pMac, LOGW, "PMC: Got exit WOWL in state %s. Nothing to do as already out of WOWL",
+            pmcGetPmcStateStr(pMac->pmc.pmcState));
             break;
     }
 
@@ -2068,7 +2088,7 @@
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tANI_BOOLEAN fRemoveCmd = eANI_BOOLEAN_TRUE;
-    pmcLog(pMac, LOG1, FL("PMC command is 0x%x"), pCommand->command);
+
     do
     {
         switch ( pCommand->command )
@@ -2104,33 +2124,29 @@
             break;
 
         case eSmeCommandExitImps:
+            pMac->pmc.requestFullPowerPending = FALSE;
+            if( ( IMPS == pMac->pmc.pmcState ) || ( STANDBY == pMac->pmc.pmcState ) )
             {
-                tPmcState origState = pMac->pmc.pmcState;
-                pMac->pmc.requestFullPowerPending = FALSE;
-                if( ( IMPS == pMac->pmc.pmcState ) || ( STANDBY == pMac->pmc.pmcState ) )
+                //Check state before sending message. The state may change after that
+                if( STANDBY == pMac->pmc.pmcState )
                 {
-                    //Check state before sending message. The state may change after that
-                    if( STANDBY == pMac->pmc.pmcState )
-                    {
-                        //Enable Idle scan in CSR
-                        csrScanResumeIMPS(pMac);
-                    }
+                    //Enable Idle scan in CSR
+                    csrScanResumeIMPS(pMac);
+                }
 
+                status = pmcSendMessage(pMac, eWNI_PMC_EXIT_IMPS_REQ, NULL, 0);
+                if ( HAL_STATUS_SUCCESS( status ) )
+                {
                     pMac->pmc.pmcState = REQUEST_FULL_POWER;
-                    status = pmcSendMessage(pMac, eWNI_PMC_EXIT_IMPS_REQ, NULL, 0);
-                    if ( HAL_STATUS_SUCCESS( status ) )
-                    {
-                        pmcLog(pMac, LOG1, FL("eWNI_PMC_EXIT_IMPS_REQ sent to PE"));
-                        fRemoveCmd = eANI_BOOLEAN_FALSE;
-                    }
-                    else
-                    {
-                        pMac->pmc.pmcState = origState;
-                        pmcLog(pMac, LOGE,
-                               FL("eWNI_PMC_EXIT_IMPS_REQ fail to be sent to PE status %d"), status);
-                        //Callbacks are called with success srarus, do we need to pass in real status??
-                        pmcEnterFullPowerState(pMac);
-                    }
+                    pmcLog(pMac, LOG2, FL("eWNI_PMC_EXIT_IMPS_REQ sent to PE"));
+                    fRemoveCmd = eANI_BOOLEAN_FALSE;
+                }
+                else
+                {
+                    pmcLog(pMac, LOGE,
+                           FL("eWNI_PMC_EXIT_IMPS_REQ fail to be sent to PE status %d"), status);
+                    //Callbacks are called with success srarus, do we need to pass in real status??
+                    pmcEnterFullPowerState(pMac);
                 }
             }
             break;
@@ -2144,7 +2160,7 @@
                 {
                     /* Change PMC state */
                     pMac->pmc.pmcState = REQUEST_BMPS;
-                    pmcLog(pMac, LOG1, "PMC: Enter BMPS req done");
+                    pmcLog(pMac, LOG2, "PMC: Enter BMPS req done");
 
                     /* Tell MAC to have device enter BMPS mode. */
                     status = pmcSendMessage(pMac, eWNI_PMC_ENTER_BMPS_REQ, NULL, 0);
@@ -2172,23 +2188,21 @@
             break;
 
         case eSmeCommandExitBmps:
-            if ((BMPS == pMac->pmc.pmcState) || (UAPSD == pMac->pmc.pmcState))
+            if( BMPS == pMac->pmc.pmcState )
             {
-                tPmcState origState = pMac->pmc.pmcState;
                 pMac->pmc.requestFullPowerPending = FALSE;
-                /* Change PMC state */
-                pMac->pmc.pmcState = REQUEST_FULL_POWER;
+
                 status = pmcSendMessage( pMac, eWNI_PMC_EXIT_BMPS_REQ,
                             &pCommand->u.pmcCmd.u.exitBmpsInfo, sizeof(tExitBmpsInfo) );
                 if ( HAL_STATUS_SUCCESS( status ) )
                 {
+                    pMac->pmc.pmcState = REQUEST_FULL_POWER;
                     fRemoveCmd = eANI_BOOLEAN_FALSE;
-                    pmcLog(pMac, LOG1, FL("eWNI_PMC_EXIT_BMPS_REQ sent to PE"));
+                    pmcLog(pMac, LOG2, FL("eWNI_PMC_EXIT_BMPS_REQ sent to PE"));
 
                 }
                 else
                 {
-                    pMac->pmc.pmcState = origState;
                     pmcLog(pMac, LOGE, FL("eWNI_PMC_EXIT_BMPS_REQ fail to be sent to PE status %d"), status);
                     pmcEnterFullPowerState(pMac);
                 }
@@ -2199,16 +2213,14 @@
             if( BMPS == pMac->pmc.pmcState )
             {
                 pMac->pmc.uapsdSessionRequired = TRUE;
-                /* Change PMC state */
-                pMac->pmc.pmcState = REQUEST_START_UAPSD;
                 status = pmcSendMessage(pMac, eWNI_PMC_ENTER_UAPSD_REQ, NULL, 0);
                 if ( HAL_STATUS_SUCCESS( status ) )
                 {
+                    pMac->pmc.pmcState = REQUEST_START_UAPSD;
                     fRemoveCmd = eANI_BOOLEAN_FALSE;
                 }
                 else
                 {
-                    pMac->pmc.pmcState = BMPS;
                     pmcLog(pMac, LOGE, "PMC: failure to send message "
                        "eWNI_PMC_ENTER_BMPS_REQ");
                     //there is no retry for re-entering UAPSD so tell the requester we are done witgh failure.
@@ -2228,20 +2240,19 @@
                    break;
                }
 
-               /* Change state. Note that device will be put in BMPS state at the
-                  end of REQUEST_STOP_UAPSD state even if response is a failure*/
-               pMac->pmc.pmcState = REQUEST_STOP_UAPSD;
                /* Tell MAC to have device exit UAPSD mode. */
                status = pmcSendMessage(pMac, eWNI_PMC_EXIT_UAPSD_REQ, NULL, 0);
                if ( HAL_STATUS_SUCCESS( status ) )
                {
+                   /* Change state. Note that device will be put in BMPS state at the
+                      end of REQUEST_STOP_UAPSD state even if response is a failure*/
+                   pMac->pmc.pmcState = REQUEST_STOP_UAPSD;
                    pMac->pmc.requestFullPowerPending = TRUE;
                    pMac->pmc.requestFullPowerReason = pCommand->u.pmcCmd.fullPowerReason;
                    fRemoveCmd = eANI_BOOLEAN_FALSE;
                }
                else
                {
-                   pMac->pmc.pmcState = UAPSD;
                    pmcLog(pMac, LOGE, "PMC: failure to send message "
                       "eWNI_PMC_EXIT_UAPSD_REQ");
                    pmcEnterBmpsState(pMac);
@@ -2251,31 +2262,27 @@
            break;
 
         case eSmeCommandEnterWowl:
-           {
-               tPmcState origState = pMac->pmc.pmcState;
-               if( ( BMPS == pMac->pmc.pmcState ) || ( WOWL == pMac->pmc.pmcState ) )
-               {
-                   pMac->pmc.pmcState = REQUEST_ENTER_WOWL;
-                   status = pmcSendMessage(pMac, eWNI_PMC_ENTER_WOWL_REQ,
-                          &pCommand->u.pmcCmd.u.enterWowlInfo, sizeof(tSirSmeWowlEnterParams));
-                   if ( HAL_STATUS_SUCCESS( status ) )
-                   {
-                       fRemoveCmd = eANI_BOOLEAN_FALSE;
-                   }
-                   else
-                   {
-                       pMac->pmc.pmcState = origState;
-                       pmcLog(pMac, LOGE,
-                              "PMC: failure to send message eWNI_PMC_ENTER_WOWL_REQ in state %d", origState);
-                       pmcDoEnterWowlCallbacks(pMac, eHAL_STATUS_FAILURE);
-                   }
-               }
-               else
-               {
-                   fRemoveCmd = eANI_BOOLEAN_TRUE;
-               }
-               break;
-           }
+            if( ( BMPS == pMac->pmc.pmcState ) || ( WOWL == pMac->pmc.pmcState ) )
+            {
+                status = pmcSendMessage(pMac, eWNI_PMC_ENTER_WOWL_REQ,
+                        &pCommand->u.pmcCmd.u.enterWowlInfo, sizeof(tSirSmeWowlEnterParams));
+                if ( HAL_STATUS_SUCCESS( status ) )
+                {
+                    pMac->pmc.pmcState = REQUEST_ENTER_WOWL;
+                    fRemoveCmd = eANI_BOOLEAN_FALSE;
+                }
+                else
+                {
+                    pmcLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_WOWL_REQ");
+                    pmcDoEnterWowlCallbacks(pMac, eHAL_STATUS_FAILURE);
+                }
+            }
+            else
+            {
+                fRemoveCmd = eANI_BOOLEAN_TRUE;
+            }
+            break;
+
         case eSmeCommandExitWowl:
             if( WOWL == pMac->pmc.pmcState )
             {
@@ -2290,7 +2297,6 @@
                 }
                 else
                 {
-                    pMac->pmc.pmcState = WOWL;
                     pmcLog(pMac, LOGP, "PMC: failure to send message eWNI_PMC_EXIT_WOWL_REQ");
                     pmcEnterBmpsState(pMac);
                 }
@@ -2336,7 +2342,6 @@
                 {
                     pmcLog(pMac, LOGE, "PMC: failure to send message "
                         "eWNI_PMC_ENTER_IMPS_REQ");
-                    pMac->pmc.pmcState = FULL_POWER;
                     pmcEnterFullPowerState(pMac);
                     pmcDoStandbyCallbacks(pMac, eHAL_STATUS_FAILURE);
                     /* Start the timer only if Auto BMPS feature is enabled or an UAPSD session is
@@ -2371,21 +2376,21 @@
     /* Check if IMPS is enabled. */
     if (!pMac->pmc.impsEnabled)
     {
-        pmcLog(pMac, LOG1, FL("IMPS is disabled"));
+        pmcLog(pMac, LOG2, FL("IMPS is disabled"));
         return eHAL_STATUS_PMC_DISABLED;
     }
 
     /* Check if IMPS enabled for current power source. */
     if ((pMac->pmc.powerSource == AC_POWER) && !pMac->pmc.impsConfig.enterOnAc)
     {
-        pmcLog(pMac, LOG1, FL("IMPS is disabled when operating on AC power"));
+        pmcLog(pMac, LOG2, FL("IMPS is disabled when operating on AC power"));
         return eHAL_STATUS_PMC_AC_POWER;
     }
 
     /* Check that entry into a power save mode is allowed at this time. */
     if (!pmcPowerSaveCheck(pMac))
     {
-        pmcLog(pMac, LOG1, FL("IMPS cannot be entered now"));
+        pmcLog(pMac, LOG2, FL("IMPS cannot be entered now"));
         return eHAL_STATUS_PMC_NOT_NOW;
     }
 
@@ -2393,7 +2398,7 @@
        running sessions agree. */
     if (!pmcAllowImps(pMac))
     {
-        pmcLog(pMac, LOG1, FL("IMPS cannot be entered now"));
+        pmcLog(pMac, LOG2, FL("IMPS cannot be entered now"));
         return eHAL_STATUS_PMC_NOT_NOW;
     }
 
@@ -2401,7 +2406,7 @@
     if ((pMac->pmc.pmcState == REQUEST_IMPS) || (pMac->pmc.pmcState == IMPS) ||
         (pMac->pmc.pmcState == REQUEST_FULL_POWER))
     {
-        pmcLog(pMac, LOG1, FL("Already in IMPS"));
+        pmcLog(pMac, LOG2, FL("Already in IMPS"));
         return eHAL_STATUS_PMC_ALREADY_IN_IMPS;
     }
 
@@ -2424,7 +2429,7 @@
    /* Check if BMPS is enabled. */
    if (!pMac->pmc.bmpsEnabled)
    {
-      pmcLog(pMac, LOGE, FL("PMC: Cannot initiate BMPS. BMPS is disabled"));
+      pmcLog(pMac, LOGE, "PMC: Cannot initiate BMPS. BMPS is disabled");
       return eHAL_STATUS_PMC_DISABLED;
    }
 
@@ -2439,8 +2444,7 @@
    /* Check that we are associated with a single active session. */
    if (!pmcValidateConnectState( pMac ))
    {
-      pmcLog(pMac, VOS_TRACE_LEVEL_INFO, FL("PMC: STA not associated with an AP with single"
-                          " active session. BMPS cannot be entered"));
+      pmcLog(pMac, LOGE, "PMC: STA not associated with an AP with single active session. BMPS cannot be entered");
       return eHAL_STATUS_FAILURE;
    }
 
@@ -2448,14 +2452,13 @@
    if (pMac->pmc.pmcState != FULL_POWER)
    {
       pmcLog(pMac, LOGE,
-             FL("PMC: Device not in full power. Cannot request BMPS. pmcState %d"),
-              pMac->pmc.pmcState);
+             "PMC: Device not in full power. Cannot request BMPS. pmcState %d", pMac->pmc.pmcState);
       return eHAL_STATUS_FAILURE;
    }
    /* Check that entry into a power save mode is allowed at this time. */
    if (!pmcPowerSaveCheck(pMac))
    {
-      pmcLog(pMac, LOGE, FL("PMC: Power save check failed. BMPS cannot be entered now"));
+      pmcLog(pMac, LOGE, "PMC: Power save check failed. BMPS cannot be entered now");
       return eHAL_STATUS_PMC_NOT_NOW;
    }
 
@@ -2513,12 +2516,60 @@
      * an Infra session */
     if (!csrIsInfraConnected(pMac))
     {
-        pmcLog(pMac, LOG1, FL("No Infra Session. BMPS can't be started"));
+        pmcLog(pMac, LOG1, FL("No Infra Session or multiple sessions. BMPS should not be started"));
         return eANI_BOOLEAN_FALSE;
     }
     return eANI_BOOLEAN_TRUE;
 }
 
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+
+#define PMC_DIAG_EVT_TIMER_INTERVAL ( 5000 )
+
+void pmcDiagEvtTimerExpired (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
+
+    vos_mem_zero(&psRequest, sizeof(vos_event_wlan_powersave_payload_type));
+    psRequest.event_subtype = WLAN_PMC_CURRENT_STATE;
+    psRequest.pmc_current_state = pMac->pmc.pmcState;
+
+    WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
+
+    pmcLog(pMac, LOGW, FL("DIAG event timer expired"));
+
+    /* re-arm timer */
+    if (pmcStartDiagEvtTimer(hHal) != eHAL_STATUS_SUCCESS)
+    {
+        pmcLog(pMac, LOGP, FL("Cannot re-arm DIAG evt timer"));
+    }
+    vos_timer_start(&pMac->pmc.hDiagEvtTimer, PMC_DIAG_EVT_TIMER_INTERVAL);
+}
+
+eHalStatus pmcStartDiagEvtTimer (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    pmcLog(pMac, LOG2, FL("Entering pmcStartDiagEvtTimer"));
+
+    if ( vos_timer_start(&pMac->pmc.hDiagEvtTimer, PMC_DIAG_EVT_TIMER_INTERVAL) != VOS_STATUS_SUCCESS)
+    {
+       pmcLog(pMac, LOGP, FL("Cannot start DIAG evt timer"));
+       return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+void pmcStopDiagEvtTimer (tHalHandle hHal)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    pmcLog(pMac, LOG2, FL("Entering pmcStopDiagEvtTimer"));
+    (void)vos_timer_stop(&pMac->pmc.hDiagEvtTimer);
+}
+#endif
 const char * sme_PmcStatetoString(const v_U8_t pmcState)
 {   switch (pmcState)
     {
diff --git a/wlan/prima/CORE/SME/src/pmc/pmcApi.c b/wlan/prima/CORE/SME/src/pmc/pmcApi.c
index 3d520c4..ba43a29 100644
--- a/wlan/prima/CORE/SME/src/pmc/pmcApi.c
+++ b/wlan/prima/CORE/SME/src/pmc/pmcApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,7 +39,6 @@
 #include "palTimer.h"
 #include "csrLinkList.h"
 #include "smsDebug.h"
-#include "sme_Trace.h"
 #include "pmcApi.h"
 #include "pmc.h"
 #include "cfgApi.h"
@@ -115,6 +114,15 @@
         return eHAL_STATUS_FAILURE;
     }
 
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    /* Allocate a timer used to report current PMC state through periodic DIAG event */
+    if (vos_timer_init(&pMac->pmc.hDiagEvtTimer, VOS_TIMER_TYPE_SW, pmcDiagEvtTimerExpired, hHal) != VOS_STATUS_SUCCESS)
+    {
+        pmcLog(pMac, LOGE, FL("Cannot allocate timer for diag event reporting"));
+        return eHAL_STATUS_FAILURE;
+    }
+#endif
+
     //Initialize the default value for Bmps related config. 
     pMac->pmc.bmpsConfig.trafficMeasurePeriod = BMPS_TRAFFIC_TIMER_DEFAULT;
     pMac->pmc.bmpsConfig.bmpsPeriod = WNI_CFG_LISTEN_INTERVAL_STADEF;
@@ -243,6 +251,13 @@
                        sizeof(tSirMacHTMIMOPowerSaveState)) != eHAL_STATUS_SUCCESS)
         return eHAL_STATUS_FAILURE;
 
+#ifdef FEATURE_WLAN_DIAG_SUPPORT 
+    if (pmcStartDiagEvtTimer(hHal) != eHAL_STATUS_SUCCESS)
+    {
+       return eHAL_STATUS_FAILURE;
+    }
+#endif
+
 #if defined(ANI_LOGDUMP)
     pmcDumpInit(hHal);
 #endif
@@ -282,6 +297,10 @@
 
     pmcStopTrafficTimer(hHal);
 
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    pmcStopDiagEvtTimer(hHal);
+#endif
+
     if (vos_timer_stop(&pMac->pmc.hExitPowerSaveTimer) != VOS_STATUS_SUCCESS)
     {
         pmcLog(pMac, LOGE, FL("Cannot cancel exit power save mode timer"));
@@ -341,6 +360,12 @@
     {
         pmcLog(pMac, LOGE, FL("Cannot deallocate traffic timer"));
     }
+#ifdef FEATURE_WLAN_DIAG_SUPPORT    
+    if (vos_timer_destroy(&pMac->pmc.hDiagEvtTimer) != VOS_STATUS_SUCCESS)
+    {
+        pmcLog(pMac, LOGE, FL("Cannot deallocate timer for diag event reporting"));
+    }
+#endif
     if (vos_timer_destroy(&pMac->pmc.hExitPowerSaveTimer) != VOS_STATUS_SUCCESS)
     {
         pmcLog(pMac, LOGE, FL("Cannot deallocate exit power save mode timer"));
@@ -978,8 +1003,7 @@
                                 void *callbackContext, tRequestFullPowerReason fullPowerReason)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    tpRequestFullPowerEntry pRequestFullPowerEntry;
-    tListElem *pEntry;
+    tpRequestFullPowerEntry pEntry;
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT    
     WLAN_VOS_DIAG_EVENT_DEF(psRequest, vos_event_wlan_powersave_payload_type);
@@ -1019,14 +1043,17 @@
         {
             pmcLog(pMac, LOGE, FL("Cannot cancel IMPS timer"));
         }
+    /* Enter Request Full Power State. */
+    if (pmcEnterRequestFullPowerState(hHal, fullPowerReason) != eHAL_STATUS_SUCCESS)
+        return eHAL_STATUS_FAILURE;
 
     /* If able to enter Request Full Power State, then request is pending.
        Allocate entry for request full power callback routine list. */
     //If caller doesn't need a callback, simply waits up the chip.
-    if (callbackRoutine)
+    if( callbackRoutine )
     {
-        pRequestFullPowerEntry = vos_mem_malloc(sizeof(tRequestFullPowerEntry));
-        if (NULL == pRequestFullPowerEntry)
+        pEntry = vos_mem_malloc(sizeof(tRequestFullPowerEntry));
+        if ( NULL == pEntry )
         {
             pmcLog(pMac, LOGE,
                    FL("Cannot allocate memory for request full power routine list entry"));
@@ -1035,24 +1062,11 @@
         }
 
         /* Store routine and context in entry. */
-        pRequestFullPowerEntry->callbackRoutine = callbackRoutine;
-        pRequestFullPowerEntry->callbackContext = callbackContext;
+        pEntry->callbackRoutine = callbackRoutine;
+        pEntry->callbackContext = callbackContext;
 
         /* Add entry to list. */
-        csrLLInsertTail(&pMac->pmc.requestFullPowerList, &pRequestFullPowerEntry->link, TRUE);
-    }
-    /* Enter Request Full Power State. */
-    if (pmcEnterRequestFullPowerState(hHal, fullPowerReason) != eHAL_STATUS_SUCCESS)
-    {
-        /* If pmcEnterRequestFullPowerState fails ; driver need to remove callback
-         * from requestFullPowerList */
-        if (callbackRoutine)
-        {
-            pEntry = csrLLRemoveTail(&pMac->pmc.requestFullPowerList, TRUE);
-            pRequestFullPowerEntry = GET_BASE_ADDR(pEntry, tRequestFullPowerEntry, link);
-            vos_mem_free(pRequestFullPowerEntry);
-        }
-        return eHAL_STATUS_FAILURE;
+        csrLLInsertTail(&pMac->pmc.requestFullPowerList, &pEntry->link, TRUE);
     }
 
     return eHAL_STATUS_PMC_PENDING;
@@ -1244,7 +1258,7 @@
     {
         pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 
-        pmcLog(pMac, LOG2, FL("process message = 0x%x"), pMsg->messageType);
+        pmcLog(pMac, LOG2, FL("process message = %d"), pMsg->messageType);
 
     /* Process each different type of message. */
     switch (pMsg->messageType)
@@ -1345,32 +1359,16 @@
                     pmcLog(pMac, LOGE, FL("SSR Is in progress do not send "
                                           "exit imps req again"));
                 }
-                else if( (pMac->pmc.ImpsRspFailCnt <=
-                           BMPS_IMPS_FAILURE_REPORT_THRESHOLD))
+                else if( eHAL_STATUS_SUCCESS ==
+                      pmcSendMessage(pMac, eWNI_PMC_EXIT_IMPS_REQ, NULL, 0) )
                 {
-                    pMac->pmc.ImpsRspFailCnt++;
-                    if (eHAL_STATUS_SUCCESS ==
-                        pmcSendMessage(pMac, eWNI_PMC_EXIT_IMPS_REQ, NULL, 0) )
-                    {
-                        fRemoveCommand = eANI_BOOLEAN_FALSE;
-                        pMac->pmc.pmcState = REQUEST_FULL_POWER;
-                        pmcLog(pMac, LOGE, FL("eWNI_PMC_EXIT_IMPS_REQ sent again"
-                                              " to PE"));
-                        break;
-                    }
-                }
-                else
-                {
-                    pMac->pmc.ImpsRspFailCnt = 0;
-                    VOS_ASSERT(0);
+                    fRemoveCommand = eANI_BOOLEAN_FALSE;
+                    pMac->pmc.pmcState = REQUEST_FULL_POWER;
+                    pmcLog(pMac, LOGE, FL("eWNI_PMC_EXIT_IMPS_REQ sent again"
+                                          " to PE"));
                     break;
                 }
             }
-            else
-            {
-                pMac->pmc.ImpsRspFailCnt = 0;
-            }
-
             pmcEnterFullPowerState(pMac);
         break;
 
@@ -1436,18 +1434,15 @@
                 pmcLog(pMac, LOGP,
                        FL("Response message to request to exit BMPS indicates failure, status %d"),
                        pMsg->statusCode);
-                /*Status is not succes, so set back the pmc state as BMPS*/
-                pMac->pmc.pmcState = BMPS;
             }
-            else
-                pmcEnterFullPowerState(pMac);
+            pmcEnterFullPowerState(pMac);
         break;
 
         /* We got a response to our Start UAPSD request.  */
         case eWNI_PMC_ENTER_UAPSD_RSP:
             pmcLog(pMac, LOG2, FL("Rcvd eWNI_PMC_ENTER_UAPSD_RSP with status = %d"), pMsg->statusCode);
             if( eSmeCommandEnterUapsd != pCommand->command )
-            {
+        {
                 pmcLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_UAPSD_RSP without request"));
                 fRemoveCommand = eANI_BOOLEAN_FALSE;
                 break;
@@ -1460,32 +1455,23 @@
                 break;
             }
 
-            /* Enter UAPSD State if response indicates success. */
+         /* Enter UAPSD State if response indicates success. */
             if (pMsg->statusCode == eSIR_SME_SUCCESS) 
             {
                 pmcEnterUapsdState(pMac);
                 pmcDoStartUapsdCallbacks(pMac, eHAL_STATUS_SUCCESS);
-            }
-            else
-            {
-                /* If response is failure, then we try to put the chip back in
-                   BMPS mode*/
-                tANI_BOOLEAN OrigUapsdReqState = pMac->pmc.uapsdSessionRequired;
+         }
+         /* If response is failure, then we try to put the chip back in
+            BMPS mode*/
+            else {
                 pmcLog(pMac, LOGE, "PMC: response message to request to enter "
                    "UAPSD indicates failure, status %d", pMsg->statusCode);
-
                 //Need to reset the UAPSD flag so pmcEnterBmpsState won't try to enter UAPSD.
                 pMac->pmc.uapsdSessionRequired = FALSE;
                 pmcEnterBmpsState(pMac);
-
-                if (pMsg->statusCode != eSIR_SME_UAPSD_REQ_INVALID)
-                {
-                    //UAPSD will not be retied in this case so tell requester we are done with failure
-                    pmcDoStartUapsdCallbacks(pMac, eHAL_STATUS_FAILURE);
-                }
-                else
-                    pMac->pmc.uapsdSessionRequired = OrigUapsdReqState;
-            }
+                //UAPSD will not be retied in this case so tell requester we are done with failure
+                pmcDoStartUapsdCallbacks(pMac, eHAL_STATUS_FAILURE);
+         }
          break;
 
       /* We got a response to our Stop UAPSD request.  */
@@ -1611,7 +1597,7 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    pmcLog(pMac, LOG2, FL("Message type %d"), pMsg->messageType);
+    pmcLog(pMac, LOG2, FL("Entering pmcMessageProcessor, message type %d"), pMsg->messageType);
 
     switch( pMsg->messageType )
     {
@@ -2118,7 +2104,7 @@
     tListElem *pEntry;
     tpDeviceStateUpdateIndEntry pDeviceStateUpdateIndEntry;
 
-    pmcLog(pMac, LOG2, FL(": Enter"));
+    pmcLog(pMac, LOG2, FL("Entering pmcDeregisterDeviceStateUpdateInd"));
 
     /* Find entry in the power save update routine list that matches
        the specified routine and remove it. */
@@ -2196,6 +2182,7 @@
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT
     vos_log_powersave_wow_add_ptrn_pkt_type *log_ptr = NULL;
+    WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_powersave_wow_add_ptrn_pkt_type, LOG_WLAN_POWERSAVE_WOW_ADD_PTRN_C);
 #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT
 
     pmcLog(pMac, LOG2, "PMC: entering pmcWowlAddBcastPattern");
@@ -2213,8 +2200,6 @@
     }
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT
-    WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_powersave_wow_add_ptrn_pkt_type,
-        LOG_WLAN_POWERSAVE_WOW_ADD_PTRN_C);
     if( log_ptr )
     {
        log_ptr->pattern_id = pattern->ucPatternId;
@@ -2231,9 +2216,9 @@
        /* 1 bit in the pattern mask denotes 1 byte of pattern hence pattern mask size is 1/8 */
        vos_mem_copy(log_ptr->pattern_mask, pattern->ucPatternMask,
                     SIR_WOWL_BCAST_PATTERN_MAX_SIZE >> 3);
-       WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
     }
 
+    WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
 #endif
 
 
@@ -2609,8 +2594,6 @@
     msg.type = WDA_SET_HOST_OFFLOAD;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
     if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_HOST_OFFLOAD message to WDA", __func__);
@@ -2664,8 +2647,6 @@
     msg.type = WDA_SET_KEEP_ALIVE;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
     if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
@@ -2718,8 +2699,6 @@
     msg.type = WDA_SET_NS_OFFLOAD;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
     if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post SIR_HAL_SET_HOST_OFFLOAD message to HAL", __func__);
@@ -2962,12 +2941,10 @@
 )
 {
     tpSirPNOScanReq pRequestBuf;
+    vos_msg_t msg;
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     tANI_U8 ucDot11Mode;
-    tSmeCmd *pCommand;
-    tANI_U8 *tmp = NULL;
-    tANI_U16 len = 0;
 
     if (NULL == pSession)
     {
@@ -2975,125 +2952,108 @@
                   "%s: pSession is NULL", __func__);
         return eHAL_STATUS_FAILURE;
     }
-
-    pCommand = csrGetCommandBuffer(pMac);
-    if(NULL == pCommand)
-    {
-        smsLog( pMac, LOGE, FL(" fail to get command buffer") );
-        return eHAL_STATUS_RESOURCES;
-    }
-    pRequestBuf = &(pCommand->u.pnoInfo);
-    vos_mem_copy(pRequestBuf, pRequest, sizeof(tSirPNOScanReq));
-    if (pRequestBuf->enable == 1)
-    {
-        if (pRequestBuf->ucNetworksCount == 0)
-        {
-            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                      FL("Network count is 0"));
-            csrReleaseCommand(pMac, pCommand);
-            return eHAL_STATUS_FAILURE;
-        }
-        /*Must translate the mode first*/
-        ucDot11Mode = (tANI_U8) csrTranslateToWNICfgDot11Mode(pMac,
-                                       csrFindBestPhyMode( pMac, pMac->roam.configParam.phyMode ));
-
-        if (pRequestBuf->us24GProbeTemplateLen ||
-                 pRequestBuf->us5GProbeTemplateLen)
-        {
-            tmp = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE);
-            if (tmp == NULL)
-            {
-                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                    FL("failed to allocate memory"));
-            }
-            /* Continue even mem alloc fails as driver can still go ahead
-             * without supplicant IE's in probe req.
-             */
-        }
-
-        if (NULL != tmp)
-        {
-            len = pRequestBuf->us24GProbeTemplateLen;
-            if (0 != len && len <= SIR_PNO_MAX_PB_REQ_SIZE)
-            {
-                vos_mem_copy(tmp, pRequestBuf->p24GProbeTemplate, len);
-            }
-        }
-
-        /*Prepare a probe request for 2.4GHz band and one for 5GHz band*/
-        if (eSIR_SUCCESS == pmcPrepareProbeReqTemplate(pMac, SIR_PNO_24G_DEFAULT_CH,
-                                  ucDot11Mode, pSession->selfMacAddr,
-                                  pRequestBuf->p24GProbeTemplate,
-                                  &pRequestBuf->us24GProbeTemplateLen))
-        {
-            /* Append IE passed by supplicant(if any) to probe request */
-            if ((0 < len) &&((pRequestBuf->us24GProbeTemplateLen + len)
-                              < SIR_PNO_MAX_PB_REQ_SIZE ))
-            {
-                vos_mem_copy((tANI_U8 *)&pRequestBuf->p24GProbeTemplate +
-                              pRequestBuf->us24GProbeTemplateLen,
-                              tmp,
-                              len);
-                pRequestBuf->us24GProbeTemplateLen += len;
-                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                     "%s: us24GProbeTemplateLen = %d", __func__,
-                      pRequestBuf->us24GProbeTemplateLen);
-            }
-            else
-            {
-                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                   "%s: Extra ie discarded on 2.4G, IE length = %d Max IE length is %d",
-                   __func__, pRequestBuf->us24GProbeTemplateLen, SIR_PNO_MAX_PB_REQ_SIZE);
-            }
-        }
-
-        len = 0;
-        if (NULL != tmp)
-        {
-            len = pRequestBuf->us5GProbeTemplateLen;
-            if (0 != len && len <= SIR_PNO_MAX_PB_REQ_SIZE)
-            {
-                vos_mem_copy(tmp, pRequestBuf->p5GProbeTemplate, len);
-            }
-        }
-
-        if (eSIR_SUCCESS == pmcPrepareProbeReqTemplate(pMac, SIR_PNO_5G_DEFAULT_CH,
-                                   ucDot11Mode, pSession->selfMacAddr,
-                                   pRequestBuf->p5GProbeTemplate,
-                                   &pRequestBuf->us5GProbeTemplateLen))
-        {
-            /* Append IE passed by supplicant(if any) to probe request */
-            if ((0 < len) &&((pRequestBuf->us5GProbeTemplateLen + len)
-                              < SIR_PNO_MAX_PB_REQ_SIZE))
-            {
-                vos_mem_copy((tANI_U8 *)&pRequestBuf->p5GProbeTemplate +
-                          pRequestBuf->us5GProbeTemplateLen,
-                          tmp,
-                          len);
-                pRequestBuf->us5GProbeTemplateLen += len;
-                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                    "%s: us5GProbeTemplateLen = %d", __func__,
-                     pRequestBuf->us5GProbeTemplateLen);
-            }
-            else
-            {
-                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                       "%s: Extra IE discarded on 5G, IE length = %d Max IE length is %d",
-                        __func__, pRequestBuf->us5GProbeTemplateLen, SIR_PNO_MAX_PB_REQ_SIZE);
-            }
-        }
-        if (NULL != tmp)
-            vos_mem_free(tmp);
-    }
-    pCommand->command = eSmeCommandPnoReq;
-    pCommand->sessionId = (tANI_U8)sessionId;
-
-    if (!HAL_STATUS_SUCCESS(csrQueueSmeCommand(pMac, pCommand,
-                                               !pRequestBuf->enable)))
+    VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+               "%s: SSID = 0x%08x%08x%08x%08x%08x%08x%08x%08x, "
+               "0x%08x%08x%08x%08x%08x%08x%08x%08x", __func__,
+               *((v_U32_t *) &pRequest->aNetworks[0].ssId.ssId[0]),
+               *((v_U32_t *) &pRequest->aNetworks[0].ssId.ssId[4]),
+               *((v_U32_t *) &pRequest->aNetworks[0].ssId.ssId[8]),
+               *((v_U32_t *) &pRequest->aNetworks[0].ssId.ssId[12]),
+               *((v_U32_t *) &pRequest->aNetworks[0].ssId.ssId[16]),
+               *((v_U32_t *) &pRequest->aNetworks[0].ssId.ssId[20]),
+               *((v_U32_t *) &pRequest->aNetworks[0].ssId.ssId[24]),
+               *((v_U32_t *) &pRequest->aNetworks[0].ssId.ssId[28]),
+               *((v_U32_t *) &pRequest->aNetworks[1].ssId.ssId[0]),
+               *((v_U32_t *) &pRequest->aNetworks[1].ssId.ssId[4]),
+               *((v_U32_t *) &pRequest->aNetworks[1].ssId.ssId[8]),
+               *((v_U32_t *) &pRequest->aNetworks[1].ssId.ssId[12]),
+               *((v_U32_t *) &pRequest->aNetworks[1].ssId.ssId[16]),
+               *((v_U32_t *) &pRequest->aNetworks[1].ssId.ssId[20]),
+               *((v_U32_t *) &pRequest->aNetworks[1].ssId.ssId[24]),
+               *((v_U32_t *) &pRequest->aNetworks[1].ssId.ssId[28]));
+    if (!pSession)
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                  FL("failed to post eSmeCommandPnoReq command"));
-        csrReleaseCommand(pMac, pCommand);
+            "%s: pSessionis NULL", __func__);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    pRequestBuf = vos_mem_malloc(sizeof(tSirPNOScanReq));
+    if (NULL == pRequestBuf)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for PNO request", __func__);
+        return eHAL_STATUS_FAILED_ALLOC;
+    }
+
+    vos_mem_copy(pRequestBuf, pRequest, sizeof(tSirPNOScanReq));
+
+    /*Must translate the mode first*/
+    ucDot11Mode = (tANI_U8) csrTranslateToWNICfgDot11Mode(pMac, 
+                                       csrFindBestPhyMode( pMac, pMac->roam.configParam.phyMode ));
+
+    /*Prepare a probe request for 2.4GHz band and one for 5GHz band*/
+    if (eSIR_SUCCESS == pmcPrepareProbeReqTemplate(pMac, SIR_PNO_24G_DEFAULT_CH,
+                              ucDot11Mode, pSession->selfMacAddr,
+                              pRequestBuf->p24GProbeTemplate,
+                              &pRequestBuf->us24GProbeTemplateLen))
+    {
+        /* Append IE passed by supplicant(if any) to probe request */
+        if ((0 < pRequest->us24GProbeTemplateLen) &&
+            ((pRequestBuf->us24GProbeTemplateLen +
+              pRequest->us24GProbeTemplateLen) < SIR_PNO_MAX_PB_REQ_SIZE ))
+        {
+            vos_mem_copy((tANI_U8 *)&pRequestBuf->p24GProbeTemplate +
+                          pRequestBuf->us24GProbeTemplateLen,
+                          (tANI_U8 *)&pRequest->p24GProbeTemplate,
+                          pRequest->us24GProbeTemplateLen);
+            pRequestBuf->us24GProbeTemplateLen +=
+                                                pRequest->us24GProbeTemplateLen;
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                   "%s: pRequest->us24GProbeTemplateLen = %d", __func__,
+                    pRequest->us24GProbeTemplateLen);
+        }
+        else
+        {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                   "%s: Extra ie discarded on 2.4G, IE length = %d Max IE length is %d",
+                   __func__, pRequest->us24GProbeTemplateLen, SIR_PNO_MAX_PB_REQ_SIZE);
+        }
+    }
+
+    if (eSIR_SUCCESS == pmcPrepareProbeReqTemplate(pMac, SIR_PNO_5G_DEFAULT_CH,
+                               ucDot11Mode, pSession->selfMacAddr,
+                               pRequestBuf->p5GProbeTemplate,
+                               &pRequestBuf->us5GProbeTemplateLen))
+    {
+        /* Append IE passed by supplicant(if any) to probe request */
+        if ((0 < pRequest->us5GProbeTemplateLen ) &&
+            ((pRequestBuf->us5GProbeTemplateLen +
+              pRequest->us5GProbeTemplateLen) < SIR_PNO_MAX_PB_REQ_SIZE ))
+        {
+            vos_mem_copy((tANI_U8 *)&pRequestBuf->p5GProbeTemplate +
+                          pRequestBuf->us5GProbeTemplateLen,
+                          (tANI_U8 *)&pRequest->p5GProbeTemplate,
+                          pRequest->us5GProbeTemplateLen);
+            pRequestBuf->us5GProbeTemplateLen += pRequest->us5GProbeTemplateLen;
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                    "%s: pRequestBuf->us5GProbeTemplateLen = %d", __func__,
+                     pRequest->us5GProbeTemplateLen);
+        }
+        else
+        {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                   "%s: Extra IE discarded on 5G, IE length = %d Max IE length is %d",
+                    __func__, pRequest->us5GProbeTemplateLen, SIR_PNO_MAX_PB_REQ_SIZE);
+        }
+    }
+
+    msg.type     = WDA_SET_PNO_REQ;
+    msg.reserved = 0;
+    msg.bodyptr  = pRequestBuf;
+    if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_PNO_REQ message to WDA", __func__);
+        vos_mem_free(pRequestBuf);
         return eHAL_STATUS_FAILURE;
     }
 
@@ -3125,8 +3085,6 @@
     msg.type = WDA_SET_RSSI_FILTER_REQ;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
     if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_PNO_REQ message to WDA", __func__);
@@ -3178,8 +3136,6 @@
     msg.type = WDA_UPDATE_SCAN_PARAMS_REQ;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
     if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_UPDATE_SCAN_PARAMS message to WDA", __func__);
@@ -3219,8 +3175,6 @@
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
     if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_POWER_PARAMS_REQ message to WDA", __func__);
@@ -3284,8 +3238,6 @@
     pMac->pmc.FilterMatchCountCB = callbackRoutine;
     pMac->pmc.FilterMatchCountCBContext = callbackContext;
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
     if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
@@ -3343,8 +3295,6 @@
     msg.type = WDA_GTK_OFFLOAD_REQ;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
     if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
@@ -3410,8 +3360,6 @@
     pMac->pmc.GtkOffloadGetInfoCB = callbackRoutine;
     pMac->pmc.GtkOffloadGetInfoCBContext = callbackContext;
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
     if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_GTK_OFFLOAD_GETINFO_REQ message to WDA", 
@@ -3484,8 +3432,6 @@
     msg.type     = WDA_SET_BATCH_SCAN_REQ;
     msg.reserved = 0;
     msg.bodyptr  = pRequestBuf;
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
     if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
@@ -3538,8 +3484,6 @@
     msg.type     = WDA_TRIGGER_BATCH_SCAN_RESULT_IND;
     msg.reserved = 0;
     msg.bodyptr  = pRequestBuf;
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
     if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
@@ -3581,8 +3525,6 @@
     msg.type     = WDA_STOP_BATCH_SCAN_IND;
     msg.reserved = 0;
     msg.bodyptr  = pRequestBuf;
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
     if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
diff --git a/wlan/prima/CORE/SME/src/pmc/pmcLogDump.c b/wlan/prima/CORE/SME/src/pmc/pmcLogDump.c
index c8c222f..ea3043e 100644
--- a/wlan/prima/CORE/SME/src/pmc/pmcLogDump.c
+++ b/wlan/prima/CORE/SME/src/pmc/pmcLogDump.c
@@ -31,6 +31,9 @@
 *
 * Description: Implements the dump commands specific to PMC module
 *
+* Copyright 2008 (c) Qualcomm, Incorporated.
+* All Rights Reserved.
+* Qualcomm Confidential and Proprietary.
 *
 ******************************************************************************/
 
diff --git a/wlan/prima/CORE/SME/src/rrm/sme_rrm.c b/wlan/prima/CORE/SME/src/rrm/sme_rrm.c
index af18b4f..33996fc 100644
--- a/wlan/prima/CORE/SME/src/rrm/sme_rrm.c
+++ b/wlan/prima/CORE/SME/src/rrm/sme_rrm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -31,6 +31,9 @@
   
   \brief implementation for SME RRM APIs
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -75,9 +78,6 @@
 #ifdef FEATURE_WLAN_ESE
 #define RRM_ROAM_SCORE_NEIGHBOR_IAPP_LIST                       30
 #endif
-
-v_TIME_t RRM_scan_timer;
-
 /**---------------------------------------------------------------------------
   
   \brief rrmLLPurgeNeighborCache() - 
@@ -230,8 +230,6 @@
                                             ie_len+sizeof(tSirBssDescription));
                if (NULL == pBeaconRep->pBssDescription[msgCounter])
                    break;
-               vos_mem_zero(pBeaconRep->pBssDescription[msgCounter],
-                            ie_len+sizeof(tSirBssDescription));
                vos_mem_copy( pBeaconRep->pBssDescription[msgCounter],
                              pBssDesc,
                              sizeof(tSirBssDescription) );
@@ -470,7 +468,6 @@
    tANI_U8 counter=0;
    tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
    tANI_U32 sessionId;
-   tCsrRoamInfo *roam_info;
 
 #if defined WLAN_VOWIFI_DEBUG
    smsLog( pMac, LOGE, "Send scan result to PE ");
@@ -521,8 +518,6 @@
 #endif
    }
 
-   smsLog(pMac, LOG1, FL("RRM Measurement Done %d"), measurementDone);
-
    if (NULL == pResult)
    {
       // no scan results
@@ -578,59 +573,32 @@
    while (pScanResult)
    {
       pNextResult = sme_ScanResultGetNext(pMac, pResult);
-      smsLog(pMac, LOG1, "Scan res timer:%lu, rrm scan timer:%lu",
-             pScanResult->timer, RRM_scan_timer);
-      if (pScanResult->timer >= RRM_scan_timer) {
-          roam_info = vos_mem_malloc(sizeof(*roam_info));
-          if (NULL == roam_info) {
-              smsLog(pMac, LOGW, FL("vos_mem_malloc failed:"));
-              status =  eHAL_STATUS_FAILED_ALLOC;
-              goto rrm_send_scan_results_done;
-          }
-          vos_mem_zero(roam_info, sizeof(*roam_info));
-          roam_info->pBssDesc = &pScanResult->BssDescriptor;
-          csrRoamCallCallback(pMac, sessionId, roam_info, 0,
-                           eCSR_ROAM_UPDATE_SCAN_RESULT, eCSR_ROAM_RESULT_NONE);
-          vos_mem_free(roam_info);
-          pScanResultsArr[counter++] = pScanResult;
-      }
+      pScanResultsArr[counter++] = pScanResult;
       pScanResult = pNextResult; //sme_ScanResultGetNext(hHal, pResult);
       if (counter >= SIR_BCN_REPORT_MAX_BSS_DESC)
          break;
       }
 
-   smsLog(pMac, LOG1, " Number of BSS Desc with RRM Scan %d ", counter);
-   /*
-    * The beacon report should be sent whether the counter is zero or non-zero.
-    * There might be a few scan results in the cache but not actually are a
-    * result of this scan. During that scenario, the counter will be zero.
-    * The report should be sent and LIM will further cleanup the RRM to
-    * accept the further incoming requests
-    * In case the counter is Zero, the pScanResultsArr will be NULL.
-    * The next level routine does a check for the measurementDone to determine
-    * whether to send a report or not.
-    */
-
-   if (counter || measurementDone) {
+   if (counter)
+   {
+          smsLog(pMac, LOG1, " Number of BSS Desc with RRM Scan %d ", counter);
 #if defined(FEATURE_WLAN_ESE_UPLOAD)
-       if (eRRM_MSG_SOURCE_ESE_UPLOAD == pSmeRrmContext->msgSource)
-       {
-           status = sme_EseSendBeaconReqScanResults(pMac,
+         if (eRRM_MSG_SOURCE_ESE_UPLOAD == pSmeRrmContext->msgSource)
+         {
+             status = sme_EseSendBeaconReqScanResults(pMac,
                                                 sessionId,
                                                 chanList[0],
                                                 pScanResultsArr,
                                                 measurementDone,
                                                 counter);
-       }
-       else
+         }
+         else
 #endif /*FEATURE_WLAN_ESE_UPLOAD*/
-           status = sme_RrmSendBeaconReportXmitInd( pMac,
+             status = sme_RrmSendBeaconReportXmitInd( pMac,
                                                 pScanResultsArr,
                                                 measurementDone,
                                                 counter);
    }
-
-rrm_send_scan_results_done:
    sme_ScanResultPurge(pMac, pResult); 
 
    return status;
@@ -771,8 +739,6 @@
                scanRequest.scanType,
                scanRequest.maxChnTime );
 
-       RRM_scan_timer = vos_timer_get_system_time();
-
 #if defined WLAN_VOWIFI_DEBUG
        smsLog( pMac, LOGE, "For Duration %d ", scanRequest.maxChnTime );
 #endif
@@ -804,11 +770,6 @@
    }
    else if (2 == scanType)  /* beacon table */
    {
-       /*In beacon table mode, scan results are taken directly from scan cache
-         without issuing any scan request. So, it is not proper to update
-         RRM_scan_timer with latest time and hence made it to zero to satisfy
-         pScanResult->timer >= RRM_scan_timer */
-       RRM_scan_timer = 0;
        if ((pSmeRrmContext->currentIndex + 1) < pSmeRrmContext->channelList.numOfChannels)
        {
            sme_RrmSendScanResult( pMac, 1, &pSmeRrmContext->channelList.ChannelList[pSmeRrmContext->currentIndex], false );
diff --git a/wlan/prima/CORE/SME/src/sme_common/sme_Api.c b/wlan/prima/CORE/SME/src/sme_common/sme_Api.c
index 182040c..0a498fc 100644
--- a/wlan/prima/CORE/SME/src/sme_common/sme_Api.c
+++ b/wlan/prima/CORE/SME/src/sme_common/sme_Api.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -34,6 +34,9 @@
 
   \brief Definitions for SME APIs
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -72,7 +75,10 @@
 #include "vos_trace.h"
 #include "sapApi.h"
 #include "macTrace.h"
+
+#ifdef DEBUG_ROAM_DELAY
 #include "vos_utils.h"
+#endif
 
 extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
 
@@ -92,6 +98,7 @@
 extern void csrReleaseRocReqCommand( tpAniSirGlobal pMac);
 extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
 extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
+extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
 extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
 extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
 extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
@@ -183,14 +190,9 @@
                                              &pMac->sme.smeCmdFreeList)))
        goto end;
 
-    pCmd = (tSmeCmd *) vos_mem_vmalloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
+    pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
     if ( NULL == pCmd )
-    {
-       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                 FL("fail to allocate memory %lu"),
-                    (unsigned long)(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd));
        status = eHAL_STATUS_FAILURE;
-    }
     else
     {
        status = eHAL_STATUS_SUCCESS;
@@ -270,7 +272,7 @@
 }
 
 void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
-        tDblLinkList *pList, bool flush_all)
+        tDblLinkList *pList)
 {
     //release any out standing commands back to free command list
     tListElem *pEntry, *pNext;
@@ -290,12 +292,6 @@
     {
         pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
         pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
-        if (!flush_all &&
-            csr_is_disconnect_full_power_cmd(pCommand)) {
-            smsLog(pMac, LOGW, FL(" Ignore disconnect"));
-            pEntry = pNext;
-            continue;
-        }
         if(pCommand->sessionId == sessionId)
         {
             if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
@@ -342,7 +338,7 @@
 
     if(NULL != pMac->sme.pSmeCmdBufAddr)
     {
-        vos_mem_vfree(pMac->sme.pSmeCmdBufAddr);
+        vos_mem_free(pMac->sme.pSmeCmdBufAddr);
         pMac->sme.pSmeCmdBufAddr = NULL;
     }
 
@@ -406,8 +402,7 @@
         /* reset when free list is available */
             smeCommandQueueFull = 0;
     }
-    else
-    {
+    else {
         int idx = 1;
 
         //Cannot change pRetCmd here since it needs to return later.
@@ -445,52 +440,22 @@
             }
             pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
         }
+        /* Increament static variable so that it prints pending command only once*/
+        smeCommandQueueFull++;
         csrLLUnlock(&pMac->sme.smeCmdPendingList);
 
-        idx = 1;
         //There may be some more command in CSR's own pending queue
         csrLLLock(&pMac->roam.roamCmdPendingList);
         pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
-        while(pEntry && !smeCommandQueueFull)
+        while(pEntry)
         {
             pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
-            /* Print only 1st five commands from CSR pending queue */
-            if (idx <= 5)
-                smsLog( pMac, LOGE,
-                       "Out of command buffer...CSR pending command #%d (0x%X)",
-                        idx, pTempCmd->command );
-            idx++;
+            smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
+                    idx++, pTempCmd->command );
             dumpCsrCommandInfo(pMac, pTempCmd);
             pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
         }
-        /*
-         * Increament static variable so that it prints pending command
-         * only once
-         */
-        smeCommandQueueFull++;
         csrLLUnlock(&pMac->roam.roamCmdPendingList);
-
-        vos_state_info_dump_all();
-
-        if (pMac->roam.configParam.enableFatalEvent)
-        {
-            vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                    WLAN_LOG_INDICATOR_HOST_DRIVER,
-                    WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF,
-                    FALSE, FALSE);
-        }
-        else
-        {
-           /* Trigger SSR */
-           vos_wlanRestart();
-        }
-    }
-
-    if( pRetCmd )
-    {
-         vos_mem_set((tANI_U8 *)&pRetCmd->command, sizeof(pRetCmd->command), 0);
-         vos_mem_set((tANI_U8 *)&pRetCmd->sessionId, sizeof(pRetCmd->sessionId), 0);
-         vos_mem_set((tANI_U8 *)&pRetCmd->u, sizeof(pRetCmd->u), 0);
     }
 
     return( pRetCmd );
@@ -731,102 +696,6 @@
     return status;
 }
 
-eHalStatus smeProcessPnoCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
-{
-    tpSirPNOScanReq pnoReqBuf;
-    tSirMsgQ msgQ;
-
-    pnoReqBuf = vos_mem_malloc(sizeof(tSirPNOScanReq));
-    if ( NULL == pnoReqBuf )
-    {
-        smsLog(pMac, LOGE, FL("failed to allocate memory"));
-        return eHAL_STATUS_FAILURE;
-    }
-
-    vos_mem_copy(pnoReqBuf, &(pCmd->u.pnoInfo), sizeof(tSirPNOScanReq));
-
-    smsLog(pMac, LOG1, FL("post WDA_SET_PNO_REQ comamnd"));
-    msgQ.type = WDA_SET_PNO_REQ;
-    msgQ.reserved = 0;
-    msgQ.bodyptr = pnoReqBuf;
-    msgQ.bodyval = 0;
-    wdaPostCtrlMsg( pMac, &msgQ);
-
-    return eHAL_STATUS_SUCCESS;
-}
-
-/**
- * sme_process_set_max_tx_power() - Set the Maximum Transmit Power
- *
- * @pMac: mac pointer.
- * @command: cmd param containing bssid, self mac
- *           and power in db
- *
- * Set the maximum transmit power dynamically.
- *
- * Return: eHalStatus
- *
- */
-eHalStatus sme_process_set_max_tx_power(tpAniSirGlobal pMac,
-                                    tSmeCmd *command)
-{
-   vos_msg_t msg;
-   tMaxTxPowerParams *max_tx_params = NULL;
-
-   max_tx_params = vos_mem_malloc(sizeof(*max_tx_params));
-   if (NULL == max_tx_params)
-   {
-       smsLog(pMac, LOGE, FL("fail to allocate memory for max_tx_params"));
-       return eHAL_STATUS_FAILURE;
-   }
-
-   vos_mem_copy(max_tx_params->bssId,
-     command->u.set_tx_max_pwr.bssid, SIR_MAC_ADDR_LENGTH);
-   vos_mem_copy(max_tx_params->selfStaMacAddr,
-     command->u.set_tx_max_pwr.self_sta_mac_addr,
-                 SIR_MAC_ADDR_LENGTH);
-   max_tx_params->power =
-              command->u.set_tx_max_pwr.power;
-
-   msg.type = WDA_SET_MAX_TX_POWER_REQ;
-   msg.reserved = 0;
-   msg.bodyptr = max_tx_params;
-
-   if(VOS_STATUS_SUCCESS !=
-        vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
-   {
-       smsLog(pMac, LOGE,
-        FL("Not able to post WDA_SET_MAX_TX_POWER_REQ message to WDA"));
-       vos_mem_free(max_tx_params);
-       return eHAL_STATUS_FAILURE;
-   }
-   return eHAL_STATUS_SUCCESS;
-}
-
-static void smeProcessNanReq(tpAniSirGlobal pMac, tSmeCmd *pCommand )
-{
-    tSirMsgQ msgQ;
-    tSirRetStatus   retCode = eSIR_SUCCESS;
-
-    msgQ.type = WDA_NAN_REQUEST;
-    msgQ.reserved = 0;
-    msgQ.bodyptr = pCommand->u.pNanReq;
-    msgQ.bodyval = 0;
-
-    retCode = wdaPostCtrlMsg( pMac, &msgQ );
-    if( eSIR_SUCCESS != retCode)
-    {
-        vos_mem_free(pCommand->u.pNanReq);
-        smsLog( pMac, LOGE,
-                FL("Posting WDA_NAN_REQUEST to WDA failed, reason=%X"),
-                retCode );
-    }
-    else
-    {
-        smsLog(pMac, LOG1, FL("posted WDA_NAN_REQUEST command"));
-    }
-}
-
 tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
 {
     tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
@@ -921,14 +790,8 @@
                     status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
                     if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
                     {
-                        /* Set the time out to 30 sec */
-                        pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
-                                          CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
                         //Force this command to wake up the chip
                         csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
-                        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                               TRACE_CODE_SME_COMMAND,pPmcCmd->sessionId,
-                               pPmcCmd->command));
                         csrLLUnlock( &pMac->sme.smeCmdActiveList );
                         fContinue = pmcProcessCommand( pMac, pPmcCmd );
                         if( fContinue )
@@ -953,24 +816,6 @@
                 {
                     // we can reuse the pCommand
 
-                    /* For ROC set timeot to 30 *3 as Supplicant can retry
-                     * P2P Invitation Request 120 times with 500ms interval.
-                     * For roam command set timeout to 30 * 2 sec.
-                     * There are cases where we try to connect to different
-                     * APs with same SSID one by one until sucessfully conneted
-                     * and thus roam command might take more time if connection
-                     * is rejected by too many APs.
-                     */
-                    if (eSmeCommandRemainOnChannel == pCommand->command)
-                        pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
-                                         CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE * 3;
-                    else if ((eSmeCommandRoam == pCommand->command) &&
-                        (eCsrHddIssued == pCommand->u.roamCmd.roamReason))
-                        pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
-                                         CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE * 2;
-                    else
-                        pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
-                                             CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
                     // Insert the command onto the ActiveList...
                     csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
 
@@ -1048,44 +893,6 @@
                             csrLLUnlock( &pMac->sme.smeCmdActiveList );
                             csrProcessDelStaSessionCommand( pMac, pCommand );
                             break;
-                        case eSmeCommandMacSpoofRequest:
-                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
-                            csrProcessMacAddrSpoofCommand( pMac, pCommand );
-                            //We need to re-run the command
-                            fContinue = eANI_BOOLEAN_TRUE;
-
-                            // No Rsp expected, free cmd from active list
-                            if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
-                                        &pCommand->Link, LL_ACCESS_LOCK ) )
-                            {
-                               csrReleaseCommand( pMac, pCommand );
-                            }
-
-                            break;
-                        case eSmeCommandGetFrameLogRequest:
-                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
-                            csrProcessGetFrameLogCommand( pMac, pCommand );
-                            //We need to re-run the command
-                            fContinue = eANI_BOOLEAN_TRUE;
-                            // No Rsp expected, free cmd from active list
-                            if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
-                                        &pCommand->Link, LL_ACCESS_LOCK ) )
-                            {
-                               csrReleaseCommand( pMac, pCommand );
-                            }
-                            break;
-                        case eSmeCommandSetMaxTxPower:
-                            csrLLUnlock(&pMac->sme.smeCmdActiveList);
-                            sme_process_set_max_tx_power(pMac, pCommand);
-                            /* We need to re-run the command */
-                            fContinue = eANI_BOOLEAN_TRUE;
-                            /* No Rsp expected, free cmd from active list */
-                            if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
-                                        &pCommand->Link, LL_ACCESS_LOCK))
-                            {
-                               csrReleaseCommand(pMac, pCommand);
-                            }
-                            break;
 
 #ifdef FEATURE_OEM_DATA_SUPPORT
                         case eSmeCommandOemDataReq:
@@ -1188,22 +995,7 @@
                                 }
                             }
                             break;
-                        case eSmeCommandPnoReq:
-                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
-                            status = smeProcessPnoCommand(pMac, pCommand);
-                            if (!HAL_STATUS_SUCCESS(status)){
-                                smsLog(pMac, LOGE,
-                                  FL("failed to post SME PNO SCAN %d"), status);
-                            }
-                            //We need to re-run the command
-                            fContinue = eANI_BOOLEAN_TRUE;
 
-                            if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
-                                              &pCommand->Link, LL_ACCESS_LOCK))
-                            {
-                                csrReleaseCommand(pMac, pCommand);
-                            }
-                            break;
                         case eSmeCommandAddTs:
                         case eSmeCommandDelTs:
                             csrLLUnlock( &pMac->sme.smeCmdActiveList );
@@ -1228,31 +1020,22 @@
                         case eSmeCommandTdlsDelPeer:
                         case eSmeCommandTdlsLinkEstablish:
                         case eSmeCommandTdlsChannelSwitch: // tdlsoffchan
-                            smsLog(pMac, LOG1,
-                                  FL("sending TDLS Command 0x%x to PE"),
-                                  pCommand->command);
-                            csrLLUnlock(&pMac->sme.smeCmdActiveList);
-                            status = csrTdlsProcessCmd(pMac, pCommand);
-                            if(!HAL_STATUS_SUCCESS(status))
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+                        case eSmeCommandTdlsDiscovery:
+                        case eSmeCommandTdlsLinkSetup:
+                        case eSmeCommandTdlsLinkTear:
+                        case eSmeCommandTdlsEnterUapsd:
+                        case eSmeCommandTdlsExitUapsd:
+#endif
                             {
-                                if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
-                                        &pCommand->Link, LL_ACCESS_LOCK))
-                                 csrReleaseCommand(pMac, pCommand);
+                                VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                                        "sending TDLS Command 0x%x to PE", pCommand->command);
+
+                                csrLLUnlock( &pMac->sme.smeCmdActiveList );
+                                status = csrTdlsProcessCmd( pMac, pCommand );
                             }
                             break ;
 #endif
-                        case eSmeCommandNanReq:
-                            csrLLUnlock( &pMac->sme.smeCmdActiveList );
-                            smeProcessNanReq( pMac, pCommand );
-                            if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
-                                              &pCommand->Link, LL_ACCESS_LOCK))
-                            {
-                                csrReleaseCommand(pMac, pCommand);
-                            }
-                            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                                    "eSmeCommandNanReq processed");
-                            fContinue = eANI_BOOLEAN_TRUE;
-                            break;
 
                         default:
                             //something is wrong
@@ -1439,7 +1222,6 @@
 #endif
       sme_p2pOpen(pMac);
       smeTraceInit(pMac);
-      sme_register_debug_callback();
 
    }while (0);
 
@@ -1651,6 +1433,16 @@
    /* update the directed scan offload setting */
    pMac->fScanOffload = pSmeConfigParams->fScanOffload;
 
+   /* Enable channel bonding mode in 2.4GHz */
+   if ((pSmeConfigParams->csrConfig.channelBondingMode24GHz == TRUE) &&
+       (IS_HT40_OBSS_SCAN_FEATURE_ENABLE))
+   {
+      ccmCfgSetInt(hHal,WNI_CFG_CHANNEL_BONDING_24G,
+                 eANI_BOOLEAN_TRUE, NULL,eANI_BOOLEAN_FALSE);
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
+                   "Setting channelBondingMode24GHz:%d " ,
+                pSmeConfigParams->csrConfig.channelBondingMode24GHz);
+   }
    if (pMac->fScanOffload)
    {
        /* If scan offload is enabled then lim has allow the sending of
@@ -1836,61 +1628,6 @@
    return status;
 }
 
-/**
- * sme_set_allowed_action_frames() - Set allowed action frames to FW
- *
- * @hal: Handler to HAL
- *
- * This function conveys the list of action frames that needs to be forwarded
- * to driver by FW. Rest of the action frames can be dropped in FW.Bitmask is
- * set with ALLOWED_ACTION_FRAMES_BITMAP
- *
- * Return: None
- */
-static void sme_set_allowed_action_frames(tHalHandle hal)
-{
-    eHalStatus status;
-    tpAniSirGlobal mac = PMAC_STRUCT(hal);
-    vos_msg_t vos_message;
-    VOS_STATUS vos_status;
-    struct sir_allowed_action_frames *sir_allowed_action_frames;
-
-    sir_allowed_action_frames =
-                         vos_mem_malloc(sizeof(*sir_allowed_action_frames));
-    if (!sir_allowed_action_frames) {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                    "Not able to allocate memory for WDA_SET_ALLOWED_ACTION_FRAMES_IND");
-        return;
-    }
-
-    vos_mem_zero(sir_allowed_action_frames, sizeof(*sir_allowed_action_frames));
-    sir_allowed_action_frames->bitmask = ALLOWED_ACTION_FRAMES_BITMAP;
-    sir_allowed_action_frames->reserved = 0;
-
-    status = sme_AcquireGlobalLock(&mac->sme);
-    if (status == eHAL_STATUS_SUCCESS) {
-           /* serialize the req through MC thread */
-        vos_message.bodyptr = sir_allowed_action_frames;
-        vos_message.type = WDA_SET_ALLOWED_ACTION_FRAMES_IND;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                    TRACE_CODE_SME_TX_WDA_MSG,
-                    NO_SESSION, vos_message.type));
-        vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &vos_message);
-        if (!VOS_IS_STATUS_SUCCESS(vos_status)) {
-              VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                         "Not able to post WDA_SET_ALLOWED_ACTION_FRAMES_IND message to HAL");
-              vos_mem_free(sir_allowed_action_frames);
-        }
-
-        sme_ReleaseGlobalLock( &mac->sme );
-    } else {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-                    "sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(sir_allowed_action_frames);
-    }
-    return;
-}
-
 /*--------------------------------------------------------------------------
 
   \brief sme_Start() - Put all SME modules at ready state.
@@ -1936,8 +1673,6 @@
       pMac->sme.state = SME_STATE_START;
    }while (0);
 
-   sme_set_allowed_action_frames(hHal);
-
    return status;
 }
 
@@ -2017,42 +1752,6 @@
 }
 #endif
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-/* ---------------------------------------------------------------------------
-    \fn sme_HT2040CoexInfoInd
-    \brief a Send 20/40 Coex info to SAP layer
-
-    \param tpSirHT2040CoexInfoInd - 20/40 Coex info param
-    \return eHalStatus
-  ---------------------------------------------------------------------------*/
-
-eHalStatus sme_HT2040CoexInfoInd( tHalHandle hHal,
-                  tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-    eHalStatus  status = eHAL_STATUS_SUCCESS;
-    tANI_U32 SessionId = pSmeHT2040CoexInfoInd->sessionId;
-    tCsrRoamInfo roamInfo = {0};
-
-    roamInfo.pSmeHT2040CoexInfoInd = pSmeHT2040CoexInfoInd;
-
-    smsLog(pMac, LOGW, FL("HT40MHzIntolerant: %d HT20MHzBssWidthReq: %d"),
-                   roamInfo.pSmeHT2040CoexInfoInd->HT40MHzIntolerant,
-                   roamInfo.pSmeHT2040CoexInfoInd->HT20MHzBssWidthReq);
-
-    smsLog(pMac, LOGW, FL("Total Intolerant Channel: %d"),
-                   roamInfo.pSmeHT2040CoexInfoInd->channel_num);
-
-    /* forward the 20/40 BSS Coex information to HDD */
-    smsLog(pMac, LOGW, FL("Sending eCSR_ROAM_2040_COEX_INFO_IND"
-                          " to  WLANSAP_RoamCallback "));
-
-    csrRoamCallCallback(pMac, SessionId, &roamInfo,
-                        0, eCSR_ROAM_2040_COEX_INFO_IND, 0);
-    return status;
-}
-#endif
-
 #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
 /*------------------------------------------------------------------
  *
@@ -2150,38 +1849,12 @@
    }
 
    sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
-   vos_mem_free(pSmeBcnReportReq);
    return status;
 }
 
 #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
 
 
-#ifdef WLAN_FEATURE_RMC
-eHalStatus sme_IbssPeerInfoResponseHandleer( tHalHandle hHal,
-                                      tpSirIbssGetPeerInfoRspParams pIbssPeerInfoParams)
-{
-   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-
-   if (NULL == pMac)
-   {
-       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
-           "%s: pMac is null", __func__);
-       return eHAL_STATUS_FAILURE;
-   }
-   if (pMac->sme.peerInfoParams.peerInfoCbk == NULL)
-   {
-       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-           "%s: HDD callback is null", __func__);
-       return eHAL_STATUS_FAILURE;
-   }
-   pMac->sme.peerInfoParams.peerInfoCbk(pMac->sme.peerInfoParams.pUserData,
-                                        &pIbssPeerInfoParams->ibssPeerInfoRspParams);
-   return eHAL_STATUS_SUCCESS;
-}
-#endif /* WLAN_FEATURE_RMC */
-
-
 /* ---------------------------------------------------------------------------
     \fn sme_getBcnMissRate
     \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
@@ -2227,8 +1900,6 @@
         vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
         vosMessage.bodyptr = pMsg;
         vosMessage.reserved = 0;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                  TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
         vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
         if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
         {
@@ -2244,42 +1915,6 @@
     return eHAL_STATUS_FAILURE;
 }
 
-eHalStatus sme_EncryptMsgResponseHandler(tHalHandle hHal,
-                                      tpSirEncryptedDataRspParams pEncRspParams)
-{
-   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-
-   if (NULL == pMac)
-   {
-       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
-           "%s: pMac is null", __func__);
-       return eHAL_STATUS_FAILURE;
-   }
-   if (pMac->sme.pEncMsgInfoParams.pEncMsgCbk == NULL)
-   {
-       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-           "%s: HDD callback is null", __func__);
-       return eHAL_STATUS_FAILURE;
-   }
-   pMac->sme.pEncMsgInfoParams.pEncMsgCbk(pMac->sme.pEncMsgInfoParams.pUserData,
-                                        &pEncRspParams->encryptedDataRsp);
-   return eHAL_STATUS_SUCCESS;
-}
-
-eHalStatus sme_UpdateMaxRateInd(tHalHandle hHal,
-                                tSirSmeUpdateMaxRateParams *pSmeUpdateMaxRateParams)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-    eHalStatus     status = eHAL_STATUS_SUCCESS;
-    tANI_U8        sessionId = pSmeUpdateMaxRateParams->smeSessionId;
-
-    /* forward the information to HDD */
-    status = csrRoamCallCallback(pMac, sessionId, NULL, 0,
-                                 eCSR_ROAM_UPDATE_MAX_RATE_IND,
-                                 pSmeUpdateMaxRateParams->maxRateFlag);
-    return status;
-}
-
 /*--------------------------------------------------------------------------
 
   \brief sme_ProcessMsg() - The main message processor for SME.
@@ -2445,19 +2080,17 @@
                     smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RDY_IND), nothing to process");
                 }
                 break;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-           case eWNI_SME_2040_COEX_IND:
+           case eWNI_SME_MGMT_FRM_IND:
                 if(pMsg->bodyptr)
                 {
-                    sme_HT2040CoexInfoInd(pMac, pMsg->bodyptr);
+                    sme_mgmtFrmInd(pMac, pMsg->bodyptr);
                     vos_mem_free(pMsg->bodyptr);
                 }
                 else
                 {
-                    smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_2040_COEX_IND), nothing to process");
+                    smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
                 }
                 break;
-#endif
            case eWNI_SME_ACTION_FRAME_SEND_CNF:
                 if(pMsg->bodyptr)
                 {
@@ -2470,8 +2103,6 @@
                 }
                 break;
           case eWNI_SME_COEX_IND:
-                MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                       TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
                 if(pMsg->bodyptr)
                 {
                    tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg->bodyptr;
@@ -2500,8 +2131,6 @@
 
 #ifdef FEATURE_WLAN_SCAN_PNO
           case eWNI_SME_PREF_NETWORK_FOUND_IND:
-                MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                       TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
                 if(pMsg->bodyptr)
                 {
                    status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
@@ -2515,8 +2144,6 @@
 #endif // FEATURE_WLAN_SCAN_PNO
 
           case eWNI_SME_TX_PER_HIT_IND:
-                MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                       TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
                 if (pMac->sme.pTxPerHitCallback)
                 {
                    pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
@@ -2549,8 +2176,6 @@
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
           case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
-                MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                       TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
                 if(pMsg->bodyptr)
                 {
                    status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
@@ -2577,8 +2202,6 @@
 
 #ifdef WLAN_WAKEUP_EVENTS
           case eWNI_SME_WAKE_REASON_IND:
-                MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                       TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
                 if(pMsg->bodyptr)
                 {
                    status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
@@ -2604,7 +2227,17 @@
           case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
           case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
           case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP:
-               {
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+          case eWNI_SME_TDLS_DISCOVERY_START_RSP:
+          case eWNI_SME_TDLS_DISCOVERY_START_IND:
+          case eWNI_SME_TDLS_LINK_START_RSP:
+          case eWNI_SME_TDLS_LINK_START_IND:
+          case eWNI_SME_TDLS_TEARDOWN_RSP:
+          case eWNI_SME_TDLS_TEARDOWN_IND:
+          case eWNI_SME_ADD_TDLS_PEER_IND:
+          case eWNI_SME_DELETE_TDLS_PEER_IND:
+#endif
+                {
                     if (pMsg->bodyptr)
                     {
                         status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
@@ -2655,8 +2288,6 @@
 
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
            case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
-                MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                       TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
                 if (pMsg->bodyptr)
                 {
                     sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
@@ -2674,8 +2305,6 @@
 #ifdef FEATURE_WLAN_LPHB
           /* LPHB timeout indication arrived, send IND to client */
           case eWNI_SME_LPHB_IND:
-                MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                       TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
                 if (pMac->sme.pLphbIndCb)
                 {
                    pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
@@ -2685,30 +2314,9 @@
                 break;
 #endif /* FEATURE_WLAN_LPHB */
 
-#ifdef WLAN_FEATURE_RMC
-          case eWNI_SME_IBSS_PEER_INFO_RSP:
-              MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                       TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
-              if (pMsg->bodyptr)
-              {
-                  sme_IbssPeerInfoResponseHandleer(pMac, pMsg->bodyptr);
-                  vos_mem_free(pMsg->bodyptr);
-              }
-              else
-              {
-                  smsLog(pMac, LOGE,
-                         "Empty rsp message for (eWNI_SME_IBSS_PEER_INFO_RSP),"
-                         " nothing to process");
-              }
-              break ;
-
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_CH_AVOID
           /* LPHB timeout indication arrived, send IND to client */
           case eWNI_SME_CH_AVOID_IND:
-                MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                       TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
                 if (pMac->sme.pChAvoidNotificationCb)
                 {
                    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
@@ -2720,52 +2328,6 @@
                 break;
 #endif /* FEATURE_WLAN_CH_AVOID */
 
-          case eWNI_SME_ENCRYPT_MSG_RSP:
-              MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                     TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
-              if (pMsg->bodyptr)
-              {
-                  sme_EncryptMsgResponseHandler(pMac, pMsg->bodyptr);
-                  vos_mem_free(pMsg->bodyptr);
-              }
-              else
-              {
-                  smsLog(pMac, LOGE,
-                         "Empty rsp message for (eWNI_SME_ENCRYPT_MSG_RSP),"
-                         " nothing to process");
-              }
-              break ;
-
-          case eWNI_SME_UPDATE_MAX_RATE_IND:
-              if (pMsg->bodyptr)
-              {
-                  sme_UpdateMaxRateInd(pMac, pMsg->bodyptr);
-                  vos_mem_free(pMsg->bodyptr);
-              }
-              else
-              {
-                  smsLog(pMac, LOGE,
-                         "Empty message for (eWNI_SME_UPDATE_MAX_RATE_IND),"
-                         " nothing to process");
-              }
-              break;
-
-          case eWNI_SME_NAN_EVENT:
-              MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                     TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
-              if (pMsg->bodyptr)
-              {
-                  sme_NanEvent(hHal, pMsg->bodyptr);
-                  vos_mem_free(pMsg->bodyptr);
-              }
-              else
-              {
-                  smsLog(pMac, LOGE,
-                          "Empty message for (eWNI_SME_NAN_EVENT),"
-                          " nothing to process");
-              }
-              break;
-
           default:
 
              if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
@@ -2996,19 +2558,6 @@
 
    return status;
 }
-
-v_VOID_t sme_PreClose(tHalHandle hHal)
-{
-   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-
-   if(!pMac)
-       return;
-
-   smsLog(pMac, LOGW, FL("Stopping Active CMD List Timer"));
-   vos_timer_stop( pMac->sme.smeCmdActiveList.cmdTimeoutTimer );
-
-}
-
 #ifdef FEATURE_WLAN_LFR
 tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
 {
@@ -3119,7 +2668,6 @@
         {
             smsLog(pMac, LOGE, FL("fScanEnable %d isCoexScoIndSet: %d "),
                      pMac->scan.fScanEnable, pMac->isCoexScoIndSet);
-            status = eHAL_STATUS_RESOURCES;
         }
     } while( 0 );
 
@@ -3203,29 +2751,6 @@
    return (status);
 }
 
- /*
- * ---------------------------------------------------------------------------
- *  \fn sme_FilterScanDFSResults
- *  \brief a wrapper function to request CSR to filter BSSIDs on DFS channels
- *         from the scan results.
- *  \return eHalStatus
- *---------------------------------------------------------------------------
- */
-eHalStatus sme_FilterScanDFSResults(tHalHandle hHal)
-{
-   eHalStatus status = eHAL_STATUS_SUCCESS;
-   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-
-   status = sme_AcquireGlobalLock( &pMac->sme );
-   if ( HAL_STATUS_SUCCESS( status ) )
-   {
-       csrScanFilterDFSResults(pMac);
-       sme_ReleaseGlobalLock( &pMac->sme );
-   }
-
-   return (status);
-}
-
 eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
 {
         eHalStatus status = eHAL_STATUS_FAILURE;
@@ -3287,6 +2812,8 @@
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     tCsrScanResultInfo *pRet = NULL;
 
+    MTRACE(vos_trace(VOS_MODULE_ID_SME ,
+        TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
     status = sme_AcquireGlobalLock( &pMac->sme );
     if ( HAL_STATUS_SUCCESS( status ) )
     {
@@ -3447,7 +2974,6 @@
     return smeConfig.csrConfig.channelBondingMode5GHz;
 }
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
 /* ---------------------------------------------------------------------------
     \fn sme_GetChannelBondingMode24G
     \brief get the channel bonding mode for 2.4G band
@@ -3461,66 +2987,9 @@
 
     sme_GetConfigParam(pMac, &smeConfig);
 
-    return smeConfig.csrConfig.channelBondingAPMode24GHz;
+    return smeConfig.csrConfig.channelBondingMode24GHz;
 }
 
-/* ---------------------------------------------------------------------------
-    \fn sme_UpdateChannelBondingMode24G
-    \brief update the channel bonding mode for 2.4G band
-    \param hHal - HAL handle
-    \param cbMode - channel bonding mode
-    \return
-  ---------------------------------------------------------------------------*/
-void sme_UpdateChannelBondingMode24G(tHalHandle hHal, tANI_U8 cbMode)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    tSmeConfigParams  smeConfig;
-
-    vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
-    sme_GetConfigParam(pMac, &smeConfig);
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("Previous Channel Bonding : = %d"),
-                   smeConfig.csrConfig.channelBondingAPMode24GHz);
-
-    smeConfig.csrConfig.channelBondingAPMode24GHz = cbMode;
-    sme_UpdateConfig(hHal, &smeConfig);
-    VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
-                   FL("New Channel Bonding : = %d"),
-                   sme_GetChannelBondingMode24G(hHal));
-    return;
-}
-
-/* ---------------------------------------------------------------------------
-
-    \fn sme_SetHT2040Mode
-
-    \brief To update HT Operation beacon IE & Channel Bonding.
-
-    \param
-
-    \return eHalStatus  SUCCESS
-                        FAILURE or RESOURCES
-                        The API finished and failed.
-
-  -------------------------------------------------------------------------------*/
-eHalStatus sme_SetHT2040Mode(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 cbMode)
-{
-   eHalStatus status = eHAL_STATUS_FAILURE;
-   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-
-   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-       FL("Channel Bonding =%d"),
-       cbMode);
-
-   status = sme_AcquireGlobalLock(&pMac->sme);
-   if (HAL_STATUS_SUCCESS(status))
-   {
-      status = csrSetHT2040Mode(pMac, sessionId, cbMode);
-      sme_ReleaseGlobalLock(&pMac->sme );
-   }
-   return (status);
-}
-#endif
 
 /* ---------------------------------------------------------------------------
     \fn sme_RoamConnect
@@ -3702,7 +3171,7 @@
    {
       if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
       {
-          status = csrRoamDisconnect( pMac, sessionId, reason );
+         status = csrRoamDisconnect( pMac, sessionId, reason );
       }
       else
       {
@@ -3715,52 +3184,6 @@
 }
 
 /* ---------------------------------------------------------------------------
-    \fn.sme_abortConnection
-    \brief a wrapper function to request CSR to stop from connecting a network
-    \retun void.
----------------------------------------------------------------------------*/
-
-void sme_abortConnection(tHalHandle hHal, tANI_U8 sessionId)
-{
-   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-   eHalStatus status = eHAL_STATUS_FAILURE;
-
-   status = sme_AcquireGlobalLock( &pMac->sme );
-   if ( HAL_STATUS_SUCCESS( status ) )
-   {
-      if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
-      {
-          csr_abortConnection( pMac, sessionId);
-      }
-      sme_ReleaseGlobalLock( &pMac->sme );
-   }
-   return;
-}
-
-/* sme_dhcp_done_ind() - send dhcp done ind
- * @hal: hal context
- * @session_id: session id
- *
- * Return: void.
- */
-void sme_dhcp_done_ind(tHalHandle hal, uint8_t session_id)
-{
-   tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
-   tCsrRoamSession *session;
-
-   if (!mac_ctx)
-      return;
-
-   session = CSR_GET_SESSION(mac_ctx, session_id);
-   if(!session)
-   {
-   smsLog(mac_ctx, LOGE, FL(" session %d not found "), session_id);
-   return;
-   }
-   session->dhcp_done = true;
-}
-
-/* ---------------------------------------------------------------------------
     \fn sme_RoamStopBss
     \brief To stop BSS for Soft AP. This is an asynchronous API.
     \param hHal - Global structure
@@ -3799,12 +3222,7 @@
     \return eHalStatus  SUCCESS  Roam callback will be called to indicate actual results
   -------------------------------------------------------------------------------*/
 eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                 const tANI_U8 *pPeerMacAddr
-#else
-                                 tANI_U8 *pPeerMacAddr
-#endif
-)
+                                tANI_U8 *pPeerMacAddr)
 {
    eHalStatus status = eHAL_STATUS_FAILURE;
    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
@@ -3852,9 +3270,7 @@
      VOS_ASSERT(0);
      return status;
    }
-   MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                    TRACE_CODE_SME_RX_HDD_MSG_DEAUTH_STA,
-                    sessionId, pDelStaParams->reason_code));
+
    status = sme_AcquireGlobalLock( &pMac->sme );
    if ( HAL_STATUS_SUCCESS( status ) )
    {
@@ -4129,19 +3545,12 @@
 }
 
 eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                      const tANI_U8 *pBSSId,
-#else
                                       tANI_U8 *pBSSId,
-#endif
                                       tANI_BOOLEAN flush_cache )
 {
    eHalStatus status = eHAL_STATUS_FAILURE;
    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
    status = sme_AcquireGlobalLock( &pMac->sme );
-
-   MTRACE(vos_trace(VOS_MODULE_ID_SME,
-          TRACE_CODE_SME_RX_HDD_ROAM_DEL_PMKIDCACHE, sessionId, flush_cache));
    if ( HAL_STATUS_SUCCESS( status ) )
    {
       if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
@@ -4333,7 +3742,6 @@
          return status;
       }
 #endif
-      pParam->fBtcEnableIndTimerVal = pMac->fBtcEnableIndTimerVal;
       sme_ReleaseGlobalLock( &pMac->sme );
    }
 
@@ -5194,6 +4602,13 @@
       smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
       return eHAL_STATUS_FAILURE;
    }
+   /*Once Setkey is done, we can go in BMPS*/
+   if(pSetKey->keyLength)
+   {
+     pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
+     smsLog(pMac, LOG1, FL("Reset remainInPowerActiveTillDHCP"
+                           " to allow BMPS"));
+   }
 
    status = sme_AcquireGlobalLock( &pMac->sme );
    if ( HAL_STATUS_SUCCESS( status ) )
@@ -5240,22 +4655,21 @@
       status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
       sme_ReleaseGlobalLock( &pMac->sme );
    }
-   if (pMac->roam.configParam.roamDelayStatsEnabled)
+#ifdef DEBUG_ROAM_DELAY
+   //Store sent PTK key time
+   if(pSetKey->keyDirection == eSIR_TX_RX)
    {
-       //Store sent PTK key time
-       if(pSetKey->keyDirection == eSIR_TX_RX)
-       {
-           vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
-       }
-       else if(pSetKey->keyDirection == eSIR_RX_ONLY)
-       {
-           vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
-       }
-       else
-       {
-           return (status);
-       }
+      vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
    }
+   else if(pSetKey->keyDirection == eSIR_RX_ONLY)
+   {
+      vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
+   }
+   else
+   {
+      return (status);
+   }
+#endif
 
    return (status);
 }
@@ -5386,6 +4800,7 @@
 }
 #endif
 
+
 #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
 /* ---------------------------------------------------------------------------
     \fn sme_GetTsmStats
@@ -5455,46 +4870,6 @@
 
 }
 
-eHalStatus sme_GetFwStats(tHalHandle hHal, tANI_U32 stats,
-                            void *pContext, tSirFWStatsCallback callback)
-{
-   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-   vos_msg_t msg;
-   tSirFWStatsGetReq *pGetFWStatsReq;
-
-   smsLog(pMac, LOG1, FL(" ENTER stats = %d "),stats);
-
-   if ( eHAL_STATUS_SUCCESS ==  sme_AcquireGlobalLock( &pMac->sme ))
-   {
-       pGetFWStatsReq = (tSirFWStatsGetReq *)vos_mem_malloc(sizeof(tSirFWStatsGetReq));
-       if ( NULL == pGetFWStatsReq)
-       {
-          smsLog(pMac, LOGE, FL("Not able to allocate memory for "
-               "WDA_FW_STATS_GET_REQ"));
-          sme_ReleaseGlobalLock( &pMac->sme );
-          return eHAL_STATUS_FAILURE;
-       }
-       pGetFWStatsReq->stats = stats;
-       pGetFWStatsReq->callback = (tSirFWStatsCallback)callback;
-       pGetFWStatsReq->data = pContext;
-
-       msg.type = WDA_FW_STATS_GET_REQ;
-       msg.reserved = 0;
-       msg.bodyptr = pGetFWStatsReq;
-       if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
-       {
-            smsLog(pMac, LOGE,
-              FL("Not able to post WDA_FW_STATS_GET_REQ message to HAL"));
-            vos_mem_free(pGetFWStatsReq);
-            sme_ReleaseGlobalLock( &pMac->sme );
-            return eHAL_STATUS_FAILURE;
-       }
-       sme_ReleaseGlobalLock( &pMac->sme );
-       return eHAL_STATUS_SUCCESS;
-   }
-   return eHAL_STATUS_FAILURE;
-}
-
 /* ---------------------------------------------------------------------------
     \fn smeGetTLSTAState
     \helper function to get the TL STA State whenever the function is called.
@@ -6048,8 +5423,6 @@
         vosMessage.bodyptr = pMsg;
         vosMessage.reserved = 0;
 
-       MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
         vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
         if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
         {
@@ -6118,8 +5491,6 @@
        vosMessage.bodyptr = pMsg;
        vosMessage.reserved = 0;
 
-       MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
        vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
        {
@@ -6134,149 +5505,6 @@
     return (status);
 }
 
-#ifdef WLAN_FEATURE_RMC
-/*---------------------------------------------------------------------------
-
-    \fn sme_TXFailMonitorStopInd
-
-    \brief API to signal the FW to start monitoring TX failures
-
-    \return eHalStatus  SUCCESS.
-
-                         FAILURE or RESOURCES  The API finished and failed.
- --------------------------------------------------------------------------*/
-eHalStatus sme_TXFailMonitorStartStopInd(tHalHandle hHal, tANI_U8 tx_fail_count,
-                                         void * txFailIndCallback)
-{
-    eHalStatus            status;
-    VOS_STATUS            vosStatus;
-    tpAniSirGlobal        pMac = PMAC_STRUCT(hHal);
-    vos_msg_t             vosMessage;
-    tAniTXFailMonitorInd  *pMsg;
-
-    status = sme_AcquireGlobalLock(&pMac->sme);
-    if ( eHAL_STATUS_SUCCESS == status)
-    {
-        pMsg = (tAniTXFailMonitorInd*)
-                   vos_mem_malloc(sizeof(tAniTXFailMonitorInd));
-        if (NULL == pMsg)
-        {
-            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                   "%s: Failed to allocate memory", __func__);
-            sme_ReleaseGlobalLock( &pMac->sme );
-            return eHAL_STATUS_FAILURE;
-        }
-
-        pMsg->msgType = WDA_TX_FAIL_MONITOR_IND;
-        pMsg->msgLen = (tANI_U16)sizeof(tAniTXFailMonitorInd);
-
-        //tx_fail_count = 0 should disable the Monitoring in FW
-        pMsg->tx_fail_count = tx_fail_count;
-        pMsg->txFailIndCallback = txFailIndCallback;
-
-        vosMessage.type = WDA_TX_FAIL_MONITOR_IND;
-        vosMessage.bodyptr = pMsg;
-        vosMessage.reserved = 0;
-
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
-        vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage );
-        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
-        {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                         "%s: Post TX Fail monitor Start MSG fail", __func__);
-           vos_mem_free(pMsg);
-           status = eHAL_STATUS_FAILURE;
-        }
-        sme_ReleaseGlobalLock( &pMac->sme );
-    }
-    return (status);
-}
-#endif /* WLAN_FEATURE_RMC */
-
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-void sme_PERRoamScanStartStop(void *hHal, tANI_U8 start)
-{
-    eHalStatus            status;
-    VOS_STATUS            vosStatus;
-    tpAniSirGlobal        pMac = PMAC_STRUCT(hHal);
-    vos_msg_t             vosMessage;
-    tPERRoamScanStart     *pMsg;
-
-    status = sme_AcquireGlobalLock(&pMac->sme);
-    if ( eHAL_STATUS_SUCCESS == status)
-    {
-        pMsg = (tPERRoamScanStart *)
-                   vos_mem_malloc(sizeof(tPERRoamScanStart));
-        if (NULL == pMsg)
-        {
-            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                   "%s: Failed to allocate memory", __func__);
-            sme_ReleaseGlobalLock( &pMac->sme );
-            return;
-        }
-
-        pMsg->msgType = WDA_PER_ROAM_SCAN_TRIGGER_REQ;
-        pMsg->msgLen = (tANI_U16)sizeof(*pMsg);
-
-        pMsg->start = start;
-
-        vosMessage.type = WDA_PER_ROAM_SCAN_TRIGGER_REQ;
-        vosMessage.bodyptr = pMsg;
-        vosMessage.reserved = 0;
-
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
-        vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage );
-        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
-        {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                         "%s: Post TX Fail monitor Start MSG fail", __func__);
-           vos_mem_free(pMsg);
-           status = eHAL_STATUS_FAILURE;
-        }
-        sme_ReleaseGlobalLock(&pMac->sme);
-    }
-}
-
-/* sme_set_per_roam_rxconfig : set PER config for Rx monitoring
- * @hHal: hal pointer
- * @staId: station id
- * @minRate : rate at which to start monitoring
- * @maxRate : Rate at which to stop monitoring
- * @minPercentage: minimum % of packets required in minRate to trigger a scan
- * @minPktRequired: minimum number of packets required to trigger a scan
- * @waitPeriodForNextPERScan: time to wait before start monitoring again once
- * roam scan is triggered
- * */
-
-VOS_STATUS sme_set_per_roam_rxconfig (tHalHandle hHal, v_U8_t staId,
-                             v_U16_t minRate, v_U16_t maxRate,
-                             v_U8_t minPercentage, v_U16_t minPktRequired,
-                             v_U64_t waitPeriodForNextPERScan)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
-    WLANTL_StartRxRateMonitor(pVosContext, staId, minRate, maxRate,
-                    minPercentage, minPktRequired,
-                    (void *) hHal, waitPeriodForNextPERScan,
-                    sme_PERRoamScanStartStop);
-    pMac->PERroamCandidatesCnt = 0;
-    return eHAL_STATUS_SUCCESS;
-}
-
-/* sme_unset_per_roam_rxconfig : unset PER config for Rx monitoring
- * */
-VOS_STATUS sme_unset_per_roam_rxconfig (tHalHandle hHal)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
-    vos_mem_set(pMac->previousRoamApInfo,
-                sizeof(tSirRoamAPInfo) * SIR_PER_ROAM_MAX_CANDIDATE_CNT, 0);
-    WLANTL_StopRxRateMonitor(pVosContext);
-    return eHAL_STATUS_SUCCESS;
-}
-#endif
 
 /* ---------------------------------------------------------------------------
     \fn sme_BtcSignalBtEvent
@@ -6567,7 +5795,7 @@
                        TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
    if(eDRIVER_TYPE_MFG == pMac->gDriverType)
    {
-      if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf, 0))
+      if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
       {
          return VOS_STATUS_SUCCESS;
       }
@@ -6587,7 +5815,7 @@
       /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
       if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
       {
-         if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf, 0))
+         if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
          {
             status = VOS_STATUS_SUCCESS;
          }
@@ -7063,57 +6291,6 @@
     return(status);
 }
 
-/* ---------------------------------------------------------------------------
-    \fn sme_OemDataReqNew
-    \brief a wrapper function for OEM DATA REQ NEW
-    \param pOemDataReqNewConfig - Data to be passed to FW
-  ---------------------------------------------------------------------------*/
-void sme_OemDataReqNew(tHalHandle hHal,
-        tOemDataReqNewConfig *pOemDataReqNewConfig)
-{
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    tOemDataReqNewConfig *pLocalOemDataReqNewConfig;
-    vos_msg_t vosMessage = {0};
-
-    pLocalOemDataReqNewConfig =
-            vos_mem_malloc(sizeof(*pLocalOemDataReqNewConfig));
-
-    if (!pLocalOemDataReqNewConfig)
-    {
-        smsLog(pMac, LOGE,
-        "Failed to allocate memory for WDA_START_OEM_DATA_REQ_IND_NEW");
-        return;
-    }
-
-    vos_mem_zero(pLocalOemDataReqNewConfig, sizeof(tOemDataReqNewConfig));
-    vos_mem_copy(pLocalOemDataReqNewConfig, pOemDataReqNewConfig,
-                                            sizeof(tOemDataReqNewConfig));
-
-    if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
-        /* Serialize the req through MC thread */
-        vosMessage.bodyptr = pLocalOemDataReqNewConfig;
-        vosMessage.type    = WDA_START_OEM_DATA_REQ_IND_NEW;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
-
-        if(VOS_STATUS_SUCCESS !=
-                          vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage)) {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
-                 "Failed to post WDA_START_OEM_DATA_REQ_IND_NEW msg to WDA",
-                __func__);
-           vos_mem_free(pLocalOemDataReqNewConfig);
-        }
-        sme_ReleaseGlobalLock(&pMac->sme);
-    }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-                "sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(pLocalOemDataReqNewConfig);
-    }
-}
-
 #endif /*FEATURE_OEM_DATA_SUPPORT*/
 
 /*--------------------------------------------------------------------------
@@ -7185,21 +6362,18 @@
 
   --------------------------------------------------------------------------*/
 eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
-                            tANI_BOOLEAN fSync,
-                            tANI_U8 bPurgeSmeCmdList,
-                            csrRoamSessionCloseCallback callback,
-                            void *pContext)
+                          csrRoamSessionCloseCallback callback, void *pContext)
 {
    eHalStatus status;
    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
 
    MTRACE(vos_trace(VOS_MODULE_ID_SME,
                  TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
-   status = sme_AcquireGlobalLock(&pMac->sme);
-   if (HAL_STATUS_SUCCESS(status))
+   status = sme_AcquireGlobalLock( &pMac->sme );
+   if ( HAL_STATUS_SUCCESS( status ) )
    {
-      status = csrRoamCloseSession(pMac, sessionId, fSync, bPurgeSmeCmdList,
-                                    callback, pContext);
+      status = csrRoamCloseSession( pMac, sessionId, FALSE,
+                                    callback, pContext );
 
       sme_ReleaseGlobalLock( &pMac->sme );
    }
@@ -7335,8 +6509,6 @@
 
   //status = halFW_SendBTAmpEventMesg(pMac, event);
 
-  MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
   if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
   {
     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
@@ -7355,13 +6527,11 @@
     \param  hHal - The handle returned by macOpen.
     \param  bssid -  Pointer to the BSSID to roam to.
     \param  fastRoamTrig - Trigger to Scan or roam
-    \param  channel - channel number on which fastroam is requested
     \return eHalStatus
   ---------------------------------------------------------------------------*/
 eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
                                             tANI_U8 *bssid,
-                                            tSmeFastRoamTrigger fastRoamTrig,
-                                            tANI_U8 channel)
+                                            tSmeFastRoamTrigger fastRoamTrig)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     tpCsrNeighborRoamControlInfo  pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
@@ -7380,16 +6550,9 @@
             pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
             vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
                        (void *)bssid, sizeof(tSirMacAddr));
-            smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID"
+            smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID "
                    MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
-            /*
-             * As FastReassoc is based on assumption that roamable AP should be
-             * present into the occupied channel list.We shd  add i/p channel
-             * in occupied channel list if roamable-ap(BSSID in fastreassoc cmd)
-             * aged out prior to connection and there is no scan from aged out
-             * to till connection indication.
-            */
-            csrAddChannelToOccupiedChannelList(pMac, channel);
+
             vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
             if (VOS_STATUS_SUCCESS != vosStatus)
             {
@@ -7540,9 +6703,6 @@
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     eHalStatus status;
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                   TRACE_CODE_SME_RX_HDD_PREF_NET_LIST,
-                   sessionId, pRequest->ucNetworksCount));
     if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
     {
         pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
@@ -7590,12 +6750,13 @@
     \param  hHal - The handle returned by macOpen.
     \param  sessionId - sessionId on which we need to abort scan.
     \param  reason - Reason to abort the scan.
-    \return tSirAbortScanStatus Abort scan status
+    \return VOS_STATUS
+            VOS_STATUS_E_FAILURE - failure
+            VOS_STATUS_SUCCESS  success
   ---------------------------------------------------------------------------*/
-tSirAbortScanStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
-                                        eCsrAbortReason reason)
+eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
+                            eCsrAbortReason reason)
 {
-    tSirAbortScanStatus scanAbortStatus = eSIR_ABORT_SCAN_FAILURE;
     eHalStatus status;
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
 
@@ -7604,12 +6765,12 @@
     status = sme_AcquireGlobalLock( &pMac->sme );
     if ( HAL_STATUS_SUCCESS( status ) )
     {
-       scanAbortStatus = csrScanAbortMacScan(pMac, sessionId, reason);
+       status = csrScanAbortMacScan(pMac, sessionId, reason);
 
        sme_ReleaseGlobalLock( &pMac->sme );
     }
 
-    return ( scanAbortStatus );
+    return ( status );
 }
 
 /* ----------------------------------------------------------------------------
@@ -7641,48 +6802,6 @@
     return eHAL_STATUS_FAILURE;
 }// sme_GetOperationChannel ends here
 
-/**
- * sme_register_mgmt_frame_ind_callback() - Register a callback for
- * management frame indication to PE.
- * @hHal: hal pointer
- * @callback: callback pointer to be registered
- *
- * This function is used to register a callback for management
- * frame indication to PE.
- *
- * Return: Success if msg is posted to PE else Failure.
- */
-eHalStatus sme_register_mgmt_frame_ind_callback(tHalHandle hHal,
-   sir_mgmt_frame_ind_callback callback)
-{
-   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-   struct sir_sme_mgmt_frame_cb_req *msg;
-   eHalStatus status = eHAL_STATUS_SUCCESS;
-
-   smsLog(pMac, LOG1, FL(": ENTER"));
-
-   if (eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock(&pMac->sme))
-   {
-       msg = vos_mem_malloc(sizeof(*msg));
-       if (NULL == msg)
-       {
-          smsLog(pMac, LOGE,
-            FL("Not able to allocate memory for eWNI_SME_REGISTER_MGMT_FRAME_CB"));
-          sme_ReleaseGlobalLock( &pMac->sme );
-          return eHAL_STATUS_FAILURE;
-       }
-       vos_mem_set(msg, sizeof(*msg), 0);
-       msg->message_type = eWNI_SME_REGISTER_MGMT_FRAME_CB;
-       msg->length          = sizeof(*msg);
-
-       msg->callback = callback;
-       status = palSendMBMessage(pMac->hHdd, msg);
-       sme_ReleaseGlobalLock( &pMac->sme );
-       return status;
-   }
-   return eHAL_STATUS_FAILURE;
-}
-
 /* ---------------------------------------------------------------------------
 
     \fn sme_RegisterMgtFrame
@@ -7982,190 +7101,6 @@
   return(status);
 }
 
-/* ---------------------------------------------------------------------------
-    \fn sme_GetFramesLog
-    \brief a wrapper function that client calls to register a callback to get
-           mgmt frames logged
-    \param flag - flag tells to clear OR send the frame log buffer
-    \return eHalStatus
-  ---------------------------------------------------------------------------*/
-eHalStatus sme_GetFramesLog(tHalHandle hHal, tANI_U8 flag)
-{
-   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-   eHalStatus status = eHAL_STATUS_SUCCESS;
-   tSmeCmd *pGetFrameLogCmd;
-
-    status = sme_AcquireGlobalLock( &pMac->sme );
-    if ( HAL_STATUS_SUCCESS( status ) )
-    {
-       pGetFrameLogCmd = csrGetCommandBuffer(pMac);
-       if (pGetFrameLogCmd)
-       {
-           pGetFrameLogCmd->command = eSmeCommandGetFrameLogRequest;
-           pGetFrameLogCmd->u.getFramelogCmd.getFrameLogCmdFlag= flag;
-
-           status = csrQueueSmeCommand(pMac, pGetFrameLogCmd, eANI_BOOLEAN_TRUE);
-           if ( !HAL_STATUS_SUCCESS( status ) )
-           {
-               smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
-               csrReleaseCommandScan(pMac, pGetFrameLogCmd);
-           }
-       }
-       else
-       {
-           //log error
-           smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
-           status = eHAL_STATUS_RESOURCES;
-       }
-       sme_ReleaseGlobalLock( &pMac->sme);
-   }
-   return (status);
-}
-
-/* ---------------------------------------------------------------------------
-
-  \fn    sme_InitMgmtFrameLogging
-
-  \brief
-    SME will pass this request to lower mac to initialize Frame Logging.
-
-  \param
-
-    hHal - The handle returned by macOpen.
-
-    wlanFWLoggingInitParam - Params to initialize frame logging
-
-  \return eHalStatus
-
-
---------------------------------------------------------------------------- */
-eHalStatus sme_InitMgmtFrameLogging( tHalHandle hHal,
-                            tSirFWLoggingInitParam *wlanFWLoggingInitParam)
-{
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    vos_msg_t       vosMessage;
-    tpSirFWLoggingInitParam msg;
-
-    msg = vos_mem_malloc(sizeof(tSirFWLoggingInitParam));
-
-    if (NULL == msg)
-    {
-        smsLog(pMac, LOGE, FL("Failed to alloc mem of size %zu for msg"),
-            sizeof(*msg));
-        return eHAL_STATUS_FAILED_ALLOC;
-    }
-    *msg = *wlanFWLoggingInitParam;
-
-    if ( eHAL_STATUS_SUCCESS == ( status =
-                                        sme_AcquireGlobalLock( &pMac->sme ) ) )
-    {
-        /* serialize the req through MC thread */
-        vosMessage.bodyptr = msg;
-        vosMessage.type         = WDA_MGMT_LOGGING_INIT_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
-        vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
-        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
-        {
-           vos_mem_free(msg);
-           status = eHAL_STATUS_FAILURE;
-        }
-        sme_ReleaseGlobalLock( &pMac->sme );
-    }
-    else
-    {
-        smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock error"));
-        vos_mem_free(msg);
-    }
-    return(status);
-}
-/* ---------------------------------------------------------------------------
-
-  \fn    sme_StartRssiMonitoring
-
-  \brief
-    SME will pass this request to lower mac to start monitoring rssi range on
-    a bssid.
-
-  \param
-
-    hHal - The handle returned by macOpen.
-
-    tSirRssiMonitorReq req- depict the monitor req params.
-
-  \return eHalStatus
-
---------------------------------------------------------------------------- */
-eHalStatus sme_StartRssiMonitoring( tHalHandle hHal,
-                            tSirRssiMonitorReq *req)
-{
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    vos_msg_t       vosMessage;
-
-    if ( eHAL_STATUS_SUCCESS == ( status =
-                                        sme_AcquireGlobalLock( &pMac->sme ) ) )
-    {
-        /* serialize the req through MC thread */
-        vosMessage.bodyptr = req;
-        vosMessage.type    = WDA_START_RSSI_MONITOR_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
-        vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
-        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
-        {
-           status = eHAL_STATUS_FAILURE;
-        }
-        sme_ReleaseGlobalLock( &pMac->sme );
-    }
-    return(status);
-}
-
-/* ---------------------------------------------------------------------------
-
-  \fn    sme_StopRssiMonitoring
-
-  \brief
-    SME will pass this request to lower mac to stop monitoring rssi range on
-    a bssid.
-
-  \param
-
-    hHal - The handle returned by macOpen.
-
-    tSirRssiMonitorReq req- depict the monitor req params.
-
-  \return eHalStatus
-
---------------------------------------------------------------------------- */
-eHalStatus sme_StopRssiMonitoring(tHalHandle hHal,
-                            tSirRssiMonitorReq *req)
-{
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    vos_msg_t       vosMessage;
-
-    if ( eHAL_STATUS_SUCCESS == ( status =
-                                        sme_AcquireGlobalLock( &pMac->sme ) ) )
-    {
-        /* serialize the req through MC thread */
-        vosMessage.bodyptr = req;
-        vosMessage.type    = WDA_STOP_RSSI_MONITOR_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
-        vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
-        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
-        {
-           status = eHAL_STATUS_FAILURE;
-        }
-        sme_ReleaseGlobalLock( &pMac->sme );
-    }
-    return(status);
-}
 
 /* ---------------------------------------------------------------------------
 
@@ -8207,8 +7142,6 @@
         /* serialize the req through MC thread */
         vosMessage.bodyptr = wlanRxpFilterParam;
         vosMessage.type         = WDA_CFG_RXP_FILTER_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
         vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
         if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
         {
@@ -8253,8 +7186,6 @@
         /* serialize the req through MC thread */
         vosMessage.bodyptr = wlanSuspendParam;
         vosMessage.type    = WDA_WLAN_SUSPEND_IND;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
         vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
         if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
         {
@@ -8299,8 +7230,6 @@
         /* serialize the req through MC thread */
         vosMessage.bodyptr = wlanResumeParam;
         vosMessage.type    = WDA_WLAN_RESUME_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
         vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
         if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
         {
@@ -8341,21 +7270,6 @@
    return (sessionid);
 }
 
-tANI_U32 sme_get_sessionid_from_activeList(tpAniSirGlobal mac)
-{
-    tListElem *entry = NULL;
-    tSmeCmd *command = NULL;
-    tANI_U32  session_id = 0;
-
-    entry = csrLLPeekHead( &mac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
-    if ( entry ) {
-        command = GET_BASE_ADDR( entry, tSmeCmd, Link );
-        session_id = command->sessionId;
-    }
-
-    return (session_id);
-}
-
 /* ---------------------------------------------------------------------------
 
     \fn sme_GetInfraOperationChannel
@@ -8504,20 +7418,6 @@
     return (status);
 }
 
-eHalStatus sme_SetCfgScanControlList(tHalHandle hHal, tANI_U8 *countryCode, tCsrChannel *pChannelList)
-{
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-
-    status = sme_AcquireGlobalLock( &pMac->sme );
-    if ( HAL_STATUS_SUCCESS( status ) )
-    {
-        csrSetCfgScanControlList(pMac, countryCode, pChannelList);
-        sme_ReleaseGlobalLock( &pMac->sme );
-    }
-
-    return (status);
-}
 
 /* ---------------------------------------------------------------------------
 
@@ -8561,8 +7461,6 @@
     msg.reserved = 0;
     msg.bodyptr = pTxPerTrackingParamReq;
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
     if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_TX_PER_TRACKING_REQ message to WDA", __func__);
@@ -8607,19 +7505,6 @@
    static uNvTables nvTables;
    pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
 
-    if (pMac->scan.fcc_constraint)
-    {
-       pMac->scan.fcc_constraint = false;
-       if (VOS_TRUE== vos_mem_compare(pMac->scan.countryCodeCurrent,
-                                          pMsg->countryCode, 2))
-       {
-           csrInitGetChannels(pMac);
-           csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
-           csrScanFilterResults(pMac);
-           return status ;
-       }
-   }
-
 
    /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
    if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
@@ -8723,11 +7608,6 @@
    {
        //if 11d has priority, clear currentCountryBssid & countryCode11d to get
        //set again if we find AP with 11d info during scan
-       status = csrSetRegulatoryDomain(pMac, domainIdIoctl, NULL);
-       if (status != eHAL_STATUS_SUCCESS)
-       {
-           smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
-       }
        if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
        {
            smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
@@ -8798,10 +7678,6 @@
         is11dCountry = VOS_TRUE;
     }
 
-   smsLog( pMac, LOG1, FL("pMsg->countryCode : %c%c,"
-                "pMac->scan.countryCode11d : %c%c\n"),
-                pMsg->countryCode[0], pMsg->countryCode[1],
-                pMac->scan.countryCode11d[0], pMac->scan.countryCode11d[1]);
     /* Set the country code given by userspace when 11dOriginal is FALSE
      * when 11doriginal is True,is11dCountry =0 and
      * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
@@ -8823,27 +7699,17 @@
             return eHAL_STATUS_FAILURE;
         }
     }
+    pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
     /* if Supplicant country code has priority, disable 11d */
-    if ((!is11dCountry) &&
-         (pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
-        (!pMac->roam.configParam.fEnforceCountryCode))
+    if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
     {
         pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
         smsLog( pMac, LOG1, FL(" 11d is being  disabled"));
     }
 
-    pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
     vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
                   WNI_CFG_COUNTRY_CODE_LEN);
-    vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
-                  WNI_CFG_COUNTRY_CODE_LEN);
 
-
-    status = csrSetRegulatoryDomain(pMac, reg_domain_id, NULL);
-    if (status != eHAL_STATUS_SUCCESS)
-    {
-        smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
-    }
     status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
 
     if (VOS_FALSE == is11dCountry )
@@ -8943,11 +7809,6 @@
     }
     else
     {
-        status = csrSetRegulatoryDomain(pMac, REGDOMAIN_WORLD, NULL);
-        if (status != eHAL_STATUS_SUCCESS)
-        {
-            smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
-        }
         status = csrInitGetChannels(pMac);
         if ( status != eHAL_STATUS_SUCCESS )
         {
@@ -9117,8 +7978,6 @@
     msg.type = WDA_8023_MULTICAST_LIST_REQ;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
     if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
@@ -9172,8 +8031,6 @@
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
            "FT %d FID %d ",
            pRequestBuf->filterType, pRequestBuf->filterId);
@@ -9284,8 +8141,6 @@
     msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
     if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
@@ -9479,59 +8334,51 @@
 #endif // WLAN_WAKEUP_EVENTS
 
 
-/**
- * sme_SetMaxTxPower() - Set the Maximum Transmit Power
- *
- * @hHal: hal pointer.
- * @bssid: bssid to set the power cap for
- * @self_mac_addr:self mac address
- * @db: power to set in dB
- *
- * Set the maximum transmit power dynamically.
- *
- * Return: eHalStatus
- *
- */
-eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr bssid,
-                             tSirMacAddr self_mac_addr, v_S7_t db)
+/* ---------------------------------------------------------------------------
+
+    \fn sme_SetMaxTxPower
+
+    \brief Set the Maximum Transmit Power dynamically. Note: this setting will
+    not persist over reboots.
+
+    \param  hHal
+    \param pBssid  BSSID to set the power cap for
+    \param pBssid  pSelfMacAddress self MAC Address
+    \param pBssid  power to set in dB
+    \- return eHalStatus
+
+  -------------------------------------------------------------------------------*/
+eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
+                             tSirMacAddr pSelfMacAddress, v_S7_t dB)
 {
-   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-   eHalStatus status = eHAL_STATUS_SUCCESS;
-   tSmeCmd *set_max_tx_pwr;
-
-   MTRACE(vos_trace(VOS_MODULE_ID_SME,
-       TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
-   smsLog(pMac, LOG1,
-     FL("bssid :" MAC_ADDRESS_STR " self addr: "MAC_ADDRESS_STR" power %d Db"),
-     MAC_ADDR_ARRAY(bssid), MAC_ADDR_ARRAY(self_mac_addr), db);
-
-    status = sme_AcquireGlobalLock( &pMac->sme );
-    if ( HAL_STATUS_SUCCESS( status ) )
+    vos_msg_t msg;
+    tpMaxTxPowerParams pMaxTxParams = NULL;
+    MTRACE(vos_trace(VOS_MODULE_ID_SME,
+                     TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
+    pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
+    if (NULL == pMaxTxParams)
     {
-       set_max_tx_pwr = csrGetCommandBuffer(pMac);
-       if (set_max_tx_pwr)
-       {
-           set_max_tx_pwr->command = eSmeCommandSetMaxTxPower;
-           vos_mem_copy(set_max_tx_pwr->u.set_tx_max_pwr.bssid,
-                                     bssid, SIR_MAC_ADDR_LENGTH);
-           vos_mem_copy(set_max_tx_pwr->u.set_tx_max_pwr.self_sta_mac_addr,
-                 self_mac_addr, SIR_MAC_ADDR_LENGTH);
-           set_max_tx_pwr->u.set_tx_max_pwr.power = db;
-           status = csrQueueSmeCommand(pMac, set_max_tx_pwr, eANI_BOOLEAN_TRUE);
-           if ( !HAL_STATUS_SUCCESS( status ) )
-           {
-               smsLog( pMac, LOGE, FL("fail to send msg status = %d"), status );
-               csrReleaseCommandScan(pMac, set_max_tx_pwr);
-           }
-       }
-       else
-       {
-           smsLog(pMac, LOGE, FL("can not obtain a common buffer"));
-           status = eHAL_STATUS_RESOURCES;
-       }
-       sme_ReleaseGlobalLock( &pMac->sme);
-   }
-   return (status);
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for pMaxTxParams", __func__);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
+    vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
+                 SIR_MAC_ADDR_LENGTH);
+    pMaxTxParams->power = dB;
+
+    msg.type = WDA_SET_MAX_TX_POWER_REQ;
+    msg.reserved = 0;
+    msg.bodyptr = pMaxTxParams;
+
+    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_MAX_TX_POWER_REQ message to WDA", __func__);
+        vos_mem_free(pMaxTxParams);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    return eHAL_STATUS_SUCCESS;
 }
 
 /* ---------------------------------------------------------------------------
@@ -9567,8 +8414,6 @@
     msg.reserved = 0;
     msg.bodyptr = pMaxTxPowerPerBandParams;
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
     if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
@@ -9702,8 +8547,6 @@
         /* serialize the req through MC thread */
         vosMessage.bodyptr = setTmLevelReq;
         vosMessage.type    = WDA_SET_TM_LEVEL_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
         vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
         if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
         {
@@ -11043,12 +9886,13 @@
 #endif
 }
 
-
 /* ---------------------------------------------------------------------------
     \fn sme_IsFeatureSupportedByFW
+
     \brief  Check if a feature is enabled by FW
 
     \param  featEnumValue - Enumeration value from placeHolderInCapBitmap
+
     \- return 1/0 (TRUE/FALSE)
     -------------------------------------------------------------------------*/
 tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
@@ -11080,20 +9924,13 @@
     \- return VOS_STATUS_SUCCES
     -------------------------------------------------------------------------*/
 VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
-                                           tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                           const tSirMacAddr peerMac,
-#else
-                                           tSirMacAddr peerMac,
-#endif
-                                           tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
+                                                   tANI_U8 sessionId,
+                                                   tSirMacAddr peerMac,
+                                                   tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
 {
     eHalStatus          status    = eHAL_STATUS_SUCCESS;
     tpAniSirGlobal      pMac      = PMAC_STRUCT(hHal);
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                   TRACE_CODE_SME_RX_HDD_TDLS_LINK_ESTABLISH_PARAM,
-                   sessionId, tdlsLinkEstablishParams->isOffChannelSupported));
     status = sme_AcquireGlobalLock( &pMac->sme );
 
     if ( HAL_STATUS_SUCCESS( status ) )
@@ -11124,9 +9961,6 @@
     eHalStatus          status    = eHAL_STATUS_SUCCESS;
     tpAniSirGlobal      pMac      = PMAC_STRUCT(hHal);
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                    TRACE_CODE_SME_RX_HDD_TDLS_CHAN_SWITCH_REQ,
-                    sessionId, tdlsOffCh));
     status = sme_AcquireGlobalLock( &pMac->sme );
 
     if ( HAL_STATUS_SUCCESS( status ) )
@@ -11153,23 +9987,13 @@
     \param responder - Tdls request type
     \- return VOS_STATUS_SUCCES
     -------------------------------------------------------------------------*/
-VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                 const tSirMacAddr peerMac,
-#else
-                                 tSirMacAddr peerMac,
-#endif
-                                 tANI_U8 frame_type, tANI_U8 dialog,
-                                 tANI_U16 statusCode, tANI_U32 peerCapability,
-                                 tANI_U8 *buf, tANI_U8 len, tANI_U8 responder)
+VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
+      tANI_U8 frame_type, tANI_U8 dialog, tANI_U16 statusCode, tANI_U32 peerCapability, tANI_U8 *buf, tANI_U8 len, tANI_U8 responder)
 {
     eHalStatus          status    = eHAL_STATUS_SUCCESS;
     tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
     tpAniSirGlobal      pMac      = PMAC_STRUCT(hHal);
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                    TRACE_CODE_SME_RX_HDD_TDLS_SEND_MGMT_FRAME,
-                    sessionId, statusCode));
     status = sme_AcquireGlobalLock( &pMac->sme );
     if ( HAL_STATUS_SUCCESS( status ) )
     {
@@ -11198,12 +10022,7 @@
     \param  staParams - Peer Station Parameters
     \- return VOS_STATUS_SUCCES
     -------------------------------------------------------------------------*/
-VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                 const tSirMacAddr peerMac,
-#else
-                                 tSirMacAddr peerMac,
-#endif
+VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
                                  tCsrStaParams *pstaParams)
 {
     eHalStatus          status    = eHAL_STATUS_SUCCESS;
@@ -11215,14 +10034,10 @@
                 "%s :pstaParams is NULL",__func__);
         return eHAL_STATUS_FAILURE;
     }
-
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                    TRACE_CODE_SME_RX_HDD_TDLS_CHANGE_PEER_STA, sessionId,
-                    pstaParams->capability));
     status = sme_AcquireGlobalLock( &pMac->sme );
     if ( HAL_STATUS_SUCCESS( status ) )
     {
-        status = csrTdlsChangePeerSta(hHal, sessionId, peerMac, pstaParams);
+        status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
 
         sme_ReleaseGlobalLock( &pMac->sme );
     }
@@ -11238,20 +10053,11 @@
     \param  peerMac - peer's Mac Adress.
     \- return VOS_STATUS_SUCCES
     -------------------------------------------------------------------------*/
-VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                              const tSirMacAddr peerMac
-#else
-                              tSirMacAddr peerMac
-#endif
-                             )
+VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
 {
     eHalStatus          status    = eHAL_STATUS_SUCCESS;
     tpAniSirGlobal      pMac      = PMAC_STRUCT(hHal);
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                    TRACE_CODE_SME_RX_HDD_TDLS_ADD_PEER_STA,
-                    sessionId, 0));
     status = sme_AcquireGlobalLock( &pMac->sme );
     if ( HAL_STATUS_SUCCESS( status ) )
     {
@@ -11270,24 +10076,16 @@
     \param  peerMac - peer's Mac Adress.
     \- return VOS_STATUS_SUCCES
     -------------------------------------------------------------------------*/
-VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                                 const tSirMacAddr peerMac
-#else
-                                 tSirMacAddr peerMac
-#endif
-)
+VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
 {
     eHalStatus          status    = eHAL_STATUS_SUCCESS;
     tpAniSirGlobal      pMac      = PMAC_STRUCT(hHal);
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                    TRACE_CODE_SME_RX_HDD_TDLS_DEL_PEER_STA,
-                    sessionId, 0));
     status = sme_AcquireGlobalLock( &pMac->sme );
     if ( HAL_STATUS_SUCCESS( status ) )
     {
         status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
+
         sme_ReleaseGlobalLock( &pMac->sme );
     }
 
@@ -11305,8 +10103,6 @@
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
     pMac->isTdlsPowerSaveProhibited = val;
-    smsLog(pMac, LOG1, FL("isTdlsPowerSaveProhibited is %d"),
-                   pMac->isTdlsPowerSaveProhibited);
     return;
 }
 #endif
@@ -11321,20 +10117,114 @@
     return (BMPS == pmcGetPmcState(hHal));
 }
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/*
+ * SME API to start TDLS discovery Procedure
+ */
+VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tCsrTdlsDisRequest disReq = {{0}} ;
+    vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
+    status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
+
+    return status ;
+
+}
+
+/*
+ * Process TDLS discovery results
+ */
+v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
+                                 tSmeTdlsDisResult *disResult, v_U8_t listType)
+{
+    tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
+    tSirTdlsPeerInfo *peerInfo = NULL ;
+    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+    tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
+    tDblLinkList *peerList =  &disInfo->tdlsPotentialPeerList ;
+    tListElem *pEntry = NULL ;
+    v_U8_t peerCnt = 0 ;
+
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+            ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
+    pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
+    while(pEntry)
+    {
+        peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
+                tdlsPeerStaLink) ;
+        peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
+
+        switch(listType)
+        {
+            case TDLS_SETUP_LIST:
+                {
+                    if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
+                    {
+                        vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
+                                     peerInfo->peerMac, sizeof(tSirMacAddr));
+                        disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
+                        peerCnt++ ;
+                    }
+                    break ;
+                }
+            case TDLS_DIS_LIST:
+                {
+                    vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
+                                 peerInfo->peerMac, sizeof(tSirMacAddr));
+                    disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
+                    peerCnt++ ;
+                    break ;
+                }
+            default:
+                {
+                    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                            ("unknown list type ")) ;
+                    break ;
+                }
+        }
+
+        pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
+    }
+
+    return peerCnt ;
+
+}
+
+/*
+ * SME API to start TDLS link setup Procedure.
+ */
+VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tCsrTdlsSetupRequest setupReq = {{0}} ;
+    vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
+    status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
+    return status ;
+
+}
+
+/*
+ * SME API to start TDLS link Teardown Procedure.
+ */
+VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
+{
+    VOS_STATUS status = VOS_STATUS_SUCCESS;
+    tCsrTdlsTeardownRequest teardownReq = {{0}} ;
+    vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
+    status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
+    return status ;
+
+}
+
+#endif /* FEATURE_WLAN_TDLS */
+
 eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
 
     smsLog(pMac, LOG2, FL("enter"));
-
-    if (pMac->fActiveScanOnDFSChannels)
-    {
-        smsLog(pMac, LOG1, FL("Skip updating fEnableDFSChnlScan"
-                              " as DFS feature is triggered"));
-        return (status);
-    }
-
     status = sme_AcquireGlobalLock( &pMac->sme );
     if ( HAL_STATUS_SUCCESS( status ) )
     {
@@ -11346,143 +10236,6 @@
     return (status);
 }
 
-/* ---------------------------------------------------------------------------
-    \fn sme_UpdateDFSRoamMode
-    \brief  Update DFS roam scan mode
-            This function is called to configure allowDFSChannelRoam
-            dynamically
-    \param  hHal - HAL handle for device
-    \param  allowDFSChannelRoam - DFS roaming scan mode
-            mode 0 disable roam scan on DFS channels
-            mode 1 enables roam scan (passive/active) on DFS channels
-    \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
-            successfully.
-            Other status means SME failed to update DFS roaming scan config.
-    \sa
-    -------------------------------------------------------------------------*/
-eHalStatus sme_UpdateDFSRoamMode(tHalHandle hHal, tANI_U8 allowDFSChannelRoam)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-    eHalStatus status    = eHAL_STATUS_SUCCESS;
-
-    status = sme_AcquireGlobalLock( &pMac->sme );
-    if ( HAL_STATUS_SUCCESS( status ) )
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
-                     "LFR runtime successfully set AllowDFSChannelRoam Mode to "
-                     "%d - old value is %d",
-                     allowDFSChannelRoam,
-                     pMac->roam.configParam.allowDFSChannelRoam);
-        pMac->roam.configParam.allowDFSChannelRoam = allowDFSChannelRoam;
-        sme_ReleaseGlobalLock( &pMac->sme );
-    }
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-    if (csrRoamIsRoamOffloadScanEnabled(pMac))
-    {
-       csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
-                          REASON_CHANNEL_LIST_CHANGED);
-    }
-#endif
-
-    return status ;
-}
-
-/* ---------------------------------------------------------------------------
-    \fn sme_UpdateDFSScanMode
-    \brief  Update DFS scan mode
-            This function is called to configure fEnableDFSChnlScan.
-    \param  hHal - HAL handle for device
-    \param  dfsScanMode - DFS scan mode
-            mode 0 disable scan on DFS channels
-            mode 1 enables passive scan on DFS channels
-            mode 2 enables active scan on DFS channels for static list
-    \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
-            successfully.
-            Other status means SME failed to update DFS scan config.
-    \sa
-    -------------------------------------------------------------------------*/
-eHalStatus sme_UpdateDFSScanMode(tHalHandle hHal, tANI_U8 dfsScanMode)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-    eHalStatus          status    = eHAL_STATUS_SUCCESS;
-
-    status = sme_AcquireGlobalLock( &pMac->sme );
-    if ( HAL_STATUS_SUCCESS( status ) )
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
-                     "DFS scan Mode changed to %d, old value is %d ",
-                     dfsScanMode,
-                     pMac->scan.fEnableDFSChnlScan);
-        pMac->scan.fEnableDFSChnlScan = dfsScanMode;
-        sme_ReleaseGlobalLock( &pMac->sme );
-    }
-
-    sme_FilterScanDFSResults(hHal);
-    sme_UpdateChannelList( hHal );
-
-    return status ;
-}
-
-/*--------------------------------------------------------------------------
-  \brief sme_GetDFSScanMode() - get DFS scan mode
-  \param hHal - The handle returned by macOpen.
-  \return DFS scan mode
-            mode 0 disable scan on DFS channels
-            mode 1 enables passive scan on DFS channels
-            mode 2 enables active scan on DFS channels for static list
-  \sa
-  --------------------------------------------------------------------------*/
-v_U8_t sme_GetDFSScanMode(tHalHandle hHal)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-    return pMac->scan.fEnableDFSChnlScan;
-}
-
-/* ---------------------------------------------------------------------------
-    \fn sme_HandleDFSChanScan
-    \brief  Gets Valid channel list and updates scan control list according to
-             dfsScanMode
-    \param  hHal - HAL handle for device
-    \return eHAL_STATUS_FAILURE when failed to get valid channel list
-            Otherwise eHAL_STATUS_SUCCESS -
-    \sa
-    -------------------------------------------------------------------------*/
-eHalStatus sme_HandleDFSChanScan(tHalHandle hHal)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-    eHalStatus status    = eHAL_STATUS_SUCCESS;
-    tCsrChannel ChannelList;
-
-    /*
-     * Set Flag to block driver scan type conversion from active to passive
-     * and vice versa in case if fEnableDFSChnlScan is
-     * DFS_CHNL_SCAN_ENABLED_ACTIVE
-     */
-    if (DFS_CHNL_SCAN_ENABLED_ACTIVE ==
-            pMac->scan.fEnableDFSChnlScan)
-        pMac->fActiveScanOnDFSChannels = 1;
-    else
-        pMac->fActiveScanOnDFSChannels = 0;
-
-    ChannelList.numChannels = sizeof(ChannelList.channelList);
-    status = sme_GetCfgValidChannels(hHal, (tANI_U8 *)ChannelList.channelList,
-                                     (tANI_U32*)&ChannelList.numChannels);
-    if (!HAL_STATUS_SUCCESS(status))
-    {
-         smsLog(pMac, LOGE,
-                FL("Failed to get valid channel list (err=%d)"), status);
-         return status;
-    }
-
-    smsLog(pMac, LOG1, FL("Valid Channel list:"));
-    VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                        ChannelList.channelList, ChannelList.numChannels);
-
-    sme_SetCfgScanControlList(hHal, pMac->scan.countryCodeCurrent,
-                                                            &ChannelList);
-    return status ;
-}
-
 /*
  * SME API to enable/disable WLAN driver initiated SSR
  */
@@ -11506,193 +10259,12 @@
 }
 
 /*
- * SME API to stringify bonding mode. (hostapd convention)
- */
-
-static const char* sme_CBMode2String( tANI_U32 mode)
-{
-   switch (mode)
-   {
-      case eCSR_INI_SINGLE_CHANNEL_CENTERED:
-         return "HT20";
-      case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
-         return "HT40-"; /* lower secondary channel */
-      case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
-         return "HT40+"; /* upper secondary channel */
-#ifdef WLAN_FEATURE_11AC
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
-         return "VHT80+40+"; /* upper secondary channels */
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
-         return "VHT80+40-"; /* 1 lower and 2 upper secondary channels */
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
-         return "VHT80-40+"; /* 2 lower and 1 upper secondary channels */
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
-         return "VHT80-40-"; /* lower secondary channels */
-#endif
-      default:
-         VOS_ASSERT(0);
-         return "Unknown";
-   }
-}
-
-/*
- * SME API to adjust bonding mode to regulatory .. etc.
- *
- */
-static VOS_STATUS sme_AdjustCBMode(tAniSirGlobal* pMac,
-      tSmeConfigParams  *smeConfig,
-      tANI_U8 channel)
-{
-   const tANI_U8 step = SME_START_CHAN_STEP;
-   tANI_U8 i, startChan = channel, chanCnt = 0, chanBitmap = 0;
-   tANI_BOOLEAN violation = VOS_FALSE;
-   tANI_U32 newMode, mode;
-   tANI_U8 centerChan = channel;
-   /* to validate 40MHz channels against the regulatory domain */
-   tANI_BOOLEAN ht40PhyMode = VOS_FALSE;
-
-   /* get the bonding mode */
-   mode = (channel <= 14) ? smeConfig->csrConfig.channelBondingMode24GHz :
-                        smeConfig->csrConfig.channelBondingMode5GHz;
-   newMode = mode;
-
-   /* get the channels */
-   switch (mode)
-   {
-      case eCSR_INI_SINGLE_CHANNEL_CENTERED:
-         startChan = channel;
-         chanCnt = 1;
-         break;
-      case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
-         startChan = channel - step;
-         chanCnt = 2;
-         centerChan = channel - CSR_CB_CENTER_CHANNEL_OFFSET;
-         ht40PhyMode = VOS_TRUE;
-         break;
-      case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
-         startChan = channel;
-         chanCnt=2;
-         centerChan = channel + CSR_CB_CENTER_CHANNEL_OFFSET;
-         ht40PhyMode = VOS_TRUE;
-         break;
-#ifdef WLAN_FEATURE_11AC
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
-         startChan = channel;
-         chanCnt = 4;
-         break;
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
-         startChan = channel - step;
-         chanCnt = 4;
-         break;
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
-         startChan = channel - 2*step;
-         chanCnt = 4;
-         break;
-      case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
-         startChan = channel - 3*step;
-         chanCnt = 4;
-         break;
-#endif
-      default:
-         VOS_ASSERT(0);
-         return VOS_STATUS_E_FAILURE;
-   }
-
-   /* find violation; also map valid channels to a bitmap */
-   for (i = 0; i < chanCnt; i++)
-   {
-      if (csrIsValidChannel(pMac, (startChan + (i * step))) ==
-            eHAL_STATUS_SUCCESS)
-         chanBitmap = chanBitmap | 1 << i;
-      else
-         violation = VOS_TRUE;
-   }
-   /* validate if 40MHz channel is allowed */
-   if (ht40PhyMode)
-   {
-      if (!csrRoamIsValid40MhzChannel(pMac, centerChan))
-         violation = VOS_TRUE;
-   }
-
-   /* no channels are valid */
-   if (chanBitmap == 0)
-   {
-      /* never be in this case */
-      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-            FL("channel %d %s is not supported"),
-            channel,
-            sme_CBMode2String(mode));
-      return VOS_STATUS_E_INVAL;
-   }
-
-   /* fix violation */
-   if (violation)
-   {
-      const tANI_U8 lowerMask = 0x03, upperMask = 0x0c;
-      /* fall back to single channel in all exception cases */
-      newMode = eCSR_INI_SINGLE_CHANNEL_CENTERED;
-
-      switch (mode)
-      {
-         case eCSR_INI_SINGLE_CHANNEL_CENTERED:
-            /* fall thru */
-         case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
-            /* fall thru */
-         case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
-            break;
-#ifdef WLAN_FEATURE_11AC
-         case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
-            if ((chanBitmap & lowerMask) == lowerMask)
-               newMode = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
-            break;
-         case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
-            if ((chanBitmap & lowerMask) == lowerMask)
-               newMode = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
-            break;
-         case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
-            if ((chanBitmap & upperMask) == upperMask)
-               newMode = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
-            break;
-         case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
-            if ((chanBitmap & upperMask) == upperMask)
-               newMode = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
-            break;
-#endif
-         default:
-            return VOS_STATUS_E_NOSUPPORT;
-            break;
-      }
-
-      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
-            FL("bonding mode adjust: %s to %s"),
-            sme_CBMode2String(mode),
-            sme_CBMode2String(newMode));
-
-   }
-
-   /* check for mode change */
-   if (newMode != mode)
-   {
-      if (channel <= 14)
-          smeConfig->csrConfig.channelBondingMode24GHz = newMode;
-      else
-          smeConfig->csrConfig.channelBondingMode5GHz = newMode;
-   }
-
-   return VOS_STATUS_SUCCESS;
-
-}
-
-/*
  * SME API to determine the channel bonding mode
  */
 VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
 {
    tSmeConfigParams  smeConfig;
    tpAniSirGlobal    pMac = PMAC_STRUCT(hHal);
-#ifdef WLAN_FEATURE_11AC
-   tANI_U8 vht80Allowed;
-#endif
 
    if (
 #ifdef WLAN_FEATURE_11AC
@@ -11711,98 +10283,46 @@
       return VOS_STATUS_SUCCESS;
    }
 
-   vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
-   sme_GetConfigParam(pMac, &smeConfig);
-
    /* If channel bonding mode is not required */
-#ifdef WLAN_FEATURE_AP_HT40_24G
-   if ( !pMac->roam.configParam.channelBondingMode5GHz
-      && !smeConfig.csrConfig.apHT40_24GEnabled ) {
-#else
    if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
-#endif
       return VOS_STATUS_SUCCESS;
    }
 
+   vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
+   sme_GetConfigParam(pMac, &smeConfig);
 
 #ifdef WLAN_FEATURE_11AC
    if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
          eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
    {
-      /* Check if VHT80 is allowed for the channel*/
-      vht80Allowed = vos_is_channel_valid_for_vht80(channel);
-
-      if (vht80Allowed)
+      if ( channel== 36 || channel == 52 || channel == 100 ||
+            channel == 116 || channel == 149 )
       {
-         if (channel== 36 || channel == 52 || channel == 100 ||
-              channel == 116 || channel == 149)
-         {
-            smeConfig.csrConfig.channelBondingMode5GHz =
-              eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
-         }
-         else if (channel == 40 || channel == 56 || channel == 104 ||
-              channel == 120 || channel == 153)
-         {
-            smeConfig.csrConfig.channelBondingMode5GHz =
-              eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
-         }
-         else if (channel == 44 || channel == 60 || channel == 108 ||
-            channel == 124 || channel == 157)
-        {
-            smeConfig.csrConfig.channelBondingMode5GHz =
-              eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
-        }
-        else if (channel == 48 || channel == 64 || channel == 112 ||
-             channel == 128 || channel == 144 || channel == 161)
-        {
-            smeConfig.csrConfig.channelBondingMode5GHz =
-              eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
-        }
-        else if (channel == 165)
-        {
-            smeConfig.csrConfig.channelBondingMode5GHz =
-              eCSR_INI_SINGLE_CHANNEL_CENTERED;
-        }
+         smeConfig.csrConfig.channelBondingMode5GHz =
+            PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
       }
-      else /* Set VHT40 */
+      else if ( channel == 40 || channel == 56 || channel == 104 ||
+            channel == 120 || channel == 153 )
       {
-        if (channel== 40 || channel == 48 || channel == 56 ||
-            channel == 64 || channel == 104 || channel == 112 ||
-            channel == 120 || channel == 128 || channel == 136 ||
-            channel == 144 || channel == 153 || channel == 161)
-        {
-            smeConfig.csrConfig.channelBondingMode5GHz =
-                eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
-        }
-        else if (channel== 36 || channel == 44 || channel == 52 ||
-            channel == 60 || channel == 100 || channel == 108 ||
-            channel == 116 || channel == 124 || channel == 132 ||
-            channel == 140 || channel == 149 || channel == 157)
-        {
-            smeConfig.csrConfig.channelBondingMode5GHz =
-                eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
-        }
-        else if (channel == 165)
-        {
-            smeConfig.csrConfig.channelBondingMode5GHz =
-                eCSR_INI_SINGLE_CHANNEL_CENTERED;
-        }
+         smeConfig.csrConfig.channelBondingMode5GHz =
+            PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
       }
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-      if (smeConfig.csrConfig.apHT40_24GEnabled)
+      else if ( channel == 44 || channel == 60 || channel == 108 ||
+            channel == 124 || channel == 157 )
       {
-          if (channel >= 1 && channel <= 7)
-             smeConfig.csrConfig.channelBondingAPMode24GHz =
-                eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
-          else if (channel >= 8 && channel <= 13)
-             smeConfig.csrConfig.channelBondingAPMode24GHz =
-                eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
-          else if (channel ==14)
-             smeConfig.csrConfig.channelBondingAPMode24GHz =
-                eCSR_INI_SINGLE_CHANNEL_CENTERED;
+         smeConfig.csrConfig.channelBondingMode5GHz =
+            PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
       }
-#endif
+      else if ( channel == 48 || channel == 64 || channel == 112 ||
+            channel == 128 || channel == 144 || channel == 161 )
+      {
+         smeConfig.csrConfig.channelBondingMode5GHz =
+            PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
+      }
+      else if ( channel == 165 )
+      {
+         smeConfig.csrConfig.channelBondingMode5GHz = 0;
+      }
    }
 #endif
 
@@ -11814,37 +10334,19 @@
             channel == 120 || channel == 128 || channel == 136 ||
             channel == 144 || channel == 153 || channel == 161 )
       {
-         smeConfig.csrConfig.channelBondingMode5GHz =
-                eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
+         smeConfig.csrConfig.channelBondingMode5GHz = 1;
       }
       else if ( channel== 36 || channel == 44 || channel == 52 ||
             channel == 60 || channel == 100 || channel == 108 ||
             channel == 116 || channel == 124 || channel == 132 ||
             channel == 140 || channel == 149 || channel == 157 )
       {
-         smeConfig.csrConfig.channelBondingMode5GHz =
-                eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
+         smeConfig.csrConfig.channelBondingMode5GHz = 2;
       }
       else if ( channel == 165 )
       {
-         smeConfig.csrConfig.channelBondingMode5GHz =
-                eCSR_INI_SINGLE_CHANNEL_CENTERED;
+         smeConfig.csrConfig.channelBondingMode5GHz = 0;
       }
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-      if (smeConfig.csrConfig.apHT40_24GEnabled)
-      {
-          if (channel >= 1 && channel <= 7)
-             smeConfig.csrConfig.channelBondingAPMode24GHz =
-                eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
-          else if (channel >= 8 && channel <= 13)
-             smeConfig.csrConfig.channelBondingAPMode24GHz =
-                eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
-          else if (channel ==14)
-             smeConfig.csrConfig.channelBondingAPMode24GHz =
-                eCSR_INI_SINGLE_CHANNEL_CENTERED;
-      }
-#endif
    }
 
    /*
@@ -11858,29 +10360,10 @@
          eCSR_DOT11_MODE_abg == eCsrPhyMode)
    {
       smeConfig.csrConfig.channelBondingMode5GHz = 0;
-#ifdef WLAN_FEATURE_AP_HT40_24G
-   } else if ( eCSR_DOT11_MODE_11g_ONLY == eCsrPhyMode)
-      smeConfig.csrConfig.channelBondingAPMode24GHz =
-         eCSR_INI_SINGLE_CHANNEL_CENTERED;
-#else
    }
-#endif
 
-   sme_AdjustCBMode(pMac, &smeConfig, channel);
-
-#ifdef WLAN_FEATURE_AP_HT40_24G
-   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-         FL("%s cbmode selected=%d bonding mode:%s"),
-         (channel <= 14) ? "2G" : "5G",
-         (channel <= 14) ? smeConfig.csrConfig.channelBondingAPMode24GHz :
-                        smeConfig.csrConfig.channelBondingMode5GHz,
-         (channel <= 14) ?
-         sme_CBMode2String(smeConfig.csrConfig.channelBondingAPMode24GHz) :
-         sme_CBMode2String(smeConfig.csrConfig.channelBondingMode5GHz));
-#else
    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
-       "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
-#endif
+         "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
 
    sme_UpdateConfig (pMac, &smeConfig);
    return VOS_STATUS_SUCCESS;
@@ -11946,20 +10429,6 @@
     return VOS_STATUS_E_FAILURE;
 }
 
-/*
- * SME API to check if any sessoion connected.
- */
-VOS_STATUS sme_is_any_session_connected(tHalHandle hHal)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-    if(csrIsAnySessionConnected(pMac))
-    {
-
-        return VOS_STATUS_SUCCESS;
-    }
-    return VOS_STATUS_E_FAILURE;
-}
-
 
 #ifdef FEATURE_WLAN_LPHB
 /* ---------------------------------------------------------------------------
@@ -11982,9 +10451,6 @@
     tpAniSirGlobal      pMac      = PMAC_STRUCT(hHal);
     vos_msg_t           vosMessage;
 
-    MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                   TRACE_CODE_SME_RX_HDD_LPHB_CONFIG_REQ,
-                   NO_SESSION, lphdReq->cmd));
     status = sme_AcquireGlobalLock(&pMac->sme);
     if (eHAL_STATUS_SUCCESS == status)
     {
@@ -12005,8 +10471,6 @@
         /* serialize the req through MC thread */
         vosMessage.bodyptr = lphdReq;
         vosMessage.type    = WDA_LPHB_CONF_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
         vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
         if (!VOS_IS_STATUS_SUCCESS(vosStatus))
         {
@@ -12045,173 +10509,15 @@
 
 }
 
-/**
- * sme_AddPeriodicTxPtrn() - Add Periodic TX Pattern
- * @hal: global hal handle
- * @addPeriodicTxPtrnParams: request message
- *
- * Return: eHalStatus enumeration
- */
-eHalStatus
-sme_AddPeriodicTxPtrn(tHalHandle hal,
-        struct sSirAddPeriodicTxPtrn *addPeriodicTxPtrnParams)
-{
-    eHalStatus status     = eHAL_STATUS_SUCCESS;
-    VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
-    tpAniSirGlobal mac   = PMAC_STRUCT(hal);
-    struct sSirAddPeriodicTxPtrn *req_msg;
-    vos_msg_t msg;
-
-    smsLog(mac, LOG1, FL("enter"));
-
-    req_msg = vos_mem_malloc(sizeof(*req_msg));
-    if (!req_msg)
-    {
-        smsLog(mac, LOGE, FL("vos_mem_malloc failed"));
-        return eHAL_STATUS_FAILED_ALLOC;
-    }
-
-    *req_msg = *addPeriodicTxPtrnParams;
-
-    status = sme_AcquireGlobalLock(&mac->sme);
-    if (status != eHAL_STATUS_SUCCESS)
-    {
-        smsLog(mac, LOGE,
-                FL("sme_AcquireGlobalLock failed!(status=%d)"),
-                status);
-        vos_mem_free(req_msg);
-        return status;
-    }
-
-    /* Serialize the req through MC thread */
-    msg.bodyptr = req_msg;
-    msg.type    = WDA_ADD_PERIODIC_TX_PTRN_IND;
-    vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &msg);
-    if (!VOS_IS_STATUS_SUCCESS(vos_status))
-    {
-        smsLog(mac, LOGE,
-                FL("vos_mq_post_message failed!(err=%d)"),
-                vos_status);
-        vos_mem_free(req_msg);
-        status = eHAL_STATUS_FAILURE;
-    }
-    sme_ReleaseGlobalLock(&mac->sme);
-    return status;
-}
-
-
-/**
- * sme_DelPeriodicTxPtrn() - Delete Periodic TX Pattern
- * @hal: global hal handle
- * @delPeriodicTxPtrnParams: request message
- *
- * Return: eHalStatus enumeration
- */
-eHalStatus
-sme_DelPeriodicTxPtrn(tHalHandle hal,
-        struct sSirDelPeriodicTxPtrn *delPeriodicTxPtrnParams)
-{
-
-    eHalStatus status     = eHAL_STATUS_SUCCESS;
-    VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
-    tpAniSirGlobal mac   = PMAC_STRUCT(hal);
-    struct sSirDelPeriodicTxPtrn *req_msg;
-    vos_msg_t msg;
-
-    smsLog(mac, LOG1, FL("enter"));
-
-    req_msg = vos_mem_malloc(sizeof(*req_msg));
-
-    if (!req_msg)
-    {
-        smsLog(mac, LOGE, FL("vos_mem_malloc failed"));
-        return eHAL_STATUS_FAILED_ALLOC;
-    }
-
-    *req_msg = *delPeriodicTxPtrnParams;
-
-    status = sme_AcquireGlobalLock(&mac->sme);
-    if (status != eHAL_STATUS_SUCCESS)
-    {
-        smsLog(mac, LOGE,
-                FL("sme_AcquireGlobalLock failed!(status=%d)"),
-                status);
-        vos_mem_free(req_msg);
-        return status;
-    }
-
-    /* Serialize the req through MC thread */
-    msg.bodyptr = req_msg;
-    msg.type    = WDA_DEL_PERIODIC_TX_PTRN_IND;
-    vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &msg);
-    if (!VOS_IS_STATUS_SUCCESS(vos_status))
-    {
-        smsLog(mac, LOGE,
-                FL("vos_mq_post_message failed!(err=%d)"),
-                vos_status);
-        vos_mem_free(req_msg);
-        status = eHAL_STATUS_FAILURE;
-    }
-    sme_ReleaseGlobalLock(&mac->sme);
-    return status;
-}
-
-#ifdef WLAN_FEATURE_RMC
 /* ---------------------------------------------------------------------------
-    \fn sme_EnableRMC
-    \brief  Used to enable RMC
-    setting will not persist over reboots
-    \param  hHal
-    \param  sessionId
-    \- return eHalStatus
-    -------------------------------------------------------------------------*/
-eHalStatus sme_EnableRMC(tHalHandle hHal, tANI_U32 sessionId)
-{
-    eHalStatus status = eHAL_STATUS_FAILURE;
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-
-    smsLog(pMac, LOG1, FL("enable RMC"));
-    status = sme_AcquireGlobalLock(&pMac->sme);
-    if (HAL_STATUS_SUCCESS(status))
-    {
-        status = csrEnableRMC(pMac, sessionId);
-        sme_ReleaseGlobalLock(&pMac->sme);
-    }
-    return status;
-}
-
-/* ---------------------------------------------------------------------------
-    \fn sme_DisableRMC
-    \brief  Used to disable RMC
-    setting will not persist over reboots
-    \param  hHal
-    \param  sessionId
-    \- return eHalStatus
-    -------------------------------------------------------------------------*/
-eHalStatus sme_DisableRMC(tHalHandle hHal, tANI_U32 sessionId)
-{
-   eHalStatus status = eHAL_STATUS_FAILURE;
-   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-
-   smsLog(pMac, LOG1, FL("disable RMC"));
-   status = sme_AcquireGlobalLock(&pMac->sme);
-   if (HAL_STATUS_SUCCESS(status))
-   {
-      status = csrDisableRMC(pMac, sessionId);
-      sme_ReleaseGlobalLock(&pMac->sme);
-   }
-   return status;
-}
-#endif /* WLAN_FEATURE_RMC */
-
-/* ---------------------------------------------------------------------------
-    \fn sme_SendRateUpdateInd
-    \brief  API to Update rate
+    \fn sme_AddPeriodicTxPtrn
+    \brief  API to Periodic TX Pattern Offload feature
     \param  hHal - The handle returned by macOpen
-    \param  rateUpdateParams - Pointer to rate update params
+    \param  addPeriodicTxPtrnParams - Pointer to the add pattern structure
     \return eHalStatus
   ---------------------------------------------------------------------------*/
-eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
+eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
+                                 *addPeriodicTxPtrnParams)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
     eHalStatus status;
@@ -12219,15 +10525,13 @@
 
     if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
     {
-        msg.type     = WDA_RATE_UPDATE_IND;
-        msg.bodyptr  = rateUpdateParams;
+        msg.type     = WDA_ADD_PERIODIC_TX_PTRN_IND;
+        msg.bodyptr  = addPeriodicTxPtrnParams;
 
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
         if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
         {
             VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
-                       "to post WDA_SET_RMC_RATE_IND to WDA!",
+                       "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
                        __func__);
 
             sme_ReleaseGlobalLock(&pMac->sme);
@@ -12241,64 +10545,41 @@
     return status;
 }
 
-#ifdef WLAN_FEATURE_RMC
 /* ---------------------------------------------------------------------------
-    \fn sme_GetIBSSPeerInfo
-    \brief  Used to disable RMC
-    setting will not persist over reboots
-    \param  hHal
-    \param  ibssPeerInfoReq  multicast Group IP address
-    \- return eHalStatus
-    -------------------------------------------------------------------------*/
-eHalStatus sme_RequestIBSSPeerInfo(tHalHandle hHal, void *pUserData,
-                                            pIbssPeerInfoCb peerInfoCbk,
-                                            tANI_BOOLEAN allPeerInfoReqd,
-                                            tANI_U8 staIdx)
+    \fn sme_DelPeriodicTxPtrn
+    \brief  API to Periodic TX Pattern Offload feature
+    \param  hHal - The handle returned by macOpen
+    \param  delPeriodicTxPtrnParams - Pointer to the delete pattern structure
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
+                                 *delPeriodicTxPtrnParams)
 {
-   eHalStatus status = eHAL_STATUS_FAILURE;
-   VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
-   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-   vos_msg_t vosMessage;
-   tSirIbssGetPeerInfoReqParams *pIbssInfoReqParams;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    eHalStatus status;
+    vos_msg_t msg;
 
-   status = sme_AcquireGlobalLock(&pMac->sme);
-   if ( eHAL_STATUS_SUCCESS == status)
-   {
-       pMac->sme.peerInfoParams.peerInfoCbk = peerInfoCbk;
-       pMac->sme.peerInfoParams.pUserData = pUserData;
+    if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
+    {
+        msg.type     = WDA_DEL_PERIODIC_TX_PTRN_IND;
+        msg.bodyptr  = delPeriodicTxPtrnParams;
 
-       pIbssInfoReqParams = (tSirIbssGetPeerInfoReqParams *)
-                        vos_mem_malloc(sizeof(tSirIbssGetPeerInfoReqParams));
-       if (NULL == pIbssInfoReqParams)
-       {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                  "%s: Not able to allocate memory for dhcp start", __func__);
-           sme_ReleaseGlobalLock( &pMac->sme );
-           return eHAL_STATUS_FAILURE;
-       }
-       pIbssInfoReqParams->allPeerInfoReqd = allPeerInfoReqd;
-       pIbssInfoReqParams->staIdx = staIdx;
+        if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
+        {
+            VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
+                       "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
+                       __func__);
 
-       vosMessage.type = WDA_GET_IBSS_PEER_INFO_REQ;
-       vosMessage.bodyptr = pIbssInfoReqParams;
-       vosMessage.reserved = 0;
+            sme_ReleaseGlobalLock(&pMac->sme);
+            return eHAL_STATUS_FAILURE;
+        }
 
-       MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
-       vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
-       if ( VOS_STATUS_SUCCESS != vosStatus )
-       {
-          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                        "%s: Post WDA_GET_IBSS_PEER_INFO_REQ MSG failed", __func__);
-          vos_mem_free(pIbssInfoReqParams);
-          vosStatus = eHAL_STATUS_FAILURE;
-       }
-       sme_ReleaseGlobalLock( &pMac->sme );
-   }
+        sme_ReleaseGlobalLock(&pMac->sme);
+        return eHAL_STATUS_SUCCESS;
+    }
 
-   return (vosStatus);
+    return status;
 }
-#endif
 
 void smeGetCommandQStatus( tHalHandle hHal )
 {
@@ -12376,6 +10657,41 @@
 }
 
 /* ---------------------------------------------------------------------------
+    \fn sme_SendRateUpdateInd
+    \brief  API to Update rate
+    \param  hHal - The handle returned by macOpen
+    \param  rateUpdateParams - Pointer to rate update params
+    \return eHalStatus
+  ---------------------------------------------------------------------------*/
+eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    eHalStatus status;
+    vos_msg_t msg;
+
+    if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
+    {
+        msg.type     = WDA_RATE_UPDATE_IND;
+        msg.bodyptr  = rateUpdateParams;
+
+        if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
+        {
+            VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
+                       "to post WDA_SET_RMC_RATE_IND to WDA!",
+                       __func__);
+
+            sme_ReleaseGlobalLock(&pMac->sme);
+            return eHAL_STATUS_FAILURE;
+        }
+
+        sme_ReleaseGlobalLock(&pMac->sme);
+        return eHAL_STATUS_SUCCESS;
+    }
+
+    return status;
+}
+
+/* ---------------------------------------------------------------------------
     \fn sme_TriggerBatchScanResultInd
     \brief  API to trigger batch scan result indications from FW
     \param  hHal - The handle returned by macOpen.
@@ -12434,67 +10750,6 @@
 
 #endif
 
-void activeListCmdTimeoutHandle(void *userData)
-{
-    tHalHandle hHal= (tHalHandle) userData;
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-    tListElem *pEntry;
-    tSmeCmd *pTempCmd = NULL;
-
-    if (NULL == pMac)
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
-            "%s: pMac is null", __func__);
-        return;
-    }
-    /* Return if no cmd pending in active list as
-     * in this case we should not be here.
-     */
-    if ((NULL == userData) ||
-        (0 == csrLLCount(&pMac->sme.smeCmdActiveList)))
-        return;
-    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-        "%s: Active List command timeout Cmd List Count %d", __func__,
-        csrLLCount(&pMac->sme.smeCmdActiveList) );
-    smeGetCommandQStatus(hHal);
-
-    vos_state_info_dump_all();
-
-
-    pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
-    if (pEntry) {
-        pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
-    }
-    /* If user initiated scan took more than active list timeout
-     * abort it.
-     */
-    if (pTempCmd && (eSmeCommandScan == pTempCmd->command) &&
-        (eCsrScanUserRequest == pTempCmd->u.scanCmd.reason)) {
-        sme_AbortMacScan(hHal, pTempCmd->sessionId,
-                                 eCSR_SCAN_ABORT_DEFAULT);
-        return;
-    } else if (pTempCmd &&
-         (eSmeCommandRemainOnChannel == pTempCmd->command)) {
-         /* Ignore if ROC took more than 120 sec */
-         return;
-    }
-    if (pMac->roam.configParam.enableFatalEvent)
-    {
-       vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                  WLAN_LOG_INDICATOR_HOST_DRIVER,
-                  WLAN_LOG_REASON_SME_COMMAND_STUCK,
-                  FALSE, FALSE);
-    }
-    else
-    {
-       /* Initiate SSR to recover */
-       if (!(vos_isLoadUnloadInProgress() ||
-           vos_is_logp_in_progress(VOS_MODULE_ID_SME, NULL)))
-       {
-          vos_wlanRestart();
-       }
-    }
-}
 
 #ifdef FEATURE_WLAN_CH_AVOID
 /* ---------------------------------------------------------------------------
@@ -12532,33 +10787,14 @@
 }
 #endif /* FEATURE_WLAN_CH_AVOID */
 
-
-/**
- * sme_set_rssi_threshold_breached_cb() - set rssi threshold breached callback
- * @hal: global hal handle
- * @cb: callback function pointer
- *
- * This function stores the rssi threshold breached callback function.
- *
- * Return: eHalStatus enumeration.
- */
-eHalStatus sme_set_rssi_threshold_breached_cb(tHalHandle hal,
-                                void (*cb)(void *, struct rssi_breach_event *))
+void activeListCmdTimeoutHandle(void *userData)
 {
-        eHalStatus status  = eHAL_STATUS_SUCCESS;
-        tpAniSirGlobal mac = PMAC_STRUCT(hal);
-
-        status = sme_AcquireGlobalLock(&mac->sme);
-        if (status != eHAL_STATUS_SUCCESS) {
-                smsLog(mac, LOGE,
-                        FL("sme_AcquireGlobalLock failed!(status=%d)"),
-                        status);
-                return status;
-        }
-
-        mac->sme.rssiThresholdBreachedCb = cb;
-        sme_ReleaseGlobalLock(&mac->sme);
-        return status;
+    if (NULL == userData)
+        return;
+    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+        "%s: Active List command timeout Cmd List Count %d", __func__,
+    csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
+    smeGetCommandQStatus((tHalHandle) userData);
 }
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
@@ -12601,13 +10837,10 @@
         msg.reserved = 0;
         msg.bodyptr = plinkLayerSetReq;
 
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
         if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
         {
             VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
                     "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
-            vos_mem_free(plinkLayerSetReq);
             status = eHAL_STATUS_FAILURE;
         }
         sme_ReleaseGlobalLock( &pMac->sme );
@@ -12616,8 +10849,6 @@
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
                 "sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(plinkLayerSetReq);
-        status = eHAL_STATUS_FAILURE;
     }
     return status;
 }
@@ -12657,13 +10888,10 @@
         msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
         msg.reserved = 0;
         msg.bodyptr = pGetStatsReq;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
         if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
         {
             VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
                     "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
-            vos_mem_free(pGetStatsReq);
             status = eHAL_STATUS_FAILURE;
         }
         sme_ReleaseGlobalLock( &pMac->sme );
@@ -12672,8 +10900,6 @@
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
                 "sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(pGetStatsReq);
-        status = eHAL_STATUS_FAILURE;
     }
     return status;
 }
@@ -12717,13 +10943,10 @@
         msg.reserved = 0;
         msg.bodyptr = pClearStatsReq;
 
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
         if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
         {
             VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
                     "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
-            vos_mem_free(pClearStatsReq);
             status = eHAL_STATUS_FAILURE;
         }
         sme_ReleaseGlobalLock( &pMac->sme );
@@ -12732,8 +10955,6 @@
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
                 "sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(pClearStatsReq);
-        status = eHAL_STATUS_FAILURE;
     }
 
     return status;
@@ -12772,7 +10993,6 @@
 }
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
 
-
 eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -12794,6 +11014,13 @@
     status = sme_AcquireGlobalLock( &pMac->sme );
     if ( HAL_STATUS_SUCCESS( status ) )
     {
+        if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
+        {
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                     "%s: Invalid session Id %u", __func__, sessionId);
+            sme_ReleaseGlobalLock( &pMac->sme);
+            return eHAL_STATUS_FAILURE;
+        }
         pCsrSession = CSR_GET_SESSION( pMac, sessionId );
 
         if (pCsrSession == NULL)
@@ -12804,14 +11031,6 @@
             return eHAL_STATUS_FAILURE;
         }
 
-        if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
-        {
-            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                     "%s: Invalid session Id %u", __func__, sessionId);
-            sme_ReleaseGlobalLock( &pMac->sme);
-            return eHAL_STATUS_FAILURE;
-        }
-
         pSession = peFindSessionByBssid( pMac,
             pCsrSession->connectedProfile.bssid, &peSessionId );
 
@@ -12825,7 +11044,7 @@
 
         if ( !pSession->QosMapSet.present )
         {
-            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
                      "%s: QOS Mapping IE not present", __func__);
             sme_ReleaseGlobalLock( &pMac->sme);
             return eHAL_STATUS_FAILURE;
@@ -12840,9 +11059,10 @@
                    if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
                                 (pSession->QosMapSet.dscp_range[i][1] == 255))
                    {
+                       dscpmapping[j]= 0;
                        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                               "%s: User Priority %d is not used in mapping",
-                                __func__, i);
+                       "%s: User Priority %d is not used in mapping",
+                                                             __func__, i);
                        break;
                    }
                    else
@@ -12880,40 +11100,34 @@
     }
 }
 
-eHalStatus sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
+tANI_BOOLEAN  sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
 {
-   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-   eHalStatus status = eHAL_STATUS_SUCCESS;
-   tSmeCmd *pMacSpoofCmd;
+    eHalStatus status   = eHAL_STATUS_SUCCESS;
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+    tANI_U16 len;
 
-    status = sme_AcquireGlobalLock( &pMac->sme );
-    if ( HAL_STATUS_SUCCESS( status ) )
+    if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
     {
-       pMacSpoofCmd = csrGetCommandBuffer(pMac);
-       if (pMacSpoofCmd)
-       {
-           pMacSpoofCmd->command = eSmeCommandMacSpoofRequest;
-           vos_mem_set(&pMacSpoofCmd->u.macAddrSpoofCmd,
-                                                    sizeof(tSirSpoofMacAddrReq), 0);
-           vos_mem_copy(pMacSpoofCmd->u.macAddrSpoofCmd.macAddr,
-                                               macaddr->bytes, VOS_MAC_ADDRESS_LEN);
+        tpSirSpoofMacAddrReq pMsg;
 
-           status = csrQueueSmeCommand(pMac, pMacSpoofCmd, false);
-           if ( !HAL_STATUS_SUCCESS( status ) )
-           {
-               smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
-               csrReleaseCommand(pMac, pMacSpoofCmd);
-           }
-       }
-       else
-       {
-           //log error
-           smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
-           status = eHAL_STATUS_RESOURCES;
-       }
-       sme_ReleaseGlobalLock( &pMac->sme);
-   }
-   return (status);
+        /* Create the message and send to lim */
+        len = sizeof(tSirSpoofMacAddrReq);
+        pMsg = vos_mem_malloc(len);
+        if ( NULL == pMsg )
+           status = eHAL_STATUS_FAILURE;
+        else
+        {
+            vos_mem_set(pMsg, sizeof(tSirSpoofMacAddrReq), 0);
+            pMsg->messageType     = eWNI_SME_MAC_SPOOF_ADDR_IND;
+            pMsg->length          = len;
+            /* Data starts from here */
+            vos_mem_copy(pMsg->macAddr, macaddr->bytes, VOS_MAC_ADDRESS_LEN);
+
+            status = palSendMBMessage(pMac->hHdd, pMsg);
+        }
+        sme_ReleaseGlobalLock( &pMac->sme );
+    }
+    return status;
 }
 
 #ifdef WLAN_FEATURE_EXTSCAN
@@ -13062,30 +11276,18 @@
 
     *pGetEXTScanCapabilitiesReq = *pReq;
 
+    MTRACE(vos_trace(VOS_MODULE_ID_SME,
+               TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CAPABILITIES, NO_SESSION, 0));
     if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
         /* Serialize the req through MC thread */
         vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
         vosMessage.type    = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
         vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
-        if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-                    "failed to post WDA_EXTSCAN_GET_CAPABILITIES_REQ ",
-                    __func__);
-           vos_mem_free(pGetEXTScanCapabilitiesReq);
+        if (!VOS_IS_STATUS_SUCCESS(vosStatus))
            status = eHAL_STATUS_FAILURE;
-        }
 
         sme_ReleaseGlobalLock(&pMac->sme);
     }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-                "sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(pGetEXTScanCapabilitiesReq);
-        status = eHAL_STATUS_FAILURE;
-    }
     return(status);
 }
 
@@ -13124,24 +11326,12 @@
         /* Serialize the req through MC thread */
         vosMessage.bodyptr = pextScanStartReq;
         vosMessage.type    = WDA_EXTSCAN_START_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
         vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
-        if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                    "%s: failed to post WDA_EXTSCAN_START_REQ", __func__);
-           vos_mem_free(pextScanStartReq);
+        if (!VOS_IS_STATUS_SUCCESS(vosStatus))
            status = eHAL_STATUS_FAILURE;
-        }
+
         sme_ReleaseGlobalLock(&pMac->sme);
     }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-                "sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(pextScanStartReq);
-        status = eHAL_STATUS_FAILURE;
-    }
     return(status);
 }
 
@@ -13179,25 +11369,13 @@
         /* Serialize the req through MC thread */
         vosMessage.bodyptr = pEXTScanStopReq;
         vosMessage.type    = WDA_EXTSCAN_STOP_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
         vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
         if (!VOS_IS_STATUS_SUCCESS(vosStatus))
         {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                    "%s: failed to post WDA_EXTSCAN_STOP_REQ", __func__);
-           vos_mem_free(pEXTScanStopReq);
            status = eHAL_STATUS_FAILURE;
         }
         sme_ReleaseGlobalLock(&pMac->sme);
     }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-                "sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(pEXTScanStopReq);
-        status = eHAL_STATUS_FAILURE;
-    }
     return(status);
 }
 
@@ -13236,24 +11414,12 @@
         /* Serialize the req through MC thread */
         vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
         vosMessage.type    = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
         vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
-        if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                    "%s: failed to post WDA_EXTSCAN_STOP_REQ", __func__);
-           vos_mem_free(pEXTScanSetBssidHotlistReq);
+        if (!VOS_IS_STATUS_SUCCESS(vosStatus))
            status = eHAL_STATUS_FAILURE;
-        }
+
         sme_ReleaseGlobalLock(&pMac->sme);
     }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-                "sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(pEXTScanSetBssidHotlistReq);
-        status = eHAL_STATUS_FAILURE;
-    }
 
     return(status);
 }
@@ -13293,138 +11459,103 @@
         /* Serialize the req through MC thread */
         vosMessage.bodyptr = pEXTScanHotlistResetReq;
         vosMessage.type    = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
         vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
-        if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                    "%s: failed to post WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
-                     __func__);
-           vos_mem_free(pEXTScanHotlistResetReq);
+        if (!VOS_IS_STATUS_SUCCESS(vosStatus))
            status = eHAL_STATUS_FAILURE;
-        }
+
         sme_ReleaseGlobalLock(&pMac->sme);
     }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-                "sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(pEXTScanHotlistResetReq);
-        status = eHAL_STATUS_FAILURE;
-    }
     return(status);
 }
 
-/**
- * sme_set_ssid_hotlist() - Set the SSID hotlist
- * @hal: SME handle
- * @request: set ssid hotlist request
- *
- * Return: eHalStatus
- */
-eHalStatus
-sme_set_ssid_hotlist(tHalHandle hal,
-             tSirEXTScanSetSsidHotListReqParams *request)
+/* ---------------------------------------------------------------------------
+    \fn sme_SetSignificantChange
+    \brief  SME API to set significant change
+    \param  hHal
+    \param  pSetSignificantChangeReq: Extended Scan set significant change structure
+    \- return eHalStatus
+    -------------------------------------------------------------------------*/
+eHalStatus sme_SetSignificantChange (tHalHandle hHal,
+         tSirEXTScanSetSignificantChangeReqParams *pSetSignificantChangeReq)
 {
-    eHalStatus status;
-    VOS_STATUS vstatus;
-    tpAniSirGlobal mac = PMAC_STRUCT(hal);
-    vos_msg_t vos_message;
-    tSirEXTScanSetSsidHotListReqParams *set_req;
-    int i;
+    eHalStatus status    = eHAL_STATUS_SUCCESS;
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+    tpAniSirGlobal pMac  = PMAC_STRUCT(hHal);
+    vos_msg_t vosMessage;
+    tSirEXTScanSetSignificantChangeReqParams *pEXTScanSetSignificantReq;
 
-    set_req = vos_mem_malloc(sizeof(*set_req));
-    if (!set_req) {
+    pEXTScanSetSignificantReq = vos_mem_malloc(sizeof(*pEXTScanSetSignificantReq));
+    if ( !pEXTScanSetSignificantReq)
+    {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-              "%s: Not able to allocate memory for WDA_EXTSCAN_SET_SSID_HOTLIST_REQ",
-              __func__);
-        return eHAL_STATUS_FAILURE;
-    }
-
-    *set_req = *request;
-
-
-
-   for( i = 0; i < set_req->ssid_count; i++){
-
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-         "%s: SSID %s \n length: %d",
-              __func__, set_req->ssid[i].ssid.ssId, set_req->ssid[i].ssid.length);
-  }
-
-     MTRACE(vos_trace(VOS_MODULE_ID_SME,
-            TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SSID_HOTLIST, NO_SESSION, 0));
-
-    status = sme_AcquireGlobalLock(&mac->sme);
-    if (eHAL_STATUS_SUCCESS == status) {
-        /* Serialize the req through MC thread */
-        vos_message.bodyptr = set_req;
-        vos_message.type    = WDA_EXTSCAN_SET_SSID_HOTLIST_REQ;
-        vstatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vos_message);
-        sme_ReleaseGlobalLock(&mac->sme);
-        if (!VOS_IS_STATUS_SUCCESS(vstatus)) {
-            vos_mem_free(set_req);
-            status = eHAL_STATUS_FAILURE;
-        }
-    } else {
-      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-            "%s: sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(set_req);
-        status = eHAL_STATUS_FAILURE;
-    }
-    return status;
-}
-
-/**
- * sme_reset_ssid_hotlist() - Set the SSID hotlist
- * @hal: SME handle
- * @request: reset ssid hotlist request
- *
- * Return: eHalStatus
- */
-eHalStatus
-sme_reset_ssid_hotlist(tHalHandle hal,
-        tSirEXTScanResetSsidHotlistReqParams *request)
-{
-    eHalStatus status;
-    VOS_STATUS vstatus;
-    tpAniSirGlobal mac = PMAC_STRUCT(hal);
-    vos_msg_t vos_message;
-    tSirEXTScanResetSsidHotlistReqParams *set_req;
-
-    set_req = vos_mem_malloc(sizeof(*set_req));
-    if (!set_req) {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                "%s: Not able to allocate memory for WDA_EXTSCAN_SET_SSID_HOTLIST_REQ",
+                "%s: Not able to allocate memory for "
+                "WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ",
                 __func__);
         return eHAL_STATUS_FAILURE;
     }
 
-    *set_req = *request;
+    *pEXTScanSetSignificantReq = *pSetSignificantChangeReq;
+
+
 
     MTRACE(vos_trace(VOS_MODULE_ID_SME,
-            TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SSID_HOTLIST, NO_SESSION, 0));
-
-    status = sme_AcquireGlobalLock(&mac->sme);
-    if (eHAL_STATUS_SUCCESS == status) {
+           TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SIGNF_CHANGE, NO_SESSION, 0));
+    if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
         /* Serialize the req through MC thread */
-        vos_message.bodyptr = set_req;
-        vos_message.type    = WDA_EXTSCAN_RESET_SSID_HOTLIST_REQ;
-        vstatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vos_message);
-        sme_ReleaseGlobalLock(&mac->sme);
-        if (!VOS_IS_STATUS_SUCCESS(vstatus)) {
-            vos_mem_free(set_req);
-            status = eHAL_STATUS_FAILURE;
-        }
-    } else {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                 "%s: sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(set_req);
-        status = eHAL_STATUS_FAILURE;
+        vosMessage.bodyptr = pEXTScanSetSignificantReq;
+        vosMessage.type    = WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ;
+        vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
+        if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+           status = eHAL_STATUS_FAILURE;
+
+        sme_ReleaseGlobalLock(&pMac->sme);
     }
-    return status;
+    return(status);
 }
 
+/* ---------------------------------------------------------------------------
+    \fn sme_ResetSignificantChange
+    \brief  SME API to reset significant change
+    \param  hHal
+    \param  pResetReq: Extended Scan reset significant change structure
+    \- return eHalStatus
+    -------------------------------------------------------------------------*/
+eHalStatus sme_ResetSignificantChange (tHalHandle hHal,
+                          tSirEXTScanResetSignificantChangeReqParams *pResetReq)
+{
+    eHalStatus status    = eHAL_STATUS_SUCCESS;
+    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+    tpAniSirGlobal pMac  = PMAC_STRUCT(hHal);
+    vos_msg_t vosMessage;
+    tSirEXTScanResetSignificantChangeReqParams *pEXTScanResetSignificantReq;
+
+    pEXTScanResetSignificantReq =
+        vos_mem_malloc(sizeof(*pEXTScanResetSignificantReq));
+    if ( !pEXTScanResetSignificantReq)
+    {
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+                "%s: Not able to allocate memory for "
+                "WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ",
+                __func__);
+        return eHAL_STATUS_FAILURE;
+    }
+
+    *pEXTScanResetSignificantReq = *pResetReq;
+
+    MTRACE(vos_trace(VOS_MODULE_ID_SME,
+           TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SIGNF_CHANGE, NO_SESSION, 0));
+    if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
+        /* Serialize the req through MC thread */
+        vosMessage.bodyptr = pEXTScanResetSignificantReq;
+        vosMessage.type    = WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ;
+        vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
+        if (!VOS_IS_STATUS_SUCCESS(vosStatus))
+           status = eHAL_STATUS_FAILURE;
+
+        sme_ReleaseGlobalLock(&pMac->sme);
+    }
+    return(status);
+}
 
 /* ---------------------------------------------------------------------------
     \fn sme_getCachedResults
@@ -13462,25 +11593,12 @@
         /* Serialize the req through MC thread */
         vosMessage.bodyptr = pEXTScanCachedResultsReq;
         vosMessage.type    = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
         vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
-        if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                "%s: failed tp post WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
-                __func__);
-           vos_mem_free(pEXTScanCachedResultsReq);
+        if (!VOS_IS_STATUS_SUCCESS(vosStatus))
            status = eHAL_STATUS_FAILURE;
-        }
+
         sme_ReleaseGlobalLock(&pMac->sme);
     }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-            FL("Failed to acquire SME Global Lock"));
-        vos_mem_free(pEXTScanCachedResultsReq);
-        status = eHAL_STATUS_FAILURE;
-    }
     return(status);
 }
 
@@ -13499,72 +11617,11 @@
     return(status);
 }
 
-#ifdef FEATURE_OEM_DATA_SUPPORT
-eHalStatus sme_OemDataRegisterCallback (tHalHandle hHal,
-                void (*pOemDataIndCb)(void *, const tANI_U16, void *, tANI_U32),
-                          void *callbackContext)
-{
-    eHalStatus status    = eHAL_STATUS_SUCCESS;
-    tpAniSirGlobal pMac  = PMAC_STRUCT(hHal);
-
-    if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
-        pMac->sme.pOemDataIndCb = pOemDataIndCb;
-        pMac->sme.pOemDataCallbackContext = callbackContext;
-        sme_ReleaseGlobalLock(&pMac->sme);
-    }
-    return(status);
-}
-#endif
-
 void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode)
 {
     tpAniSirGlobal pMac  = PMAC_STRUCT(hHal);
-    eHalStatus status    = eHAL_STATUS_SUCCESS;
-    vos_msg_t vosMessage = {0};
-    tSirHighPriorityDataInfoInd *phighPriorityDataInfo;
 
     pMac->miracast_mode = mode;
-
-    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-              "%s: miracast_mode: %d", __func__, mode);
-
-    phighPriorityDataInfo =
-            vos_mem_malloc(sizeof(*phighPriorityDataInfo));
-    if ( !phighPriorityDataInfo)
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
-        "Failed to allocate memory for WDA_HIGH_PRIORITY_DATA_INFO_IND",
-                  __func__);
-        return;
-    }
-
-    if (mode)
-        phighPriorityDataInfo->pause = TRUE;
-    else
-        phighPriorityDataInfo->pause = FALSE;
-
-    if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
-        /* Serialize the req through MC thread */
-        vosMessage.bodyptr = phighPriorityDataInfo;
-        vosMessage.type    = WDA_HIGH_PRIORITY_DATA_INFO_IND;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
-
-        if(VOS_STATUS_SUCCESS !=
-                          vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage)) {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
-                 "Failed to post WDA_HIGH_PRIORITY_DATA_INFO_IND msg to WDA",
-                __func__);
-            vos_mem_free(phighPriorityDataInfo);
-        }
-        sme_ReleaseGlobalLock(&pMac->sme);
-    }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-                "sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(phighPriorityDataInfo);
-    }
 }
 #endif /* WLAN_FEATURE_EXTSCAN */
 
@@ -13597,67 +11654,6 @@
     pMac->scan.fEnableDFSChnlScan = !disbale_dfs;
     csrDisableDfsChannel(pMac);
 
-    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-              "%s: Modified fEnableDFSChnlScan: %d", __func__,
-                               pMac->scan.fEnableDFSChnlScan);
-}
-
-/* ---------------------------------------------------------------------------
-    \fn sme_Encryptmsgsend
-    \brief  SME API to issue encrypt message request
-    \param  hHal
-    \param  pCmd: Data to be encrypted
-    \- return eHalStatus
-    -------------------------------------------------------------------------*/
-eHalStatus sme_Encryptmsgsend (tHalHandle hHal,
-                               u8 *pCmd,
-                               int length,
-                               pEncryptMsgRSPCb encMsgCbk)
-{
-    eHalStatus status    = eHAL_STATUS_SUCCESS;
-    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
-    tpAniSirGlobal pMac  = PMAC_STRUCT(hHal);
-    vos_msg_t vosMessage;
-    u8 *pEncryptMsg;
-
-    pEncryptMsg = vos_mem_malloc(length);
-    if ( !pEncryptMsg)
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                "%s: Not able to allocate memory for "
-                "SIR_HAL_ENCRYPT_MSG_REQ",
-                __func__);
-        return eHAL_STATUS_FAILURE;
-    }
-
-    vos_mem_copy(pEncryptMsg, pCmd, length);
-
-    if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
-
-        pMac->sme.pEncMsgInfoParams.pEncMsgCbk = encMsgCbk;
-        pMac->sme.pEncMsgInfoParams.pUserData = hHal;
-        /* Serialize the req through MC thread */
-        vosMessage.bodyptr = pEncryptMsg;
-        vosMessage.type    = SIR_HAL_ENCRYPT_MSG_REQ;
-        MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
-        vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
-        if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-            "%s: failed to post SIR_HAL_ENCRYPT_MSG_REQ", __func__);
-           vos_mem_free(pEncryptMsg);
-           status = eHAL_STATUS_FAILURE;
-        }
-        sme_ReleaseGlobalLock(&pMac->sme);
-    }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-                "sme_AcquireGlobalLock error", __func__);
-        vos_mem_free(pEncryptMsg);
-        status = eHAL_STATUS_FAILURE;
-    }
-    return(status);
 }
 
 /* ---------------------------------------------------------------------------
@@ -13694,664 +11690,17 @@
 }
 
 /* ---------------------------------------------------------------------------
-    \fn smeNeighborMiddleOfRoaming
 
-    \brief This function is a wrapper to call csrNeighborMiddleOfRoaming
+    \fn smeNeighborRoamIsHandoffInProgress
+
+    \brief  This function is a wrapper to call csrNeighborRoamIsHandoffInProgress
 
     \param hHal - The handle returned by macOpen.
 
-    \return eANI_BOOLEAN_TRUE if reassoc in progress,
-            eANI_BOOLEAN_FALSE otherwise
+    \return eANI_BOOLEAN_TRUE if reassoc in progress, eANI_BOOLEAN_FALSE otherwise
+
 ---------------------------------------------------------------------------*/
-
-tANI_BOOLEAN smeNeighborMiddleOfRoaming(tHalHandle hHal)
+tANI_BOOLEAN smeNeighborRoamIsHandoffInProgress(tHalHandle hHal)
 {
-    return (csrNeighborMiddleOfRoaming(PMAC_STRUCT(hHal)));
-}
-
-/* ---------------------------------------------------------------------------
-
-    \fn sme_IsTdlsOffChannelValid
-
-    \brief To check if the channel is valid for currently established domain
-    This is a synchronous API.
-
-    \param hHal - The handle returned by macOpen.
-    \param channel - channel to verify
-
-    \return TRUE/FALSE, TRUE if channel is valid
-
-  -------------------------------------------------------------------------------*/
-tANI_BOOLEAN sme_IsTdlsOffChannelValid(tHalHandle hHal, tANI_U8 channel)
-{
-   eHalStatus status = eHAL_STATUS_FAILURE;
-   tANI_BOOLEAN valid = FALSE;
-   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-
-   status = sme_AcquireGlobalLock( &pMac->sme );
-   if ( HAL_STATUS_SUCCESS( status ) )
-   {
-      /* check whether off channel is valid and non DFS */
-      if (csrRoamIsChannelValid(pMac, channel))
-      {
-          if (!CSR_IS_CHANNEL_DFS(channel))
-              valid = TRUE;
-          else {
-              VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                        "%s: configured channel is DFS", __func__);
-          }
-      }
-      else {
-          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                    "%s: configured channel is not valid", __func__);
-      }
-      sme_ReleaseGlobalLock( &pMac->sme );
-   }
-    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-              "%s: current country code %c%c channel %d valid %d",
-              __func__, pMac->scan.countryCodeCurrent[0],
-              pMac->scan.countryCodeCurrent[1], channel, valid);
-   return (valid);
-}
-
-tANI_BOOLEAN sme_IsCoexScoIndicationSet(tHalHandle hHal)
-{
-   eHalStatus status = eHAL_STATUS_FAILURE;
-   tANI_BOOLEAN valid = FALSE;
-   tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-
-   status = sme_AcquireGlobalLock( &pMac->sme );
-   if ( HAL_STATUS_SUCCESS( status ) )
-   {
-      valid = pMac->isCoexScoIndSet;
-   }
-   sme_ReleaseGlobalLock( &pMac->sme );
-   return (valid);
-}
-eHalStatus sme_SetMiracastVendorConfig(tHalHandle hHal,
-    tANI_U32 iniNumBuffAdvert , tANI_U32 set_value)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
-    tANI_U32 val = SIZE_OF_SUPPORTED_MCS_SET;
-
-    if (ccmCfgGetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet, &val)
-                                        != eHAL_STATUS_SUCCESS)
-    {
-       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-           FL("failed to get ini param, WNI_CFG_SUPPORTED_MCS_SET"));
-       return eHAL_STATUS_FAILURE;
-    }
-
-    if (set_value)
-    {
-       if (pMac->miracastVendorConfig)
-       {
-         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-          FL(" Miracast tuning already enabled!!"));
-         return eHAL_STATUS_SUCCESS;
-       }
-
-       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-        FL("Enable Miracast tuning by disabling 64QAM rates, setting 4 blocks for aggregation and disabling probe response for broadcast probe in P2P-GO mode"));
-
-       if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, 4,
-                  NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-       {
-          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-            FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
-          return eHAL_STATUS_FAILURE;
-       }
-       /* Disable 64QAM rates ie (MCS 5,6 and 7)
-        */
-       mcsSet[0]=0x1F;
-    }
-    else
-    {
-       if (!pMac->miracastVendorConfig)
-       {
-         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-          FL(" Miracast tuning already disabled!!"));
-         return eHAL_STATUS_SUCCESS;
-       }
-
-       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-        FL("Disable Miracast tuning by enabling all MCS rates, setting %d blocks for aggregation and enabling probe response for broadcast probe in P2P-GO mode"),
-       iniNumBuffAdvert);
-
-       if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, iniNumBuffAdvert,
-                  NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-       {
-          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-            FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
-          return eHAL_STATUS_FAILURE;
-       }
-       /* Enable all MCS rates)
-        */
-       mcsSet[0]=0xFF;
-    }
-
-    if (ccmCfgSetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet,
-          val, NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-    {
-       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-         FL("Failure: Could not set WNI_CFG_SUPPORTED_MCS_SET"));
-       return eHAL_STATUS_FAILURE;
-    }
-
-    pMac->miracastVendorConfig = set_value;
-    return eHAL_STATUS_SUCCESS;
-}
-
-void sme_SetDefDot11Mode(tHalHandle hHal)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-    csrSetDefaultDot11Mode(pMac);
-}
-
-/* ---------------------------------------------------------------------------
-    \fn sme_SetTdls2040BSSCoexistence
-    \brief  API to enable or disable 20_40 BSS Coexistence IE in TDLS frames.
-
-    \param  isEnabled - Enable or Disable.
-    \- return VOS_STATUS_SUCCES
-    -------------------------------------------------------------------------*/
-eHalStatus sme_SetTdls2040BSSCoexistence(tHalHandle hHal,
-                                     tANI_S32 isTdls2040BSSCoexEnabled)
-{
-    eHalStatus          status    = eHAL_STATUS_SUCCESS;
-    tpAniSirGlobal      pMac      = PMAC_STRUCT(hHal);
-    vos_msg_t           msg;
-    tAniSetTdls2040BSSCoex  *pMsg;
-
-    status = sme_AcquireGlobalLock( &pMac->sme );
-    if (HAL_STATUS_SUCCESS( status ))
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                  "%s: is2040BSSCoexEnabled %d ",
-                  __func__, isTdls2040BSSCoexEnabled);
-        pMsg = vos_mem_malloc(sizeof(tAniSetTdls2040BSSCoex));
-        if (NULL == pMsg )
-        {
-            smsLog(pMac, LOGE, "failed to allocate mem for SetTdls2040BSSCoex");
-            sme_ReleaseGlobalLock( &pMac->sme );
-            return eHAL_STATUS_FAILURE;
-        }
-
-        pMsg->msgType = pal_cpu_to_be16(
-                        (tANI_U16)eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ);
-        pMsg->msgLen = (tANI_U16)sizeof(tAniSetTdls2040BSSCoex);
-        pMsg->SetTdls2040BSSCoex = isTdls2040BSSCoexEnabled;
-
-        msg.type = eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ;
-        msg.reserved = 0;
-        msg.bodyptr = pMsg;
-        msg.bodyval = 0;
-
-        if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_PE, &msg))
-        {
-            smsLog(pMac, LOGE,
-                   "sme_SetTdls2040BSSCoexistence failed to post msg to PE ");
-            vos_mem_free((void *)pMsg);
-            status = eHAL_STATUS_FAILURE;
-        }
-        smsLog(pMac, LOG1, FL(" returned"));
-        sme_ReleaseGlobalLock( &pMac->sme );
-    }
-    return status;
-}
-
-/* ---------------------------------------------------------------------------
-    \fn sme_SetRtsCtsHtVht
-    \brief  API to to enable/disable RTS/CTS for different modes.
-
-    \param  set_value - Bit mask value to enable RTS/CTS for different modes.
-    \- return VOS_STATUS_SUCCES if INdication is posted to
-       WDA else return eHAL_STATUS_FAILURE
-    -------------------------------------------------------------------------*/
-eHalStatus sme_SetRtsCtsHtVht(tHalHandle hHal, tANI_U32 set_value)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    vos_msg_t msg;
-
-    smsLog(pMac, LOG1, FL(" set_value = %d"), set_value);
-
-    if (ccmCfgSetInt(hHal, WNI_CFG_ENABLE_RTSCTS_HTVHT, set_value,
-                  NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
-    {
-        smsLog(pMac, LOGE,
-            FL("Failure: Could not set WNI_CFG_ENABLE_RTSCTS_HTVHT"));
-          return eHAL_STATUS_FAILURE;
-    }
-    if ( eHAL_STATUS_SUCCESS ==  sme_AcquireGlobalLock( &pMac->sme ))
-    {
-        vos_mem_zero(&msg, sizeof(vos_msg_t));
-        msg.type = WDA_SET_RTS_CTS_HTVHT;
-        msg.reserved = 0;
-        msg.bodyval = set_value;
-        if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
-        {
-            smsLog(pMac, LOGE,
-              FL("Not able to post WDA_SET_RTS_CTS_HTVHT message to HAL"));
-            sme_ReleaseGlobalLock( &pMac->sme );
-            return eHAL_STATUS_FAILURE;
-        }
-        sme_ReleaseGlobalLock( &pMac->sme );
-        return eHAL_STATUS_SUCCESS;
-    }
-    return eHAL_STATUS_FAILURE;
-
-}
-
-
-/* ---------------------------------------------------------------------------
-    \fn sme_fatal_event_logs_req
-    \brief  API to to send flush log command to FW..
-
-    \param  hHal - Mac Context Handle
-    \- return VOS_STATUS_SUCCES if command is posted to
-       WDA else return eHAL_STATUS_FAILURE
-    -------------------------------------------------------------------------*/
-eHalStatus sme_fatal_event_logs_req(tHalHandle hHal, tANI_U32 is_fatal,
-                               tANI_U32 indicator, tANI_U32 reason_code,
-                               tANI_BOOLEAN dump_vos_trace)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    vos_msg_t msg;
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
-    tpSirFatalEventLogsReqParam pFatalEventLogsReqParams;
-
-    /* Dump last 500 VosTrace */
-    if (dump_vos_trace)
-       vosTraceDumpAll(pMac, 0, 0, 500, 0);
-
-    if (WLAN_LOG_INDICATOR_HOST_ONLY == indicator)
-    {
-      vos_flush_host_logs_for_fatal();
-      return VOS_STATUS_SUCCESS;
-    }
-
-    if ( eHAL_STATUS_SUCCESS ==  sme_AcquireGlobalLock( &pMac->sme ))
-    {
-        pFatalEventLogsReqParams =
-                            vos_mem_malloc(sizeof(*pFatalEventLogsReqParams));
-        if(NULL == pFatalEventLogsReqParams)
-        {
-            smsLog(pMac, LOGE,
-                 FL("vos_mem_alloc failed "));
-            return eHAL_STATUS_FAILED_ALLOC;
-        }
-        vos_mem_set(pFatalEventLogsReqParams,
-                    sizeof(*pFatalEventLogsReqParams), 0);
-        pFatalEventLogsReqParams->reason_code = reason_code;
-
-        vos_mem_zero(&msg, sizeof(vos_msg_t));
-        msg.type = WDA_FATAL_EVENT_LOGS_REQ;
-        msg.reserved = 0;
-        msg.bodyptr = pFatalEventLogsReqParams;
-        msg.bodyval = 0;
-        vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
-        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
-        {
-           vos_mem_free(pFatalEventLogsReqParams);
-           status = eHAL_STATUS_FAILURE;
-        }
-        sme_ReleaseGlobalLock( &pMac->sme );
-        return status;
-
-    }
-    return eHAL_STATUS_FAILURE;
-}
-
-
-/**
- * sme_handleSetFccChannel() - handle fcc constraint request
- * @hal: HAL pointer
- * @fcc_constraint: whether to apply or remove fcc constraint
- *
- * Return: tANI_BOOLEAN.
- */
-tANI_BOOLEAN sme_handleSetFccChannel(tHalHandle hHal, tANI_U8 fcc_constraint,
-                                     v_U32_t scan_pending)
-{
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-
-    status = sme_AcquireGlobalLock(&pMac->sme);
-
-    if (eHAL_STATUS_SUCCESS == status &&
-                 (!sme_Is11dSupported(hHal)) )
-    {
-        pMac->scan.fcc_constraint = !fcc_constraint;
-
-        if (scan_pending == TRUE) {
-            pMac->scan.defer_update_channel_list = true;
-        } else {
-            /* update the channel list to the firmware */
-            csrUpdateChannelList(pMac);
-        }
-    }
-
-        sme_ReleaseGlobalLock(&pMac->sme);
-
-    return status;
-}
-
-eHalStatus sme_enableDisableChanAvoidIndEvent(tHalHandle hHal, tANI_U8 set_value)
-{
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    VOS_STATUS vosStatus;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    vos_msg_t msg;
-
-    smsLog(pMac, LOG1, FL("set_value: %d"), set_value);
-    if ( eHAL_STATUS_SUCCESS ==  sme_AcquireGlobalLock( &pMac->sme ))
-    {
-        vos_mem_zero(&msg, sizeof(vos_msg_t));
-        msg.type = WDA_SEND_FREQ_RANGE_CONTROL_IND;
-        msg.reserved = 0;
-        msg.bodyval = set_value;
-        vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
-        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
-        {
-           status = eHAL_STATUS_FAILURE;
-        }
-        sme_ReleaseGlobalLock( &pMac->sme );
-        return status;
-    }
-
-    return eHAL_STATUS_FAILURE;
-}
-
-eHalStatus sme_DeleteAllTDLSPeers(tHalHandle hHal, uint8_t sessionId)
-{
-    tSirDelAllTdlsPeers *pMsg;
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
-
-    pMsg = vos_mem_malloc(sizeof(tSirDelAllTdlsPeers));
-    if (NULL == pMsg)
-    {
-        smsLog(pMac, LOGE, FL("memory alloc failed"));
-        return eHAL_STATUS_FAILURE;
-    }
-    vos_mem_set(pMsg, sizeof( tSirDelAllTdlsPeers ), 0);
-    pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_ALL_TDLS_PEERS);
-    pMsg->mesgLen = pal_cpu_to_be16((tANI_U16)sizeof( tSirDelAllTdlsPeers ));
-    vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
-                 sizeof(tSirMacAddr));
-    status = palSendMBMessage( pMac->hHdd, pMsg );
-    return status;
-}
-
-
-/**
- * sme_FwMemDumpReq() - Send Fwr mem Dump Request
- * @hal: HAL pointer
- *
- * Return: eHalStatus
- */
-
-eHalStatus sme_FwMemDumpReq(tHalHandle hHal, tAniFwrDumpReq *recv_req)
-{
-
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    vos_msg_t msg;
-    tAniFwrDumpReq * send_req;
-
-    send_req = vos_mem_malloc(sizeof(*send_req));
-    if(!send_req) {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-            FL("Mem allo failed for FW_MEM_DUMP"));
-        return eHAL_STATUS_FAILURE;
-    }
-
-    send_req->fwMemDumpReqCallback = recv_req->fwMemDumpReqCallback;
-    send_req->fwMemDumpReqContext = recv_req->fwMemDumpReqContext;
-
-    if (eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock(&pMac->sme))
-    {
-        msg.bodyptr = send_req;
-        msg.type = WDA_FW_MEM_DUMP_REQ;
-        msg.reserved = 0;
-
-        if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
-        {
-            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-            FL("Not able to post WDA_FW_MEM_DUMP"));
-            vos_mem_free(send_req);
-            status = eHAL_STATUS_FAILURE;
-        }
-        sme_ReleaseGlobalLock(&pMac->sme);
-    }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-        FL("Failed to acquire SME Global Lock"));
-        vos_mem_free(send_req);
-        status = eHAL_STATUS_FAILURE;
-    }
-
-    return status;
-}
-
-eHalStatus sme_set_wificonfig_params(tHalHandle hHal, tSetWifiConfigParams *req)
-{
-   eHalStatus status = eHAL_STATUS_SUCCESS;
-   tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-   vos_msg_t    msg;
-
-   status = sme_AcquireGlobalLock(&pMac->sme);
-
-   if (eHAL_STATUS_SUCCESS == status){
-
-       /* serialize the req through MC thread */
-       msg.type = WDA_WIFI_CONFIG_REQ;
-       msg.reserved = 0;
-       msg.bodyptr = req;
-
-       MTRACE(vos_trace(VOS_MODULE_ID_SME,
-                 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
-
-       if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
-        {
-            VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-                   "Not able to post SIR_HAL_WIFI_CONFIG_PARAMS message to HAL", __func__);
-            status = eHAL_STATUS_FAILURE;
-        }
-        sme_ReleaseGlobalLock( &pMac->sme );
-   }
-   else
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-                "sme_AcquireGlobalLock error", __func__);
-    }
-    return status;
-}
-
-eHalStatus sme_getRegInfo(tHalHandle hHal, tANI_U8 chanId,
-                         tANI_U32  *regInfo1, tANI_U32  *regInfo2)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    eHalStatus status;
-    tANI_U8 i;
-    eAniBoolean found = false;
-
-    status = sme_AcquireGlobalLock(&pMac->sme);
-    *regInfo1 = 0;
-    *regInfo2 = 0;
-    if (HAL_STATUS_SUCCESS(status))
-    {
-        for (i = 0 ; i < WNI_CFG_VALID_CHANNEL_LIST_LEN; i++)
-        {
-            if (pMac->scan.defaultPowerTable[i].chanId == chanId)
-            {
-                SME_SET_CHANNEL_REG_POWER(*regInfo1,
-                                          pMac->scan.defaultPowerTable[i].pwr);
-
-                SME_SET_CHANNEL_MAX_TX_POWER(*regInfo2,
-                                          pMac->scan.defaultPowerTable[i].pwr);
-
-
-                found = true;
-                break;
-            }
-        }
-
-        if (!found)
-            status = eHAL_STATUS_FAILURE;
-
-        sme_ReleaseGlobalLock(&pMac->sme);
-    }
-    return status;
-}
-
-eHalStatus sme_GetCurrentAntennaIndex(tHalHandle hHal,
-                                     tCsrAntennaIndexCallback callback,
-                                     void *pContext, tANI_U8 sessionId)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    tSirAntennaDiversitySelectionReq *pMsg;
-    tCsrRoamSession *pSession;
-    VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
-    vos_msg_t vosMessage;
-
-    status = sme_AcquireGlobalLock(&pMac->sme);
-    if (HAL_STATUS_SUCCESS(status))
-    {
-        pSession = CSR_GET_SESSION( pMac, sessionId );
-        if (!pSession)
-        {
-            smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
-            sme_ReleaseGlobalLock( &pMac->sme );
-            return eHAL_STATUS_FAILURE;
-        }
-
-        pMsg = (tSirAntennaDiversitySelectionReq*)vos_mem_malloc(sizeof(*pMsg));
-        if (NULL == pMsg)
-        {
-            smsLog(pMac, LOGE, FL("failed to allocated memory"));
-            sme_ReleaseGlobalLock( &pMac->sme );
-            return eHAL_STATUS_FAILURE;
-        }
-        pMsg->callback = callback;
-        pMsg->data = pContext;
-
-        vosMessage.type = WDA_ANTENNA_DIVERSITY_SELECTION_REQ;
-        vosMessage.bodyptr = pMsg;
-        vosMessage.reserved = 0;
-
-        vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
-        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
-        {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
-                     "%s: Failed to post message to WDA", __func__);
-           vos_mem_free(pMsg);
-           sme_ReleaseGlobalLock( &pMac->sme );
-           return eHAL_STATUS_FAILURE;
-        }
-        sme_ReleaseGlobalLock( &pMac->sme);
-        return eHAL_STATUS_SUCCESS;
-    }
-    return eHAL_STATUS_FAILURE;
-}
-
-eHalStatus sme_setBcnMissPenaltyCount(tHalHandle hHal,
-                            tModifyRoamParamsReqParams *pModifyRoamReqParams)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    VOS_STATUS vosStatus;
-    tModifyRoamParamsReqParams *pMsg;
-    vos_msg_t msg;
-
-    status = sme_AcquireGlobalLock(&pMac->sme);
-    if (HAL_STATUS_SUCCESS(status))
-    {
-        pMsg = (tModifyRoamParamsReqParams*)vos_mem_malloc(sizeof(*pMsg));
-        if (NULL == pMsg)
-        {
-            smsLog(pMac, LOGE, FL("failed to allocated memory"));
-            sme_ReleaseGlobalLock( &pMac->sme );
-            return eHAL_STATUS_FAILURE;
-        }
-        if (NULL == pModifyRoamReqParams)
-        {
-            smsLog(pMac, LOGE, FL("Invalid memory"));
-            vos_mem_free(pMsg);
-            sme_ReleaseGlobalLock( &pMac->sme );
-            return eHAL_STATUS_FAILURE;
-        }
-        pMsg->param = pModifyRoamReqParams->param;
-        pMsg->value = pModifyRoamReqParams->value;
-        vos_mem_zero(&msg, sizeof(vos_msg_t));
-        msg.type = WDA_MODIFY_ROAM_PARAMS_IND;
-        msg.reserved = 0;
-        msg.bodyptr = pMsg;
-        vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
-        if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
-        {
-           status = eHAL_STATUS_FAILURE;
-           vos_mem_free(pMsg);
-        }
-        sme_ReleaseGlobalLock( &pMac->sme );
-        return status;
-    }
-
-    return eHAL_STATUS_FAILURE;
-}
-
-/**
- * sme_remove_bssid_from_scan_list() - wrapper to remove the bssid from
- * scan list
- * @hal: hal context.
- * @bssid: bssid to be removed
- *
- * This function remove the given bssid from scan list.
- *
- * Return: hal status.
- */
-eHalStatus sme_remove_bssid_from_scan_list(tHalHandle hal,
-    tSirMacAddr bssid)
-{
-    eHalStatus status = eHAL_STATUS_FAILURE;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hal);
-
-    status = sme_AcquireGlobalLock(&pMac->sme);
-    if (HAL_STATUS_SUCCESS(status)) {
-        csr_remove_bssid_from_scan_list(pMac, bssid);
-        sme_ReleaseGlobalLock(&pMac->sme);
-    }
-
-    return status;
-}
-
-/**
- * sme_set_mgmt_frm_via_wq5() - Set INI params sendMgmtPktViaWQ5 to WDA.
- * @hal: HAL pointer
- * @sendMgmtPktViaWQ5: INI params to enable/disable sending mgmt pkt via WQ5.
- *
- * Return: void
- */
-void sme_set_mgmt_frm_via_wq5(tHalHandle hHal, tANI_BOOLEAN sendMgmtPktViaWQ5)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    eHalStatus     status = eHAL_STATUS_SUCCESS;
-
-    status = sme_AcquireGlobalLock(&pMac->sme);
-    if (HAL_STATUS_SUCCESS(status))
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                "sendMgmtPktViaWQ5 is %d", sendMgmtPktViaWQ5);
-        /* not serializing this messsage, as this is only going
-         * to set a variable in WDA/WDI
-         */
-        WDA_SetMgmtPktViaWQ5(sendMgmtPktViaWQ5);
-        sme_ReleaseGlobalLock(&pMac->sme);
-    }
-    return;
+    return (csrNeighborRoamIsHandoffInProgress(PMAC_STRUCT(hHal)));
 }
diff --git a/wlan/prima/CORE/SME/src/sme_common/sme_FTApi.c b/wlan/prima/CORE/SME/src/sme_common/sme_FTApi.c
index cde9688..95bcd50 100644
--- a/wlan/prima/CORE/SME/src/sme_common/sme_FTApi.c
+++ b/wlan/prima/CORE/SME/src/sme_common/sme_FTApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -30,6 +30,9 @@
 
   \brief Definitions for SME FT APIs
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -39,7 +42,10 @@
 #include <smsDebug.h>
 #include <csrInsideApi.h>
 #include <csrNeighborRoam.h>
+
+#ifdef DEBUG_ROAM_DELAY
 #include "vos_utils.h"
+#endif
 
 /*--------------------------------------------------------------------------
   Initialize the FT context. 
@@ -59,7 +65,9 @@
         smsLog(pMac, LOGE, FL("Preauth Reassoc interval Timer allocation failed"));
         return;
     }                 
+#ifdef DEBUG_ROAM_DELAY
     vos_reset_roam_timer_log();
+#endif
 }
 
 /*--------------------------------------------------------------------------
@@ -224,8 +232,10 @@
       smsLog(pMac, LOG1, FL("%02x"), pFTKeyInfo->Key[i]);
 #endif
 
-    msgLen = sizeof(tSirFTUpdateKeyInfo);
-
+    msgLen  = sizeof( tANI_U16) + sizeof( tANI_U16 ) + 
+       sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + 
+       sizeof( pMsg->keyMaterial.numKeys ) + sizeof( pMsg->keyMaterial.key );
+                     
     pMsg = vos_mem_malloc(msgLen);
     if ( NULL == pMsg )
     {
@@ -331,12 +341,11 @@
     switch(pMac->ft.ftSmeContext.FTState)
     {
     case eFT_SET_KEY_WAIT:
-      if (pMac->roam.configParam.roamDelayStatsEnabled)
-      {
-          //store the PTK send event
-          vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
-      }
-      if (sme_GetFTPreAuthState (hHal) == TRUE)
+#ifdef DEBUG_ROAM_DELAY
+    //store the PTK send event
+    vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
+#endif
+    if (sme_GetFTPreAuthState (hHal) == TRUE)
       {
           status = sme_FTSendUpdateKeyInd(pMac, pFTKeyInfo);
           if (status != 0 )
@@ -360,10 +369,10 @@
               pMac->ft.ftSmeContext.FTState, status);
 #endif
        break;
-
+          
     default:
-       smsLog(pMac, LOG1, FL("Unhandled state=%d"),
-                              pMac->ft.ftSmeContext.FTState);
+       smsLog( pMac, LOGE, "%s: Unhandled state=%d", __func__,
+               pMac->ft.ftSmeContext.FTState);
        status = eHAL_STATUS_FAILURE;
        break;
     }
@@ -473,10 +482,9 @@
     tpAniSirGlobal pMac = (tpAniSirGlobal )context;
     csrNeighborRoamRequestHandoff(pMac);
 #endif
-    if (pMac->roam.configParam.roamDelayStatsEnabled)
-    {
-        vos_record_roam_event(e_SME_PREAUTH_CALLBACK_HIT, NULL, 0);
-    }
+#ifdef DEBUG_ROAM_DELAY
+    vos_record_roam_event(e_SME_PREAUTH_CALLBACK_HIT, NULL, 0);
+#endif
     return;
 }
 
diff --git a/wlan/prima/CORE/SME/src/sme_common/sme_Trace.c b/wlan/prima/CORE/SME/src/sme_common/sme_Trace.c
index ab2f2bf..e32902b 100644
--- a/wlan/prima/CORE/SME/src/sme_common/sme_Trace.c
+++ b/wlan/prima/CORE/SME/src/sme_common/sme_Trace.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,8 +38,6 @@
 #include "macTrace.h"
 #include "sme_Trace.h"
 #include "smeInternal.h"
-#include "smeInside.h"
-
 #ifndef SME_TRACE_RECORD
 void smeTraceInit(tpAniSirGlobal pMac)
 {
@@ -72,7 +70,6 @@
         CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE);
         CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE);
         CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE);
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_ROAM_DEL_PMKIDCACHE);
         CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM);
         CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS);
         CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE);
@@ -136,24 +133,7 @@
         CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED);
         CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_UPDATE_WESMODE);
         CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_SET_SCANCTRL);
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_MSG_DEAUTH_STA);
-#ifdef FEATURE_WLAN_TDLS
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_TDLS_LINK_ESTABLISH_PARAM);
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_TDLS_CHAN_SWITCH_REQ);
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_TDLS_SEND_MGMT_FRAME);
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_TDLS_CHANGE_PEER_STA);
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_TDLS_ADD_PEER_STA);
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_TDLS_DEL_PEER_STA);
-#endif
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_PREF_NET_LIST);
-#ifdef FEATURE_WLAN_LPHB
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_LPHB_CONFIG_REQ);
-#endif /* FEATURE_WLAN_LPHB */
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_EXTSCAN_START);
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP);
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST);
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST);
-        CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS);
+
         default:
             return( "UNKNOWN" );
             break;
@@ -173,17 +153,6 @@
         CASE_RETURN_STRING(eSmeCommandRemoveKey);
         CASE_RETURN_STRING(eSmeCommandAddStaSession);
         CASE_RETURN_STRING(eSmeCommandDelStaSession);
-        CASE_RETURN_STRING(eSmeCommandPnoReq);
-        CASE_RETURN_STRING(eSmeCommandMacSpoofRequest);
-        CASE_RETURN_STRING(eSmeCommandGetFrameLogRequest);
-#ifdef FEATURE_WLAN_TDLS
-        CASE_RETURN_STRING(eSmeCommandTdlsSendMgmt);
-        CASE_RETURN_STRING(eSmeCommandTdlsAddPeer);
-        CASE_RETURN_STRING(eSmeCommandTdlsDelPeer);
-        CASE_RETURN_STRING(eSmeCommandTdlsLinkEstablish);
-        CASE_RETURN_STRING(eSmeCommandTdlsChannelSwitch);
-#endif
-        CASE_RETURN_STRING(eSmeCommandNanReq);
         CASE_RETURN_STRING(eSmePmcCommandMask);
         CASE_RETURN_STRING(eSmeCommandEnterImps);
         CASE_RETURN_STRING(eSmeCommandExitImps);
@@ -210,29 +179,17 @@
 static void smeTraceDump(tpAniSirGlobal pMac, tpvosTraceRecord pRecord,
                                                             tANI_U16 recIndex)
 {
-    switch (pRecord->code) {
-        case TRACE_CODE_SME_COMMAND:
-            smsLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                recIndex, pRecord->time, pRecord->session, "SME COMMAND:",
-                 smeTraceGetCommandString(pRecord->data), pRecord->data);
-            break;
-        case TRACE_CODE_SME_TX_WDA_MSG:
-            smsLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                recIndex, pRecord->time, pRecord->session, "TX WDA Msg:",
-                macTraceGetWdaMsgString((tANI_U16)pRecord->data),
-                                              pRecord->data);
-            break;
-        case TRACE_CODE_SME_RX_WDA_MSG:
-            smsLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                recIndex, pRecord->time, pRecord->session, "RX WDA Msg:",
-                macTraceGetSmeMsgString((tANI_U16)pRecord->data),
-                                              pRecord->data);
-            break;
-        default:
-            smsLog(pMac, LOG1, "%04d %012u S%d %-14s %-30s(0x%x)",
-                recIndex, pRecord->time, pRecord->session, "RX HDD MSG:",
-                smeTraceGetRxMsgString(pRecord->code), pRecord->data);
-        break;
+    if (TRACE_CODE_SME_COMMAND == pRecord->code)
+    {
+        smsLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x)", recIndex,
+                   pRecord->time, pRecord->session, "SME COMMAND:",
+                   smeTraceGetCommandString(pRecord->data), pRecord->data );
+    }
+    else
+    {
+        smsLog(pMac, LOGE, "%04d %012u S%d %-14s %-30s(0x%x)", recIndex,
+                   pRecord->time, pRecord->session, "RX HDD MSG:",
+                   smeTraceGetRxMsgString(pRecord->code), pRecord->data );
     }
 }
 
@@ -240,50 +197,4 @@
 {
     vosTraceRegister(VOS_MODULE_ID_SME, (tpvosTraceCb)&smeTraceDump);
 }
-
-/**
- * sme_state_info_dump() - prints state information of sme layer
- */
-static void sme_state_info_dump(void)
-{
-    tANI_U32  session_id = 0;
-    tHalHandle hal;
-    tpAniSirGlobal mac;
-    v_CONTEXT_t vos_ctx_ptr;
-
-    /* get the global voss context */
-    vos_ctx_ptr = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL);
-
-    if (NULL == vos_ctx_ptr) {
-        VOS_ASSERT(0);
-        return;
-    }
-
-    hal = vos_get_context(VOS_MODULE_ID_SME, vos_ctx_ptr);
-    if (NULL == hal) {
-        VOS_ASSERT(0);
-        return;
-    }
-
-    mac = PMAC_STRUCT(hal);
-
-    session_id = sme_get_sessionid_from_activeList(mac);
-    smsLog( mac, LOG1, FL(" SessionId %d for active command"), session_id);
-
-    smsLog(mac, LOG1, FL("NeighborRoamState: %d RoamState: %d"
-           "RoamSubState: %d ConnectState: %d pmcState: %d PmmState: %d"),
-           mac->roam.neighborRoamInfo.neighborRoamState,
-           mac->roam.curState[session_id], mac->roam.curSubState[session_id],
-           mac->roam.roamSession[session_id].connectState, mac->pmc.pmcState,
-           mac->pmm.gPmmState);
-}
-
-/**
- * sme_register_debug_callback() - registration function sme layer
- * to print sme state information
- */
-void sme_register_debug_callback()
-{
-    vos_register_debug_callback(VOS_MODULE_ID_SME, &sme_state_info_dump);
-}
 #endif
diff --git a/wlan/prima/CORE/SVC/external/wlan_nlink_common.h b/wlan/prima/CORE/SVC/external/wlan_nlink_common.h
index 6ffcee6..9b0cd4c 100644
--- a/wlan/prima/CORE/SVC/external/wlan_nlink_common.h
+++ b/wlan/prima/CORE/SVC/external/wlan_nlink_common.h
@@ -32,6 +32,9 @@
   message types and definitions that is shared between the user space service
   (e.g. BTC service) and WLAN kernel module.
 
+  Copyright (c) 2009 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 
 ===========================================================================*/
 
@@ -39,7 +42,7 @@
 #define WLAN_NLINK_COMMON_H__
 
 #include <linux/netlink.h>
-#include <linux/if.h>
+
 /*---------------------------------------------------------------------------
  * External Functions
  *-------------------------------------------------------------------------*/
@@ -85,11 +88,8 @@
 // Special Message Type used by SoftAP, intercepted by send_btc_nlink_msg() and
 // replaced by WLAN_STA_ASSOC_DONE_IND
 #define WLAN_BTC_SOFTAP_BSS_START      0x11
-#define WLAN_MSG_RPS_ENABLE_IND        0x10A
-#define WLAN_SVC_IFACE_NUM_QUEUES      6
 
 #define WLAN_SVC_SAP_RESTART_IND 0x108
-#define WLAN_SVC_WLAN_TP_IND     0x109
 // Event data for WLAN_BTC_QUERY_STATE_RSP & WLAN_STA_ASSOC_DONE_IND
 typedef struct
 {
@@ -102,21 +102,14 @@
    ANI_NL_MSG_PUMAC = ANI_NL_MSG_BASE + 0x01,// PTT Socket App
    ANI_NL_MSG_PTT   = ANI_NL_MSG_BASE + 0x07,// Quarky GUI
    WLAN_NL_MSG_BTC,
-   WLAN_NL_MSG_OEM,
-   WLAN_NL_MSG_SVC  = ANI_NL_MSG_BASE + 0x0A,
    ANI_NL_MSG_LOG   = ANI_NL_MSG_BASE + 0x0C,
+   WLAN_NL_MSG_SVC,
    ANI_NL_MSG_MAX  
 } tAniNlModTypes, tWlanNlModTypes;
 
 #define WLAN_NL_MSG_BASE ANI_NL_MSG_BASE
 #define WLAN_NL_MSG_MAX  ANI_NL_MSG_MAX
 
-struct wlan_rps_data {
-   char ifname[IFNAMSIZ];
-   uint16_t num_queues;
-   uint16_t cpu_map[WLAN_SVC_IFACE_NUM_QUEUES];
-};
-
 //All Netlink messages must contain this header
 typedef struct sAniHdr {
    unsigned short type;
diff --git a/wlan/prima/CORE/SVC/inc/wlan_logging_sock_svc.h b/wlan/prima/CORE/SVC/inc/wlan_logging_sock_svc.h
index 4ddd24b..602df23 100644
--- a/wlan/prima/CORE/SVC/inc/wlan_logging_sock_svc.h
+++ b/wlan/prima/CORE/SVC/inc/wlan_logging_sock_svc.h
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 The Linux Foundation. All rights reserved.
 *
 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
 *
@@ -39,69 +39,10 @@
 #include <vos_trace.h>
 #include <wlan_nlink_common.h>
 
-
 int wlan_logging_sock_init_svc(void);
 int wlan_logging_sock_deinit_svc(void);
-int wlan_logging_flush_pkt_queue(void);
+int wlan_logging_sock_activate_svc(int log_fe_to_console, int num_buf);
 int wlan_logging_sock_deactivate_svc(void);
 int wlan_log_to_user(VOS_TRACE_LEVEL log_level, char *to_be_sent, int length);
-int wlan_queue_logpkt_for_app(vos_pkt_t *pPacket, uint32 pkt_type);
-void wlan_process_done_indication(uint8 type, uint32 reason_code);
-int wlan_logging_sock_activate_svc(int log_fe_to_console, int num_buf,
-                             int pkt_stats_enabled, int pkt_stats_buff);
-void wlan_flush_host_logs_for_fatal(void);
-
-void wlan_init_log_completion(void);
-int wlan_set_log_completion(uint32 is_fatal,
-                            uint32 indicator,
-                            uint32 reason_code);
-void wlan_get_log_and_reset_completion(uint32 *is_fatal,
-                             uint32 *indicator,
-                             uint32 *reason_code,
-                             bool reset);
-bool wlan_is_log_report_in_progress(void);
-void wlan_reset_log_report_in_progress(void);
-
-void wlan_deinit_log_completion(void);
-
-void wlan_logging_set_log_level(void);
-
-#define FW_MEM_DUMP_MAGIC 0x3C3A2D44
-
-enum FW_MEM_DUMP_STATE{
-       FW_MEM_DUMP_IDLE,
-       FW_MEM_DUMP_READ_IN_PROGRESS,
-       FW_MEM_DUMP_WRITE_IN_PROGRESS,
-       FW_MEM_DUMP_WRITE_DONE,
-};
-int wlan_fwr_mem_dump_buffer_allocation(void);
-bool wlan_fwr_mem_dump_test_and_set_write_allowed_bit(void);
-bool wlan_fwr_mem_dump_test_and_set_read_allowed_bit(void);
-void wlan_set_fwr_mem_dump_state(enum FW_MEM_DUMP_STATE fw_mem_dump_state);
-void wlan_set_svc_fw_mem_dump_req_cb(void*,void*);
-size_t wlan_fwr_mem_dump_fsread_handler(char __user *buf, size_t count, loff_t *pos,loff_t* bytes_left);
-void wlan_indicate_mem_dump_complete(bool );
-void wlan_store_fwr_mem_dump_size(uint32 dump_size);
-void wlan_free_fwr_mem_dump_buffer(void);
-
-bool wlan_is_logger_thread(int threadId);
-int wlan_pkt_stats_to_user(void *perPktStat);
-void wlan_disable_and_flush_pkt_stats(void);
- void wlan_fillTxStruct(void *pktStat);
- bool wlan_isPktStatsEnabled(void);
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-void wlan_report_log_completion(uint32 is_fatal,
-      uint32 indicator,
-      uint32 reason_code);
-#else
-static inline void wlan_report_log_completion(uint32 is_fatal,
-        uint32 indicator,
-        uint32 reason_code)
-{
-    return;
-}
-
-#endif
-
 
 #endif /* WLAN_LOGGING_SOCK_SVC_H */
diff --git a/wlan/prima/CORE/SVC/inc/wlan_nlink_srv.h b/wlan/prima/CORE/SVC/inc/wlan_nlink_srv.h
index 369332d..ac61eff 100644
--- a/wlan/prima/CORE/SVC/inc/wlan_nlink_srv.h
+++ b/wlan/prima/CORE/SVC/inc/wlan_nlink_srv.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -62,5 +62,4 @@
 void nl_srv_nl_ready_indication(void);
 void nl_srv_nl_close_indication(int pid);
 #endif /* WLAN_KD_READY_NOTIFIER */
-int nl_srv_is_initialized(void);
 #endif
diff --git a/wlan/prima/CORE/SVC/inc/wlan_ptt_sock_svc.h b/wlan/prima/CORE/SVC/inc/wlan_ptt_sock_svc.h
index 2f2bac6..3b6c0b0 100644
--- a/wlan/prima/CORE/SVC/inc/wlan_ptt_sock_svc.h
+++ b/wlan/prima/CORE/SVC/inc/wlan_ptt_sock_svc.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -61,17 +61,9 @@
 #define ANI_DRIVER_MSG_START         0x0001
 #define ANI_MSG_APP_REG_REQ         (ANI_DRIVER_MSG_START + 0)
 #define ANI_MSG_APP_REG_RSP         (ANI_DRIVER_MSG_START + 1)
-#define ANI_MSG_OEM_DATA_REQ        (ANI_DRIVER_MSG_START + 2)
-#define ANI_MSG_OEM_DATA_RSP        (ANI_DRIVER_MSG_START + 3)
-#define ANI_MSG_CHANNEL_INFO_REQ    (ANI_DRIVER_MSG_START + 4)
-#define ANI_MSG_CHANNEL_INFO_RSP    (ANI_DRIVER_MSG_START + 5)
-#define ANI_MSG_OEM_ERROR           (ANI_DRIVER_MSG_START + 6)
-
 #define ANI_MAX_RADIOS      3
 #define ANI_NL_MSG_OK       0
 #define ANI_NL_MSG_ERROR    -1
-#define INVALID_PID         -1
-
 #define ANI_NL_MSG_OVERHEAD (NLMSG_SPACE(tAniHdr + 4))
 /*
  * Packet Format for READ_REGISTER & WRITE_REGISTER:
@@ -95,7 +87,6 @@
  * Payload     : LEN_PAYLOAD bytes
 */
 int ptt_sock_activate_svc(void *pAdapter);
-int ptt_sock_deactivate_svc(hdd_context_t *pHddCtx);
 int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid, int flag);
 
 /*
@@ -108,12 +99,6 @@
     int radio;                        // unit number of the radio
     tAniHdr wmsg;                     // Airgo Message Header
 } tAniNlHdr;
-typedef struct sAniNlMgmtLogMsg {
-    struct  nlmsghdr nlh;
-    int radio;
-    tAniHdr wmsg;
-    uint32 frameSize;
-} tAniNlLogHdr;
 typedef struct sAniAppRegReq {
     tAniNlModTypes type;              // module id
     int pid;                          // process id
diff --git a/wlan/prima/CORE/SVC/src/logging/wlan_logging_sock_svc.c b/wlan/prima/CORE/SVC/src/logging/wlan_logging_sock_svc.c
index b19bd42..7a0b678 100644
--- a/wlan/prima/CORE/SVC/src/logging/wlan_logging_sock_svc.c
+++ b/wlan/prima/CORE/SVC/src/logging/wlan_logging_sock_svc.c
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 The Linux Foundation. All rights reserved.
 *
 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
 *
@@ -30,7 +30,6 @@
  *
  ******************************************************************************/
 #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
-#include <linux/rtc.h>
 #include <vmalloc.h>
 #include <wlan_nlink_srv.h>
 #include <vos_status.h>
@@ -40,53 +39,18 @@
 #include <vos_types.h>
 #include <kthread.h>
 #include "vos_memory.h"
-#include <linux/ratelimit.h>
-#include <asm/arch_timer.h>
-#include <vos_utils.h>
-
 
 #define LOGGING_TRACE(level, args...) \
-		VOS_TRACE(VOS_MODULE_ID_SVC, level, ## args)
+		VOS_TRACE(VOS_MODULE_ID_HDD, level, ## args)
 
 /* Global variables */
 
 #define ANI_NL_MSG_LOG_TYPE 89
 #define ANI_NL_MSG_READY_IND_TYPE 90
-#define ANI_NL_MSG_LOG_PKT_TYPE 91
-#define ANI_NL_MSG_FW_LOG_PKT_TYPE 92
 #define INVALID_PID -1
 
-#define MAX_PKTSTATS_LOG_LENGTH 2048
 #define MAX_LOGMSG_LENGTH 4096
-#define LOGGER_MGMT_DATA_PKT_POST        0x001
-#define HOST_LOG_POST                    0x002
-#define LOGGER_FW_LOG_PKT_POST           0x003
-#define LOGGER_FATAL_EVENT_POST          0x004
-#define LOGGER_FW_MEM_DUMP_PKT_POST      0x005
-#define LOGGER_FW_MEM_DUMP_PKT_POST_DONE 0x006
-#define HOST_PKT_STATS_POST              0x008
-
-
-#define LOGGER_MAX_DATA_MGMT_PKT_Q_LEN   (8)
-#define LOGGER_MAX_FW_LOG_PKT_Q_LEN   (16)
-#define LOGGER_MAX_FW_MEM_DUMP_PKT_Q_LEN   (32)
-
-
-#define NL_BDCAST_RATELIMIT_INTERVAL (5*HZ)
-#define NL_BDCAST_RATELIMIT_BURST    1
-#define PTT_MSG_DIAG_CMDS_TYPE   0x5050
-#define DIAG_TYPE_LOGS   1
-
-/* Limit FW initiated fatal event to ms */
-#define LIMIT_FW_FATAL_EVENT_MS   10000
-
-
-/* Qtimer Frequency */
-#define QTIMER_FREQ      19200000
-
-static DEFINE_RATELIMIT_STATE(errCnt,		\
-		NL_BDCAST_RATELIMIT_INTERVAL,	\
-		NL_BDCAST_RATELIMIT_BURST);
+#define SECONDS_IN_A_DAY (86400)
 
 struct log_msg {
 	struct list_head node;
@@ -101,49 +65,6 @@
 	char logbuf[MAX_LOGMSG_LENGTH];
 };
 
-struct logger_log_complete {
-	uint32_t is_fatal;
-	uint32_t indicator;
-	uint32_t reason_code;
-	bool is_report_in_progress;
-	bool is_flush_complete;
-	uint32_t last_fw_bug_reason;
-	unsigned long last_fw_bug_timestamp;
-};
-
-struct fw_mem_dump_logging{
-	//It will hold the starting point of mem dump buffer
-	uint8 *fw_dump_start_loc;
-	//It will hold the current loc to tell how much data filled
-	uint8 *fw_dump_current_loc;
-	uint32 fw_dump_max_size;
-	vos_pkt_t *fw_mem_dump_queue;
-	/* Holds number of pkts in fw log vos pkt queue */
-	unsigned int fw_mem_dump_pkt_qcnt;
-	/* Number of dropped pkts for fw dump */
-	unsigned int fw_mem_dump_pkt_drop_cnt;
-	/* Lock to synchronize of queue/dequeue of pkts in fw log pkt queue */
-	spinlock_t fw_mem_dump_lock;
-	/* Fw memory dump status */
-	enum FW_MEM_DUMP_STATE fw_mem_dump_status;
-	/* storage for HDD callback which completes fw mem dump request */
-	void * svc_fw_mem_dump_req_cb;
-	/* storage for HDD callback which completes fw mem dump request arg */
-	void * svc_fw_mem_dump_req_cb_arg;
-};
-
-struct pkt_stats_msg {
-	struct list_head node;
-	/* indicates the current filled log length in pktlogbuf */
-	struct sk_buff *skb;
-};
-
-struct perPktStatsInfo{
-    v_U32_t lastTxRate;           // 802.11 data rate at which the last data frame is transmitted.
-    v_U32_t  txAvgRetry;           // Average number of retries per 10 packets.
-    v_S7_t  avgRssi;              // Average of the Beacon RSSI.
-};
-
 struct wlan_logging {
 	/* Log Fatal and ERROR to console */
 	bool log_fe_to_console;
@@ -155,18 +76,6 @@
 	struct list_head free_list;
 	/* Holds the filled nodes which needs to be indicated to APP */
 	struct list_head filled_list;
-	/* Points to head of logger pkt queue */
-	vos_pkt_t *data_mgmt_pkt_queue;
-	/* Holds number of pkts in vos pkt queue */
-	unsigned int data_mgmt_pkt_qcnt;
-	/* Lock to synchronize of queue/dequeue of pkts in logger pkt queue */
-	spinlock_t data_mgmt_pkt_lock;
-	/* Points to head of logger fw log pkt queue */
-	vos_pkt_t *fw_log_pkt_queue;
-	/* Holds number of pkts in fw log vos pkt queue */
-	unsigned int fw_log_pkt_qcnt;
-	/* Lock to synchronize of queue/dequeue of pkts in fw log pkt queue */
-	spinlock_t fw_log_pkt_lock;
 	/* Wait queue for Logger thread */
 	wait_queue_head_t wait_queue;
 	/* Logger thread */
@@ -175,37 +84,16 @@
 	struct completion   shutdown_comp;
 	/* Indicates to logger thread to exit */
 	bool exit;
+	/* wakeup indication */
+	bool wakeEvent;
 	/* Holds number of dropped logs*/
 	unsigned int drop_count;
-	/* Holds number of dropped vos pkts*/
-	unsigned int pkt_drop_cnt;
-	/* Holds number of dropped fw log vos pkts*/
-	unsigned int fw_log_pkt_drop_cnt;
 	/* current logbuf to which the log will be filled to */
 	struct log_msg *pcur_node;
-	/* Event flag used for wakeup and post indication*/
-	unsigned long event_flag;
-	/* Indicates logger thread is activated */
-	bool is_active;
-	/* data structure for log complete event*/
-	struct logger_log_complete log_complete;
-	spinlock_t bug_report_lock;
-	struct fw_mem_dump_logging fw_mem_dump_ctx;
-        int pkt_stat_num_buf;
-	unsigned int pkt_stat_drop_cnt;
-	struct list_head pkt_stat_free_list;
-	struct list_head pkt_stat_filled_list;
-	struct pkt_stats_msg *pkt_stats_pcur_node;
-	/* Index of the messages sent to userspace */
-	unsigned int pkt_stats_msg_idx;
-	bool pkt_stats_enabled;
-	spinlock_t pkt_stats_lock;
-	struct perPktStatsInfo txPktStatsInfo;
 };
 
 static struct wlan_logging gwlan_logging;
 static struct log_msg *gplog_msg;
-static struct pkt_stats_msg *pkt_stats_buffers;
 
 /* PID of the APP to log the message */
 static int gapp_pid = INVALID_PID;
@@ -280,27 +168,30 @@
 	tAniNlHdr *wnl = NULL;
 	struct sk_buff *skb;
 	struct nlmsghdr *nlh;
-	int wmsg_length = wmsg->length;
+	int wmsg_length = be16_to_cpu(wmsg->length);
 	static int nlmsg_seq;
 
 	if (radio < 0 || radio > ANI_MAX_RADIOS) {
-		pr_err("%s: invalid radio id [%d]",
+		LOGGING_TRACE(VOS_TRACE_LEVEL_ERROR,
+				"%s: invalid radio id [%d]",
 				__func__, radio);
 		return -EINVAL;
 	}
 
-	payload_len = wmsg_length + sizeof(wnl->radio) + sizeof(tAniHdr);
+	payload_len = wmsg_length + sizeof(wnl->radio);
 	tot_msg_len = NLMSG_SPACE(payload_len);
 	skb = dev_alloc_skb(tot_msg_len);
 	if (skb == NULL) {
-		pr_err("%s: dev_alloc_skb() failed for msg size[%d]",
+		LOGGING_TRACE(VOS_TRACE_LEVEL_ERROR,
+				"%s: dev_alloc_skb() failed for msg size[%d]",
 				__func__, tot_msg_len);
 		return -ENOMEM;
 	}
 	nlh = nlmsg_put(skb, pid, nlmsg_seq++, src_mod, payload_len,
 		NLM_F_REQUEST);
 	if (NULL == nlh) {
-		pr_err("%s: nlmsg_put() failed for msg size[%d]",
+		LOGGING_TRACE(VOS_TRACE_LEVEL_ERROR,
+				"%s: nlmsg_put() failed for msg size[%d]",
 				__func__, tot_msg_len);
 		kfree_skb(skb);
 		return -ENOMEM;
@@ -309,9 +200,11 @@
 	wnl = (tAniNlHdr *) nlh;
 	wnl->radio = radio;
 	vos_mem_copy(&wnl->wmsg, wmsg, wmsg_length);
+	LOGGING_TRACE(VOS_TRACE_LEVEL_INFO,
+			"%s: Sending Msg Type [0x%X] to pid[%d]\n",
+			__func__, be16_to_cpu(wmsg->type), pid);
 
 	err = nl_srv_ucast(skb, pid, MSG_DONTWAIT);
-
 	return err;
 }
 
@@ -325,8 +218,6 @@
 	vos_trace_setValue(VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ALL,
 			VOS_TRUE);
 	vos_trace_setValue(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ALL, VOS_TRUE);
-	vos_trace_setValue(VOS_MODULE_ID_PMC, VOS_TRACE_LEVEL_ALL, VOS_TRUE);
-	vos_trace_setValue(VOS_MODULE_ID_SVC, VOS_TRACE_LEVEL_ALL, VOS_TRUE);
 }
 
 static void clear_default_logtoapp_log_level(void)
@@ -342,6 +233,8 @@
 				VOS_TRUE);
 	}
 
+	vos_trace_setValue(VOS_MODULE_ID_RSV3, VOS_TRACE_LEVEL_NONE,
+			VOS_FALSE);
 	vos_trace_setValue(VOS_MODULE_ID_RSV4, VOS_TRACE_LEVEL_NONE,
 			VOS_FALSE);
 }
@@ -375,8 +268,7 @@
 			(struct log_msg *)(gwlan_logging.filled_list.next);
 		++gwlan_logging.drop_count;
 		/* print every 64th drop count */
-		if (vos_is_multicast_logging() &&
-			(!(gwlan_logging.drop_count % 0x40))) {
+		if (gapp_pid != INVALID_PID && (!(gwlan_logging.drop_count % 0x40))) {
 			pr_err("%s: drop_count = %u index = %d filled_length = %d\n",
 				__func__, gwlan_logging.drop_count,
 				gwlan_logging.pcur_node->index,
@@ -391,182 +283,12 @@
 	return ret;
 }
 
-void wlan_fillTxStruct(void *pktStat)
-{
-	vos_mem_copy(&gwlan_logging.txPktStatsInfo,
-		(struct perPktStatsInfo *)pktStat,
-		sizeof(struct perPktStatsInfo));
-}
-
-bool wlan_isPktStatsEnabled(void)
-{
-	return gwlan_logging.pkt_stats_enabled;
-}
-
-
-
-/* Need to call this with spin_lock acquired */
-static int wlan_queue_pkt_stats_for_app(void)
-{
-	int ret = 0;
-
-	list_add_tail(&gwlan_logging.pkt_stats_pcur_node->node,
-			&gwlan_logging.pkt_stat_filled_list);
-
-	if (!list_empty(&gwlan_logging.pkt_stat_free_list)) {
-		/* Get buffer from free list */
-		gwlan_logging.pkt_stats_pcur_node =
-			(struct pkt_stats_msg *)(gwlan_logging.pkt_stat_free_list.next);
-		list_del_init(gwlan_logging.pkt_stat_free_list.next);
-	} else if (!list_empty(&gwlan_logging.pkt_stat_filled_list)) {
-		/* Get buffer from filled list */
-		/* This condition will drop the packet from being
-		 * indicated to app
-		 */
-		gwlan_logging.pkt_stats_pcur_node =
-			(struct pkt_stats_msg *)(gwlan_logging.pkt_stat_filled_list.next);
-		++gwlan_logging.pkt_stat_drop_cnt;
-		/* print every 64th drop count */
-		if (vos_is_multicast_logging() &&
-			(!(gwlan_logging.pkt_stat_drop_cnt % 0x40))) {
-			pr_err("%s: drop_count = %u  filled_length = %d\n",
-				__func__, gwlan_logging.pkt_stat_drop_cnt,
-				gwlan_logging.pkt_stats_pcur_node->skb->len);
-		}
-		list_del_init(gwlan_logging.pkt_stat_filled_list.next);
-		ret = 1;
-	}
-
-	/* Reset the current node values */
-	gwlan_logging.pkt_stats_pcur_node-> skb->len = 0;
-	return ret;
-}
-
-int wlan_pkt_stats_to_user(void *perPktStat)
-{
-	bool wake_up_thread = false;
-	tPerPacketStats *pktstats = perPktStat;
-	unsigned long flags;
-	tx_rx_pkt_stats rx_tx_stats;
-	int total_log_len = 0;
-	struct sk_buff *ptr;
-	tpSirMacMgmtHdr hdr;
-	uint32 rateIdx;
-
-	if (!vos_is_multicast_logging())
-	{
-		return -EIO;
-	}
-	if (vos_is_multicast_logging()) {
-
-	vos_mem_zero(&rx_tx_stats, sizeof(tx_rx_pkt_stats));
-
-	if (pktstats->is_rx){
-		rx_tx_stats.ps_hdr.flags = (1 << PKTLOG_FLG_FRM_TYPE_REMOTE_S);
-	}else{
-		rx_tx_stats.ps_hdr.flags = (1 << PKTLOG_FLG_FRM_TYPE_LOCAL_S);
-
-	}
-	/*Send log type as PKTLOG_TYPE_PKT_STAT (9)*/
-	rx_tx_stats.ps_hdr.log_type = PKTLOG_TYPE_PKT_STAT;
-	rx_tx_stats.ps_hdr.timestamp = vos_timer_get_system_ticks();
-	rx_tx_stats.ps_hdr.missed_cnt = 0;
-	rx_tx_stats.ps_hdr.size = sizeof(tx_rx_pkt_stats) -
-				sizeof(pkt_stats_hdr) + pktstats->data_len-
-				MAX_PKT_STAT_DATA_LEN;
-
-	rx_tx_stats.stats.flags |= PER_PACKET_ENTRY_FLAGS_TX_SUCCESS;
-	rx_tx_stats.stats.flags |= PER_PACKET_ENTRY_FLAGS_80211_HEADER;
-	if (pktstats->is_rx)
-		rx_tx_stats.stats.flags |= PER_PACKET_ENTRY_FLAGS_DIRECTION_TX;
-
-	hdr = (tpSirMacMgmtHdr)pktstats->data;
-	if (hdr->fc.wep) {
-		rx_tx_stats.stats.flags |= PER_PACKET_ENTRY_FLAGS_PROTECTED;
-		/* Reset wep bit to parse frame properly */
-		hdr->fc.wep = 0;
-	}
-
-	rx_tx_stats.stats.tid = pktstats->tid;
-	rx_tx_stats.stats.dxe_timestamp = pktstats->dxe_timestamp;
-
-	if (!pktstats->is_rx)
-	{
-		rx_tx_stats.stats.rssi = gwlan_logging.txPktStatsInfo.avgRssi;
-		rx_tx_stats.stats.num_retries = gwlan_logging.txPktStatsInfo.txAvgRetry;
-		rateIdx = gwlan_logging.txPktStatsInfo.lastTxRate;
-	}
-	else
-	{
-		rx_tx_stats.stats.rssi = pktstats->rssi;
-		rx_tx_stats.stats.num_retries = pktstats->num_retries;
-		rateIdx = pktstats->rate_idx;
-
-	}
-	rx_tx_stats.stats.link_layer_transmit_sequence = pktstats->seq_num;
-
-	/* Calculate rate and MCS from rate index */
-	if( rateIdx >= 210 && rateIdx <= 217)
-		rateIdx-=202;
-	if( rateIdx >= 218 && rateIdx <= 225 )
-		rateIdx-=210;
-	get_rate_and_MCS(&rx_tx_stats.stats, rateIdx);
-
-	vos_mem_copy(rx_tx_stats.stats.data,pktstats->data, pktstats->data_len);
-
-	/* 1+1 indicate '\n'+'\0' */
-	total_log_len = sizeof(tx_rx_pkt_stats) + pktstats->data_len -
-						 MAX_PKT_STAT_DATA_LEN;
-	spin_lock_irqsave(&gwlan_logging.pkt_stats_lock, flags);
-	// wlan logging svc resources are not yet initialized
-	if (!gwlan_logging.pkt_stats_pcur_node) {
-		pr_err("%s, logging svc not initialized", __func__);
-		spin_unlock_irqrestore(&gwlan_logging.pkt_stats_lock, flags);
-		return -EIO;
-	}
-
-	;
-
-	 /* Check if we can accomodate more log into current node/buffer */
-	if (total_log_len + sizeof(vos_log_pktlog_info) + sizeof(tAniNlHdr) >=
-		skb_tailroom(gwlan_logging.pkt_stats_pcur_node->skb)) {
-		wake_up_thread = true;
-		wlan_queue_pkt_stats_for_app();
-	}
-	ptr = gwlan_logging.pkt_stats_pcur_node->skb;
-
-
-	vos_mem_copy(skb_put(ptr, total_log_len), &rx_tx_stats, total_log_len);
-	spin_unlock_irqrestore(&gwlan_logging.pkt_stats_lock, flags);
-	/* Wakeup logger thread */
-	if ((true == wake_up_thread)) {
-			/* If there is logger app registered wakeup the logging
-			* thread
-			*/
-			set_bit(HOST_PKT_STATS_POST, &gwlan_logging.event_flag);
-			wake_up_interruptible(&gwlan_logging.wait_queue);
-		}
-	}
-	return 0;
-}
-
-void wlan_disable_and_flush_pkt_stats()
-{
-	unsigned long flags;
-	spin_lock_irqsave(&gwlan_logging.pkt_stats_lock, flags);
-	if(gwlan_logging.pkt_stats_pcur_node->skb->len){
-		wlan_queue_pkt_stats_for_app();
-	}
-	spin_unlock_irqrestore(&gwlan_logging.pkt_stats_lock, flags);
-	set_bit(HOST_PKT_STATS_POST, &gwlan_logging.event_flag);
-	wake_up_interruptible(&gwlan_logging.wait_queue);
-}
 
 int wlan_log_to_user(VOS_TRACE_LEVEL log_level, char *to_be_sent, int length)
 {
 	/* Add the current time stamp */
 	char *ptr;
-	char tbuf[100];
+	char tbuf[50];
 	int tlen;
 	int total_log_len;
 	unsigned int *pfilled_length;
@@ -574,11 +296,8 @@
 	unsigned long flags;
 
 	struct timeval tv;
-	struct rtc_time tm;
-	unsigned long local_time;
-        u64 qtimer_ticks;
 
-	if (!vos_is_multicast_logging()) {
+	if (gapp_pid == INVALID_PID) {
 		/*
 		 * This is to make sure that we print the logs to kmsg console
 		 * when no logger app is running. This is also needed to
@@ -588,20 +307,14 @@
 		 * messages.
 		 */
 		pr_err("%s\n", to_be_sent);
-	} else {
+	}
 
-	/* Format the Log time [hr:min:sec.microsec] */
+	/* Format the Log time [Secondselapsedinaday.microseconds] */
 	do_gettimeofday(&tv);
+	tlen = snprintf(tbuf, sizeof(tbuf), "[%s][%5lu.%06lu] ", current->comm,
+			(unsigned long) (tv.tv_sec%SECONDS_IN_A_DAY),
+			tv.tv_usec);
 
-	/* Convert rtc to local time */
-	local_time = (u32)(tv.tv_sec - (sys_tz.tz_minuteswest * 60));
-	rtc_time_to_tm(local_time, &tm);
-        /* Firmware Time Stamp */
-        qtimer_ticks =  arch_counter_get_cntpct();
-
-        tlen = snprintf(tbuf, sizeof(tbuf), "[%02d:%02d:%02d.%06lu] [%016llX]"
-                        " [%.5s] ", tm.tm_hour, tm.tm_min, tm.tm_sec, tv.tv_usec,
-                        qtimer_ticks, current->comm);
 	/* 1+1 indicate '\n'+'\0' */
 	total_log_len = length + tlen + 1 + 1;
 
@@ -616,8 +329,8 @@
 	pfilled_length = &gwlan_logging.pcur_node->filled_length;
 
 	 /* Check if we can accomodate more log into current node/buffer */
-	if (MAX_LOGMSG_LENGTH < (*pfilled_length + sizeof(tAniNlHdr) +
-			total_log_len)) {
+	if ((MAX_LOGMSG_LENGTH - (*pfilled_length + sizeof(tAniNlHdr))) <
+			total_log_len) {
 		wake_up_thread = true;
 		wlan_queue_logmsg_for_app();
 		pfilled_length = &gwlan_logging.pcur_node->filled_length;
@@ -650,282 +363,25 @@
 	/* Wakeup logger thread */
 	if ((true == wake_up_thread)) {
 		/* If there is logger app registered wakeup the logging
-                 * thread
+                 * thread Else broadcast a Ready Indication message,
+                 * apps which are waiting on this message can
+                 * register for the logs.
                  */
-
-			set_bit(HOST_LOG_POST, &gwlan_logging.event_flag);
+		if ( (gapp_pid != INVALID_PID)) {
+			gwlan_logging.wakeEvent = TRUE;
 			wake_up_interruptible(&gwlan_logging.wait_queue);
+		}
+		else {
+			wlan_logging_srv_nl_ready_indication();
+		}
 	}
 
-	if (gwlan_logging.log_fe_to_console
+	if ((gapp_pid != INVALID_PID)
+		&& gwlan_logging.log_fe_to_console
 		&& ((VOS_TRACE_LEVEL_FATAL == log_level)
 		|| (VOS_TRACE_LEVEL_ERROR == log_level))) {
-		pr_err("%s %s\n",tbuf, to_be_sent);
+		pr_err("%s\n", to_be_sent);
 	}
-	}
-
-	return 0;
-}
-
-static int send_fw_log_pkt_to_user(void)
-{
-	int ret = -1;
-	int extra_header_len, nl_payload_len;
-	struct sk_buff *skb = NULL;
-	static int nlmsg_seq;
-	vos_pkt_t *current_pkt;
-	vos_pkt_t *next_pkt;
-	VOS_STATUS status = VOS_STATUS_E_FAILURE;
-	unsigned long flags;
-
-	tAniNlHdr msg_header;
-
-	do {
-		spin_lock_irqsave(&gwlan_logging.fw_log_pkt_lock, flags);
-
-		if (!gwlan_logging.fw_log_pkt_queue) {
-			spin_unlock_irqrestore(
-				&gwlan_logging.fw_log_pkt_lock, flags);
-			return -EIO;
-		}
-
-		/* pick first pkt from queued chain */
-		current_pkt = gwlan_logging.fw_log_pkt_queue;
-
-		/* get the pointer to the next packet in the chain */
-		status = vos_pkt_walk_packet_chain(current_pkt, &next_pkt,
-							TRUE);
-
-		/* both "success" and "empty" are acceptable results */
-		if (!((status == VOS_STATUS_SUCCESS) ||
-					(status == VOS_STATUS_E_EMPTY))) {
-			++gwlan_logging.fw_log_pkt_drop_cnt;
-			spin_unlock_irqrestore(
-				&gwlan_logging.fw_log_pkt_lock, flags);
-			pr_err("%s: Failure walking packet chain", __func__);
-			return -EIO;
-		}
-
-		/* update queue head with next pkt ptr which could be NULL */
-		gwlan_logging.fw_log_pkt_queue = next_pkt;
-		--gwlan_logging.fw_log_pkt_qcnt;
-		spin_unlock_irqrestore(&gwlan_logging.fw_log_pkt_lock, flags);
-
-		status = vos_pkt_get_os_packet(current_pkt, (v_VOID_t **)&skb,
-						TRUE);
-		if (!VOS_IS_STATUS_SUCCESS(status)) {
-			++gwlan_logging.fw_log_pkt_drop_cnt;
-			pr_err("%s: Failure extracting skb from vos pkt",
-				__func__);
-			return -EIO;
-		}
-
-		/*return vos pkt since skb is already detached */
-		vos_pkt_return_packet(current_pkt);
-
-		extra_header_len = sizeof(msg_header.radio) + sizeof(tAniHdr);
-		nl_payload_len = extra_header_len + skb->len;
-
-		msg_header.nlh.nlmsg_type = ANI_NL_MSG_LOG;
-		msg_header.nlh.nlmsg_len = nlmsg_msg_size(nl_payload_len);
-		msg_header.nlh.nlmsg_flags = NLM_F_REQUEST;
-		msg_header.nlh.nlmsg_pid = gapp_pid;
-		msg_header.nlh.nlmsg_seq = nlmsg_seq++;
-
-		msg_header.radio = 0;
-
-		msg_header.wmsg.type = ANI_NL_MSG_FW_LOG_PKT_TYPE;
-		msg_header.wmsg.length = skb->len;
-
-		if (unlikely(skb_headroom(skb) < sizeof(msg_header))) {
-			pr_err("VPKT [%d]: Insufficient headroom, head[%p],"
-				" data[%p], req[%zu]", __LINE__, skb->head,
-				skb->data, sizeof(msg_header));
-			return -EIO;
-		}
-
-		vos_mem_copy(skb_push(skb, sizeof(msg_header)), &msg_header,
-							sizeof(msg_header));
-
-		ret = nl_srv_bcast(skb);
-		if ((ret < 0) && (ret != -ESRCH)) {
-			pr_info("%s: Send Failed %d drop_count = %u\n",
-				__func__, ret, ++gwlan_logging.fw_log_pkt_drop_cnt);
-		} else {
-			ret = 0;
-		}
-
-	} while (next_pkt);
-
-	return ret;
-}
-
-static int send_data_mgmt_log_pkt_to_user(void)
-{
-	int ret = -1;
-	int extra_header_len, nl_payload_len;
-	struct sk_buff *skb = NULL;
-	static int nlmsg_seq;
-	vos_pkt_t *current_pkt;
-	vos_pkt_t *next_pkt;
-	VOS_STATUS status = VOS_STATUS_E_FAILURE;
-	unsigned long flags;
-
-	tAniNlLogHdr msg_header;
-
-	do {
-		spin_lock_irqsave(&gwlan_logging.data_mgmt_pkt_lock, flags);
-
-		if (!gwlan_logging.data_mgmt_pkt_queue) {
-			spin_unlock_irqrestore(
-				&gwlan_logging.data_mgmt_pkt_lock, flags);
-			return -EIO;
-		}
-
-		/* pick first pkt from queued chain */
-		current_pkt = gwlan_logging.data_mgmt_pkt_queue;
-
-		/* get the pointer to the next packet in the chain */
-		status = vos_pkt_walk_packet_chain(current_pkt, &next_pkt,
-							TRUE);
-
-		/* both "success" and "empty" are acceptable results */
-		if (!((status == VOS_STATUS_SUCCESS) ||
-					(status == VOS_STATUS_E_EMPTY))) {
-			++gwlan_logging.pkt_drop_cnt;
-			spin_unlock_irqrestore(
-				&gwlan_logging.data_mgmt_pkt_lock, flags);
-			pr_err("%s: Failure walking packet chain", __func__);
-			return -EIO;
-		}
-
-		/* update queue head with next pkt ptr which could be NULL */
-		gwlan_logging.data_mgmt_pkt_queue = next_pkt;
-		--gwlan_logging.data_mgmt_pkt_qcnt;
-		spin_unlock_irqrestore(&gwlan_logging.data_mgmt_pkt_lock, flags);
-
-		status = vos_pkt_get_os_packet(current_pkt, (v_VOID_t **)&skb,
-						TRUE);
-		if (!VOS_IS_STATUS_SUCCESS(status)) {
-			++gwlan_logging.pkt_drop_cnt;
-			pr_err("%s: Failure extracting skb from vos pkt",
-				__func__);
-			return -EIO;
-		}
-
-		/*return vos pkt since skb is already detached */
-		vos_pkt_return_packet(current_pkt);
-
-		extra_header_len = sizeof(msg_header.radio) + sizeof(tAniHdr) +
-						sizeof(msg_header.frameSize);
-		nl_payload_len = extra_header_len + skb->len;
-
-		msg_header.nlh.nlmsg_type = ANI_NL_MSG_LOG;
-		msg_header.nlh.nlmsg_len = nlmsg_msg_size(nl_payload_len);
-		msg_header.nlh.nlmsg_flags = NLM_F_REQUEST;
-		msg_header.nlh.nlmsg_pid = 0;
-		msg_header.nlh.nlmsg_seq = nlmsg_seq++;
-
-		msg_header.radio = 0;
-
-		msg_header.wmsg.type = ANI_NL_MSG_LOG_PKT_TYPE;
-		msg_header.wmsg.length = skb->len + sizeof(uint32);
-
-		msg_header.frameSize = WLAN_MGMT_LOGGING_FRAMESIZE_128BYTES;
-
-		if (unlikely(skb_headroom(skb) < sizeof(msg_header))) {
-			pr_err("VPKT [%d]: Insufficient headroom, head[%p],"
-				" data[%p], req[%zu]", __LINE__, skb->head,
-				skb->data, sizeof(msg_header));
-			return -EIO;
-		}
-
-		vos_mem_copy(skb_push(skb, sizeof(msg_header)), &msg_header,
-							sizeof(msg_header));
-
-		ret =  nl_srv_bcast(skb);
-		if (ret < 0) {
-			pr_info("%s: Send Failed %d drop_count = %u\n",
-				__func__, ret, ++gwlan_logging.pkt_drop_cnt);
-		} else {
-			ret = 0;
-		}
-
-	} while (next_pkt);
-
-	return ret;
-}
-
-static int fill_fw_mem_dump_buffer(void)
-{
-	struct sk_buff *skb = NULL;
-	vos_pkt_t *current_pkt;
-	vos_pkt_t *next_pkt;
-	VOS_STATUS status = VOS_STATUS_E_FAILURE;
-	unsigned long flags;
-	int  byte_left = 0;
-	do {
-		spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-
-		if (!gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue) {
-			spin_unlock_irqrestore(
-				&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-			return -EIO;
-		}
-
-		/* pick first pkt from queued chain */
-		current_pkt = gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue;
-
-		/* get the pointer to the next packet in the chain */
-		status = vos_pkt_walk_packet_chain(current_pkt, &next_pkt,
-							TRUE);
-
-		/* both "success" and "empty" are acceptable results */
-		if (!((status == VOS_STATUS_SUCCESS) ||
-					(status == VOS_STATUS_E_EMPTY))) {
-			spin_unlock_irqrestore(
-				&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-			pr_err("%s: Failure walking packet chain", __func__);
-			return -EIO;
-		}
-
-		/* update queue head with next pkt ptr which could be NULL */
-		gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue = next_pkt;
-		--gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_qcnt;
-		spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-
-		status = vos_pkt_get_os_packet(current_pkt, (v_VOID_t **)&skb,
-						VOS_FALSE);
-		if (!VOS_IS_STATUS_SUCCESS(status)) {
-			pr_err("%s: Failure extracting skb from vos pkt",
-				__func__);
-			return -EIO;
-		}
-
-		//Copy data from SKB to mem dump buffer
-		spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-		if((skb) && (skb->len != 0))
-		{
-			// Prevent buffer overflow
-			byte_left = ((int)gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size -
-					(int)(gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc - gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc));
-			if(skb->len > byte_left)
-			{
-				vos_mem_copy(gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc, skb->data, byte_left);
-				//Update the current location ptr
-				gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc +=  byte_left;
-			}
-			else
-			{
-				vos_mem_copy(gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc, skb->data, skb->len);
-				//Update the current location ptr
-				gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc +=  skb->len;
-			}
-		}
-		spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-		/*return vos pkt since skb is already detached */
-		vos_pkt_return_packet(current_pkt);
-	} while (next_pkt);
 
 	return 0;
 }
@@ -944,7 +400,7 @@
 	static int rate_limit;
 
 	while (!list_empty(&gwlan_logging.filled_list)
-			&& !gwlan_logging.exit) {
+		&& !gwlan_logging.exit) {
 
 		skb = dev_alloc_skb(MAX_LOGMSG_LENGTH);
 		if (skb == NULL) {
@@ -970,7 +426,7 @@
 			sizeof(wnl->radio) + sizeof(tAniHdr);
 
 		tot_msg_len = NLMSG_SPACE(payload_len);
-		nlh = nlmsg_put(skb, 0, nlmsg_seq++,
+		nlh = nlmsg_put(skb, gapp_pid, nlmsg_seq++,
 				ANI_NL_MSG_LOG, payload_len,
 				NLM_F_REQUEST);
 		if (NULL == nlh) {
@@ -1000,15 +456,14 @@
 				&gwlan_logging.free_list);
 		spin_unlock_irqrestore(&gwlan_logging.spin_lock, flags);
 
-		ret = nl_srv_bcast(skb);
+		ret = nl_srv_ucast(skb, gapp_pid, 0);
 		if (ret < 0) {
-			if (__ratelimit(&errCnt))
-			{
-			    pr_info("%s: Send Failed %d drop_count = %u\n",
-				  __func__, ret, gwlan_logging.drop_count);
-			}
-			gwlan_logging.drop_count++;
+			pr_err("%s: Send Failed %d drop_count = %u\n",
+				__func__, ret, ++gwlan_logging.drop_count);
 			skb = NULL;
+			gapp_pid = INVALID_PID;
+			clear_default_logtoapp_log_level();
+			wlan_logging_srv_nl_ready_indication();
 			break;
 		} else {
 			skb = NULL;
@@ -1019,126 +474,6 @@
 	return ret;
 }
 
-
-static int send_per_pkt_stats_to_user(void)
-{
-	int ret = -1;
-	struct pkt_stats_msg *plog_msg;
-	unsigned long flags;
-	struct sk_buff *skb_new = NULL;
-	vos_log_pktlog_info pktlog;
-	tAniNlHdr msg_header;
-	int extra_header_len, nl_payload_len;
-	static int nlmsg_seq;
-	static int rate_limit;
-	int diag_type;
-	bool free_old_skb = false;
-
-	while (!list_empty(&gwlan_logging.pkt_stat_filled_list)
-		&& !gwlan_logging.exit) {
-		skb_new= dev_alloc_skb(MAX_PKTSTATS_LOG_LENGTH);
-		if (skb_new == NULL) {
-			if (!rate_limit) {
-				pr_err("%s: dev_alloc_skb() failed for msg size[%d] drop count = %u\n",
-					__func__, MAX_LOGMSG_LENGTH,
-					gwlan_logging.drop_count);
-			}
-			rate_limit = 1;
-			ret = -ENOMEM;
-			break;
-		}
-
-		spin_lock_irqsave(&gwlan_logging.pkt_stats_lock, flags);
-
-		plog_msg = (struct pkt_stats_msg *)
-			(gwlan_logging.pkt_stat_filled_list.next);
-		list_del_init(gwlan_logging.pkt_stat_filled_list.next);
-		spin_unlock_irqrestore(&gwlan_logging.pkt_stats_lock, flags);
-
-		vos_mem_zero(&pktlog, sizeof(vos_log_pktlog_info));
-		vos_log_set_code(&pktlog, LOG_WLAN_PKT_LOG_INFO_C);
-
-		pktlog.version = VERSION_LOG_WLAN_PKT_LOG_INFO_C;
-		pktlog.buf_len = plog_msg->skb->len;
-		vos_log_set_length(&pktlog.log_hdr, plog_msg->skb->len +
-					sizeof(vos_log_pktlog_info));
-		pktlog.seq_no = gwlan_logging.pkt_stats_msg_idx++;
-
-		if (unlikely(skb_headroom(plog_msg->skb) < sizeof(vos_log_pktlog_info))) {
-			pr_err("VPKT [%d]: Insufficient headroom, head[%p],"
-				" data[%p], req[%zu]", __LINE__, plog_msg->skb->head,
-				plog_msg->skb->data, sizeof(msg_header));
-			ret = -EIO;
-			free_old_skb = true;
-			goto err;
-		}
-		vos_mem_copy(skb_push(plog_msg->skb, sizeof(vos_log_pktlog_info)), &pktlog,
-							sizeof(vos_log_pktlog_info));
-
-		if (unlikely(skb_headroom(plog_msg->skb) < sizeof(int))) {
-			pr_err("VPKT [%d]: Insufficient headroom, head[%p],"
-				" data[%p], req[%zu]", __LINE__, plog_msg->skb->head,
-				plog_msg->skb->data, sizeof(int));
-			ret = -EIO;
-			free_old_skb = true;
-			goto err;
-		}
-
-		diag_type = DIAG_TYPE_LOGS;
-		vos_mem_copy(skb_push(plog_msg->skb, sizeof(int)), &diag_type,
-									 sizeof(int));
-
-		extra_header_len = sizeof(msg_header.radio) + sizeof(tAniHdr);
-		nl_payload_len = extra_header_len + plog_msg->skb->len;
-
-		msg_header.nlh.nlmsg_type = ANI_NL_MSG_PUMAC;
-		msg_header.nlh.nlmsg_len = nlmsg_msg_size(nl_payload_len);
-		msg_header.nlh.nlmsg_flags = NLM_F_REQUEST;
-		msg_header.nlh.nlmsg_pid = 0;
-		msg_header.nlh.nlmsg_seq = nlmsg_seq++;
-
-		msg_header.radio = 0;
-
-		msg_header.wmsg.type = PTT_MSG_DIAG_CMDS_TYPE;
-		msg_header.wmsg.length = cpu_to_be16(plog_msg->skb->len);
-
-		if (unlikely(skb_headroom(plog_msg->skb) < sizeof(msg_header))) {
-			pr_err("VPKT [%d]: Insufficient headroom, head[%p],"
-				" data[%p], req[%zu]", __LINE__, plog_msg->skb->head,
-				plog_msg->skb->data, sizeof(msg_header));
-			ret = -EIO;
-			free_old_skb = true;
-			goto err;
-		}
-
-		vos_mem_copy(skb_push(plog_msg->skb, sizeof(msg_header)), &msg_header,
-							sizeof(msg_header));
-
-		ret = nl_srv_bcast(plog_msg->skb);
-		if (ret < 0) {
-			pr_info("%s: Send Failed %d drop_count = %u\n",
-				__func__, ret, ++gwlan_logging.fw_log_pkt_drop_cnt);
-		} else {
-			ret = 0;
-		}
-err:
-		/*
-		 * Free old skb in case or error before assigning new skb
-		 * to the free list.
-		 */
-		if (free_old_skb)
-			dev_kfree_skb(plog_msg->skb);
-		spin_lock_irqsave(&gwlan_logging.pkt_stats_lock, flags);
-		plog_msg->skb = skb_new;
-		list_add_tail(&plog_msg->node,
-				&gwlan_logging.pkt_stat_free_list);
-		spin_unlock_irqrestore(&gwlan_logging.pkt_stats_lock, flags);
-		ret = 0;
-	}
-
-	return ret;
-}
-
 /**
  * wlan_logging_thread() - The WLAN Logger thread
  * @Arg - pointer to the HDD context
@@ -1149,119 +484,44 @@
 {
 	int ret_wait_status = 0;
 	int ret = 0;
-	unsigned long flags;
+
 	set_user_nice(current, -2);
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0))
 	daemonize("wlan_logging_thread");
 #endif
+
 	while (!gwlan_logging.exit) {
 		ret_wait_status = wait_event_interruptible(
-		  gwlan_logging.wait_queue,
-		  (test_bit(HOST_LOG_POST, &gwlan_logging.event_flag) ||
-		   gwlan_logging.exit ||
-		   test_bit(LOGGER_MGMT_DATA_PKT_POST,
-						&gwlan_logging.event_flag) ||
-		   test_bit(LOGGER_FW_LOG_PKT_POST,
-						&gwlan_logging.event_flag) ||
-		   test_bit(LOGGER_FATAL_EVENT_POST,
-						&gwlan_logging.event_flag) ||
-		   test_bit(LOGGER_FW_MEM_DUMP_PKT_POST, &gwlan_logging.event_flag) ||
-		   test_bit(LOGGER_FW_MEM_DUMP_PKT_POST_DONE, &gwlan_logging.event_flag)||
-		   test_bit(HOST_PKT_STATS_POST,
-						 &gwlan_logging.event_flag)));
+		    gwlan_logging.wait_queue,
+		    (gwlan_logging.wakeEvent || gwlan_logging.exit));
+
+		gwlan_logging.wakeEvent = FALSE;
 
 		if (ret_wait_status == -ERESTARTSYS) {
-			pr_err("%s: wait_event return -ERESTARTSYS", __func__);
+			pr_err("%s: wait_event_interruptible returned -ERESTARTSYS",
+				__func__);
 			break;
 		}
 
 		if (gwlan_logging.exit) {
+		    pr_err("%s: Exiting the thread\n", __func__);
 		    break;
 		}
 
-		if (test_and_clear_bit(HOST_LOG_POST,
-			&gwlan_logging.event_flag)) {
-			ret = send_filled_buffers_to_user();
-			if (-ENOMEM == ret) {
-				msleep(200);
-			}
-			if (WLAN_LOG_INDICATOR_HOST_ONLY ==
-				gwlan_logging.log_complete.indicator)
-			{
-				vos_send_fatal_event_done();
-			}
+		if (INVALID_PID == gapp_pid) {
+		    pr_err("%s: Invalid PID\n", __func__);
+		    continue;
 		}
 
-		if (test_and_clear_bit(LOGGER_FW_LOG_PKT_POST,
-			&gwlan_logging.event_flag)) {
-			send_fw_log_pkt_to_user();
-		}
-
-		if (test_and_clear_bit(LOGGER_MGMT_DATA_PKT_POST,
-			&gwlan_logging.event_flag)) {
-			send_data_mgmt_log_pkt_to_user();
-		}
-
-		if (test_and_clear_bit(LOGGER_FATAL_EVENT_POST,
-			&gwlan_logging.event_flag)) {
-			if (gwlan_logging.log_complete.is_flush_complete == true) {
-				gwlan_logging.log_complete.is_flush_complete = false;
-				vos_send_fatal_event_done();
-			}
-			else {
-				gwlan_logging.log_complete.is_flush_complete = true;
-
-				spin_lock_irqsave(&gwlan_logging.spin_lock, flags);
-				/* Flush all current host logs*/
-				wlan_queue_logmsg_for_app();
-				spin_unlock_irqrestore(&gwlan_logging.spin_lock, flags);
-
-				set_bit(HOST_LOG_POST,&gwlan_logging.event_flag);
-				set_bit(LOGGER_FW_LOG_PKT_POST, &gwlan_logging.event_flag);
-				set_bit(LOGGER_FATAL_EVENT_POST, &gwlan_logging.event_flag);
-				wake_up_interruptible(&gwlan_logging.wait_queue);
-			}
-		}
-
-		if (test_and_clear_bit(LOGGER_FW_MEM_DUMP_PKT_POST,
-			&gwlan_logging.event_flag)) {
-			fill_fw_mem_dump_buffer();
-		}
-		if(test_and_clear_bit(LOGGER_FW_MEM_DUMP_PKT_POST_DONE, &gwlan_logging.event_flag)){
-				spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,flags);
-				/*Chnage fw memory dump to indicate write done*/
-				gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status = FW_MEM_DUMP_WRITE_DONE;
-				/*reset dropped packet count upon completion of this request*/
-				gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_drop_cnt = 0;
-				spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,flags);
-				fill_fw_mem_dump_buffer();
-				/*
-				 * Call the registered HDD callback for indicating
-				 * memdump complete. If it's null,then something is
-				 * not right.
-				 */
-				if (gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb &&
-				    gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb_arg) {
-					((hdd_fw_mem_dump_req_cb)
-					gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb)(
-					(struct hdd_fw_mem_dump_req_ctx*)
-					gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb_arg);
-
-					/*invalidate the callback pointers*/
-					spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,flags);
-					gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb = NULL;
-					gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb_arg = NULL;
-					spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,flags);
-				}
-		}
-
-		if (test_and_clear_bit(HOST_PKT_STATS_POST,
-			&gwlan_logging.event_flag)) {
-			send_per_pkt_stats_to_user();
+		ret = send_filled_buffers_to_user();
+		if (-ENOMEM == ret) {
+		    msleep(200);
 		}
 	}
 
+	pr_info("%s: Terminating\n", __func__);
+
 	complete_and_exit(&gwlan_logging.shutdown_comp, 0);
 
 	return 0;
@@ -1276,43 +536,29 @@
 	int radio;
 	int type;
 	int ret;
-	unsigned long flags;
-
-        if (TRUE == vos_isUnloadInProgress())
-        {
-                pr_info("%s: unload in progress\n",__func__);
-                return -ENODEV;
-        }
 
 	wnl = (tAniNlHdr *) skb->data;
 	radio = wnl->radio;
 	type = wnl->nlh.nlmsg_type;
 
 	if (radio < 0 || radio > ANI_MAX_RADIOS) {
-		pr_err("%s: invalid radio id [%d]\n",
+		LOGGING_TRACE(VOS_TRACE_LEVEL_ERROR,
+				"%s: invalid radio id [%d]\n",
 				__func__, radio);
 		return -EINVAL;
 	}
 
-	if (wnl->wmsg.length > skb->data_len)
-	{
-		pr_err("%s: invalid length msgLen:%x skb data_len:%x \n",
-		       __func__, wnl->wmsg.length, skb->data_len);
-		return -EINVAL;
-	}
-
 	if (gapp_pid != INVALID_PID) {
 		if (wnl->nlh.nlmsg_pid > gapp_pid) {
 			gapp_pid = wnl->nlh.nlmsg_pid;
 		}
 
-		spin_lock_irqsave(&gwlan_logging.spin_lock, flags);
+		spin_lock_bh(&gwlan_logging.spin_lock);
 		if (gwlan_logging.pcur_node->filled_length) {
 			wlan_queue_logmsg_for_app();
 		}
-		spin_unlock_irqrestore(&gwlan_logging.spin_lock, flags);
-
-		set_bit(HOST_LOG_POST, &gwlan_logging.event_flag);
+		spin_unlock_bh(&gwlan_logging.spin_lock);
+		gwlan_logging.wakeEvent = TRUE;
 		wake_up_interruptible(&gwlan_logging.wait_queue);
 	} else {
 		/* This is to set the default levels (WLAN logging
@@ -1320,93 +566,23 @@
 		 * logger app is registered for the first time.
 		 */
 		gapp_pid = wnl->nlh.nlmsg_pid;
+		set_default_logtoapp_log_level();
 	}
 
 	ret = wlan_send_sock_msg_to_app(&wnl->wmsg, 0,
 			ANI_NL_MSG_LOG, wnl->nlh.nlmsg_pid);
 	if (ret < 0) {
-		pr_err("wlan_send_sock_msg_to_app: failed");
+		LOGGING_TRACE(VOS_TRACE_LEVEL_ERROR,
+				"wlan_send_sock_msg_to_app: failed");
 	}
 
 	return ret;
 }
 
-void wlan_init_log_completion(void)
+int wlan_logging_sock_activate_svc(int log_fe_to_console, int num_buf)
 {
-	gwlan_logging.log_complete.indicator = WLAN_LOG_INDICATOR_UNUSED;
-	gwlan_logging.log_complete.is_fatal = WLAN_LOG_TYPE_NON_FATAL;
-	gwlan_logging.log_complete.is_report_in_progress = false;
-	gwlan_logging.log_complete.reason_code = WLAN_LOG_REASON_CODE_UNUSED;
-	gwlan_logging.log_complete.last_fw_bug_reason = 0;
-	gwlan_logging.log_complete.last_fw_bug_timestamp = 0;
-
-	spin_lock_init(&gwlan_logging.bug_report_lock);
-}
-
-int wlan_set_log_completion(uint32 is_fatal,
-                            uint32 indicator,
-                            uint32 reason_code)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&gwlan_logging.bug_report_lock, flags);
-	gwlan_logging.log_complete.indicator = indicator;
-	gwlan_logging.log_complete.is_fatal = is_fatal;
-	gwlan_logging.log_complete.is_report_in_progress = true;
-	gwlan_logging.log_complete.reason_code = reason_code;
-	spin_unlock_irqrestore(&gwlan_logging.bug_report_lock, flags);
-	return 0;
-}
-void wlan_get_log_and_reset_completion(uint32 *is_fatal,
-                             uint32 *indicator,
-                             uint32 *reason_code,
-                             bool reset)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&gwlan_logging.bug_report_lock, flags);
-	*indicator = gwlan_logging.log_complete.indicator;
-	*is_fatal = gwlan_logging.log_complete.is_fatal;
-	*reason_code = gwlan_logging.log_complete.reason_code;
-	if (reset) {
-		gwlan_logging.log_complete.indicator =
-						WLAN_LOG_INDICATOR_UNUSED;
-		gwlan_logging.log_complete.is_fatal = WLAN_LOG_TYPE_NON_FATAL;
-		gwlan_logging.log_complete.is_report_in_progress = false;
-		gwlan_logging.log_complete.reason_code =
-					 WLAN_LOG_REASON_CODE_UNUSED;
-	}
-	spin_unlock_irqrestore(&gwlan_logging.bug_report_lock, flags);
-}
-
-bool wlan_is_log_report_in_progress(void)
-{
-	return gwlan_logging.log_complete.is_report_in_progress;
-}
-
-
-void wlan_reset_log_report_in_progress(void)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&gwlan_logging.bug_report_lock, flags);
-	gwlan_logging.log_complete.is_report_in_progress = false;
-	spin_unlock_irqrestore(&gwlan_logging.bug_report_lock, flags);
-}
-
-
-void wlan_deinit_log_completion(void)
-{
-	return;
-}
-
-
-int wlan_logging_sock_activate_svc(int log_fe_to_console, int num_buf,
-								int pkt_stats_enabled, int pkt_stats_buff)
-{
-	int i, j = 0;
+	int i = 0;
 	unsigned long irq_flag;
-	bool failure = FALSE;
 
 	pr_info("%s: Initalizing FEConsoleLog = %d NumBuff = %d\n",
 			__func__, log_fe_to_console, num_buf);
@@ -1437,60 +613,10 @@
 		(gwlan_logging.free_list.next);
 	list_del_init(gwlan_logging.free_list.next);
 	spin_unlock_irqrestore(&gwlan_logging.spin_lock, irq_flag);
-	if(pkt_stats_enabled)
-	{
-		pr_info("%s: Initalizing Pkt stats pkt_stats_buff = %d\n",
-			__func__, pkt_stats_buff);
-		pkt_stats_buffers = (struct pkt_stats_msg *) kzalloc(
-			 pkt_stats_buff * sizeof(struct pkt_stats_msg), GFP_KERNEL);
-		if (!pkt_stats_buffers) {
-			pr_err("%s: Could not allocate memory for Pkt stats\n", __func__);
-			failure = TRUE;
-			goto err;
-		}
 
-		gwlan_logging.pkt_stat_num_buf = pkt_stats_buff;
-
-		gwlan_logging.pkt_stats_msg_idx = 0;
-		INIT_LIST_HEAD(&gwlan_logging.pkt_stat_free_list);
-		INIT_LIST_HEAD(&gwlan_logging.pkt_stat_filled_list);
-
-		for (i = 0; i < pkt_stats_buff; i++) {
-			pkt_stats_buffers[i].skb= dev_alloc_skb(MAX_PKTSTATS_LOG_LENGTH);
-			if (pkt_stats_buffers[i].skb == NULL)
-			{
-				pr_err("%s: Memory alloc failed for skb",__func__);
-				/* free previously allocated skb and return;*/
-				for (j = 0; j<i ; j++)
-				{
-					dev_kfree_skb(pkt_stats_buffers[j].skb);
-				}
-			spin_lock_irqsave(&gwlan_logging.spin_lock, irq_flag);
-			vos_mem_free(pkt_stats_buffers);
-			pkt_stats_buffers = NULL;
-			spin_unlock_irqrestore(&gwlan_logging.spin_lock, irq_flag);
-			failure = TRUE;
-			goto err;
-			}
-			list_add(&pkt_stats_buffers[i].node,
-								&gwlan_logging.pkt_stat_free_list);
-
-		}
-		gwlan_logging.pkt_stats_pcur_node = (struct pkt_stats_msg *)
-			(gwlan_logging.pkt_stat_free_list.next);
-		list_del_init(gwlan_logging.pkt_stat_free_list.next);
-		gwlan_logging.pkt_stats_enabled = TRUE;
-	}
-err:
-	if (failure)
-	gwlan_logging.pkt_stats_enabled = false;
 	init_waitqueue_head(&gwlan_logging.wait_queue);
 	gwlan_logging.exit = false;
-	clear_bit(HOST_LOG_POST, &gwlan_logging.event_flag);
-	clear_bit(LOGGER_MGMT_DATA_PKT_POST, &gwlan_logging.event_flag);
-	clear_bit(LOGGER_FW_LOG_PKT_POST, &gwlan_logging.event_flag);
-	clear_bit(LOGGER_FATAL_EVENT_POST, &gwlan_logging.event_flag);
-	clear_bit(HOST_PKT_STATS_POST, &gwlan_logging.event_flag);
+	gwlan_logging.wakeEvent = FALSE;
 	init_completion(&gwlan_logging.shutdown_comp);
 	gwlan_logging.thread = kthread_create(wlan_logging_thread, NULL,
 					"wlan_logging_thread");
@@ -1505,64 +631,18 @@
 		return -ENOMEM;
 	}
 	wake_up_process(gwlan_logging.thread);
-	gwlan_logging.is_active = true;
 
 	nl_srv_register(ANI_NL_MSG_LOG, wlan_logging_proc_sock_rx_msg);
 
 	//Broadcast SVC ready message to logging app/s running
 	wlan_logging_srv_nl_ready_indication();
-	return 0;
-}
-
-int wlan_logging_flush_pkt_queue(void)
-{
-	vos_pkt_t *pkt_queue_head;
-	unsigned long flags;
-	spin_lock_irqsave(&gwlan_logging.data_mgmt_pkt_lock, flags);
-	if (NULL != gwlan_logging.data_mgmt_pkt_queue) {
-		pkt_queue_head = gwlan_logging.data_mgmt_pkt_queue;
-		gwlan_logging.data_mgmt_pkt_queue = NULL;
-		gwlan_logging.pkt_drop_cnt = 0;
-		gwlan_logging.data_mgmt_pkt_qcnt = 0;
-		spin_unlock_irqrestore(&gwlan_logging.data_mgmt_pkt_lock,
-					flags);
-		vos_pkt_return_packet(pkt_queue_head);
-	} else {
-		spin_unlock_irqrestore(&gwlan_logging.data_mgmt_pkt_lock,
-					flags);
-	}
-
-	spin_lock_irqsave(&gwlan_logging.fw_log_pkt_lock, flags);
-	if (NULL != gwlan_logging.fw_log_pkt_queue) {
-		pkt_queue_head = gwlan_logging.fw_log_pkt_queue;
-		gwlan_logging.fw_log_pkt_queue = NULL;
-		gwlan_logging.fw_log_pkt_drop_cnt = 0;
-		gwlan_logging.fw_log_pkt_qcnt = 0;
-		spin_unlock_irqrestore(&gwlan_logging.fw_log_pkt_lock,
-					flags);
-		vos_pkt_return_packet(pkt_queue_head);
-	} else {
-		spin_unlock_irqrestore(&gwlan_logging.fw_log_pkt_lock,
-					flags);
-	}
-	spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-	if (NULL != gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue) {
-		pkt_queue_head = gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue;
-		spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,
-					flags);
-		vos_pkt_return_packet(pkt_queue_head);
-		wlan_free_fwr_mem_dump_buffer();
-	} else {
-		spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,
-					flags);
-	}
+	pr_info("%s: Activated wlan_logging svc\n", __func__);
 	return 0;
 }
 
 int wlan_logging_sock_deactivate_svc(void)
 {
 	unsigned long irq_flag;
-	int i;
 
 	if (!gplog_msg)
 		return 0;
@@ -1573,32 +653,15 @@
 
 	INIT_COMPLETION(gwlan_logging.shutdown_comp);
 	gwlan_logging.exit = true;
-	gwlan_logging.is_active = false;
-	vos_set_multicast_logging(0);
 	wake_up_interruptible(&gwlan_logging.wait_queue);
 	wait_for_completion(&gwlan_logging.shutdown_comp);
 
 	spin_lock_irqsave(&gwlan_logging.spin_lock, irq_flag);
 	vfree(gplog_msg);
-	gplog_msg = NULL;
 	gwlan_logging.pcur_node = NULL;
 	spin_unlock_irqrestore(&gwlan_logging.spin_lock, irq_flag);
 
-	spin_lock_irqsave(&gwlan_logging.pkt_stats_lock, irq_flag);
-	/* free allocated skb */
-	for (i = 0; i < gwlan_logging.pkt_stat_num_buf; i++)
-	{
-		if (pkt_stats_buffers[i].skb)
-			dev_kfree_skb(pkt_stats_buffers[i].skb);
-	}
-	if(pkt_stats_buffers)
-		vos_mem_free(pkt_stats_buffers);
-	pkt_stats_buffers = NULL;
-	gwlan_logging.pkt_stats_pcur_node = NULL;
-	gwlan_logging.pkt_stats_enabled = false;
-	spin_unlock_irqrestore(&gwlan_logging.pkt_stats_lock, irq_flag);
-
-	wlan_logging_flush_pkt_queue();
+	pr_info("%s: Deactivate wlan_logging svc\n", __func__);
 
 	return 0;
 }
@@ -1606,15 +669,8 @@
 int wlan_logging_sock_init_svc(void)
 {
 	spin_lock_init(&gwlan_logging.spin_lock);
-	spin_lock_init(&gwlan_logging.data_mgmt_pkt_lock);
-	spin_lock_init(&gwlan_logging.fw_log_pkt_lock);
-	spin_lock_init(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock);
-	spin_lock_init(&gwlan_logging.pkt_stats_lock);
 	gapp_pid = INVALID_PID;
 	gwlan_logging.pcur_node = NULL;
-	gwlan_logging.pkt_stats_pcur_node= NULL;
-
-	wlan_init_log_completion();
 
 	return 0;
 }
@@ -1622,554 +678,8 @@
 int wlan_logging_sock_deinit_svc(void)
 {
 	gwlan_logging.pcur_node = NULL;
-	gwlan_logging.pkt_stats_pcur_node = NULL;
 	gapp_pid = INVALID_PID;
 
-	wlan_deinit_log_completion();
-	return 0;
+       return 0;
 }
-
-int wlan_queue_data_mgmt_pkt_for_app(vos_pkt_t *pPacket)
-{
-	unsigned long flags;
-	vos_pkt_t *next_pkt;
-	vos_pkt_t *free_pkt;
-	VOS_STATUS status = VOS_STATUS_E_FAILURE;
-
-	spin_lock_irqsave(&gwlan_logging.data_mgmt_pkt_lock, flags);
-	if (gwlan_logging.data_mgmt_pkt_qcnt >= LOGGER_MAX_DATA_MGMT_PKT_Q_LEN) {
-		status = vos_pkt_walk_packet_chain(
-			gwlan_logging.data_mgmt_pkt_queue, &next_pkt, TRUE);
-		/*both "success" and "empty" are acceptable results*/
-		if (!((status == VOS_STATUS_SUCCESS) ||
-				(status == VOS_STATUS_E_EMPTY))) {
-			++gwlan_logging.pkt_drop_cnt;
-			spin_unlock_irqrestore(
-				&gwlan_logging.data_mgmt_pkt_lock, flags);
-			pr_err("%s: Failure walking packet chain", __func__);
-			/*keep returning pkts to avoid low resource cond*/
-			vos_pkt_return_packet(pPacket);
-			return VOS_STATUS_E_FAILURE;
-		}
-
-		free_pkt = gwlan_logging.data_mgmt_pkt_queue;
-		gwlan_logging.data_mgmt_pkt_queue = next_pkt;
-		/*returning head of pkt queue. latest pkts are important*/
-		--gwlan_logging.data_mgmt_pkt_qcnt;
-		spin_unlock_irqrestore(&gwlan_logging.data_mgmt_pkt_lock,
-					flags);
-		vos_pkt_return_packet(free_pkt);
-	} else {
-		spin_unlock_irqrestore(&gwlan_logging.data_mgmt_pkt_lock,
-					flags);
-	}
-
-	spin_lock_irqsave(&gwlan_logging.data_mgmt_pkt_lock, flags);
-
-	if (gwlan_logging.data_mgmt_pkt_queue) {
-		vos_pkt_chain_packet(gwlan_logging.data_mgmt_pkt_queue,
-					pPacket, TRUE);
-	} else {
-		gwlan_logging.data_mgmt_pkt_queue = pPacket;
-	}
-	++gwlan_logging.data_mgmt_pkt_qcnt;
-
-	spin_unlock_irqrestore(&gwlan_logging.data_mgmt_pkt_lock, flags);
-
-	set_bit(LOGGER_MGMT_DATA_PKT_POST, &gwlan_logging.event_flag);
-	wake_up_interruptible(&gwlan_logging.wait_queue);
-
-	return VOS_STATUS_SUCCESS;
-}
-
-/**
- * wlan_logging_set_log_level() - Set the logging level
- *
- * This function is used to set the logging level of host debug messages
- *
- * Return: None
- */
-void wlan_logging_set_log_level(void)
-{
-	set_default_logtoapp_log_level();
-}
-
-int wlan_queue_fw_log_pkt_for_app(vos_pkt_t *pPacket)
-{
-	unsigned long flags;
-	vos_pkt_t *next_pkt;
-	vos_pkt_t *free_pkt;
-	VOS_STATUS status = VOS_STATUS_E_FAILURE;
-
-	spin_lock_irqsave(&gwlan_logging.fw_log_pkt_lock, flags);
-	if (gwlan_logging.fw_log_pkt_qcnt >= LOGGER_MAX_FW_LOG_PKT_Q_LEN) {
-		status = vos_pkt_walk_packet_chain(
-			gwlan_logging.fw_log_pkt_queue, &next_pkt, TRUE);
-		/*both "success" and "empty" are acceptable results*/
-		if (!((status == VOS_STATUS_SUCCESS) ||
-				(status == VOS_STATUS_E_EMPTY))) {
-			++gwlan_logging.fw_log_pkt_drop_cnt;
-			spin_unlock_irqrestore(
-				&gwlan_logging.fw_log_pkt_lock, flags);
-			pr_err("%s: Failure walking packet chain", __func__);
-			/*keep returning pkts to avoid low resource cond*/
-			vos_pkt_return_packet(pPacket);
-			return VOS_STATUS_E_FAILURE;
-		}
-
-		free_pkt = gwlan_logging.fw_log_pkt_queue;
-		gwlan_logging.fw_log_pkt_queue = next_pkt;
-		/*returning head of pkt queue. latest pkts are important*/
-		--gwlan_logging.fw_log_pkt_qcnt;
-		spin_unlock_irqrestore(&gwlan_logging.fw_log_pkt_lock,
-					flags);
-		vos_pkt_return_packet(free_pkt);
-	} else {
-		spin_unlock_irqrestore(&gwlan_logging.fw_log_pkt_lock,
-					flags);
-	}
-
-	spin_lock_irqsave(&gwlan_logging.fw_log_pkt_lock, flags);
-
-	if (gwlan_logging.fw_log_pkt_queue) {
-		vos_pkt_chain_packet(gwlan_logging.fw_log_pkt_queue,
-					pPacket, TRUE);
-	} else {
-		gwlan_logging.fw_log_pkt_queue = pPacket;
-	}
-	++gwlan_logging.fw_log_pkt_qcnt;
-
-	spin_unlock_irqrestore(&gwlan_logging.fw_log_pkt_lock, flags);
-
-	set_bit(LOGGER_FW_LOG_PKT_POST, &gwlan_logging.event_flag);
-	wake_up_interruptible(&gwlan_logging.wait_queue);
-
-	return VOS_STATUS_SUCCESS;
-}
-
-int wlan_queue_fw_mem_dump_for_app(vos_pkt_t *pPacket)
-{
-	unsigned long flags;
-	vos_pkt_t *next_pkt;
-	vos_pkt_t *free_pkt;
-	VOS_STATUS status = VOS_STATUS_E_FAILURE;
-
-	spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-	if (gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_qcnt >= LOGGER_MAX_FW_MEM_DUMP_PKT_Q_LEN) {
-		status = vos_pkt_walk_packet_chain(
-			gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue, &next_pkt, TRUE);
-		/*both "success" and "empty" are acceptable results*/
-		if (!((status == VOS_STATUS_SUCCESS) ||
-				(status == VOS_STATUS_E_EMPTY))) {
-			spin_unlock_irqrestore(
-				&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-			pr_err("%s: Failure walking packet chain", __func__);
-			/*keep returning pkts to avoid low resource cond*/
-			vos_pkt_return_packet(pPacket);
-			return VOS_STATUS_E_FAILURE;
-		}
-
-		free_pkt = gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue;
-		gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue = next_pkt;
-		/*returning head of pkt queue. latest pkts are important*/
-		--gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_qcnt;
-                ++gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_drop_cnt ;
-		spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,
-					flags);
-                pr_info("%s : fw mem_dump pkt cnt --> %d\n" ,__func__, gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_drop_cnt);
-		vos_pkt_return_packet(free_pkt);
-	} else {
-		spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,
-					flags);
-	}
-
-	spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-
-	if (gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue) {
-		vos_pkt_chain_packet(gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue,
-					pPacket, TRUE);
-	} else {
-		gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue = pPacket;
-	}
-	++gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_qcnt;
-
-	spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-
-	set_bit(LOGGER_FW_MEM_DUMP_PKT_POST, &gwlan_logging.event_flag);
-	wake_up_interruptible(&gwlan_logging.wait_queue);
-
-	return VOS_STATUS_SUCCESS;
-}
-
-int wlan_queue_logpkt_for_app(vos_pkt_t *pPacket, uint32 pkt_type)
-{
-	VOS_STATUS status = VOS_STATUS_E_FAILURE;
-
-	if (pPacket == NULL) {
-		pr_err("%s: Null param", __func__);
-		VOS_ASSERT(0);
-		return VOS_STATUS_E_FAILURE;
-	}
-
-	if (gwlan_logging.is_active == false) {
-		/*return all packets queued*/
-		wlan_logging_flush_pkt_queue();
-
-		/*return currently received pkt*/
-		vos_pkt_return_packet(pPacket);
-		return VOS_STATUS_E_FAILURE;
-	}
-
-	switch (pkt_type) {
-	case WLAN_MGMT_FRAME_LOGS:
-		status = wlan_queue_data_mgmt_pkt_for_app(pPacket);
-		break;
-
-	case WLAN_FW_LOGS:
-		status = wlan_queue_fw_log_pkt_for_app(pPacket);
-		break;
-	case WLAN_FW_MEMORY_DUMP:
-		status = wlan_queue_fw_mem_dump_for_app(pPacket);
-		break;
-
-	default:
-		pr_info("%s: Unknown pkt received %d", __func__, pkt_type);
-		status = VOS_STATUS_E_INVAL;
-		break;
-	};
-
-	return status;
-}
-
-void wlan_process_done_indication(uint8 type, uint32 reason_code)
-{
-        if (FALSE == sme_IsFeatureSupportedByFW(MEMORY_DUMP_SUPPORTED))
-        {
-            if ((type == WLAN_FW_LOGS) &&
-                (wlan_is_log_report_in_progress() == TRUE))
-            {
-                pr_info("%s: Setting LOGGER_FATAL_EVENT %d\n",
-                         __func__, reason_code);
-                set_bit(LOGGER_FATAL_EVENT_POST, &gwlan_logging.event_flag);
-                wake_up_interruptible(&gwlan_logging.wait_queue);
-            }
-            return;
-        }
-
-	if ((type == WLAN_FW_LOGS) && reason_code &&
-				 vos_isFatalEventEnabled() &&
-				 vos_is_wlan_logging_enabled())
-	{
-		if(wlan_is_log_report_in_progress() == TRUE)
-		{
-                        pr_info("%s: Setting LOGGER_FATAL_EVENT %d\n",
-                                 __func__, reason_code);
-			set_bit(LOGGER_FATAL_EVENT_POST, &gwlan_logging.event_flag);
-			wake_up_interruptible(&gwlan_logging.wait_queue);
-		}
-		else
-		{
-			unsigned long flags;
-
-			/* Drop FW initiated fatal event for
-			 * LIMIT_FW_FATAL_EVENT_MS if received for same reason.
-			 */
-			spin_lock_irqsave(&gwlan_logging.bug_report_lock,
-									flags);
-			if ((reason_code ==
-			   gwlan_logging.log_complete.last_fw_bug_reason) &&
-			   ((vos_timer_get_system_time() -
-			    gwlan_logging.log_complete.last_fw_bug_timestamp)
-						< LIMIT_FW_FATAL_EVENT_MS)) {
-				spin_unlock_irqrestore(
-					&gwlan_logging.bug_report_lock,
-					flags);
-				pr_info("%s: Ignoring Fatal event from firmware for reason %d\n",
-					__func__, reason_code);
-				return;
-			}
-			gwlan_logging.log_complete.last_fw_bug_reason =
-								reason_code;
-			gwlan_logging.log_complete.last_fw_bug_timestamp =
-						vos_timer_get_system_time();
-			spin_unlock_irqrestore(&gwlan_logging.bug_report_lock,
-									flags);
-
-			/*Firmware Initiated*/
-			pr_info("%s : FW triggered Fatal Event, reason_code : %d\n", __func__,
-			reason_code);
-			wlan_set_log_completion(WLAN_LOG_TYPE_FATAL,
-					WLAN_LOG_INDICATOR_FIRMWARE,
-					reason_code);
-			set_bit(LOGGER_FATAL_EVENT_POST, &gwlan_logging.event_flag);
-			wake_up_interruptible(&gwlan_logging.wait_queue);
-		}
-	}
-	if(type == WLAN_FW_MEMORY_DUMP && vos_is_wlan_logging_enabled())
-	{
-		pr_info("%s: Setting FW MEM DUMP LOGGER event\n", __func__);
-		set_bit(LOGGER_FW_MEM_DUMP_PKT_POST_DONE, &gwlan_logging.event_flag);
-		wake_up_interruptible(&gwlan_logging.wait_queue);
-	}
-}
-/**
- * wlan_flush_host_logs_for_fatal() -flush host logs and send
- * fatal event to upper layer.
- */
-void wlan_flush_host_logs_for_fatal()
-{
-	unsigned long flags;
-
-	if (wlan_is_log_report_in_progress()) {
-		pr_info("%s:flush all host logs Setting HOST_LOG_POST\n",
-				 __func__);
-
-		spin_lock_irqsave(&gwlan_logging.spin_lock, flags);
-		wlan_queue_logmsg_for_app();
-		spin_unlock_irqrestore(&gwlan_logging.spin_lock, flags);
-
-		set_bit(HOST_LOG_POST, &gwlan_logging.event_flag);
-		wake_up_interruptible(&gwlan_logging.wait_queue);
-	}
-}
-
-
-/**
- * wlan_is_logger_thread()- Check if threadid is
- * of logger thread
- *
- * @threadId: passed threadid
- *
- * This function is called to check if threadid is
- * of logger thread.
- *
- * Return: true if threadid is of logger thread.
- */
-bool wlan_is_logger_thread(int threadId)
-{
-	return ((gwlan_logging.thread) &&
-		(threadId == gwlan_logging.thread->pid));
-}
-
-int wlan_fwr_mem_dump_buffer_allocation(void)
-{
-	/*Allocate the dump memory as reported by fw.
-	  or if feature not supported just report to the user */
-	if(gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size <= 0)
-	{
-	   pr_err("%s: fw_mem_dump_req not supported by firmware", __func__);
-	   return -EFAULT;
-	}
-	gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc =
-		(uint8 *)vos_mem_vmalloc(gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size);
-	gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc = gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc;
-	if(NULL == gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc)
-	{
-		pr_err("%s: fw_mem_dump_req alloc failed for size %d bytes", __func__,gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size);
-		return -ENOMEM;
-	}
-	vos_mem_zero(gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc,gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size);
-
-	return 0;
-}
-
-/*set the current fw mem dump state*/
-void wlan_set_fwr_mem_dump_state(enum FW_MEM_DUMP_STATE fw_mem_dump_state)
-{
-	unsigned long flags;
-	spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-	gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status = fw_mem_dump_state;
-	spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-}
-/*check for new request validity and free memory if present from previous request */
-bool wlan_fwr_mem_dump_test_and_set_write_allowed_bit(){
-	unsigned long flags;
-	bool ret = false;
-	bool write_done = false;
-	spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-
-	if(gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status == FW_MEM_DUMP_IDLE){
-		ret = true;
-		gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status = FW_MEM_DUMP_WRITE_IN_PROGRESS;
-	}
-	else if(gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status == FW_MEM_DUMP_WRITE_DONE){
-		ret = true;
-		write_done =  true;
-		gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status = FW_MEM_DUMP_WRITE_IN_PROGRESS;
-	}
-	spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-	pr_info("%s:fw mem dump state --> %d ", __func__,gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status);
-
-	if(write_done)
-		wlan_free_fwr_mem_dump_buffer();
-	return ret;
-}
-
-bool wlan_fwr_mem_dump_test_and_set_read_allowed_bit(){
-	unsigned long flags;
-	bool ret=false;
-	spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-	if(gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status == FW_MEM_DUMP_WRITE_DONE ||
-          gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status == FW_MEM_DUMP_READ_IN_PROGRESS ){
-          ret = true;
-          gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status = FW_MEM_DUMP_READ_IN_PROGRESS;
-	}
-	spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-	//pr_info("%s:fw mem dump state --> %d ", __func__,gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status);
-
-	return ret;
-}
-size_t wlan_fwr_mem_dump_fsread_handler(char __user *buf,
-		size_t count, loff_t *pos,loff_t* bytes_left)
-{
-	if (buf == NULL || gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc == NULL)
-	{
-		pr_err("%s : start loc : %p buf : %p ",__func__,gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc,buf);
-		return 0;
-	}
-
-	if (*pos < 0) {
-		pr_err("Invalid start offset for memdump read");
-		return 0;
-	} else if (*pos >= gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size || !count) {
-		pr_err("No more data to copy");
-		return 0;
-	} else if (count > gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size - *pos) {
-		count = gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size - *pos;
-	}
-	if (copy_to_user(buf, gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc, count)) {
-		pr_err("%s copy to user space failed",__func__);
-		return 0;
-	}
-	/* offset(pos) should be updated here based on the copy done*/
-	*pos += count;
-	*bytes_left = gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size - *pos;
-	return count;
-}
-
-void  wlan_set_svc_fw_mem_dump_req_cb (void * fw_mem_dump_req_cb, void * fw_mem_dump_req_cb_arg)
-{
-	unsigned long flags;
-	spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-	gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb = fw_mem_dump_req_cb;
-	gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb_arg = fw_mem_dump_req_cb_arg;
-	spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-}
-
-void wlan_free_fwr_mem_dump_buffer (void )
-{
-	unsigned long flags;
-	void * tmp = NULL;
-	spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-	tmp = gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc;
-	gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc = NULL;
-	gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc = NULL;
-	spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-	// Don't set fw_dump_max_size to 0, only free the buffera
-	if(tmp != NULL)
-		vos_mem_vfree((void *)tmp);
-}
-
-void wlan_store_fwr_mem_dump_size(uint32 dump_size)
-{
-	unsigned long flags;
-	spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-	//Store the dump size
-	gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size = dump_size;
-	spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
-}
-/**
- * wlan_indicate_mem_dump_complete() -  When H2H for mem
- * dump finish invoke the handler.
- *
- * This is a handler used to indicate user space about the
- * availability for firmware memory dump via vendor event.
- *
- * Return: None
- */
-void wlan_indicate_mem_dump_complete(bool status )
-{
-	hdd_context_t *hdd_ctx;
-	void *vos_ctx;
-	int ret;
-	struct sk_buff *skb = NULL;
-	vos_ctx = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-	if (!vos_ctx) {
-		pr_err("Invalid VOS context");
-		return;
-	}
-
-	hdd_ctx = vos_get_context(VOS_MODULE_ID_HDD, vos_ctx);
-	if(!hdd_ctx) {
-		pr_err("Invalid HDD context");
-		return;
-	}
-
-	ret = wlan_hdd_validate_context(hdd_ctx);
-	if (0 != ret) {
-		pr_err("HDD context is not valid");
-		return;
-	}
-
-
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
-		sizeof(uint32_t) + NLA_HDRLEN + NLMSG_HDRLEN);
-
-	if (!skb) {
-		pr_err("cfg80211_vendor_event_alloc failed");
-		return;
-	}
-	if(status)
-	{
-		if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_MEMDUMP_SIZE,
-				gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size)) {
-			pr_err("nla put fail");
-			goto nla_put_failure;
-		}
-	}
-	else
-	{
-		pr_err("memdump failed.Returning size 0 to user");
-		if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_MEMDUMP_SIZE,
-				0)) {
-			pr_err("nla put fail");
-			goto nla_put_failure;
-		}
-	}
-	/*indicate mem dump complete*/
-	cfg80211_vendor_cmd_reply(skb);
-	pr_info("Memdump event sent successfully to user space : recvd size %d",(int)(gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc - gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc));
-	return;
-
-nla_put_failure:
-	kfree_skb(skb);
-	return;
-}
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-/**
- * wlan_report_log_completion() - Report bug report completion to userspace
- * @is_fatal: Type of event, fatal or not
- * @indicator: Source of bug report, framework/host/firmware
- * @reason_code: Reason for triggering bug report
- *
- * This function is used to report the bug report completion to userspace
- *
- * Return: None
- */
-void wlan_report_log_completion(uint32_t is_fatal,
-				uint32_t indicator,
-				uint32_t reason_code)
-{
-	WLAN_VOS_DIAG_EVENT_DEF(wlan_diag_event,
-				struct vos_event_wlan_log_complete);
-
-	wlan_diag_event.is_fatal = is_fatal;
-	wlan_diag_event.indicator = indicator;
-	wlan_diag_event.reason_code = reason_code;
-	wlan_diag_event.reserved = 0;
-
-	WLAN_VOS_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_LOG_COMPLETE);
-}
-#endif
-
 #endif /* WLAN_LOGGING_SOCK_SVC_ENABLE */
diff --git a/wlan/prima/CORE/SVC/src/nlink/wlan_nlink_srv.c b/wlan/prima/CORE/SVC/src/nlink/wlan_nlink_srv.c
index facf905..a1dfc8a 100644
--- a/wlan/prima/CORE/SVC/src/nlink/wlan_nlink_srv.c
+++ b/wlan/prima/CORE/SVC/src/nlink/wlan_nlink_srv.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -111,7 +111,6 @@
    }
 #endif /* WLAN_KD_READY_NOTIFIER */
    netlink_kernel_release(nl_srv_sock);
-   nl_srv_sock = NULL;
 }
 
 /*
@@ -164,7 +163,7 @@
  */
 int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag)
 {
-   int err = -EINVAL;
+   int err;
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
    NETLINK_CB(skb).pid = 0; //sender's pid
@@ -172,15 +171,12 @@
    NETLINK_CB(skb).portid = 0; //sender's pid
 #endif
    NETLINK_CB(skb).dst_group = 0; //not multicast
-   if (nl_srv_sock != NULL) {
-      err = netlink_unicast(nl_srv_sock, skb,
-                            dst_pid, flag);
-      if (err < 0)
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
-         "NLINK: netlink_unicast to pid[%d] failed, ret[%d]", dst_pid, err);
-   }
-   else
-      dev_kfree_skb(skb);
+
+   err = netlink_unicast(nl_srv_sock, skb, dst_pid, flag);
+
+   if (err < 0)
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+      "NLINK: netlink_unicast to pid[%d] failed, ret[0x%X]", dst_pid, err);
 
    return err;
 }
@@ -191,11 +187,7 @@
  */
 int nl_srv_bcast(struct sk_buff *skb)
 {
-   int err = -EINVAL;
-   int flags = GFP_KERNEL;
-
-   if (in_interrupt() || irqs_disabled() || in_atomic())
-       flags = GFP_ATOMIC;
+   int err;
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
    NETLINK_CB(skb).pid = 0; //sender's pid
@@ -203,18 +195,14 @@
    NETLINK_CB(skb).portid = 0; //sender's pid
 #endif
    NETLINK_CB(skb).dst_group = WLAN_NLINK_MCAST_GRP_ID; //destination group
-   if (nl_srv_sock != NULL) {
-      err = netlink_broadcast(nl_srv_sock, skb, 0,
-                              WLAN_NLINK_MCAST_GRP_ID, flags);
 
-      if ((err < 0) && (err != -ESRCH))
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
+   err = netlink_broadcast(nl_srv_sock, skb, 0, WLAN_NLINK_MCAST_GRP_ID, GFP_KERNEL);
+
+   if (err < 0)
+   {
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
          "NLINK: netlink_broadcast failed err = %d", err);
    }
-   else
-      dev_kfree_skb(skb);
-
-
    return err;
 }
 
@@ -293,6 +281,9 @@
       return;
    }
 
+   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+      "NLINK: Received NL msg type [%d]", type);
+
    // turn type into dispatch table offset
    type -= WLAN_NL_MSG_BASE;
 
@@ -342,7 +333,7 @@
 
    /*multicast the message to all listening processes*/
    err = netlink_broadcast(nl_srv_sock, skb, 0, 1, GFP_KERNEL);
-   if (err && (err != -ESRCH))
+   if (err)
    {
       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW,
                 "NLINK: Ready Indication Send Fail %s, err %d",
@@ -395,19 +386,3 @@
 }
 #endif /* WLAN_KD_READY_NOTIFIER */
 
-/*
- * nl_srv_is_initialized() - This function is used check if the netlink
- * service is initialized
- *
- * This function is used check if the netlink service is initialized
- *
- * Return: Return -EPERM if the service is not initialized
- *
- */
-int nl_srv_is_initialized()
-{
-   if (nl_srv_sock)
-       return 0;
-   else
-       return -EPERM;
-}
diff --git a/wlan/prima/CORE/SVC/src/ptt/wlan_ptt_sock_svc.c b/wlan/prima/CORE/SVC/src/ptt/wlan_ptt_sock_svc.c
index 5db47dd..c243380 100644
--- a/wlan/prima/CORE/SVC/src/ptt/wlan_ptt_sock_svc.c
+++ b/wlan/prima/CORE/SVC/src/ptt/wlan_ptt_sock_svc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -96,7 +96,7 @@
          __func__, radio);
       return -EINVAL;
    }
-   payload_len = wmsg_length + sizeof(wnl->radio) + sizeof(tAniHdr);
+   payload_len = wmsg_length + 4;  // 4 extra bytes for the radio idx
    tot_msg_len = NLMSG_SPACE(payload_len);
    if ((skb = dev_alloc_skb(tot_msg_len)) == NULL) {
       PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: dev_alloc_skb() failed for msg size[%d]\n",
@@ -113,22 +113,12 @@
    wnl = (tAniNlHdr *) nlh;
    wnl->radio = radio;
    vos_mem_copy(&wnl->wmsg, wmsg, wmsg_length);
+   PTT_TRACE(VOS_TRACE_LEVEL_INFO, "%s: Sending Msg Type [0x%X] to pid[%d]\n",
+      __func__, be16_to_cpu(wmsg->type), pid);
 #ifdef PTT_SOCK_DEBUG_VERBOSE
    ptt_sock_dump_buf((const unsigned char *)skb->data, skb->len);
 #endif
-   if (pid != INVALID_PID)
-   {
-       err = nl_srv_ucast(skb, pid, flag);
-   }
-   else
-   {
-       err = nl_srv_bcast(skb);
-   }
-   if (err) {
-      PTT_TRACE(VOS_TRACE_LEVEL_INFO,
-         "%s:Failed sending Msg Type [0x%X] to pid[%d]\n",
-         __func__, be16_to_cpu(wmsg->type), pid);
-   }
+   err = nl_srv_ucast(skb, pid, flag);
    return err;
 }
 /*
@@ -153,11 +143,11 @@
    pAdapterHandle->ptt_pid = reg_req->pid;
    rspmsg.regReq.pid= reg_req->pid;
    rspmsg.wniHdr.type = cpu_to_be16(ANI_MSG_APP_REG_RSP);
-   rspmsg.wniHdr.length = cpu_to_be16(sizeof(rspmsg.wniHdr));
+   rspmsg.wniHdr.length = cpu_to_be16(sizeof(rspmsg));
    if (ptt_sock_send_msg_to_app((tAniHdr *)&rspmsg.wniHdr, radio,
       ANI_NL_MSG_PUMAC, reg_req->pid, MSG_DONTWAIT) < 0)
    {
-      PTT_TRACE(VOS_TRACE_LEVEL_INFO, "%s: Error sending ANI_MSG_APP_REG_RSP to pid[%d]\n",
+      PTT_TRACE(VOS_TRACE_LEVEL_ERROR, "%s: Error sending ANI_MSG_APP_REG_RSP to pid[%d]\n",
          __func__, reg_req->pid);
    }
 }
@@ -290,10 +280,6 @@
    tAniNlHdr *wnl;
    int radio;
    int type;
-
-   if (0 != wlan_hdd_validate_context(pAdapterHandle))
-       return -EINVAL;
-
    wnl = (tAniNlHdr *) skb->data;
    radio = wnl->radio;
    type = wnl->nlh.nlmsg_type;
@@ -324,12 +310,4 @@
 #endif /* WLAN_KD_READY_NOTIFIER */
    return 0;
 }
-
-int ptt_sock_deactivate_svc(hdd_context_t *pHddCtx)
-{
-   nl_srv_unregister(ANI_NL_MSG_PUMAC, ptt_sock_rx_nlink_msg);
-   nl_srv_unregister(ANI_NL_MSG_PTT, ptt_sock_rx_nlink_msg);
-   return 0;
-}
-
 #endif //PTT_SOCK_SVC_ENABLE
diff --git a/wlan/prima/CORE/SYS/common/inc/wlan_qct_sys.h b/wlan/prima/CORE/SYS/common/inc/wlan_qct_sys.h
index f85d29d..038aa6d 100644
--- a/wlan/prima/CORE/SYS/common/inc/wlan_qct_sys.h
+++ b/wlan/prima/CORE/SYS/common/inc/wlan_qct_sys.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -70,8 +70,6 @@
 
   --------------------------------------------------------------------------*/
 typedef v_VOID_t ( * sysResponseCback ) ( v_VOID_t *pUserData );
-typedef v_VOID_t ( * sysThreadProbeCback ) ( int threadId );
-
 
 
 
@@ -89,7 +87,6 @@
    SYS_MSG_ID_MC_STOP,
    SYS_MSG_ID_FTM_RSP,
 
-   SYS_MSG_ID_RX_THR_PROBE,
 } SYS_MSG_ID;
 
 /*---------------------------------------------------------------------------
diff --git a/wlan/prima/CORE/SYS/common/src/wlan_qct_sys.c b/wlan/prima/CORE/SYS/common/src/wlan_qct_sys.c
index be54dff..88fef21 100644
--- a/wlan/prima/CORE/SYS/common/src/wlan_qct_sys.c
+++ b/wlan/prima/CORE/SYS/common/src/wlan_qct_sys.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -35,6 +35,8 @@
   in the Gen6 host software.
 
 
+  Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
@@ -71,7 +73,6 @@
 #include "wlan_qct_wda.h"
 #include "sme_Api.h"
 #include "macInitApi.h"
-#include "vos_sched.h"
 
 VOS_STATUS WLANFTM_McProcessMsg (v_VOID_t *message);
 
@@ -382,10 +383,9 @@
          // function that is in the message.
          case SYS_MSG_ID_MC_THR_PROBE:
          {
-#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
-             if(pMsg->callback)
-                ((sysThreadProbeCback)pMsg->callback)(current->pid);
-#endif
+            VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                       " Received SYS_MSG_ID_MC_THR_PROBE message msgType = %d [0x%08x]",
+                       pMsg->type, pMsg->type);
             break;
          }
 
@@ -395,9 +395,7 @@
 
             if (NULL != timerCB)
             {
-               vos_ssr_protect(__func__);
                timerCB(pMsg->bodyptr);
-               vos_ssr_unprotect(__func__);
             }
             break;
          }
@@ -406,6 +404,7 @@
              WLANFTM_McProcessMsg((v_VOID_t *)pMsg->bodyptr);
              break;
          }
+
          default:
          {
             VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
@@ -471,10 +470,13 @@
          // function that is in the message.
          case SYS_MSG_ID_TX_THR_PROBE:
          {
-#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
-            if(pMsg->callback)
-               ((sysThreadProbeCback)pMsg->callback)(current->pid);
-#endif
+           /* Handling for this message is not needed now so adding 
+            * debug print and VOS_ASSERT*/
+            VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
+                       " Received SYS_MSG_ID_TX_THR_PROBE message msgType= %d [0x%08x]",
+                       pMsg->type, pMsg->type );
+            VOS_ASSERT(0);
+
             break;
          }
 
@@ -547,15 +549,6 @@
             break;
          }
 
-         case SYS_MSG_ID_RX_THR_PROBE:
-         {
-#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
-            if(pMsg->callback)
-                ((sysThreadProbeCback)pMsg->callback)(current->pid);
-#endif
-            break;
-         }
-
          default:
          {
             VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
@@ -778,7 +771,6 @@
 
     vosMessage.reserved = FTM_SYS_MSG_COOKIE;
     vosMessage.type     = SYS_MSG_ID_MC_THR_PROBE;
-    vosMessage.callback = NULL;
     vosMessage.bodyptr  = NULL;
 
     vos_mq_post_message(VOS_MQ_ID_SYS, &vosMessage);
diff --git a/wlan/prima/CORE/SYS/legacy/src/pal/inc/palApi.h b/wlan/prima/CORE/SYS/legacy/src/pal/inc/palApi.h
index 4007612..71e1278 100644
--- a/wlan/prima/CORE/SYS/legacy/src/pal/inc/palApi.h
+++ b/wlan/prima/CORE/SYS/legacy/src/pal/inc/palApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -451,7 +451,7 @@
 
     \return tick count.
 ----------------------------------------------------------------------------------*/
-tANI_TIMESTAMP palGetTickCount(tHddHandle hHdd);
+tANI_U32 palGetTickCount(tHddHandle hHdd);
 
 /** ---------------------------------------------------------------------------
 
diff --git a/wlan/prima/CORE/SYS/legacy/src/pal/src/palApiComm.c b/wlan/prima/CORE/SYS/legacy/src/pal/src/palApiComm.c
index c6ce6f4..f6fb3a2 100644
--- a/wlan/prima/CORE/SYS/legacy/src/pal/src/palApiComm.c
+++ b/wlan/prima/CORE/SYS/legacy/src/pal/src/palApiComm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -165,7 +165,7 @@
    
 
 
-tANI_TIMESTAMP palGetTickCount(tHddHandle hHdd)
+tANI_U32 palGetTickCount(tHddHandle hHdd)
 {
    return( vos_timer_get_system_ticks() );
 }
@@ -204,9 +204,7 @@
       pLock = vos_mem_malloc( sizeof( vos_lock_t ) );
    
       if ( NULL == pLock ) break;
-
-      vos_mem_set(pLock, sizeof( vos_lock_t ), 0);
-
+      
       vosStatus = vos_lock_init( pLock );
       if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
       {
diff --git a/wlan/prima/CORE/SYS/legacy/src/platform/inc/VossWrapper.h b/wlan/prima/CORE/SYS/legacy/src/platform/inc/VossWrapper.h
index 49eec9d..180d27d 100644
--- a/wlan/prima/CORE/SYS/legacy/src/platform/inc/VossWrapper.h
+++ b/wlan/prima/CORE/SYS/legacy/src/platform/inc/VossWrapper.h
@@ -38,6 +38,9 @@
   @brief This header file contains the various structure definitions and
   function prototypes for the RTOS abstraction layer, implemented for VOSS
 
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
diff --git a/wlan/prima/CORE/SYS/legacy/src/platform/src/VossWrapper.c b/wlan/prima/CORE/SYS/legacy/src/platform/src/VossWrapper.c
index a137cbe..5f3c0d9 100644
--- a/wlan/prima/CORE/SYS/legacy/src/platform/src/VossWrapper.c
+++ b/wlan/prima/CORE/SYS/legacy/src/platform/src/VossWrapper.c
@@ -31,6 +31,9 @@
   @brief This source file contains the various function definitions for the 
   RTOS abstraction layer, implemented for VOSS
 
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*=========================================================================== 
diff --git a/wlan/prima/CORE/SYS/legacy/src/system/inc/sysDef.h b/wlan/prima/CORE/SYS/legacy/src/system/inc/sysDef.h
index 1839c14..5631c3c 100644
--- a/wlan/prima/CORE/SYS/legacy/src/system/inc/sysDef.h
+++ b/wlan/prima/CORE/SYS/legacy/src/system/inc/sysDef.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -116,6 +116,15 @@
 /// PTT  Message Queue
 # define SYS_NIM_PTT_Q_SIZE   200             // Holds up to 25 messages
 
+/// Semaphore definitions
+// Data Semaphore
+
+# define SYS_DPH_SEM_INITIAL_CNT 0
+
+// Transport Semaphore
+
+# define SYS_BBT_SEM_INITIAL_CNT 0
+
 /// Thread definitions
 // tHAL
 
diff --git a/wlan/prima/CORE/SYS/legacy/src/system/src/macInitApi.c b/wlan/prima/CORE/SYS/legacy/src/system/src/macInitApi.c
index ced0a48..79b5f03 100644
--- a/wlan/prima/CORE/SYS/legacy/src/system/src/macInitApi.c
+++ b/wlan/prima/CORE/SYS/legacy/src/system/src/macInitApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -197,7 +197,7 @@
      */
 
     /* Allocate pMac */
-    pMac = vos_mem_vmalloc(sizeof(tAniSirGlobal));
+    pMac = vos_mem_malloc(sizeof(tAniSirGlobal));
     if ( NULL == pMac )
         return eSIR_FAILURE;
 
@@ -219,17 +219,11 @@
     {
         /* Call various PE (and other layer init here) */
         if( eSIR_SUCCESS != logInit(pMac))
-        {
-           vos_mem_vfree(pMac);
            return eSIR_FAILURE;
-        }
 
         /* Call routine to initialize CFG data structures */
         if( eSIR_SUCCESS != cfgInit(pMac) )
-        {
-            vos_mem_vfree(pMac);
             return eSIR_FAILURE;
-        }
 
         sysInitGlobals(pMac);
     }
@@ -259,7 +253,7 @@
     logDeinit(pMac);
 
     // Finally, de-allocate the global MAC datastructure:
-    vos_mem_vfree( pMac );
+    vos_mem_free( pMac );
 
     return eSIR_SUCCESS;
 }
diff --git a/wlan/prima/CORE/SYS/legacy/src/system/src/sysEntryFunc.c b/wlan/prima/CORE/SYS/legacy/src/system/src/sysEntryFunc.c
index ffa574a..fd70231 100644
--- a/wlan/prima/CORE/SYS/legacy/src/system/src/sysEntryFunc.c
+++ b/wlan/prima/CORE/SYS/legacy/src/system/src/sysEntryFunc.c
@@ -134,10 +134,6 @@
 
     if(type == SIR_MAC_MGMT_FRAME)
     {
-            if ((subType == SIR_MAC_MGMT_DEAUTH ||
-                 subType == SIR_MAC_MGMT_DISASSOC)&&
-                limIsDeauthDiassocForDrop(pMac, pBd))
-                goto fail;
 
             if( (dropReason = limIsPktCandidateForDrop(pMac, pBd, subType)) != eMGMT_DROP_NO_DROP)
             {
@@ -156,6 +152,53 @@
     }
     else if (type == SIR_MAC_DATA_FRAME)
     {
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+       /*
+        * if we reached here, probably this frame can be TDLS frame.
+        */
+       v_U16_t ethType = 0 ;
+       v_U8_t *mpduHdr =  NULL ;
+       v_U8_t *ethTypeOffset = NULL ;
+
+       /*
+        * Peek into payload and extract ethtype.
+        * In TDLS we can recieve TDLS frames with MAC HEADER (802.11) and also
+        * without MAC Header (Particularly TDLS action frames on direct link.
+        */
+       mpduHdr = (v_U8_t *)WDA_GET_RX_MAC_HEADER(pBd) ;
+
+#define SIR_MAC_ETH_HDR_LEN                       (14)
+       if(0 != WDA_GET_RX_FT_DONE(pBd))
+       {
+           ethTypeOffset = mpduHdr + SIR_MAC_ETH_HDR_LEN - sizeof(ethType) ;
+       }
+       else
+       {
+           ethTypeOffset = mpduHdr + WDA_GET_RX_MPDU_HEADER_LEN(pBd)
+                                                     + RFC1042_HDR_LENGTH ;
+       }
+
+       ethType = GET_BE16(ethTypeOffset) ;
+       if(ETH_TYPE_89_0d == ethType)
+       {
+
+           VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                                                   ("TDLS Data Frame \n")) ;
+           /* Post the message to PE Queue */
+           PELOGE(sysLog(pMac, LOGE, FL("posting to TDLS frame to lim\n"));)
+
+           ret = (tSirRetStatus) limPostMsgApi(pMac, pMsg);
+           if (ret != eSIR_SUCCESS)
+           {
+               PELOGE(sysLog(pMac, LOGE, FL("posting to LIM2 failed, \
+                                                        ret %d\n"), ret);)
+               goto fail;
+           }
+           else
+               return eSIR_SUCCESS;
+       }
+       /* fall through if ethType != TDLS, which is error case */
+#endif
 #ifdef FEATURE_WLAN_ESE
         PELOGW(sysLog(pMac, LOGW, FL("IAPP Frame...\n")););
         //Post the message to PE Queue
diff --git a/wlan/prima/CORE/SYS/legacy/src/utils/src/dot11f.c b/wlan/prima/CORE/SYS/legacy/src/utils/src/dot11f.c
index 8f5be20..ed1e604 100644
--- a/wlan/prima/CORE/SYS/legacy/src/utils/src/dot11f.c
+++ b/wlan/prima/CORE/SYS/legacy/src/utils/src/dot11f.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -20,6 +20,12 @@
  */
 
 /**
+  * Copyright (c) 2012 - 2014 Qualcomm Atheros, Inc.
+  * All Rights Reserved.
+  * Qualcomm Atheros Confidential and Proprietary.
+  */
+
+/**
   * \file dot11f.c
   *
   * \brief Structures, functions & definitions for
@@ -28,7 +34,7 @@
   *
   *
   * This file was automatically generated by 'framesc'
-  * Wed Sep  9 10:17:04 2015 from the following file(s):
+  * Mon Nov 10 19:49:53 2014 from the following file(s):
   *
   * dot11f.frms
   *
@@ -763,16 +769,6 @@
 
 #define SigFfListenInterval ( 0x000f )
 
-void dot11fUnpackFfMagicCode(tpAniSirGlobal pCtx,
-                             tANI_U8 *pBuf,
-                             tDot11fFfMagicCode *pDst)
-{
-    DOT11F_MEMCPY(pCtx, pDst->magic, pBuf, 6);
-    (void)pCtx;
-} /* End dot11fUnpackFfMagicCode. */
-
-#define SigFfMagicCode ( 0x0010 )
-
 void dot11fUnpackFfMaxTxPower(tpAniSirGlobal pCtx,
                               tANI_U8 *pBuf,
                               tDot11fFfMaxTxPower *pDst)
@@ -781,7 +777,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfMaxTxPower. */
 
-#define SigFfMaxTxPower ( 0x0011 )
+#define SigFfMaxTxPower ( 0x0010 )
 
 void dot11fUnpackFfNumOfRepetitions(tpAniSirGlobal pCtx,
                                     tANI_U8 *pBuf,
@@ -791,7 +787,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfNumOfRepetitions. */
 
-#define SigFfNumOfRepetitions ( 0x0012 )
+#define SigFfNumOfRepetitions ( 0x0011 )
 
 void dot11fUnpackFfOperatingMode(tpAniSirGlobal pCtx,
                                  tANI_U8 *pBuf,
@@ -806,7 +802,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfOperatingMode. */
 
-#define SigFfOperatingMode ( 0x0013 )
+#define SigFfOperatingMode ( 0x0012 )
 
 void dot11fUnpackFfP2POUI(tpAniSirGlobal pCtx,
                           tANI_U8 *pBuf,
@@ -816,7 +812,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfP2POUI. */
 
-#define SigFfP2POUI ( 0x0014 )
+#define SigFfP2POUI ( 0x0013 )
 
 void dot11fUnpackFfP2POUISubType(tpAniSirGlobal pCtx,
                                  tANI_U8 *pBuf,
@@ -826,7 +822,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfP2POUISubType. */
 
-#define SigFfP2POUISubType ( 0x0015 )
+#define SigFfP2POUISubType ( 0x0014 )
 
 void dot11fUnpackFfRCPI(tpAniSirGlobal pCtx,
                         tANI_U8 *pBuf,
@@ -836,37 +832,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfRCPI. */
 
-#define SigFfRCPI ( 0x0016 )
-
-void dot11fUnpackFfRMCDialogToken(tpAniSirGlobal pCtx,
-                                  tANI_U8 *pBuf,
-                                  tDot11fFfRMCDialogToken *pDst)
-{
-    framesntohl(pCtx, &pDst->token, pBuf, 0);
-    (void)pCtx;
-} /* End dot11fUnpackFfRMCDialogToken. */
-
-#define SigFfRMCDialogToken ( 0x0017 )
-
-void dot11fUnpackFfRMCOUI(tpAniSirGlobal pCtx,
-                          tANI_U8 *pBuf,
-                          tDot11fFfRMCOUI *pDst)
-{
-    DOT11F_MEMCPY(pCtx, pDst->oui, pBuf, 3);
-    (void)pCtx;
-} /* End dot11fUnpackFfRMCOUI. */
-
-#define SigFfRMCOUI ( 0x0018 )
-
-void dot11fUnpackFfRMCVersion(tpAniSirGlobal pCtx,
-                              tANI_U8 *pBuf,
-                              tDot11fFfRMCVersion *pDst)
-{
-    pDst->version = *pBuf;
-    (void)pCtx;
-} /* End dot11fUnpackFfRMCVersion. */
-
-#define SigFfRMCVersion ( 0x0019 )
+#define SigFfRCPI ( 0x0015 )
 
 void dot11fUnpackFfRSNI(tpAniSirGlobal pCtx,
                         tANI_U8 *pBuf,
@@ -876,19 +842,9 @@
     (void)pCtx;
 } /* End dot11fUnpackFfRSNI. */
 
-#define SigFfRSNI ( 0x001a )
+#define SigFfRSNI ( 0x0016 )
 
-#define SigFfReason ( 0x001b )
-
-void dot11fUnpackFfRuler(tpAniSirGlobal pCtx,
-                         tANI_U8 *pBuf,
-                         tDot11fFfRuler *pDst)
-{
-    DOT11F_MEMCPY(pCtx, pDst->mac, pBuf, 6);
-    (void)pCtx;
-} /* End dot11fUnpackFfRuler. */
-
-#define SigFfRuler ( 0x001c )
+#define SigFfReason ( 0x0017 )
 
 void dot11fUnpackFfRxAntennaId(tpAniSirGlobal pCtx,
                                tANI_U8 *pBuf,
@@ -898,7 +854,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfRxAntennaId. */
 
-#define SigFfRxAntennaId ( 0x001d )
+#define SigFfRxAntennaId ( 0x0018 )
 
 void dot11fUnpackFfSMPowerModeSet(tpAniSirGlobal pCtx,
                                   tANI_U8 *pBuf,
@@ -912,9 +868,9 @@
     (void)pCtx;
 } /* End dot11fUnpackFfSMPowerModeSet. */
 
-#define SigFfSMPowerModeSet ( 0x001e )
+#define SigFfSMPowerModeSet ( 0x0019 )
 
-#define SigFfStatus ( 0x001f )
+#define SigFfStatus ( 0x001a )
 
 void dot11fUnpackFfStatusCode(tpAniSirGlobal pCtx,
                               tANI_U8 *pBuf,
@@ -924,7 +880,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfStatusCode. */
 
-#define SigFfStatusCode ( 0x0020 )
+#define SigFfStatusCode ( 0x001b )
 
 void dot11fUnpackFfTPCEleID(tpAniSirGlobal pCtx,
                             tANI_U8 *pBuf,
@@ -934,7 +890,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfTPCEleID. */
 
-#define SigFfTPCEleID ( 0x0021 )
+#define SigFfTPCEleID ( 0x001c )
 
 void dot11fUnpackFfTPCEleLen(tpAniSirGlobal pCtx,
                              tANI_U8 *pBuf,
@@ -944,7 +900,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfTPCEleLen. */
 
-#define SigFfTPCEleLen ( 0x0022 )
+#define SigFfTPCEleLen ( 0x001d )
 
 void dot11fUnpackFfTSInfo(tpAniSirGlobal pCtx,
                           tANI_U8 *pBuf,
@@ -965,7 +921,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfTSInfo. */
 
-#define SigFfTSInfo ( 0x0023 )
+#define SigFfTSInfo ( 0x001e )
 
 void dot11fUnpackFfTimeStamp(tpAniSirGlobal pCtx,
                              tANI_U8 *pBuf,
@@ -975,7 +931,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfTimeStamp. */
 
-#define SigFfTimeStamp ( 0x0024 )
+#define SigFfTimeStamp ( 0x001f )
 
 void dot11fUnpackFfTransactionId(tpAniSirGlobal pCtx,
                                  tANI_U8 *pBuf,
@@ -985,7 +941,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfTransactionId. */
 
-#define SigFfTransactionId ( 0x0025 )
+#define SigFfTransactionId ( 0x0020 )
 
 void dot11fUnpackFfTxAntennaId(tpAniSirGlobal pCtx,
                                tANI_U8 *pBuf,
@@ -995,7 +951,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfTxAntennaId. */
 
-#define SigFfTxAntennaId ( 0x0026 )
+#define SigFfTxAntennaId ( 0x0021 )
 
 void dot11fUnpackFfTxPower(tpAniSirGlobal pCtx,
                            tANI_U8 *pBuf,
@@ -1005,7 +961,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfTxPower. */
 
-#define SigFfTxPower ( 0x0027 )
+#define SigFfTxPower ( 0x0022 )
 
 void dot11fUnpackFfVhtMembershipStatusArray(tpAniSirGlobal pCtx,
                                             tANI_U8 *pBuf,
@@ -1015,7 +971,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfVhtMembershipStatusArray. */
 
-#define SigFfVhtMembershipStatusArray ( 0x0028 )
+#define SigFfVhtMembershipStatusArray ( 0x0023 )
 
 void dot11fUnpackFfVhtUserPositionArray(tpAniSirGlobal pCtx,
                                         tANI_U8 *pBuf,
@@ -1025,7 +981,7 @@
     (void)pCtx;
 } /* End dot11fUnpackFfVhtUserPositionArray. */
 
-#define SigFfVhtUserPositionArray ( 0x0029 )
+#define SigFfVhtUserPositionArray ( 0x0024 )
 
 tANI_U32 dot11fUnpackTlvAuthorizedMACs(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U16 tlvlen, tDot11fTLVAuthorizedMACs *pDst)
 {
@@ -15779,53 +15735,6 @@
 
 } /* End dot11fUnpackQosMapConfigure. */
 
-    static const tFFDefn FFS_RMC[] = {
-        { "Category", offsetof(tDot11fRMC, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
-        { "RMCOUI", offsetof(tDot11fRMC, RMCOUI), SigFfRMCOUI , DOT11F_FF_RMCOUI_LEN, },
-        { "MagicCode", offsetof(tDot11fRMC, MagicCode), SigFfMagicCode , DOT11F_FF_MAGICCODE_LEN, },
-        { "RMCVersion", offsetof(tDot11fRMC, RMCVersion), SigFfRMCVersion , DOT11F_FF_RMCVERSION_LEN, },
-        { "Action", offsetof(tDot11fRMC, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
-        { "RMCDialogToken", offsetof(tDot11fRMC, RMCDialogToken), SigFfRMCDialogToken , DOT11F_FF_RMCDIALOGTOKEN_LEN, },
-        { "Ruler", offsetof(tDot11fRMC, Ruler), SigFfRuler , DOT11F_FF_RULER_LEN, },
-    { NULL, 0, 0, 0,},
-    };
-
-    static const tIEDefn IES_RMC[] = {
-    {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
-
-tANI_U32 dot11fUnpackRMC(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fRMC *pFrm)
-{
-    tANI_U32 i = 0;
-    tANI_U32 status = 0;
-    status = UnpackCore(pCtx, pBuf, nBuf, FFS_RMC, IES_RMC, ( tANI_U8* )pFrm, sizeof(*pFrm));
-
-    (void)i;
-#   ifdef DOT11F_DUMP_FRAMES
-    if (!DOT11F_FAILED(status))
-    {
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("Unpacked the RMC:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), pBuf, nBuf);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("to:\n"));
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("Category:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->Category.category, 1);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("RMCOUI:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->RMCOUI.oui, 3);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("MagicCode:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->MagicCode.magic, 6);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("RMCVersion:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->RMCVersion.version, 1);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("Action:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->Action.action, 1);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("RMCDialogToken:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->RMCDialogToken.token, 4);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("Ruler:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->Ruler.mac, 6);
-    }
-#   endif // DOT11F_DUMP_FRAMES
-    return status;
-
-} /* End dot11fUnpackRMC. */
-
     static const tFFDefn FFS_RadioMeasurementReport[] = {
         { "Category", offsetof(tDot11fRadioMeasurementReport, Category), SigFfCategory , DOT11F_FF_CATEGORY_LEN, },
         { "Action", offsetof(tDot11fRadioMeasurementReport, Action), SigFfAction , DOT11F_FF_ACTION_LEN, },
@@ -20682,9 +20591,6 @@
         case SigFfListenInterval:
             dot11fUnpackFfCommonFunc(pCtx, pBufRemaining, (tANI_U16*)&((( tDot11fFfListenInterval* )(pFrm + pFf->offset ))->interval));
             break;
-        case SigFfMagicCode:
-            dot11fUnpackFfMagicCode(pCtx, pBufRemaining, ( tDot11fFfMagicCode* )(pFrm + pFf->offset ));
-            break;
         case SigFfMaxTxPower:
             dot11fUnpackFfMaxTxPower(pCtx, pBufRemaining, ( tDot11fFfMaxTxPower* )(pFrm + pFf->offset ));
             break;
@@ -20703,24 +20609,12 @@
         case SigFfRCPI:
             dot11fUnpackFfRCPI(pCtx, pBufRemaining, ( tDot11fFfRCPI* )(pFrm + pFf->offset ));
             break;
-        case SigFfRMCDialogToken:
-            dot11fUnpackFfRMCDialogToken(pCtx, pBufRemaining, ( tDot11fFfRMCDialogToken* )(pFrm + pFf->offset ));
-            break;
-        case SigFfRMCOUI:
-            dot11fUnpackFfRMCOUI(pCtx, pBufRemaining, ( tDot11fFfRMCOUI* )(pFrm + pFf->offset ));
-            break;
-        case SigFfRMCVersion:
-            dot11fUnpackFfRMCVersion(pCtx, pBufRemaining, ( tDot11fFfRMCVersion* )(pFrm + pFf->offset ));
-            break;
         case SigFfRSNI:
             dot11fUnpackFfRSNI(pCtx, pBufRemaining, ( tDot11fFfRSNI* )(pFrm + pFf->offset ));
             break;
         case SigFfReason:
             dot11fUnpackFfCommonFunc(pCtx, pBufRemaining, (tANI_U16*)&((( tDot11fFfReason* )(pFrm + pFf->offset ))->code));
             break;
-        case SigFfRuler:
-            dot11fUnpackFfRuler(pCtx, pBufRemaining, ( tDot11fFfRuler* )(pFrm + pFf->offset ));
-            break;
         case SigFfRxAntennaId:
             dot11fUnpackFfRxAntennaId(pCtx, pBufRemaining, ( tDot11fFfRxAntennaId* )(pFrm + pFf->offset ));
             break;
@@ -22743,14 +22637,6 @@
     return status;
 } /* End dot11fGetPackedQosMapConfigureSize. */
 
-tANI_U32 dot11fGetPackedRMCSize(tpAniSirGlobal pCtx, tDot11fRMC *pFrm, tANI_U32 *pnNeeded)
-{
-    tANI_U32 status = 0;
-    *pnNeeded = 22;
-    status = GetPackedSizeCore(pCtx, ( tANI_U8* )pFrm, pnNeeded, IES_RMC);
-    return status;
-} /* End dot11fGetPackedRMCSize. */
-
 tANI_U32 dot11fGetPackedRadioMeasurementReportSize(tpAniSirGlobal pCtx, tDot11fRadioMeasurementReport *pFrm, tANI_U32 *pnNeeded)
 {
     tANI_U32 status = 0;
@@ -24012,14 +23898,6 @@
     (void)pCtx;
 } /* End dot11fPackFfListenInterval. */
 
-void dot11fPackFfMagicCode(tpAniSirGlobal pCtx,
-                           tDot11fFfMagicCode *pSrc,
-                           tANI_U8 *pBuf)
-{
-    DOT11F_MEMCPY(pCtx, pBuf, pSrc->magic, 6);
-    (void)pCtx;
-} /* End dot11fPackFfMagicCode. */
-
 void dot11fPackFfMaxTxPower(tpAniSirGlobal pCtx,
                             tDot11fFfMaxTxPower *pSrc,
                             tANI_U8 *pBuf)
@@ -24074,30 +23952,6 @@
     (void)pCtx;
 } /* End dot11fPackFfRCPI. */
 
-void dot11fPackFfRMCDialogToken(tpAniSirGlobal pCtx,
-                                tDot11fFfRMCDialogToken *pSrc,
-                                tANI_U8 *pBuf)
-{
-    frameshtonl(pCtx, pBuf, pSrc->token, 0);
-    (void)pCtx;
-} /* End dot11fPackFfRMCDialogToken. */
-
-void dot11fPackFfRMCOUI(tpAniSirGlobal pCtx,
-                        tDot11fFfRMCOUI *pSrc,
-                        tANI_U8 *pBuf)
-{
-    DOT11F_MEMCPY(pCtx, pBuf, pSrc->oui, 3);
-    (void)pCtx;
-} /* End dot11fPackFfRMCOUI. */
-
-void dot11fPackFfRMCVersion(tpAniSirGlobal pCtx,
-                            tDot11fFfRMCVersion *pSrc,
-                            tANI_U8 *pBuf)
-{
-    *pBuf = pSrc->version;
-    (void)pCtx;
-} /* End dot11fPackFfRMCVersion. */
-
 void dot11fPackFfRSNI(tpAniSirGlobal pCtx,
                       tDot11fFfRSNI *pSrc,
                       tANI_U8 *pBuf)
@@ -24114,14 +23968,6 @@
     (void)pCtx;
 } /* End dot11fPackFfReason. */
 
-void dot11fPackFfRuler(tpAniSirGlobal pCtx,
-                       tDot11fFfRuler *pSrc,
-                       tANI_U8 *pBuf)
-{
-    DOT11F_MEMCPY(pCtx, pBuf, pSrc->mac, 6);
-    (void)pCtx;
-} /* End dot11fPackFfRuler. */
-
 void dot11fPackFfRxAntennaId(tpAniSirGlobal pCtx,
                              tDot11fFfRxAntennaId *pSrc,
                              tANI_U8 *pBuf)
@@ -41562,40 +41408,6 @@
 
 } /* End dot11fUnpackQosMapConfigure. */
 
-tANI_U32 dot11fPackRMC(tpAniSirGlobal pCtx, tDot11fRMC *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
-{
-    tANI_U32 i = 0;
-    tANI_U32 status = 0;
-    (void)i;
-    *pnConsumed = 0U;
-    status = PackCore(pCtx, (tANI_U8*)pFrm, pBuf, nBuf, pnConsumed, FFS_RMC, IES_RMC);
-
-#   ifdef DOT11F_DUMP_FRAMES
-    if (!DOT11F_FAILED(status))
-    {
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("Packed the RMC:\n"));
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("Category:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->Category.category, 1);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("RMCOUI:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->RMCOUI.oui, 3);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("MagicCode:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->MagicCode.magic, 6);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("RMCVersion:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->RMCVersion.version, 1);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("Action:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->Action.action, 1);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("RMCDialogToken:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->RMCDialogToken.token, 4);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("Ruler:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), ( tANI_U8* )&pFrm->Ruler.mac, 6);
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), FRFL("to:\n"));
-        FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_RMC), pBuf, nBuf);
-    }
-#   endif // DOT11F_DUMP_FRAMES
-    return status;
-
-} /* End dot11fUnpackRMC. */
-
 tANI_U32 dot11fPackRadioMeasurementReport(tpAniSirGlobal pCtx, tDot11fRadioMeasurementReport *pFrm, tANI_U8 *pBuf, tANI_U32 nBuf, tANI_U32 *pnConsumed)
 {
     tANI_U32 i = 0;
@@ -46107,9 +45919,6 @@
             case SigFfListenInterval:
                 dot11fPackFfListenInterval(pCtx, (tDot11fFfListenInterval* )(pSrc + pFf->offset), pBufRemaining);
                 break;
-            case SigFfMagicCode:
-                dot11fPackFfMagicCode(pCtx, (tDot11fFfMagicCode* )(pSrc + pFf->offset), pBufRemaining);
-                break;
             case SigFfMaxTxPower:
                 dot11fPackFfMaxTxPower(pCtx, (tDot11fFfMaxTxPower* )(pSrc + pFf->offset), pBufRemaining);
                 break;
@@ -46128,24 +45937,12 @@
             case SigFfRCPI:
                 dot11fPackFfRCPI(pCtx, (tDot11fFfRCPI* )(pSrc + pFf->offset), pBufRemaining);
                 break;
-            case SigFfRMCDialogToken:
-                dot11fPackFfRMCDialogToken(pCtx, (tDot11fFfRMCDialogToken* )(pSrc + pFf->offset), pBufRemaining);
-                break;
-            case SigFfRMCOUI:
-                dot11fPackFfRMCOUI(pCtx, (tDot11fFfRMCOUI* )(pSrc + pFf->offset), pBufRemaining);
-                break;
-            case SigFfRMCVersion:
-                dot11fPackFfRMCVersion(pCtx, (tDot11fFfRMCVersion* )(pSrc + pFf->offset), pBufRemaining);
-                break;
             case SigFfRSNI:
                 dot11fPackFfRSNI(pCtx, (tDot11fFfRSNI* )(pSrc + pFf->offset), pBufRemaining);
                 break;
             case SigFfReason:
                 dot11fPackFfReason(pCtx, (tDot11fFfReason* )(pSrc + pFf->offset), pBufRemaining);
                 break;
-            case SigFfRuler:
-                dot11fPackFfRuler(pCtx, (tDot11fFfRuler* )(pSrc + pFf->offset), pBufRemaining);
-                break;
             case SigFfRxAntennaId:
                 dot11fPackFfRxAntennaId(pCtx, (tDot11fFfRxAntennaId* )(pSrc + pFf->offset), pBufRemaining);
                 break;
diff --git a/wlan/prima/CORE/SYS/legacy/src/utils/src/logApi.c b/wlan/prima/CORE/SYS/legacy/src/utils/src/logApi.c
index 04bae6c..d28ac35 100644
--- a/wlan/prima/CORE/SYS/legacy/src/utils/src/logApi.c
+++ b/wlan/prima/CORE/SYS/legacy/src/utils/src/logApi.c
@@ -164,7 +164,6 @@
     switch(modId)
     {
         case SIR_HAL_MODULE_ID:
-        case SIR_HAL_EXT_MODULE_ID:
         case SIR_PHY_MODULE_ID:
             return VOS_MODULE_ID_WDA;
         case SIR_PMM_MODULE_ID:
diff --git a/wlan/prima/CORE/SYS/legacy/src/utils/src/logDump.c b/wlan/prima/CORE/SYS/legacy/src/utils/src/logDump.c
index 3e6b1f9..9569884 100644
--- a/wlan/prima/CORE/SYS/legacy/src/utils/src/logDump.c
+++ b/wlan/prima/CORE/SYS/legacy/src/utils/src/logDump.c
@@ -173,7 +173,6 @@
         switch (i)
         {
             case SIR_HAL_MODULE_ID: p += log_sprintf( pMac, p, "HAL "); break;
-            case SIR_HAL_EXT_MODULE_ID: p += log_sprintf( pMac, p, "HAL "); break;
             case SIR_CFG_MODULE_ID: p += log_sprintf( pMac, p, "CFG "); break;
             case SIR_LIM_MODULE_ID: p += log_sprintf( pMac, p, "LIM "); break;
             case SIR_ARQ_MODULE_ID: p += log_sprintf( pMac, p, "ARQ "); break;
@@ -415,7 +414,7 @@
     }
     if(cmd <= HAL_LOG_DUMP_CMD_END)
     {
-       WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, p, 0);
+       WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, p);
     }
     else
     {
diff --git a/wlan/prima/CORE/SYS/legacy/src/utils/src/macTrace.c b/wlan/prima/CORE/SYS/legacy/src/utils/src/macTrace.c
index 12a8a6b..b2572ee 100644
--- a/wlan/prima/CORE/SYS/legacy/src/utils/src/macTrace.c
+++ b/wlan/prima/CORE/SYS/legacy/src/utils/src/macTrace.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,6 +33,9 @@
 
   \author Sunit Bhatia
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -52,9 +55,7 @@
 #include "csrNeighborRoam.h"
 #include "csrInternal.h"
 #include "limGlobal.h"
-#include "limTypes.h"
 #include "wlan_qct_tl.h"
-#include "wlan_qct_wda.h"
 #include "vos_trace.h"
 
 #ifdef TRACE_RECORD
@@ -432,10 +433,10 @@
         CASE_RETURN_STRING(eWNI_SME_SET_APWPARSNIEs_REQ);
         CASE_RETURN_STRING(eWNI_SME_UPPER_LAYER_ASSOC_CNF);
         CASE_RETURN_STRING(eWNI_SME_HIDE_SSID_REQ);
-        CASE_RETURN_STRING(eWNI_SME_CHNG_MCC_BEACON_INTERVAL);
         CASE_RETURN_STRING(eWNI_SME_REMAIN_ON_CHANNEL_REQ);
         CASE_RETURN_STRING(eWNI_SME_REMAIN_ON_CHN_IND);
         CASE_RETURN_STRING(eWNI_SME_REMAIN_ON_CHN_RSP);
+        CASE_RETURN_STRING(eWNI_SME_MGMT_FRM_IND);
         CASE_RETURN_STRING(eWNI_SME_REMAIN_ON_CHN_RDY_IND);
         CASE_RETURN_STRING(eWNI_SME_SEND_ACTION_FRAME_IND);
         CASE_RETURN_STRING(eWNI_SME_ACTION_FRAME_SEND_CNF);
@@ -444,7 +445,6 @@
         CASE_RETURN_STRING(eWNI_SME_CLEAR_DFS_CHANNEL_LIST);
         CASE_RETURN_STRING(eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
         CASE_RETURN_STRING(eWNI_SME_GET_SNR_REQ);
-        CASE_RETURN_STRING(eWNI_SME_LOST_LINK_PARAMS_IND);
         CASE_RETURN_STRING(eWNI_PMC_MSG_TYPES_BEGIN);
 
         //General Power Save Messages
@@ -516,63 +516,18 @@
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
         CASE_RETURN_STRING(eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP);
 #endif // WLAN_FEATURE_GTK_OFFLOAD
-        CASE_RETURN_STRING(eWNI_SME_ROAM_SCAN_OFFLOAD_RSP);
-#ifdef FEATURE_WLAN_LPHB
-        CASE_RETURN_STRING(eWNI_SME_LPHB_IND);
-#endif /* FEATURE_WLAN_LPHB */
-#ifdef FEATURE_WLAN_CH_AVOID
-        CASE_RETURN_STRING(eWNI_SME_CH_AVOID_IND);
-#endif /* FEATURE_WLAN_CH_AVOID */
 #ifdef WLAN_WAKEUP_EVENTS
         CASE_RETURN_STRING(eWNI_SME_WAKE_REASON_IND);
 #endif // WLAN_WAKEUP_EVENTS
         CASE_RETURN_STRING(eWNI_SME_EXCLUDE_UNENCRYPTED);
         CASE_RETURN_STRING(eWNI_SME_RSSI_IND); //RSSI indication from TL to be serialized on MC thread
-#ifdef FEATURE_WLAN_TDLS
-        CASE_RETURN_STRING(eWNI_SME_TDLS_SEND_MGMT_REQ);
-        CASE_RETURN_STRING(eWNI_SME_TDLS_SEND_MGMT_RSP);
-        CASE_RETURN_STRING(eWNI_SME_TDLS_ADD_STA_REQ);
-        CASE_RETURN_STRING(eWNI_SME_TDLS_ADD_STA_RSP);
-        CASE_RETURN_STRING(eWNI_SME_TDLS_DEL_STA_REQ);
-        CASE_RETURN_STRING(eWNI_SME_TDLS_DEL_STA_RSP);
-        CASE_RETURN_STRING(eWNI_SME_TDLS_DEL_STA_IND);
-        CASE_RETURN_STRING(eWNI_SME_TDLS_DEL_ALL_PEER_IND);
-        CASE_RETURN_STRING(eWNI_SME_MGMT_FRM_TX_COMPLETION_IND);
-        CASE_RETURN_STRING(eWNI_SME_TDLS_LINK_ESTABLISH_REQ);
-        CASE_RETURN_STRING(eWNI_SME_TDLS_LINK_ESTABLISH_RSP);
-        CASE_RETURN_STRING(eWNI_SME_TDLS_CHANNEL_SWITCH_REQ);
-        CASE_RETURN_STRING(eWNI_SME_TDLS_CHANNEL_SWITCH_RSP);
-#endif
-        CASE_RETURN_STRING(eWNI_SME_SET_BCN_FILTER_REQ);
-        CASE_RETURN_STRING(eWNI_SME_RESET_AP_CAPS_CHANGED);
-#ifdef WLAN_FEATURE_11W
-        CASE_RETURN_STRING(eWNI_SME_UNPROT_MGMT_FRM_IND);
-#endif
-        CASE_RETURN_STRING(eWNI_SME_CANDIDATE_FOUND_IND);
-        CASE_RETURN_STRING(eWNI_SME_HANDOFF_REQ);
-#ifdef WLAN_FEATURE_RMC
-        CASE_RETURN_STRING(eWNI_SME_ENABLE_RMC_REQ);
-        CASE_RETURN_STRING(eWNI_SME_DISABLE_RMC_REQ);
-        CASE_RETURN_STRING(eWNI_SME_IBSS_PEER_INFO_RSP);
-#endif
+        CASE_RETURN_STRING(eWNI_SME_MSG_TYPES_END);
         CASE_RETURN_STRING(eWNI_SME_GET_ROAM_RSSI_REQ);
         CASE_RETURN_STRING(eWNI_SME_GET_ROAM_RSSI_RSP);
         CASE_RETURN_STRING(eWNI_SME_GET_TSM_STATS_REQ);
         CASE_RETURN_STRING(eWNI_SME_GET_TSM_STATS_RSP);
-        CASE_RETURN_STRING(eWNI_SME_TSM_IE_IND);
         CASE_RETURN_STRING(eWNI_SME_HT40_OBSS_SCAN_IND);
         CASE_RETURN_STRING(eWNI_SME_HT40_STOP_OBSS_SCAN_IND);
-        CASE_RETURN_STRING(eWNI_SME_NAN_EVENT);
-        CASE_RETURN_STRING(eWNI_SME_ENCRYPT_MSG_RSP);
-#ifdef WLAN_FEATURE_AP_HT40_24G
-        CASE_RETURN_STRING(eWNI_SME_SET_HT_2040_MODE);
-        CASE_RETURN_STRING(eWNI_SME_2040_COEX_IND);
-#endif
-        CASE_RETURN_STRING(eWNI_SME_MAC_SPOOF_ADDR_IND);
-        CASE_RETURN_STRING(eWNI_SME_UPDATE_MAX_RATE_IND);
-        CASE_RETURN_STRING(eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ);
-        CASE_RETURN_STRING(eWNI_SME_REGISTER_MGMT_FRAME_CB);
-        CASE_RETURN_STRING(eWNI_SME_MSG_TYPES_END);
         default:
             return( (tANI_U8*)"UNKNOWN" );
             break;
@@ -720,9 +675,6 @@
         CASE_RETURN_STRING(WDA_TIMER_CHIP_MONITOR_TIMEOUT);
         CASE_RETURN_STRING(WDA_TIMER_TRAFFIC_ACTIVITY_REQ);
         CASE_RETURN_STRING(WDA_TIMER_ADC_RSSI_STATS);
-#ifdef WLAN_FEATURE_11W
-        CASE_RETURN_STRING(WDA_EXCLUDE_UNENCRYPTED_IND);
-#endif
 #ifdef FEATURE_WLAN_ESE
         CASE_RETURN_STRING(WDA_TSM_STATS_REQ);
         CASE_RETURN_STRING(WDA_TSM_STATS_RSP);
@@ -773,8 +725,6 @@
 #endif //SUPPORT_BEACON_FILTER
         CASE_RETURN_STRING(WDA_SET_MAX_TX_POWER_REQ);
         CASE_RETURN_STRING(WDA_SET_MAX_TX_POWER_RSP);
-        CASE_RETURN_STRING(WDA_SET_MAX_TX_POWER_PER_BAND_RSP);
-        CASE_RETURN_STRING(WDA_SET_MAX_TX_POWER_PER_BAND_REQ);
         CASE_RETURN_STRING(WDA_SEND_MSG_COMPLETE);
         CASE_RETURN_STRING(WDA_SET_HOST_OFFLOAD);
         CASE_RETURN_STRING(WDA_SET_KEEP_ALIVE);
@@ -784,10 +734,7 @@
         CASE_RETURN_STRING(WDA_ADD_STA_SELF_REQ);
         CASE_RETURN_STRING(WDA_DEL_STA_SELF_REQ);
         CASE_RETURN_STRING(WDA_SET_P2P_GO_NOA_REQ);
-        CASE_RETURN_STRING(WDA_SET_TDLS_LINK_ESTABLISH_REQ);
-        CASE_RETURN_STRING(WDA_SET_TDLS_LINK_ESTABLISH_REQ_RSP);
         CASE_RETURN_STRING(WDA_TX_COMPLETE_TIMEOUT_IND);
-        CASE_RETURN_STRING(WDA_TIMER_TRAFFIC_STATS_IND);
         CASE_RETURN_STRING(WDA_WLAN_SUSPEND_IND);
         CASE_RETURN_STRING(WDA_WLAN_RESUME_REQ);
         CASE_RETURN_STRING(WDA_MSG_TYPES_END);
@@ -808,11 +755,6 @@
 #endif // FEATURE_WLAN_SCAN_PNO
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
         CASE_RETURN_STRING(WDA_ROAM_SCAN_OFFLOAD_REQ);
-        CASE_RETURN_STRING(WDA_ROAM_SCAN_OFFLOAD_RSP);
-        CASE_RETURN_STRING(WDA_PER_ROAM_SCAN_OFFLOAD_REQ);
-        CASE_RETURN_STRING(WDA_PER_ROAM_SCAN_OFFLOAD_RSP);
-        CASE_RETURN_STRING(WDA_PER_ROAM_SCAN_TRIGGER_REQ);
-        CASE_RETURN_STRING(WDA_PER_ROAM_SCAN_TRIGGER_RSP);
 #endif
 #ifdef WLAN_WAKEUP_EVENTS
         CASE_RETURN_STRING(WDA_WAKE_REASON_IND);
@@ -834,78 +776,10 @@
 #ifdef WLAN_FEATURE_11AC
         CASE_RETURN_STRING(WDA_UPDATE_OP_MODE);
 #endif
-        CASE_RETURN_STRING(WDA_GET_ROAM_RSSI_REQ);
-        CASE_RETURN_STRING(WDA_GET_ROAM_RSSI_RSP);
-        CASE_RETURN_STRING(WDA_NAN_REQUEST);
-        CASE_RETURN_STRING(WDA_START_SCAN_OFFLOAD_REQ);
-        CASE_RETURN_STRING(WDA_START_SCAN_OFFLOAD_RSP);
-        CASE_RETURN_STRING(WDA_STOP_SCAN_OFFLOAD_REQ);
-        CASE_RETURN_STRING(WDA_STOP_SCAN_OFFLOAD_RSP);
-        CASE_RETURN_STRING(WDA_UPDATE_CHAN_LIST_RSP);
-        CASE_RETURN_STRING(WDA_RX_SCAN_EVENT);
-        CASE_RETURN_STRING(WDA_IBSS_PEER_INACTIVITY_IND);
-#ifdef FEATURE_WLAN_LPHB
-        CASE_RETURN_STRING(WDA_LPHB_WAIT_EXPIRE_IND);
-#endif
-#ifdef WLAN_FEATURE_RMC
-        CASE_RETURN_STRING(WDA_RMC_BECOME_RULER);
-        CASE_RETURN_STRING(WDA_RMC_RULER_SELECT_RESP);
-        CASE_RETURN_STRING(WDA_RMC_RULER_REQ);
-        CASE_RETURN_STRING(WDA_RMC_UPDATE_IND);
-        CASE_RETURN_STRING(WDA_GET_IBSS_PEER_INFO_RSP);
-#endif
 #ifdef FEATURE_WLAN_BATCH_SCAN
         CASE_RETURN_STRING(WDA_SET_BATCH_SCAN_REQ);
-        CASE_RETURN_STRING(WDA_SET_BATCH_SCAN_RSP);
-        CASE_RETURN_STRING(WDA_STOP_BATCH_SCAN_IND);
         CASE_RETURN_STRING(WDA_TRIGGER_BATCH_SCAN_RESULT_IND);
 #endif
-        CASE_RETURN_STRING(WDA_UPDATE_CHAN_LIST_REQ);
-        CASE_RETURN_STRING(WDA_GET_BCN_MISS_RATE_REQ);
-        CASE_RETURN_STRING(WDA_DHCP_START_IND);
-        CASE_RETURN_STRING(WDA_DHCP_STOP_IND);
-        CASE_RETURN_STRING(WDA_MGMT_LOGGING_INIT_REQ);
-#ifdef FEATURE_WLAN_LPHB
-        CASE_RETURN_STRING(WDA_LPHB_CONF_REQ);
-#endif /* FEATURE_WLAN_LPHB */
-        CASE_RETURN_STRING(WDA_ADD_PERIODIC_TX_PTRN_IND);
-        CASE_RETURN_STRING(WDA_DEL_PERIODIC_TX_PTRN_IND);
-        CASE_RETURN_STRING(WDA_RATE_UPDATE_IND);
-#ifdef WLAN_FEATURE_RMC
-        CASE_RETURN_STRING(WDA_GET_IBSS_PEER_INFO_REQ);
-        CASE_RETURN_STRING(WDA_TX_FAIL_MONITOR_IND);
-#endif /* WLAN_FEATURE_RMC */
-#ifdef WLAN_FEATURE_LINK_LAYER_STATS
-        CASE_RETURN_STRING(WDA_LINK_LAYER_STATS_SET_REQ);
-        CASE_RETURN_STRING(WDA_LINK_LAYER_STATS_GET_REQ);
-        CASE_RETURN_STRING(WDA_LINK_LAYER_STATS_CLEAR_REQ);
-#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
-#ifdef WLAN_FEATURE_EXTSCAN
-        CASE_RETURN_STRING(WDA_EXTSCAN_GET_CAPABILITIES_REQ);
-        CASE_RETURN_STRING(WDA_EXTSCAN_START_REQ);
-        CASE_RETURN_STRING(WDA_EXTSCAN_STOP_REQ);
-        CASE_RETURN_STRING(WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ);
-        CASE_RETURN_STRING(WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ);
-        CASE_RETURN_STRING(WDA_EXTSCAN_GET_CACHED_RESULTS_REQ);
-        CASE_RETURN_STRING(WDA_HIGH_PRIORITY_DATA_INFO_IND);
-#endif /* WLAN_FEATURE_EXTSCAN */
-        CASE_RETURN_STRING(WDA_HT40_OBSS_SCAN_IND);
-        CASE_RETURN_STRING(WDA_HT40_OBSS_STOP_SCAN_IND);
-        CASE_RETURN_STRING(WDA_ENCRYPT_MSG_REQ);
-        CASE_RETURN_STRING(WDA_ENCRYPT_MSG_RSP);
-#ifdef WLAN_FEATURE_LINK_LAYER_STATS
-        CASE_RETURN_STRING(WDA_LINK_LAYER_STATS_RESULTS_RSP);
-#endif
-#ifdef FEATURE_WLAN_TDLS
-        CASE_RETURN_STRING(WDA_SET_TDLS_CHAN_SWITCH_REQ);
-        CASE_RETURN_STRING(WDA_SET_TDLS_CHAN_SWITCH_REQ_RSP);
-#endif
-        CASE_RETURN_STRING(WDA_FW_STATS_GET_REQ);
-        CASE_RETURN_STRING(WDA_SET_RTS_CTS_HTVHT);
-        CASE_RETURN_STRING(WDA_MON_START_REQ);
-        CASE_RETURN_STRING(WDA_MON_STOP_REQ);
-        CASE_RETURN_STRING(WDA_SPOOF_MAC_ADDR_REQ);
-        CASE_RETURN_STRING(WDA_LOST_LINK_PARAMS_IND);
         default:
             return((tANI_U8*) "UNKNOWN" );
             break;
@@ -967,45 +841,8 @@
         CASE_RETURN_STRING(SIR_LIM_DISASSOC_ACK_TIMEOUT);
         CASE_RETURN_STRING(SIR_LIM_DEAUTH_ACK_TIMEOUT);
         CASE_RETURN_STRING(SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT);
-        CASE_RETURN_STRING(SIR_LIM_AUTH_RETRY_TIMEOUT);
         CASE_RETURN_STRING(SIR_LIM_MSG_TYPES_END);
-        CASE_RETURN_STRING(LIM_MLM_SCAN_REQ);
-        CASE_RETURN_STRING(LIM_MLM_SCAN_CNF);
-        CASE_RETURN_STRING(LIM_MLM_START_REQ);
-        CASE_RETURN_STRING(LIM_MLM_START_CNF);
-        CASE_RETURN_STRING(LIM_MLM_JOIN_REQ);
-        CASE_RETURN_STRING(LIM_MLM_JOIN_CNF);
-        CASE_RETURN_STRING(LIM_MLM_AUTH_REQ);
-        CASE_RETURN_STRING(LIM_MLM_AUTH_CNF);
-        CASE_RETURN_STRING(LIM_MLM_AUTH_IND);
-        CASE_RETURN_STRING(LIM_MLM_ASSOC_REQ);
-        CASE_RETURN_STRING(LIM_MLM_ASSOC_CNF);
-        CASE_RETURN_STRING(LIM_MLM_ASSOC_IND);
-        CASE_RETURN_STRING(LIM_MLM_DISASSOC_REQ);
-        CASE_RETURN_STRING(LIM_MLM_DISASSOC_CNF);
-        CASE_RETURN_STRING(LIM_MLM_DISASSOC_IND);
-        CASE_RETURN_STRING(LIM_MLM_REASSOC_REQ);
-        CASE_RETURN_STRING(LIM_MLM_REASSOC_CNF);
-        CASE_RETURN_STRING(LIM_MLM_REASSOC_IND);
-        CASE_RETURN_STRING(LIM_MLM_DEAUTH_REQ);
-        CASE_RETURN_STRING(LIM_MLM_DEAUTH_CNF);
-        CASE_RETURN_STRING(LIM_MLM_DEAUTH_IND);
-        CASE_RETURN_STRING(LIM_MLM_TSPEC_REQ);
-        CASE_RETURN_STRING(LIM_MLM_TSPEC_CNF);
-        CASE_RETURN_STRING(LIM_MLM_SETKEYS_REQ);
-        CASE_RETURN_STRING(LIM_MLM_SETKEYS_CNF);
-        CASE_RETURN_STRING(LIM_MLM_PURGE_STA_IND);
-        CASE_RETURN_STRING(LIM_MLM_ADDBA_REQ);
-        CASE_RETURN_STRING(LIM_MLM_ADDBA_CNF);
-        CASE_RETURN_STRING(LIM_MLM_ADDBA_RSP);
-        CASE_RETURN_STRING(LIM_MLM_DELBA_REQ);
-        CASE_RETURN_STRING(LIM_MLM_DELBA_CNF);
-        CASE_RETURN_STRING(LIM_MLM_REMOVEKEY_REQ);
-        CASE_RETURN_STRING(LIM_MLM_REMOVEKEY_CNF);
-#ifdef FEATURE_OEM_DATA_SUPPORT
-        CASE_RETURN_STRING(LIM_MLM_OEM_DATA_REQ);
-        CASE_RETURN_STRING(LIM_MLM_OEM_DATA_CNF);
-#endif
+
         default:
             return( (tANI_U8*)"UNKNOWN" );
             break;
@@ -1023,9 +860,7 @@
         CASE_RETURN_STRING(WNI_CFG_SET_CNF);
         CASE_RETURN_STRING(SIR_CFG_PARAM_UPDATE_IND);
         CASE_RETURN_STRING(SIR_CFG_DOWNLOAD_COMPLETE_IND);
-        CASE_RETURN_STRING(WNI_CFG_DNLD_RSP);
-        CASE_RETURN_STRING(WNI_CFG_GET_REQ);
-        CASE_RETURN_STRING(WNI_CFG_SET_REQ);
+
         CASE_RETURN_STRING(WNI_CFG_SET_REQ_NO_RSP);
         default:
             return( (tANI_U8*)"UNKNOWN" );
diff --git a/wlan/prima/CORE/SYS/legacy/src/utils/src/parsemactrace.cmm b/wlan/prima/CORE/SYS/legacy/src/utils/src/parsemactrace.cmm
deleted file mode 100644
index 82ec953..0000000
--- a/wlan/prima/CORE/SYS/legacy/src/utils/src/parsemactrace.cmm
+++ /dev/null
@@ -1,973 +0,0 @@
-;Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
-
-;Previously licensed under the ISC license by Qualcomm Atheros, Inc.
-
-;Permission to use, copy, modify, and/or distribute this software for
-;any purpose with or without fee is hereby granted, provided that the
-;above copyright notice and this permission notice appear in all
-;copies.
-
-;THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-;WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-;WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
-;AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-;DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-;PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-;TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-;PERFORMANCE OF THIS SOFTWARE.
-
-;This file was originally distributed by Qualcomm Atheros, Inc.
-;under proprietary terms before Copyright ownership was assigned
-;to the Linux Foundation.
-
-;parsemactrace.cmm - This script parses MAC trace table in UMAC layer
-;This script relies on message id's placed in interface header file.
-;If some message ID's are changed later, since they do not use enum, this script
-;might show incorrect data. So message ID's should always be in sync
-;Author:        Saluja, Harpreet
-;Date:          09/09/2013
-;History:-
-;Date           Modified by    Modification Information
-;--------------------------------------------------------------------
-
-
-ENTRY &FILE
-
-IF "&FILE"==""
-(
-DIALOG.file *.txt
-ENTRY &FILE
-)
-
-OPEN #1 "&FILE" /Create /Write /Append
-
-
-Var.NEW  char [256][50] \halmsgtype
-
-Var.SET \halmsgtype[0x20]="SIR_HAL_RADAR_DETECTED_IND"
-Var.SET \halmsgtype[0x21]="SIR_HAL_WDT_KAM_RSP"
-Var.SET \halmsgtype[0x22]="SIR_HAL_TIMER_TEMP_MEAS_REQ"
-Var.SET \halmsgtype[0x23]="SIR_HAL_TIMER_PERIODIC_STATS_COLLECT_REQ"
-Var.SET \halmsgtype[0x24]="SIR_HAL_CAL_REQ_NTF"
-Var.SET \halmsgtype[0x25]="SIR_HAL_MNT_OPEN_TPC_TEMP_MEAS_REQ"
-Var.SET \halmsgtype[0x26]="SIR_HAL_CCA_MONITOR_INTERVAL_TO"
-Var.SET \halmsgtype[0x27]="SIR_HAL_CCA_MONITOR_DURATION_TO"
-Var.SET \halmsgtype[0x28]="SIR_HAL_CCA_MONITOR_START"
-Var.SET \halmsgtype[0x29]="SIR_HAL_CCA_MONITOR_STOP"
-Var.SET \halmsgtype[0x2A]="SIR_HAL_CCA_CHANGE_MODE"
-Var.SET \halmsgtype[0x2B]="SIR_HAL_TIMER_WRAP_AROUND_STATS_COLLECT_REQ"
-Var.SET \halmsgtype[0x2D]="SIR_HAL_ADD_STA_REQ"
-Var.SET \halmsgtype[0x2E]="SIR_HAL_ADD_STA_RSP"
-Var.SET \halmsgtype[0x2F]="SIR_HAL_DELETE_STA_REQ"
-Var.SET \halmsgtype[0x30]="SIR_HAL_DELETE_STA_RSP"
-Var.SET \halmsgtype[0x31]="SIR_HAL_ADD_BSS_REQ"
-Var.SET \halmsgtype[0x32]="SIR_HAL_ADD_BSS_RSP"
-Var.SET \halmsgtype[0x33]="SIR_HAL_DELETE_BSS_REQ"
-Var.SET \halmsgtype[0x34]="SIR_HAL_DELETE_BSS_RSP"
-Var.SET \halmsgtype[0x35]="SIR_HAL_INIT_SCAN_REQ"
-Var.SET \halmsgtype[0x36]="SIR_HAL_INIT_SCAN_RSP"
-Var.SET \halmsgtype[0x37]="SIR_HAL_START_SCAN_REQ"
-Var.SET \halmsgtype[0x38]="SIR_HAL_START_SCAN_RSP"
-Var.SET \halmsgtype[0x39]="SIR_HAL_END_SCAN_REQ"
-Var.SET \halmsgtype[0x3A]="SIR_HAL_END_SCAN_RSP"
-Var.SET \halmsgtype[0x3B]="SIR_HAL_FINISH_SCAN_REQ"
-Var.SET \halmsgtype[0x3C]="SIR_HAL_FINISH_SCAN_RSP"
-Var.SET \halmsgtype[0x3D]="SIR_HAL_SEND_BEACON_REQ"
-Var.SET \halmsgtype[0x3E]="SIR_HAL_SEND_BEACON_RSP"
-Var.SET \halmsgtype[0x3F]="SIR_HAL_INIT_CFG_REQ"
-Var.SET \halmsgtype[0x40]="SIR_HAL_INIT_CFG_RSP"
-Var.SET \halmsgtype[0x41]="SIR_HAL_INIT_WM_CFG_REQ"
-Var.SET \halmsgtype[0x42]="SIR_HAL_INIT_WM_CFG_RSP"
-Var.SET \halmsgtype[0x43]="SIR_HAL_SET_BSSKEY_REQ"
-Var.SET \halmsgtype[0x44]="SIR_HAL_SET_BSSKEY_RSP"
-Var.SET \halmsgtype[0x45]="SIR_HAL_SET_STAKEY_REQ"
-Var.SET \halmsgtype[0x46]="SIR_HAL_SET_STAKEY_RSP"
-Var.SET \halmsgtype[0x47]="SIR_HAL_DPU_STATS_REQ"
-Var.SET \halmsgtype[0x48]="SIR_HAL_DPU_STATS_RSP"
-Var.SET \halmsgtype[0x49]="SIR_HAL_GET_DPUINFO_REQ"
-Var.SET \halmsgtype[0x4A]="SIR_HAL_GET_DPUINFO_RSP"
-Var.SET \halmsgtype[0x4B]="SIR_HAL_UPDATE_EDCA_PROFILE_IND"
-Var.SET \halmsgtype[0x4D]="SIR_HAL_UPDATE_STARATEINFO_REQ"
-Var.SET \halmsgtype[0x4E]="SIR_HAL_UPDATE_STARATEINFO_RSP"
-Var.SET \halmsgtype[0x4F]="SIR_HAL_UPDATE_BEACON_IND"
-Var.SET \halmsgtype[0x50]="SIR_HAL_UPDATE_CF_IND"
-Var.SET \halmsgtype[0x51]="SIR_HAL_CHNL_SWITCH_REQ"
-Var.SET \halmsgtype[0x52]="SIR_HAL_ADD_TS_REQ"
-Var.SET \halmsgtype[0x53]="SIR_HAL_DEL_TS_REQ"
-Var.SET \halmsgtype[0x54]="SIR_HAL_SOFTMAC_TXSTAT_REPORT"
-Var.SET \halmsgtype[0x5D]="SIR_HAL_MBOX_SENDMSG_COMPLETE_IND"
-Var.SET \halmsgtype[0x55]="SIR_HAL_EXIT_BMPS_REQ"
-Var.SET \halmsgtype[0x56]="SIR_HAL_EXIT_BMPS_RSP"
-Var.SET \halmsgtype[0x57]="SIR_HAL_EXIT_BMPS_IND"
-Var.SET \halmsgtype[0x58]="SIR_HAL_ENTER_BMPS_REQ"
-Var.SET \halmsgtype[0x59]="SIR_HAL_ENTER_BMPS_RSP"
-Var.SET \halmsgtype[0x5A]="SIR_HAL_BMPS_STATUS_IND"
-Var.SET \halmsgtype[0x5B]="SIR_HAL_MISSED_BEACON_IND"
-Var.SET \halmsgtype[0x5C]="SIR_HAL_SWITCH_CHANNEL_RSP"
-Var.SET \halmsgtype[0x5E]="SIR_HAL_PWR_SAVE_CFG"
-Var.SET \halmsgtype[0x5F]="SIR_HAL_REGISTER_PE_CALLBACK"
-Var.SET \halmsgtype[0x60]="SIR_HAL_SOFTMAC_MEM_READREQUEST"
-Var.SET \halmsgtype[0x61]="SIR_HAL_SOFTMAC_MEM_WRITEREQUEST"
-Var.SET \halmsgtype[0x62]="SIR_HAL_SOFTMAC_MEM_READRESPONSE"
-Var.SET \halmsgtype[0x63]="SIR_HAL_SOFTMAC_BULKREGWRITE_CONFIRM"
-Var.SET \halmsgtype[0x64]="SIR_HAL_SOFTMAC_BULKREGREAD_RESPONSE"
-Var.SET \halmsgtype[0x65]="SIR_HAL_SOFTMAC_HOSTMESG_MSGPROCESSRESULT"
-Var.SET \halmsgtype[0x66]="SIR_HAL_ADDBA_REQ"
-Var.SET \halmsgtype[0x67]="SIR_HAL_ADDBA_RSP"
-Var.SET \halmsgtype[0x68]="SIR_HAL_DELBA_IND"
-Var.SET \halmsgtype[0x69]="SIR_HAL_DEL_BA_IND"
-Var.SET \halmsgtype[0x6A]="SIR_HAL_DELBA_REQ"
-Var.SET \halmsgtype[0x6B]="SIR_HAL_IBSS_STA_ADD"
-Var.SET \halmsgtype[0x6C]="SIR_HAL_TIMER_ADJUST_ADAPTIVE_THRESHOLD_IND"
-Var.SET \halmsgtype[0x6D]="SIR_HAL_SET_LINK_STATE"
-Var.SET \halmsgtype[0x6E]="SIR_HAL_ENTER_IMPS_REQ"
-Var.SET \halmsgtype[0x6F]="SIR_HAL_ENTER_IMPS_RSP"
-Var.SET \halmsgtype[0x70]="SIR_HAL_EXIT_IMPS_RSP"
-Var.SET \halmsgtype[0x71]="SIR_HAL_EXIT_IMPS_REQ"
-Var.SET \halmsgtype[0x72]="SIR_HAL_SOFTMAC_HOSTMESG_PS_STATUS_IND"
-Var.SET \halmsgtype[0x73]="SIR_HAL_POSTPONE_ENTER_IMPS_RSP"
-Var.SET \halmsgtype[0x74]="SIR_HAL_STA_STAT_REQ"
-Var.SET \halmsgtype[0x75]="SIR_HAL_GLOBAL_STAT_REQ"
-Var.SET \halmsgtype[0x76]="SIR_HAL_AGGR_STAT_REQ"
-Var.SET \halmsgtype[0x77]="SIR_HAL_STA_STAT_RSP"
-Var.SET \halmsgtype[0x78]="SIR_HAL_GLOBAL_STAT_RSP"
-Var.SET \halmsgtype[0x79]="SIR_HAL_AGGR_STAT_RSP"
-Var.SET \halmsgtype[0x7A]="SIR_HAL_STAT_SUMM_REQ"
-Var.SET \halmsgtype[0x7C]="SIR_HAL_STAT_SUMM_RSP"
-Var.SET \halmsgtype[0x7D]="SIR_HAL_REMOVE_BSSKEY_REQ"
-Var.SET \halmsgtype[0x7E]="SIR_HAL_REMOVE_BSSKEY_RSP"
-Var.SET \halmsgtype[0x7F]="SIR_HAL_REMOVE_STAKEY_REQ"
-Var.SET \halmsgtype[0x80]="SIR_HAL_REMOVE_STAKEY_RSP"
-Var.SET \halmsgtype[0x81]="SIR_HAL_SET_STA_BCASTKEY_REQ"
-Var.SET \halmsgtype[0x82]="SIR_HAL_SET_STA_BCASTKEY_RSP"
-Var.SET \halmsgtype[0x83]="SIR_HAL_REMOVE_STA_BCASTKEY_REQ"
-Var.SET \halmsgtype[0x84]="SIR_HAL_REMOVE_STA_BCASTKEY_RSP"
-Var.SET \halmsgtype[0x85]="SIR_HAL_ADD_TS_RSP"
-Var.SET \halmsgtype[0x86]="SIR_HAL_DPU_MIC_ERROR"
-Var.SET \halmsgtype[0x87]="SIR_HAL_TIMER_BA_ACTIVITY_REQ"
-Var.SET \halmsgtype[0x88]="SIR_HAL_TIMER_CHIP_MONITOR_TIMEOUT"
-Var.SET \halmsgtype[0x89]="SIR_HAL_TIMER_TRAFFIC_ACTIVITY_REQ"
-Var.SET \halmsgtype[0x8A]="SIR_HAL_TIMER_ADC_RSSI_STATS"
-Var.SET \halmsgtype[0x8B]="SIR_HAL_MIC_FAILURE_IND"
-Var.SET \halmsgtype[0x8C]="SIR_HAL_UPDATE_UAPSD_IND"
-Var.SET \halmsgtype[0x8D]="SIR_HAL_SET_MIMOPS_REQ"
-Var.SET \halmsgtype[0x8E]="SIR_HAL_SET_MIMOPS_RSP"
-Var.SET \halmsgtype[0x8F]="SIR_HAL_SYS_READY_IND"
-Var.SET \halmsgtype[0x90]="SIR_HAL_SET_TX_POWER_REQ"
-Var.SET \halmsgtype[0x91]="SIR_HAL_SET_TX_POWER_RSP"
-Var.SET \halmsgtype[0x92]="SIR_HAL_GET_TX_POWER_REQ"
-Var.SET \halmsgtype[0x93]="SIR_HAL_GET_TX_POWER_RSP"
-Var.SET \halmsgtype[0x94]="SIR_HAL_GET_NOISE_REQ"
-Var.SET \halmsgtype[0x95]="SIR_HAL_GET_NOISE_RSP"
-Var.SET \halmsgtype[0x96]="SIR_HAL_TRANSMISSION_CONTROL_IND"
-Var.SET \halmsgtype[0x97]="SIR_HAL_INIT_RADAR_IND"
-Var.SET \halmsgtype[0x98]="SIR_HAL_BEACON_PRE_IND"
-Var.SET \halmsgtype[0x99]="SIR_HAL_ENTER_UAPSD_REQ"
-Var.SET \halmsgtype[0x9A]="SIR_HAL_ENTER_UAPSD_RSP"
-Var.SET \halmsgtype[0x9B]="SIR_HAL_EXIT_UAPSD_REQ"
-Var.SET \halmsgtype[0x9C]="SIR_HAL_EXIT_UAPSD_RSP"
-Var.SET \halmsgtype[0x9D]="SIR_HAL_LOW_RSSI_IND"
-Var.SET \halmsgtype[0x9E]="SIR_HAL_BEACON_FILTER_IND"
-Var.SET \halmsgtype[0x9F]="SIR_HAL_WOWL_ADD_BCAST_PTRN"
-Var.SET \halmsgtype[0xA0]="SIR_HAL_WOWL_DEL_BCAST_PTRN"
-Var.SET \halmsgtype[0xA1]="SIR_HAL_WOWL_ENTER_REQ"
-Var.SET \halmsgtype[0xA2]="SIR_HAL_WOWL_ENTER_RSP"
-Var.SET \halmsgtype[0xA3]="SIR_HAL_WOWL_EXIT_REQ"
-Var.SET \halmsgtype[0xA4]="SIR_HAL_WOWL_EXIT_RSP"
-Var.SET \halmsgtype[0xA5]="SIR_HAL_TX_COMPLETE_IND"
-Var.SET \halmsgtype[0xA6]="SIR_HAL_TIMER_RA_COLLECT_AND_ADAPT"
-Var.SET \halmsgtype[0xA7]="SIR_HAL_GET_STATISTICS_REQ"
-Var.SET \halmsgtype[0xA8]="SIR_HAL_GET_STATISTICS_RSP"
-Var.SET \halmsgtype[0xA9]="SIR_HAL_SET_KEY_DONE"
-Var.SET \halmsgtype[0xAA]="SIR_HAL_BTC_SET_CFG"
-Var.SET \halmsgtype[0xAB]="SIR_HAL_SIGNAL_BT_EVENT"
-Var.SET \halmsgtype[0xAC]="SIR_HAL_HANDLE_FW_MBOX_RSP"
-Var.SET \halmsgtype[0xAD]="SIR_HAL_UPDATE_PROBE_RSP_TEMPLATE_IND"
-Var.SET \halmsgtype[0xAE]="SIR_LIM_ADDR2_MISS_IND"
-Var.SET \halmsgtype[0xAF]="SIR_HAL_START_OEM_DATA_REQ"
-Var.SET \halmsgtype[0xB0]="SIR_HAL_START_OEM_DATA_RSP"
-Var.SET \halmsgtype[0xB1]="SIR_HAL_FINISH_OEM_DATA_REQ"
-Var.SET \halmsgtype[0xB2]="SIR_HAL_SET_MAX_TX_POWER_REQ"
-Var.SET \halmsgtype[0xB3]="SIR_HAL_SET_MAX_TX_POWER_RSP"
-Var.SET \halmsgtype[0xB4]="SIR_HAL_SEND_MSG_COMPLETE"
-Var.SET \halmsgtype[0xB5]="SIR_HAL_SET_HOST_OFFLOAD"
-Var.SET \halmsgtype[0xB6]="SIR_HAL_ADD_STA_SELF_REQ"
-Var.SET \halmsgtype[0xB7]="SIR_HAL_ADD_STA_SELF_RSP"
-Var.SET \halmsgtype[0xB8]="SIR_HAL_DEL_STA_SELF_REQ"
-Var.SET \halmsgtype[0xB9]="SIR_HAL_DEL_STA_SELF_RSP"
-Var.SET \halmsgtype[0xBA]="SIR_HAL_SIGNAL_BTAMP_EVENT"
-Var.SET \halmsgtype[0xBB]="SIR_HAL_CFG_RXP_FILTER_REQ"
-Var.SET \halmsgtype[0xBC]="SIR_HAL_CFG_RXP_FILTER_RSP"
-Var.SET \halmsgtype[0xBD]="SIR_HAL_AGGR_ADD_TS_REQ"
-Var.SET \halmsgtype[0xBE]="SIR_HAL_AGGR_ADD_TS_RSP"
-Var.SET \halmsgtype[0xBF]="SIR_HAL_AGGR_QOS_REQ"
-Var.SET \halmsgtype[0xC0]="SIR_HAL_AGGR_QOS_RSP"
-Var.SET \halmsgtype[0xC1]="SIR_HAL_SET_P2P_GO_NOA_REQ"
-Var.SET \halmsgtype[0xC2]="SIR_HAL_P2P_NOA_ATTR_IND"
-Var.SET \halmsgtype[0xC3]="SIR_HAL_P2P_NOA_START_IND"
-Var.SET \halmsgtype[0xC5]="SIR_HAL_SET_LINK_STATE_RSP"
-Var.SET \halmsgtype[0xC6]="SIR_HAL_WLAN_SUSPEND_IND"
-Var.SET \halmsgtype[0xC7]="SIR_HAL_WLAN_RESUME_REQ"
-Var.SET \halmsgtype[0xC8]="SIR_HAL_SET_KEEP_ALIVE"
-Var.SET \halmsgtype[0xC9]="SIR_HAL_SET_NS_OFFLOAD"
-Var.SET \halmsgtype[0xCA]="SIR_HAL_SET_PNO_REQ"
-Var.SET \halmsgtype[0xCB]="SIR_HAL_SET_PNO_CHANGED_IND"
-Var.SET \halmsgtype[0xCC]="SIR_HAL_UPDATE_SCAN_PARAMS"
-Var.SET \halmsgtype[0xCD]="SIR_HAL_SET_RSSI_FILTER_REQ"
-Var.SET \halmsgtype[0xCE]="SIR_HAL_SET_TX_PER_TRACKING_REQ"
-Var.SET \halmsgtype[0xCF]="SIR_HAL_8023_MULTICAST_LIST_REQ"
-Var.SET \halmsgtype[0xD0]="SIR_HAL_RECEIVE_FILTER_SET_FILTER_REQ"
-Var.SET \halmsgtype[0xD1]="SIR_HAL_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ"
-Var.SET \halmsgtype[0xD2]="SIR_HAL_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP"
-Var.SET \halmsgtype[0xD3]="SIR_HAL_RECEIVE_FILTER_CLEAR_FILTER_REQ"
-Var.SET \halmsgtype[0xD4]="SIR_HAL_SET_POWER_PARAMS_REQ"
-Var.SET \halmsgtype[0xD5]="SIR_HAL_GTK_OFFLOAD_REQ"
-Var.SET \halmsgtype[0xD6]="SIR_HAL_GTK_OFFLOAD_GETINFO_REQ"
-Var.SET \halmsgtype[0xD7]="SIR_HAL_GTK_OFFLOAD_GETINFO_RSP"
-Var.SET \halmsgtype[0xD8]="SIR_HAL_TSM_STATS_REQ"
-Var.SET \halmsgtype[0xD9]="SIR_HAL_TSM_STATS_RSP"
-Var.SET \halmsgtype[0xDA]="SIR_HAL_WAKE_REASON_IND"
-Var.SET \halmsgtype[0xDB]="SIR_HAL_SET_TM_LEVEL_REQ"
-Var.SET \halmsgtype[0xDC]="SIR_HAL_UPDATE_OP_MODE"
-Var.SET \halmsgtype[0xDD]="SIR_HAL_TDLS_LINK_ESTABLISH"
-Var.SET \halmsgtype[0xDE]="SIR_HAL_TDLS_LINK_TEARDOWN"
-Var.SET \halmsgtype[0xE3]="SIR_HAL_TRAFFIC_STATS_IND"
-Var.SET \halmsgtype[0xE5]="SIR_HAL_START_SCAN_OFFLOAD_REQ"
-Var.SET \halmsgtype[0xE6]="SIR_HAL_START_SCAN_OFFLOAD_RSP"
-Var.SET \halmsgtype[0xE7]="SIR_HAL_UPDATE_CHAN_LIST_REQ"
-Var.SET \halmsgtype[0xE8]="SIR_HAL_UPDATE_CHAN_LIST_RSP"
-Var.SET \halmsgtype[0xE9]="SIR_HAL_STOP_SCAN_OFFLOAD_REQ"
-Var.SET \halmsgtype[0xEA]="SIR_HAL_STOP_SCAN_OFFLOAD_RSP"
-Var.SET \halmsgtype[0xEB]="SIR_HAL_RX_SCAN_EVENT"
-Var.SET \halmsgtype[0xEC]="SIR_HAL_DHCP_START_IND"
-Var.SET \halmsgtype[0xED]="SIR_HAL_DHCP_STOP_IND"
-Var.SET \halmsgtype[0xEE]="SIR_HAL_IBSS_PEER_INACTIVITY_IND"
-Var.SET \halmsgtype[0xEF]="SIR_HAL_LPHB_CONF_IND"
-Var.SET \halmsgtype[0xF0]="SIR_HAL_LPHB_WAIT_EXPIRE_IND"
-Var.SET \halmsgtype[0xF1]="SIR_HAL_ADD_PERIODIC_TX_PTRN_IND"
-Var.SET \halmsgtype[0xF2]="SIR_HAL_DEL_PERIODIC_TX_PTRN_IND"
-Var.SET \halmsgtype[0xF3]="SIR_HAL_RMC_BECOME_LEADER"
-Var.SET \halmsgtype[0xF4]="SIR_HAL_RMC_LEADER_SELECT_RESP"
-Var.SET \halmsgtype[0xF5]="SIR_HAL_RMC_LEADER_REQ"
-Var.SET \halmsgtype[0xF6]="SIR_HAL_RMC_UPDATE_IND"
-Var.SET \halmsgtype[0xF7]="SIR_HAL_IBSS_PEER_INFO_REQ"
-Var.SET \halmsgtype[0xF8]="SIR_HAL_IBSS_PEER_INFO_RSP"
-Var.SET \halmsgtype[0xF9]="SIR_HAL_RATE_UPDATE_IND"
-Var.SET \halmsgtype[0xFA]="SIR_HAL_IBSS_ROUTE_TABLE_UPDATE_IND"
-Var.SET \halmsgtype[0xFB]="SIR_HAL_TX_FAIL_MONITOR_IND"
-Var.SET \halmsgtype[0xFC]="SIR_HAL_IBSS_PEER_INFO_RSP"
-Var.SET \halmsgtype[0xFD]="SIR_HAL_RATE_UPDATE_IND"
-
-
-Var.NEW  char [256][100] \tlcodetype
-
-Var.SET \tlcodetype[0x00]="TRACE_CODE_TL_STA_STATE"
-Var.SET \tlcodetype[0x01]="TRACE_CODE_TL_EAPOL_PKT_PENDING"
-Var.SET \tlcodetype[0x02]="TRACE_CODE_TL_GET_FRAMES_EAPOL"
-Var.SET \tlcodetype[0x03]="TRACE_CODE_TL_RX_CONN_EAPOL"
-Var.SET \tlcodetype[0x04]="TRACE_CODE_TL_REGISTER_STA_CLIENT"
-Var.SET \tlcodetype[0x05]="TRACE_CODE_TL_SUSPEND_DATA_TX"
-Var.SET \tlcodetype[0x06]="TRACE_CODE_TL_RESUME_DATA_TX"
-Var.SET \tlcodetype[0x07]="TRACE_CODE_TL_STA_PKT_PENDING"
-Var.SET \tlcodetype[0x08]="TRACE_CODE_TL_QUEUE_CURRENT"
-Var.SET \tlcodetype[0x09]="TRACE_CODE_TL_REORDER_TIMER_EXP_CB"
-Var.SET \tlcodetype[0x0A]="TRACE_CODE_TL_BA_SESSION_DEL"
-Var.SET \tlcodetype[0x0B]="TRACE_CODE_TL_ASSOC_FAILED"
-Var.SET \tlcodetype[0x0C]="TRACE_CODE_TL_FORWARD_CACHED_FRAMES"
-Var.SET \tlcodetype[0x0D]="TRACE_CODE_TL_FLUSH_CACHED_FRAMES"
-Var.SET \tlcodetype[0x0E]="TRACE_CODE_TL_CACHE_FRAME"
-
-Var.NEW  char [256][100] \smecodetype
-
-Var.SET \smecodetype[0x00]="TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ"
-Var.SET \smecodetype[0x01]="TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS"
-Var.SET \smecodetype[0x02]="TRACE_CODE_SME_RX_HDD_MSG_CONNECT"
-Var.SET \smecodetype[0x03]="TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO"
-Var.SET \smecodetype[0x04]="TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN"
-Var.SET \smecodetype[0x05]="TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO"
-Var.SET \smecodetype[0x06]="TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG"
-Var.SET \smecodetype[0x07]="TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG"
-Var.SET \smecodetype[0x08]="TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND"
-Var.SET \smecodetype[0x09]="TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS"
-Var.SET \smecodetype[0x0A]="TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS"
-Var.SET \smecodetype[0x0B]="TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST"
-Var.SET \smecodetype[0x0C]="TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT"
-Var.SET \smecodetype[0x0D]="TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE"
-Var.SET \smecodetype[0x0E]="TRACE_CODE_SME_RX_HDD_ROAM_REASSOC"
-Var.SET \smecodetype[0x0F]="TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT"
-Var.SET \smecodetype[0x10]="TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE"
-Var.SET \smecodetype[0x11]="TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE"
-Var.SET \smecodetype[0x12]="TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE"
-Var.SET \smecodetype[0x13]="TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM"
-Var.SET \smecodetype[0x14]="TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS"
-Var.SET \smecodetype[0x15]="TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE"
-Var.SET \smecodetype[0x16]="TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE"
-Var.SET \smecodetype[0x17]="TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE"
-Var.SET \smecodetype[0x18]="TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE"
-Var.SET \smecodetype[0x19]="TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER"
-Var.SET \smecodetype[0x1A]="TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER"
-Var.SET \smecodetype[0x1B]="TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED"
-Var.SET \smecodetype[0x1C]="TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER"
-Var.SET \smecodetype[0x1D]="TRACE_CODE_SME_RX_HDD_REQUEST_BMPS"
-Var.SET \smecodetype[0x1E]="TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG"
-Var.SET \smecodetype[0x1F]="TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY"
-Var.SET \smecodetype[0x20]="TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN"
-Var.SET \smecodetype[0x21]="TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN"
-Var.SET \smecodetype[0x22]="TRACE_CODE_SME_RX_HDD_ENTER_WOWL"
-Var.SET \smecodetype[0x23]="TRACE_CODE_SME_RX_HDD_EXIT_WOWL"
-Var.SET \smecodetype[0x24]="TRACE_CODE_SME_RX_HDD_SET_KEY"
-Var.SET \smecodetype[0x25]="TRACE_CODE_SME_RX_HDD_REMOVE_KEY"
-Var.SET \smecodetype[0x26]="TRACE_CODE_SME_RX_HDD_GET_STATS"
-Var.SET \smecodetype[0x27]="TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE"
-Var.SET \smecodetype[0x28]="TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE"
-Var.SET \smecodetype[0x29]="TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE"
-Var.SET \smecodetype[0x2A]="TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT"
-Var.SET \smecodetype[0x2B]="TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG"
-Var.SET \smecodetype[0x2C]="TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG"
-Var.SET \smecodetype[0x2D]="TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY"
-Var.SET \smecodetype[0x2E]="TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ"
-Var.SET \smecodetype[0x2F]="TRACE_CODE_SME_RX_HDD_DBG_READREG"
-Var.SET \smecodetype[0x30]="TRACE_CODE_SME_RX_HDD_DBG_WRITEREG"
-Var.SET \smecodetype[0x31]="TRACE_CODE_SME_RX_HDD_DBG_READMEM"
-Var.SET \smecodetype[0x32]="TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM"
-Var.SET \smecodetype[0x33]="TRACE_CODE_SME_RX_HDD_OPEN_SESSION"
-Var.SET \smecodetype[0x34]="TRACE_CODE_SME_RX_HDD_CLOSE_SESSION"
-Var.SET \smecodetype[0x35]="TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD"
-Var.SET \smecodetype[0x36]="TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD"
-Var.SET \smecodetype[0x37]="TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD"
-Var.SET \smecodetype[0x38]="TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS"
-Var.SET \smecodetype[0x39]="TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN"
-Var.SET \smecodetype[0x3A]="TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR"
-Var.SET \smecodetype[0x3B]="TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR"
-Var.SET \smecodetype[0x3C]="TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN"
-Var.SET \smecodetype[0x3D]="TRACE_CODE_SME_RX_HDD_SEND_ACTION"
-Var.SET \smecodetype[0x3E]="TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN"
-Var.SET \smecodetype[0x3F]="TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL"
-Var.SET \smecodetype[0x40]="TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND"
-Var.SET \smecodetype[0x41]="TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ"
-Var.SET \smecodetype[0x42]="TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW"
-Var.SET \smecodetype[0x43]="TRACE_CODE_SME_RX_HDD_SET_TXPOW"
-Var.SET \smecodetype[0x44]="TRACE_CODE_SME_RX_HDD_SET_TMLEVEL"
-Var.SET \smecodetype[0x45]="TRACE_CODE_SME_RX_HDD_CAPS_EXCH"
-Var.SET \smecodetype[0x46]="TRACE_CODE_SME_RX_HDD_DISABLE_CAP"
-Var.SET \smecodetype[0x47]="TRACE_CODE_SME_RX_HDD_GET_DEFCCNV"
-Var.SET \smecodetype[0x48]="TRACE_CODE_SME_RX_HDD_GET_CURCC"
-Var.SET \smecodetype[0x49]="TRACE_CODE_SME_RX_HDD_RESET_PW5G"
-Var.SET \smecodetype[0x4A]="TRACE_CODE_SME_RX_HDD_UPDATE_RP5G"
-Var.SET \smecodetype[0x4B]="TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND"
-Var.SET \smecodetype[0x4C]="TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND"
-Var.SET \smecodetype[0x4D]="TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF"
-Var.SET \smecodetype[0x4E]="TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF"
-Var.SET \smecodetype[0x4F]="TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED"
-Var.SET \smecodetype[0x50]="TRACE_CODE_SME_RX_HDD_UPDATE_WESMODE"
-Var.SET \smecodetype[0x51]="TRACE_CODE_SME_RX_HDD_SET_SCANCTRL"
-;deprecated Var.SET \smecodetype[0x52]="TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CAPABILITIES"
-Var.SET \smecodetype[0x52]="TRACE_CODE_SME_RX_HDD_EXTSCAN_START"
-Var.SET \smecodetype[0x53]="TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP"
-Var.SET \smecodetype[0x54]="TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST"
-Var.SET \smecodetype[0x55]="TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST"
-Var.SET \smecodetype[0x56]="TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS"
-Var.SET \smecodetype[0x57]="TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SSID_HOTLIST"
-Var.SET \smecodetype[0x58]="TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SSID_HOTLIST"
-Var.SET \smecodetype[0x59]="TRACE_CODE_SME_RX_HDD_MSG_DEAUTH_STA"
-;#ifdef FEATURE_WLAN_TDLS	//assuming this flag is enabled by default
-Var.SET \smecodetype[0x5A]="TRACE_CODE_SME_RX_HDD_TDLS_LINK_ESTABLISH_PARAM"
-Var.SET \smecodetype[0x5B]="TRACE_CODE_SME_RX_HDD_TDLS_CHAN_SWITCH_REQ"
-Var.SET \smecodetype[0x5C]="TRACE_CODE_SME_RX_HDD_TDLS_SEND_MGMT_FRAME"
-Var.SET \smecodetype[0x5D]="TRACE_CODE_SME_RX_HDD_TDLS_CHANGE_PEER_STA"
-Var.SET \smecodetype[0x5E]="TRACE_CODE_SME_RX_HDD_TDLS_ADD_PEER_STA"
-Var.SET \smecodetype[0x5F]="TRACE_CODE_SME_RX_HDD_TDLS_DEL_PEER_STA"
-;#endif
-Var.SET \smecodetype[0x60]="TRACE_CODE_SME_RX_HDD_PREF_NET_LIST"
-;#ifdef FEATURE_WLAN_LPHB	//assuming this flag is enabled by default
-Var.SET \smecodetype[0x61]="TRACE_CODE_SME_RX_HDD_LPHB_CONFIG_REQ"
-;#endif /* FEATURE_WLAN_LPHB */
-Var.SET \smecodetype[0x62]="TRACE_CODE_SME_RX_HDD_ROAM_DEL_PMKIDCACHE"
-;From here hardcoded to 250 in host code
-Var.SET \smecodetype[0xFA]="TRACE_CODE_SME_COMMAND"
-Var.SET \smecodetype[0xFB]="TRACE_CODE_SME_TX_WDA_MSG"
-Var.SET \smecodetype[0xFC]="TRACE_CODE_SME_RX_WDA_MSG"
-
-Var.NEW  char [256][50] \cfgmsgtype
-
-Var.SET \cfgmsgtype[0xB0]="SIR_CFG_PARAM_UPDATE_IND"
-Var.SET \cfgmsgtype[0xB1]="SIR_CFG_DOWNLOAD_COMPLETE_IND"
-
-
-Var.NEW  char [256][50] \limmsgtype
-
-Var.SET \limmsgtype[0xB3]="SIR_LIM_RETRY_INTERRUPT_MSG"
-Var.SET \limmsgtype[0xB4]="SIR_BB_XPORT_MGMT_MSG"
-Var.SET \limmsgtype[0xB7]="SIR_LIM_INV_KEY_INTERRUPT_MSG"
-Var.SET \limmsgtype[0xB8]="SIR_LIM_KEY_ID_INTERRUPT_MSG"
-Var.SET \limmsgtype[0xB9]="SIR_LIM_REPLAY_THRES_INTERRUPT_MSG"
-Var.SET \limmsgtype[0xBA]="SIR_LIM_TD_DUMMY_CALLBACK_MSG"
-Var.SET \limmsgtype[0xBB]="SIR_LIM_SCH_CLEAN_MSG"
-Var.SET \limmsgtype[0xBC]="SIR_LIM_RADAR_DETECT_IND"
-Var.SET \limmsgtype[0xBE]="SIR_LIM_DEL_TS_IND"
-Var.SET \limmsgtype[0xBF]="SIR_LIM_ADD_BA_IND"
-Var.SET \limmsgtype[0xC0]="SIR_LIM_DEL_BA_ALL_IND"
-Var.SET \limmsgtype[0xC1]="SIR_LIM_DELETE_STA_CONTEXT_IND"
-Var.SET \limmsgtype[0xC2]="SIR_LIM_DEL_BA_IND"
-Var.SET \limmsgtype[0xC3]="SIR_LIM_UPDATE_BEACON"
-Var.SET \limmsgtype[0xD0]="SIR_LIM_MIN_CHANNEL_TIMEOUT"
-Var.SET \limmsgtype[0xD1]="SIR_LIM_MAX_CHANNEL_TIMEOUT"
-Var.SET \limmsgtype[0xD2]="SIR_LIM_JOIN_FAIL_TIMEOUT"
-Var.SET \limmsgtype[0xD3]="SIR_LIM_AUTH_FAIL_TIMEOUT"
-Var.SET \limmsgtype[0xD4]="SIR_LIM_AUTH_RSP_TIMEOUT"
-Var.SET \limmsgtype[0xD5]="SIR_LIM_ASSOC_FAIL_TIMEOUT"
-Var.SET \limmsgtype[0xD6]="SIR_LIM_REASSOC_FAIL_TIMEOUT"
-Var.SET \limmsgtype[0xD7]="SIR_LIM_HEART_BEAT_TIMEOUT"
-Var.SET \limmsgtype[0xD9]="SIR_LIM_PREAUTH_CLNUP_TIMEOUT"
-Var.SET \limmsgtype[0xDA]="SIR_LIM_CHANNEL_SCAN_TIMEOUT"
-Var.SET \limmsgtype[0xDB]="SIR_LIM_PROBE_HB_FAILURE_TIMEOUT"
-Var.SET \limmsgtype[0xDC]="SIR_LIM_ADDTS_RSP_TIMEOUT"
-Var.SET \limmsgtype[0xE0]="SIR_LIM_MEASUREMENT_IND_TIMEOUT"
-Var.SET \limmsgtype[0xE1]="SIR_LIM_LEARN_INTERVAL_TIMEOUT"
-Var.SET \limmsgtype[0xE2]="SIR_LIM_LEARN_DURATION_TIMEOUT"
-Var.SET \limmsgtype[0xE3]="SIR_LIM_LINK_TEST_DURATION_TIMEOUT"
-Var.SET \limmsgtype[0xE6]="SIR_LIM_HASH_MISS_THRES_TIMEOUT"
-Var.SET \limmsgtype[0xE7]="SIR_LIM_CNF_WAIT_TIMEOUT"
-Var.SET \limmsgtype[0xE8]="SIR_LIM_KEEPALIVE_TIMEOUT"
-Var.SET \limmsgtype[0xE9]="SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT"
-Var.SET \limmsgtype[0xEA]="SIR_LIM_CHANNEL_SWITCH_TIMEOUT"
-Var.SET \limmsgtype[0xEB]="SIR_LIM_QUIET_TIMEOUT"
-Var.SET \limmsgtype[0xEC]="SIR_LIM_QUIET_BSS_TIMEOUT"
-Var.SET \limmsgtype[0xED]="SIR_LIM_WPS_OVERLAP_TIMEOUT"
-Var.SET \limmsgtype[0xEE]="SIR_LIM_FT_PREAUTH_RSP_TIMEOUT"
-Var.SET \limmsgtype[0xEF]="SIR_LIM_REMAIN_CHN_TIMEOUT"
-Var.SET \limmsgtype[0xF0]="SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT"
-Var.SET \limmsgtype[0xF1]="SIR_LIM_WMM_APSD_SP_START_MSG_TYPE"
-Var.SET \limmsgtype[0xF2]="SIR_LIM_WMM_APSD_SP_END_MSG_TYPE"
-Var.SET \limmsgtype[0xF3]="SIR_LIM_BEACON_GEN_IND"
-Var.SET \limmsgtype[0xF4]="SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT"
-Var.SET \limmsgtype[0xF5]="SIR_LIM_CCX_TSM_TIMEOUT"
-Var.SET \limmsgtype[0xF6]="SIR_LIM_DISASSOC_ACK_TIMEOUT"
-Var.SET \limmsgtype[0xF7]="SIR_LIM_DEAUTH_ACK_TIMEOUT"
-Var.SET \limmsgtype[0xF8]="SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT"
-Var.SET \limmsgtype[0xF9]="SIR_LIM_TDLS_DISCOVERY_RSP_WAIT"
-Var.SET \limmsgtype[0xFA]="SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT"
-Var.SET \limmsgtype[0xFB]="SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT"
-Var.SET \limmsgtype[0xFC]="SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE"
-Var.SET \limmsgtype[0xFF]="SIR_LIM_MSG_TYPES_END"
-
-
-Var.NEW  char [256][50] \schmsgtype
-
-Var.SET \schmsgtype[0x0]="SIR_SCH_CHANNEL_SWITCH_REQUEST"
-Var.SET \schmsgtype[0x1]="SIR_SCH_START_SCAN_REQ"
-Var.SET \schmsgtype[0x2]="SIR_SCH_START_SCAN_RSP"
-Var.SET \schmsgtype[0x3]="SIR_SCH_END_SCAN_NTF"
-Var.SET \schmsgtype[0xFF]="SIR_SCH_MSG_TYPES_END"
-
-Var.NEW  char [256][50] \pmmmsgtype
-
-Var.SET \pmmmsgtype[0x0]="SIR_PMM_CHANGE_PM_MODE"
-Var.SET \pmmmsgtype[0x1]="SIR_PMM_CHANGE_IMPS_MODE"
-Var.SET \pmmmsgtype[0xFF]="SIR_PMM_MSG_TYPES_END"
-
-
-Var.NEW  char [256][50] \mntmsgtype
-
-Var.SET \mntmsgtype[0x0]="SIR_MNT_RELEASE_BD"
-Var.SET \mntmsgtype[0xFF]="SIR_MNT_MSG_TYPES_END"
-
-Var.NEW  char [256][50] \dvtmsgtype
-
-Var.SET \dvtmsgtype[0xF]="SIR_DVT_ITC_MSG_TYPES_BEGIN"
-
-Var.NEW  char [0x301][50] \pttmsgtype
-
-Var.SET \pttmsgtype[0x0]="SIR_PTT_MSG_TYPES_BEGIN"
-Var.SET \pttmsgtype[0x300]="SIR_PTT_MSG_TYPES_END"
-
-
-Var.NEW  char [18][50] \code
-
-Var.SET \code[0]="TRACE_CODE_MLM_STATE"
-Var.SET \code[1]="TRACE_CODE_SME_STATE"
-Var.SET \code[2]="TRACE_CODE_TX_MGMT"
-Var.SET \code[3]="TRACE_CODE_RX_MGMT"
-Var.SET \code[4]="TRACE_CODE_RX_MGMT_TSF"
-Var.SET \code[5]="TRACE_CODE_TX_COMPLETE"
-Var.SET \code[6]="TRACE_CODE_TX_SME_MSG"
-Var.SET \code[7]="TRACE_CODE_RX_SME_MSG"
-Var.SET \code[8]="TRACE_CODE_TX_WDA_MSG"
-Var.SET \code[9]="TRACE_CODE_RX_WDA_MSG"
-Var.SET \code[10]="TRACE_CODE_TX_LIM_MSG"
-Var.SET \code[11]="TRACE_CODE_RX_LIM_MSG"
-Var.SET \code[12]="TRACE_CODE_TX_CFG_MSG"
-Var.SET \code[13]="TRACE_CODE_RX_CFG_MSG"
-Var.SET \code[14]="TRACE_CODE_RX_MGMT_DROP"
-Var.SET \code[15]="TRACE_CODE_TIMER_ACTIVATE"
-Var.SET \code[16]="TRACE_CODE_TIMER_DEACTIVATE"
-Var.SET \code[17]="TRACE_CODE_INFO_LOG"
-
-
-Var.NEW  char [13][50] \module
-
-
-Var.SET \module[0]="VOS_MODULE_ID_BAP"
-Var.SET \module[1]="VOS_MODULE_ID_TL"
-Var.SET \module[3]="VOS_MODULE_ID_SAL"
-Var.SET \module[4]="VOS_MODULE_ID_SSC"
-Var.SET \module[2]="VOS_MODULE_ID_WDI"
-Var.SET \module[5]="VOS_MODULE_ID_HDD"
-Var.SET \module[6]="VOS_MODULE_ID_SME"
-Var.SET \module[7]="VOS_MODULE_ID_PE"
-Var.SET \module[8]="VOS_MODULE_ID_WDA"
-Var.SET \module[9]="VOS_MODULE_ID_SYS"
-Var.SET \module[10]="VOS_MODULE_ID_VOSS"
-Var.SET \module[11]="VOS_MODULE_ID_SAP"
-Var.SET \module[12]="VOS_MODULE_ID_HDD_SOFTAP"
-
-Var.NEW char [16][50] \mgmttype
-
-Var.SET \mgmttype[0]="SIR_MAC_MGMT_ASSOC_REQ"
-Var.SET \mgmttype[1]="SIR_MAC_MGMT_ASSOC_RSP"
-Var.SET \mgmttype[2]="SIR_MAC_MGMT_REASSOC_REQ"
-Var.SET \mgmttype[3]="SIR_MAC_MGMT_REASSOC_RSP"
-Var.SET \mgmttype[4]="SIR_MAC_MGMT_PROBE_REQ"
-Var.SET \mgmttype[5]="SIR_MAC_MGMT_PROBE_RSP"
-Var.SET \mgmttype[8]="SIR_MAC_MGMT_BEACON"
-Var.SET \mgmttype[9]="SIR_MAC_MGMT_ATIM"
-Var.SET \mgmttype[10]="SIR_MAC_MGMT_DISASSOC"
-Var.SET \mgmttype[11]="SIR_MAC_MGMT_AUTH"
-Var.SET \mgmttype[12]="SIR_MAC_MGMT_DEAUTH"
-Var.SET \mgmttype[13]="SIR_MAC_MGMT_ACTION"
-Var.SET \mgmttype[15]="SIR_MAC_MGMT_RESERVED15"
-
-Var.NEW char [30][50] \limtimertype
-
-Var.SET \limtimertype[0]="eLIM_MIN_CHANNEL_TIMER"
-Var.SET \limtimertype[1]="eLIM_MAX_CHANNEL_TIMER"
-Var.SET \limtimertype[2]="eLIM_JOIN_FAIL_TIMER"
-Var.SET \limtimertype[3]="eLIM_AUTH_FAIL_TIMER"
-Var.SET \limtimertype[4]="eLIM_AUTH_RESP_TIMER"
-Var.SET \limtimertype[5]="eLIM_ASSOC_FAIL_TIMER"
-Var.SET \limtimertype[6]="eLIM_REASSOC_FAIL_TIMER"
-Var.SET \limtimertype[7]="eLIM_PRE_AUTH_CLEANUP_TIMER"
-Var.SET \limtimertype[8]="eLIM_HEART_BEAT_TIMER"
-Var.SET \limtimertype[9]="eLIM_BACKGROUND_SCAN_TIMER"
-Var.SET \limtimertype[10]="eLIM_KEEPALIVE_TIMER"
-Var.SET \limtimertype[11]="eLIM_CNF_WAIT_TIMER"
-Var.SET \limtimertype[12]="eLIM_AUTH_RSP_TIMER"
-Var.SET \limtimertype[13]="eLIM_UPDATE_OLBC_CACHE_TIMER"
-Var.SET \limtimertype[14]="eLIM_PROBE_AFTER_HB_TIMER"
-Var.SET \limtimertype[15]="eLIM_ADDTS_RSP_TIMER"
-Var.SET \limtimertype[16]="eLIM_CHANNEL_SWITCH_TIMER"
-Var.SET \limtimertype[17]="eLIM_LEARN_DURATION_TIMER"
-Var.SET \limtimertype[18]="eLIM_QUIET_TIMER"
-Var.SET \limtimertype[19]="eLIM_QUIET_BSS_TIMER"
-Var.SET \limtimertype[20]="eLIM_WPS_OVERLAP_TIMER"
-Var.SET \limtimertype[21]="eLIM_FT_PREAUTH_RSP_TIMER"
-Var.SET \limtimertype[22]="eLIM_REMAIN_CHN_TIMER"
-Var.SET \limtimertype[23]="eLIM_PERIODIC_PROBE_REQ_TIMER"
-;#ifdef FEATURE_WLAN_CCX
-;Var.SET \limtimertype[0]="eLIM_TSM_TIMER"
-;#endif
-;#ifdef FEATURE_WLAN_TDLS_INTERNAL
-;Var.SET \limtimertype[0]="eLIM_TDLS_DISCOVERY_RSP_WAIT"
-;Var.SET \limtimertype[0]="eLIM_TDLS_LINK_SETUP_RSP_TIMEOUT"
-;Var.SET \limtimertype[0]="eLIM_TDLS_LINK_SETUP_CNF_TIMEOUT"
-;#endif
-Var.SET \limtimertype[25]="eLIM_DISASSOC_ACK_TIMER"
-Var.SET \limtimertype[26]="eLIM_DEAUTH_ACK_TIMER"
-Var.SET \limtimertype[27]="eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER"
-Var.SET \limtimertype[28]="eLIM_INSERT_SINGLESHOT_NOA_TIMER"
-Var.SET \limtimertype[29]="eLIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE"
-
-
-
-Var.NEW  char [256][100] \hddcodetype
-
-Var.SET \hddcodetype[0x00]="TRACE_CODE_HDD_OPEN_REQUEST"
-Var.SET \hddcodetype[0x01]="TRACE_CODE_HDD_STOP_REQUEST"
-Var.SET \hddcodetype[0x02]="TRACE_CODE_HDD_TX_TIMEOUT"
-Var.SET \hddcodetype[0x03]="TRACE_CODE_HDD_P2P_DEV_ADDR_IOCTL"
-Var.SET \hddcodetype[0x04]="TRACE_CODE_HDD_SETSUSPENDMODE_IOCTL"
-Var.SET \hddcodetype[0x05]="TRACE_CODE_HDD_SETROAMTRIGGER_IOCTL"
-Var.SET \hddcodetype[0x06]="TRACE_CODE_HDD_GETROAMTRIGGER_IOCTL"
-Var.SET \hddcodetype[0x07]="TRACE_CODE_HDD_SETROAMSCANPERIOD_IOCTL"
-Var.SET \hddcodetype[0x08]="TRACE_CODE_HDD_GETROAMSCANPERIOD_IOCTL"
-Var.SET \hddcodetype[0x09]="TRACE_CODE_HDD_SETROAMDELTA_IOCTL"
-Var.SET \hddcodetype[0x0A]="TRACE_CODE_HDD_GETROAMDELTA_IOCTL"
-Var.SET \hddcodetype[0x0B]="TRACE_CODE_HDD_GETBAND_IOCTL"
-Var.SET \hddcodetype[0x0C]="TRACE_CODE_HDD_GETCOUNTRYREV_IOCTL"
-Var.SET \hddcodetype[0x0D]="TRACE_CODE_HDD_SETROAMSCANCHANNELS_IOCTL"
-Var.SET \hddcodetype[0x0E]="TRACE_CODE_HDD_GETROAMSCANCHANNELS_IOCTL"
-Var.SET \hddcodetype[0x0F]="TRACE_CODE_HDD_HOSTAPD_OPEN_REQUEST"
-Var.SET \hddcodetype[0x10]="TRACE_CODE_HDD_HOSTAPD_STOP_REQUEST"
-Var.SET \hddcodetype[0x11]="TRACE_CODE_HDD_HOSTAPD_UNINIT_REQUEST"
-Var.SET \hddcodetype[0x12]="TRACE_CODE_HDD_SOFTAP_TX_TIMEOUT"
-Var.SET \hddcodetype[0x13]="TRACE_CODE_HDD_HOSTAPD_SET_MAC_ADDR"
-Var.SET \hddcodetype[0x14]="TRACE_CODE_HDD_HOSTAPD_P2P_SET_NOA_IOCTL"
-Var.SET \hddcodetype[0x15]="TRACE_CODE_HDD_HOSTAPD_P2P_SET_PS_IOCTL"
-Var.SET \hddcodetype[0x16]="TRACE_CODE_HDD_HOSTAPD_SET_SAP_CHANNEL_LIST_IOCTL"
-Var.SET \hddcodetype[0x17]="TRACE_CODE_HDD_ADD_VIRTUAL_INTF"
-Var.SET \hddcodetype[0x18]="TRACE_CODE_HDD_DEL_VIRTUAL_INTF"
-Var.SET \hddcodetype[0x19]="TRACE_CODE_HDD_CHANGE_VIRTUAL_INTF"
-Var.SET \hddcodetype[0x1A]="TRACE_CODE_HDD_CFG80211_START_AP"
-Var.SET \hddcodetype[0x1B]="TRACE_CODE_HDD_CFG80211_CHANGE_BEACON"
-Var.SET \hddcodetype[0x1C]="TRACE_CODE_HDD_CFG80211_STOP_AP"
-Var.SET \hddcodetype[0x1D]="TRACE_CODE_HDD_CFG80211_CHANGE_BSS"
-Var.SET \hddcodetype[0x1E]="TRACE_CODE_HDD_CFG80211_ADD_KEY"
-Var.SET \hddcodetype[0x1F]="TRACE_CODE_HDD_CFG80211_GET_KEY"
-Var.SET \hddcodetype[0x20]="TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY"
-Var.SET \hddcodetype[0x21]="TRACE_CODE_HDD_CFG80211_CONNECT"
-Var.SET \hddcodetype[0x22]="TRACE_CODE_HDD_CFG80211_DISCONNECT"
-Var.SET \hddcodetype[0x23]="TRACE_CODE_HDD_CFG80211_JOIN_IBSS"
-Var.SET \hddcodetype[0x24]="TRACE_CODE_HDD_CFG80211_LEAVE_IBSS"
-Var.SET \hddcodetype[0x25]="TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS"
-Var.SET \hddcodetype[0x26]="TRACE_CODE_HDD_CFG80211_SET_TXPOWER"
-Var.SET \hddcodetype[0x27]="TRACE_CODE_HDD_CFG80211_GET_TXPOWER"
-Var.SET \hddcodetype[0x28]="TRACE_CODE_HDD_CFG80211_SET_CHANNEL"
-Var.SET \hddcodetype[0x29]="TRACE_CODE_HDD_CFG80211_ADD_BEACON"
-Var.SET \hddcodetype[0x2A]="TRACE_CODE_HDD_CFG80211_SET_BEACON"
-Var.SET \hddcodetype[0x2B]="TRACE_CODE_HDD_CFG80211_CHANGE_IFACE"
-Var.SET \hddcodetype[0x2C]="TRACE_CODE_HDD_CHANGE_STATION"
-Var.SET \hddcodetype[0x2D]="TRACE_CODE_HDD_CFG80211_UPDATE_BSS"
-Var.SET \hddcodetype[0x2E]="TRACE_CODE_HDD_CFG80211_SCAN"
-Var.SET \hddcodetype[0x2F]="TRACE_CODE_HDD_REMAIN_ON_CHANNEL"
-Var.SET \hddcodetype[0x30]="TRACE_CODE_HDD_REMAINCHANREADYHANDLER"
-Var.SET \hddcodetype[0x31]="TRACE_CODE_HDD_CFG80211_CANCEL_REMAIN_ON_CHANNEL"
-Var.SET \hddcodetype[0x32]="TRACE_CODE_HDD_ACTION"
-Var.SET \hddcodetype[0x33]="TRACE_CODE_HDD_MGMT_TX_CANCEL_WAIT"
-Var.SET \hddcodetype[0x34]="TRACE_CODE_HDD_CFG80211_GET_STA"
-Var.SET \hddcodetype[0x35]="TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT"
-Var.SET \hddcodetype[0x36]="TRACE_CODE_HDD_CFG80211_DEL_STA"
-Var.SET \hddcodetype[0x37]="TRACE_CODE_HDD_CFG80211_ADD_STA"
-Var.SET \hddcodetype[0x38]="TRACE_CODE_HDD_CFG80211_SET_PMKSA"
-Var.SET \hddcodetype[0x39]="TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES"
-Var.SET \hddcodetype[0x3A]="TRACE_CODE_HDD_CFG80211_TDLS_MGMT"
-Var.SET \hddcodetype[0x3B]="TRACE_CODE_HDD_CFG80211_TDLS_OPER"
-Var.SET \hddcodetype[0x3C]="TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA"
-Var.SET \hddcodetype[0x3D]="TRACE_CODE_HDD_UNSUPPORTED_IOCTL"
-Var.SET \hddcodetype[0x3E]="TRACE_CODE_HDD_SETROAMSCANCHANNELMINTIME_IOCTL"
-Var.SET \hddcodetype[0x3F]="TRACE_CODE_HDD_GETROAMSCANCHANNELMINTIME_IOCTL"
-Var.SET \hddcodetype[0x40]="TRACE_CODE_HDD_STOP_NETDEV"
-Var.SET \hddcodetype[0x41]="TRACE_CODE_HDD_WAKE_NETDEV"
-Var.SET \hddcodetype[0x42]="TRACE_CODE_HDD_FLUSH_TX_QUEUES"
-Var.SET \hddcodetype[0x43]="TRACE_CODE_HDD_CFG80211_RESUME_WLAN"
-Var.SET \hddcodetype[0x44]="TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN"
-Var.SET \hddcodetype[0x45]="TRACE_CODE_HDD_CFG80211_SET_MAC_ACL"
-Var.SET \hddcodetype[0x46]="TRACE_CODE_HDD_CFG80211_TESTMODE"
-Var.SET \hddcodetype[0x47]="TRACE_CODE_HDD_CFG80211_DUMP_SURVEY"
-Var.SET \hddcodetype[0x48]="TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START"
-Var.SET \hddcodetype[0x49]="TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP"
-Var.SET \hddcodetype[0x4A]="TRACE_CODE_HDD_CFG80211_DEL_PMKSA"
-
-&TRACETYPESIZE=v.value(sizeof(tvosTraceRecord))
-&TRACESIZE=v.value(sizeof(gvosTraceTbl))
-&TRACEMAXINDEX=v.value(&TRACESIZE/&TRACETYPESIZE)
-
-&HEAD=v.value(gvosTraceData.head)
-&TAIL=v.value(gvosTraceData.tail)
-
-IF ((&HEAD>&TRACEMAXINDEX)||(&TAIL>&TRACEMAXINDEX)||(&TAIL==&HEAD))
-(
-  GOTO ENDSCRIPT
-)
-
-&INDEX=&HEAD
-
-TRACESTART:
-
-&TIME=v.value(gvosTraceTbl[&INDEX].time)
-&MODULE=v.value(gvosTraceTbl[&INDEX].module)
-&CODE=v.value(gvosTraceTbl[&INDEX].code)
-&SESSION=v.value(gvosTraceTbl[&INDEX].session)
-&DATA=v.value(gvosTraceTbl[&INDEX].data)
-
-
-  WRITE #1 "TIME: "  &TIME
-  Var.Write #1 %STRING \module[&MODULE]
-
-IF (&MODULE==0x7)
-(
-if (&CODE>=0)&&(&CODE<=0x12)
-(
-    Var.Write #1 %STRING \code[&CODE] " [" %Hex &CODE "]"
-)
-
-   IF (&SESSION==0xFF)
-    (
-      WRITE #1 "NO SESSION"
-    )
-    ELSE
-    (
-      WRITE #1 "SESSION: " &SESSION
-    )
-
-
-;0 TRACE_CODE_MLM_STATE
-IF (&CODE==0x0)
-(
-  Var.NEW  tLimMlmStates \mlmstate
-  Var.Set \mlmstate=&DATA
-  ;Var.Write #1 \mlmstate %Hex &DATA
-)
-
-;1 TRACE_CODE_SME_STATE
-IF (&CODE==0x1)
-(
-  Var.NEW  tLimSmeStates \smestate
-  Var.Set \smestate=&DATA
-  Var.Write #1 \smestate %Hex &DATA
-)
-
-;2 TRACE_CODE_TX_MGMT
-IF (&CODE==0x2)
-(
-  WRITE #1 "DATA: " &DATA
-)
-
-;3 TRACE_CODE_RX_MGMT
-IF (&CODE==0x3)
-(
-  &SERIAL=v.value(&DATA>>16)
-  &SUBTYPE=v.value(&DATA&0xFF)
-  if (&SUBTYPE<=0xF)
-  (
-  Var.Write #1 %STRING \mgmttype[&SUBTYPE]
-  WRITE #1 "SEQ NUM: " &SERIAL
-  )
-  else
-  (
-    WRITE #1 "INCORRECT DATA"
-  )
-)
-
-;4 TRACE_CODE_RX_MGMT_TSF
-IF (&CODE==0x4)
-(
-  WRITE #1 "BEACON TS: " &DATA
-)
-
-;5 TRACE_CODE_TX_COMPLETE
-IF (&CODE==0x5)
-(
-  Var.Write #1 %STRING \mgmttype[&DATA] %Hex &DATA
-)
-
-;14 TRACE_CODE_RX_MGMT_DROP
-IF (&CODE==0xE)
-(
-  Var.NEW  tMgmtFrmDropReason \dropreason
-  Var.Set \dropreason=&DATA
-  Var.Write #1 \dropreason %Hex &DATA
-)
-
-
-;15 TRACE_CODE_TIMER_ACTIVATE/DEACTIVATE
-IF (&CODE==0xF)||(&CODE==0x10)
-(
-  Var.Write #1 %STRING \limtimertype[&DATA] %Hex &DATA
-)
-
-;6 TRACE_CODE_TX_SME_MSG
-IF (&CODE==0x6)
-(
-&MOD=v.value(&DATA>>8)
-&MSG=v.value(&DATA&0xFF)
-IF (&MOD==0x12)&&(&DATA>=0x12B0)
-(
-Var.Write #1 %STRING \limmsgtype[&MSG] %Hex &MSG
-)
-IF (&DATA>=0x1500)
-(
-  Var.NEW  enum eWniMsgTypes \smemsg
-  Var.Set \smemsg=&DATA
-  Var.Write #1 \smemsg %Hex &DATA
- )
-)
-
-;7 TRACE_CODE_RX_SME_MSG
-IF (&CODE==0x7)
-(
-&MOD=v.value(&DATA>>8)
-&MSG=v.value(&DATA&0xFF)
-IF (&MOD==0x12)&&(&DATA>=0x12B0)
-(
-Var.Write #1 %STRING \limmsgtype[&MSG]  %Hex &MSG
-)
-IF (&DATA>=0x1500)
-(
-  Var.NEW  enum eWniMsgTypes \smemsg
-  Var.Set \smemsg=&DATA
-  Var.Write #1 \smemsg %Hex &DATA
-)
-)
-
-;8 TRACE_CODE_TX_WDA_MSG
-IF (&CODE==0x8)
-(
-&MOD=v.value(&DATA>>8)
-&MSG=v.value(&DATA&0xFF)
-IF (&MOD==0x10)
-(
-Var.Write #1 %STRING \halmsgtype[&MSG] %Hex &MSG
-)
-)
-
-;9 TRACE_CODE_RX_WDA_MSG
-IF (&CODE==0x9)
-(
-&MOD=v.value(&DATA>>8)
-&MSG=v.value(&DATA&0xFF)
-IF (&MOD==0x10)
-(
-Var.Write #1 %STRING \halmsgtype[&MSG]  %Hex &MSG
-)
-)
-
-;10 TRACE_CODE_TX_LIM_MSG
-IF (&CODE==0xA)
-(
-&MOD=v.value(&DATA>>8)
-&MSG=v.value(&DATA&0xFF)
-IF (&MOD==0x12)&&(&DATA>=0x12B0)
-(
-Var.Write #1 %STRING \limmsgtype[&MSG] %Hex &MSG
-)
-IF (&DATA>=0x1500)
-(
-  Var.NEW  enum eWniMsgTypes \smemsg
-  Var.Set \smemsg=&DATA
-  Var.Write #1 \smemsg %Hex &DATA
-)
-)
-
-;11 TRACE_CODE_RX_LIM_MSG
-IF (&CODE==0xB)
-(
-&MOD=v.value(&DATA>>8)
-&MSG=v.value(&DATA&0xFF)
-IF (&MOD==0x12)&&(&DATA>=0x12B0)
-(
-Var.Write #1 %STRING \limmsgtype[&MSG]  %Hex &MSG
-)
-IF (&DATA>=0x1500)
-(
-  Var.NEW  enum eWniMsgTypes \smemsg
-  &DATA=v.value(&DATA&0xFFFF)
-  Var.Set \smemsg=&DATA
-  Var.Write #1 \smemsg %Hex &DATA
-)
-)
-
-;12 TRACE_CODE_TX_CFG_MSG
-IF (&CODE==0xC)
-(
-&MOD=v.value(&DATA>>8)
-&MSG=v.value(&DATA&0xFF)
-IF (&MOD==0x11)&&(&DATA>=0x11B0)
-(
-Var.Write #1 %STRING \cfgmsgtype[&MSG] %Hex &MSG
-)
-)
-
-;13 TRACE_CODE_RX_CFG_MSG
-IF (&CODE==0xD)
-(
-&MOD=v.value(&DATA>>8)
-&MSG=v.value(&DATA&0xFF)
-IF (&MOD==0x11)&&(&DATA>=0x11B0)
-(
-Var.Write #1 %STRING \cfgmsgtype[&MSG] %Hex &MSG
-)
-)
-
-IF (&DATA>=0x1500)
-(
-  Var.NEW  enum eWniMsgTypes \smemsg
-  &DATA=v.value(&DATA&0xFFFF)
-  Var.Set \smemsg=&DATA
-  Var.Write #1 \smemsg  %Hex &DATA
-)
-
-)
-
-IF (&MODULE==0x1)
-(
-  Var.Write #1 %STRING \tlcodetype[&CODE] %Hex &CODE
-  WRITE #1 "DATA: " &DATA
-
-  IF (&SESSION==0xFF)
-  (
-    WRITE #1 "NO SESSION"
-  )
-  ELSE
-  (
-    WRITE #1 "SESSION: " &SESSION
-  )
-)
-
-
-IF (&MODULE==0x6)
-(
-
-  IF ((&CODE>=0x0)&&(&CODE<=0x62))
-  (
-    Var.Write #1 %STRING \smecodetype[&CODE] %Hex &CODE
-  )
-  ELSE
-  (
-    IF ((&CODE>=0xFA)&&(&CODE<=0xFC))
-    (
-      Var.Write #1 %STRING \smecodetype[&CODE] %Hex &CODE
-    )
-    ELSE
-    (
-      WRITE #1 "CODE: " &CODE
-    )
-  )
-  WRITE #1 "DATA: " &DATA
-
-  IF (&SESSION==0xFF)
-  (
-    WRITE #1 "NO SESSION"
-  )
-  ELSE
-  (
-    WRITE #1 "SESSION: " &SESSION
-  )
-)
-
-IF (&MODULE==0x5)
-(
-
-  IF ((&CODE>=0x0)&&(&CODE<=0x4A))
-  (
-    Var.Write #1 %STRING \hddcodetype[&CODE] %Hex &CODE
-  )
-  ELSE
-  (
-    WRITE #1 "CODE: " &CODE
-  )
-  WRITE #1 "DATA: " &DATA
-
-  IF (&SESSION==0xFF)
-  (
-    WRITE #1 "NO SESSION"
-  )
-  ELSE
-  (
-    WRITE #1 "SESSION: " &SESSION
-  )
-)
-
-WRITE #1 " "
-
-&INDEX=v.value((&INDEX+1)%(&TRACEMAXINDEX))
-
-  IF (&INDEX!=&HEAD)
-  (
-    GOTO TRACESTART
-  )
-
-
-
-ENDSCRIPT:
-CLOSE #1
-ENDDO
diff --git a/wlan/prima/CORE/SYS/legacy/src/utils/src/parserApi.c b/wlan/prima/CORE/SYS/legacy/src/utils/src/parserApi.c
index 3ae3f50..a053a46 100644
--- a/wlan/prima/CORE/SYS/legacy/src/utils/src/parserApi.c
+++ b/wlan/prima/CORE/SYS/legacy/src/utils/src/parserApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -141,17 +141,17 @@
 
 inline static void __printWMMParams(tpAniSirGlobal  pMac, tDot11fIEWMMParams *pWmm)
 {
-    limLog(pMac, LOG1, FL("WMM Parameters Received: "));
-    limLog(pMac, LOG1, FL("BE: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
+    limLog(pMac, LOG1, FL("WMM Parameters Received: \n"));
+    limLog(pMac, LOG1, FL("BE: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
            pWmm->acbe_aifsn, pWmm->acbe_acm, pWmm->acbe_aci, pWmm->acbe_acwmin, pWmm->acbe_acwmax, pWmm->acbe_txoplimit);
 
-    limLog(pMac, LOG1, FL("BK: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
+    limLog(pMac, LOG1, FL("BK: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
            pWmm->acbk_aifsn, pWmm->acbk_acm, pWmm->acbk_aci, pWmm->acbk_acwmin, pWmm->acbk_acwmax, pWmm->acbk_txoplimit);
 
-    limLog(pMac, LOG1, FL("VI: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
+    limLog(pMac, LOG1, FL("VI: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
            pWmm->acvi_aifsn, pWmm->acvi_acm, pWmm->acvi_aci, pWmm->acvi_acwmin, pWmm->acvi_acwmax, pWmm->acvi_txoplimit);
 
-    limLog(pMac, LOG1, FL("VO: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
+    limLog(pMac, LOG1, FL("VO: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
            pWmm->acvo_aifsn, pWmm->acvo_acm, pWmm->acvo_aci, pWmm->acvo_acwmin, pWmm->acvo_acwmax, pWmm->acvo_txoplimit);
 
     return;
@@ -204,7 +204,7 @@
              // & if no more IE, 
              bytesLeft <= (tANI_U16)( ieLen ) )
         {
-            dot11fLog( pMac, LOG3, FL("No IE (%d) in FindIELocation."), EID );
+            dot11fLog( pMac, LOG3, FL("No IE (%d) in FindIELocation.\n"), EID );
             return ret_val;
         }
         bytesLeft -= ieLen;
@@ -228,7 +228,7 @@
     if ( eSIR_SUCCESS != nSirStatus )
     {
         dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
-                               "itfield from CFG (%d)."), nSirStatus );
+                               "itfield from CFG (%d).\n"), nSirStatus );
         return nSirStatus;
     }
 
@@ -255,7 +255,7 @@
     if ( eSIR_SUCCESS != nSirStatus )
     {
         dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
-                               "itfield from CFG (%d)."), nSirStatus );
+                               "itfield from CFG (%d).\n"), nSirStatus );
         return nSirStatus;
     }
 
@@ -349,7 +349,7 @@
 
         if(len > MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE)
         {
-            dot11fLog( pMac, LOGE, FL("len:%d is out of bounds, resetting."), len);
+            dot11fLog( pMac, LOGE, FL("len:%d is out of bounds, resetting.\n"), len);
             len = MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE;
         }
 
@@ -367,7 +367,7 @@
                        tDot11fIEDSParams *pDot11f, tANI_U8 channel,
                        tpPESession psessionEntry)
 {
-    if (IS_24G_CH(channel))
+    if ((IS_24G_CH(channel)) || pMac->rrm.rrmPEContext.rrmEnable)
     {
         // .11b/g mode PHY => Include the DS Parameter Set IE:
         pDot11f->curr_channel = channel;
@@ -441,7 +441,7 @@
 
         val  = psessionEntry->cfgProtection.fromllb;
         if(!val ){
-            dot11fLog( pMac, LOG1, FL("11B protection not enabled. Not populating ERP IE %d" ),val );
+            dot11fLog( pMac, LOGE, FL("11B protection not enabled. Not populating ERP IE %d\n" ),val );
             return eSIR_SUCCESS;
         }
 
@@ -484,7 +484,7 @@
 {
     tSirRetStatus nSirStatus;
     tANI_U32           nRates = 0;
-    tANI_U8            rates[SIR_MAC_RATESET_EID_MAX];
+    tANI_U8            rates[WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN];
 
    /* Use the ext rates present in session entry whenever nChannelNum is set to OPERATIONAL
        else use the ext supported rate set from CFG, which is fixed and does not change dynamically and is used for
@@ -501,7 +501,7 @@
         else
         {
             dot11fLog( pMac, LOGE, FL("no session context exists while"
-                        " populating Operational Rate Set"));
+                        " populating Operational Rate Set\n"));
         }
     }
     else if ( HIGHEST_24GHZ_CHANNEL_NUM >= nChannelNum )
@@ -605,6 +605,9 @@
        pDot11f->shortGI40MHz = 0;
     }
 
+    dot11fLog(pMac, LOG2, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, shortGI20:%d, shortGI40: %d, dsssCck: %d\n"),
+                                            pDot11f->supportedChannelWidthSet, pDot11f->mimoPowerSave,  pDot11f->greenField,
+                                            pDot11f->shortGI20MHz, pDot11f->shortGI40MHz, pDot11f->dsssCckMode40MHz);
 
 
     CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_AMPDU_PARAMS, nCfgValue );
@@ -616,6 +619,9 @@
     pDot11f->mpduDensity      = pHTParametersInfo->mpduDensity;
     pDot11f->reserved1        = pHTParametersInfo->reserved;
 
+    dot11fLog( pMac, LOG2, FL( "AMPDU Param: %x\n" ), nCfgValue);
+
+
     CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_MCS_SET,
                  pDot11f->supportedMCSSet, nCfgLen,
                  SIZE_OF_SUPPORTED_MCS_SET );
@@ -673,32 +679,32 @@
                               tDot11fIEVHTCaps *pDot11f)
 {
 #ifdef DUMP_MGMT_CNTNTS
-    limLog(pMac, LOG1, FL("maxMPDULen (2): %d"), pDot11f->maxMPDULen);
-    limLog(pMac, LOG1, FL("supportedChannelWidthSet (2): %d"), pDot11f->supportedChannelWidthSet);
-    limLog(pMac, LOG1, FL("ldpcCodingCap (1): %d"), pDot11f->ldpcCodingCap);
-    limLog(pMac, LOG1, FL("shortGI80MHz (1): %d"), pDot11f->shortGI80MHz);
-    limLog(pMac, LOG1, FL("shortGI160and80plus80MHz (1): %d"), pDot11f->shortGI160and80plus80MHz);
-    limLog(pMac, LOG1, FL("txSTBC (1): %d"), pDot11f->txSTBC);
-    limLog(pMac, LOG1, FL("rxSTBC (3): %d"), pDot11f->rxSTBC);
-    limLog(pMac, LOG1, FL("suBeamFormerCap (1): %d"), pDot11f->suBeamFormerCap);
-    limLog(pMac, LOG1, FL("suBeamformeeCap (1): %d"), pDot11f->suBeamformeeCap);
-    limLog(pMac, LOG1, FL("csnofBeamformerAntSup (3): %d"), pDot11f->csnofBeamformerAntSup);
-    limLog(pMac, LOG1, FL("numSoundingDim (3): %d"), pDot11f->numSoundingDim);
-    limLog(pMac, LOG1, FL("muBeamformerCap (1): %d"), pDot11f->muBeamformerCap);
-    limLog(pMac, LOG1, FL("muBeamformeeCap (1): %d"), pDot11f->muBeamformeeCap);
-    limLog(pMac, LOG1, FL("vhtTXOPPS (1): %d"), pDot11f->vhtTXOPPS);
-    limLog(pMac, LOG1, FL("htcVHTCap (1): %d"), pDot11f->htcVHTCap);
-    limLog(pMac, LOG1, FL("maxAMPDULenExp (3): %d"), pDot11f->maxAMPDULenExp);
-    limLog(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d"), pDot11f->vhtLinkAdaptCap);
-    limLog(pMac, LOG1, FL("rxAntPattern (1): %d"), pDot11f->vhtLinkAdaptCap);
-    limLog(pMac, LOG1, FL("txAntPattern (1): %d"), pDot11f->vhtLinkAdaptCap);
-    limLog(pMac, LOG1, FL("reserved1 (2): %d"), pDot11f->reserved1);
-    limLog(pMac, LOG1, FL("rxMCSMap (16): %d"), pDot11f->rxMCSMap);
-    limLog(pMac, LOG1, FL("rxHighSupDataRate (13): %d"), pDot11f->rxHighSupDataRate);
-    limLog(pMac, LOG1, FL("reserve (3): %d"), pDot11f->reserved2);
-    limLog(pMac, LOG1, FL("txMCSMap (16): %d"), pDot11f->txMCSMap);
-    limLog(pMac, LOG1, FL("txSupDataRate (13): %d"), pDot11f->txSupDataRate);
-    limLog(pMac, LOG1, FL("reserv (3): %d"), pDot11f->reserved3);
+    limLog(pMac, LOG1, FL("maxMPDULen (2): %d\n"), pDot11f->maxMPDULen);
+    limLog(pMac, LOG1, FL("supportedChannelWidthSet (2): %d\n"), pDot11f->supportedChannelWidthSet);
+    limLog(pMac, LOG1, FL("ldpcCodingCap (1): %d\n"), pDot11f->ldpcCodingCap);
+    limLog(pMac, LOG1, FL("shortGI80MHz (1): %d\n"), pDot11f->shortGI80MHz);
+    limLog(pMac, LOG1, FL("shortGI160and80plus80MHz (1): %d\n"), pDot11f->shortGI160and80plus80MHz);
+    limLog(pMac, LOG1, FL("txSTBC (1): %d\n"), pDot11f->txSTBC);
+    limLog(pMac, LOG1, FL("rxSTBC (3): %d\n"), pDot11f->rxSTBC);
+    limLog(pMac, LOG1, FL("suBeamFormerCap (1): %d\n"), pDot11f->suBeamFormerCap);
+    limLog(pMac, LOG1, FL("suBeamformeeCap (1): %d\n"), pDot11f->suBeamformeeCap);
+    limLog(pMac, LOG1, FL("csnofBeamformerAntSup (3): %d\n"), pDot11f->csnofBeamformerAntSup);
+    limLog(pMac, LOG1, FL("numSoundingDim (3): %d\n"), pDot11f->numSoundingDim);
+    limLog(pMac, LOG1, FL("muBeamformerCap (1): %d\n"), pDot11f->muBeamformerCap);
+    limLog(pMac, LOG1, FL("muBeamformeeCap (1): %d\n"), pDot11f->muBeamformeeCap);
+    limLog(pMac, LOG1, FL("vhtTXOPPS (1): %d\n"), pDot11f->vhtTXOPPS);
+    limLog(pMac, LOG1, FL("htcVHTCap (1): %d\n"), pDot11f->htcVHTCap);
+    limLog(pMac, LOG1, FL("maxAMPDULenExp (3): %d\n"), pDot11f->maxAMPDULenExp);
+    limLog(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d\n"), pDot11f->vhtLinkAdaptCap);
+    limLog(pMac, LOG1, FL("rxAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
+    limLog(pMac, LOG1, FL("txAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
+    limLog(pMac, LOG1, FL("reserved1 (2): %d\n"), pDot11f->reserved1);
+    limLog(pMac, LOG1, FL("rxMCSMap (16): %d\n"), pDot11f->rxMCSMap);
+    limLog(pMac, LOG1, FL("rxHighSupDataRate (13): %d\n"), pDot11f->rxHighSupDataRate);
+    limLog(pMac, LOG1, FL("reserve (3): %d\n"), pDot11f->reserved2);
+    limLog(pMac, LOG1, FL("txMCSMap (16): %d\n"), pDot11f->txMCSMap);
+    limLog(pMac, LOG1, FL("txSupDataRate (13): %d\n"), pDot11f->txSupDataRate);
+    limLog(pMac, LOG1, FL("reserv (3): %d\n"), pDot11f->reserved3);
 #endif /* DUMP_MGMT_CNTNTS */
 }
 
@@ -706,10 +712,10 @@
                               tDot11fIEVHTOperation *pDot11f)
 {
 #ifdef DUMP_MGMT_CNTNTS
-    limLog(pMac, LOG1, FL("chanWidth : %d"), pDot11f->chanWidth);
-    limLog(pMac, LOG1, FL("chanCenterFreqSeg1: %d"), pDot11f->chanCenterFreqSeg1);
-    limLog(pMac, LOG1, FL("chanCenterFreqSeg2: %d"), pDot11f->chanCenterFreqSeg2);
-    limLog(pMac, LOG1, FL("basicMCSSet: %d"), pDot11f->basicMCSSet);
+    limLog(pMac, LOG1, FL("chanWidth : %d\n"), pDot11f->chanWidth);
+    limLog(pMac, LOG1, FL("chanCenterFreqSeg1: %d\n"), pDot11f->chanCenterFreqSeg1);
+    limLog(pMac, LOG1, FL("chanCenterFreqSeg2: %d\n"), pDot11f->chanCenterFreqSeg2);
+    limLog(pMac, LOG1, FL("basicMCSSet: %d\n"), pDot11f->basicMCSSet);
 #endif /* DUMP_MGMT_CNTNTS */
 }
 
@@ -717,11 +723,11 @@
                               tDot11fIEVHTExtBssLoad *pDot11f)
 {
 #ifdef DUMP_MGMT_CNTNTS
-    limLog(pMac, LOG1, FL("muMIMOCapStaCount : %d"), pDot11f->muMIMOCapStaCount);
-    limLog(pMac, LOG1, FL("ssUnderUtil: %d"), pDot11f->ssUnderUtil);
-    limLog(pMac, LOG1, FL("FortyMHzUtil: %d"), pDot11f->FortyMHzUtil);
-    limLog(pMac, LOG1, FL("EightyMHzUtil: %d"), pDot11f->EightyMHzUtil);
-    limLog(pMac, LOG1, FL("OneSixtyMHzUtil: %d"), pDot11f->OneSixtyMHzUtil);
+    limLog(pMac, LOG1, FL("muMIMOCapStaCount : %d\n"), pDot11f->muMIMOCapStaCount);
+    limLog(pMac, LOG1, FL("ssUnderUtil: %d\n"), pDot11f->ssUnderUtil);
+    limLog(pMac, LOG1, FL("FortyMHzUtil: %d\n"), pDot11f->FortyMHzUtil);
+    limLog(pMac, LOG1, FL("EightyMHzUtil: %d\n"), pDot11f->EightyMHzUtil);
+    limLog(pMac, LOG1, FL("OneSixtyMHzUtil: %d\n"), pDot11f->OneSixtyMHzUtil);
 #endif /* DUMP_MGMT_CNTNTS */
 }
 
@@ -730,18 +736,16 @@
                                tDot11fIEOperatingMode *pDot11f)
 {
 #ifdef DUMP_MGMT_CNTNTS
-    limLog(pMac, LOG1, FL("ChanWidth : %d"), pDot11f->chanWidth);
-    limLog(pMac, LOG1, FL("reserved: %d"), pDot11f->reserved);
-    limLog(pMac, LOG1, FL("rxNSS: %d"), pDot11f->rxNSS);
-    limLog(pMac, LOG1, FL("rxNSS Type: %d"), pDot11f->rxNSSType);
+    limLog(pMac, LOG1, FL("ChanWidth : %d\n"), pDot11f->chanWidth);
+    limLog(pMac, LOG1, FL("reserved: %d\n"), pDot11f->reserved);
+    limLog(pMac, LOG1, FL("rxNSS: %d\n"), pDot11f->rxNSS);
+    limLog(pMac, LOG1, FL("rxNSS Type: %d\n"), pDot11f->rxNSSType);
 #endif /* DUMP_MGMT_CNTNTS */
 }
 
 void limLogQosMapSet(tpAniSirGlobal pMac, tSirQosMapSet *pQosMapSet)
 {
     tANI_U8 i;
-    if (pQosMapSet->num_dscp_exceptions > 21)
-        pQosMapSet->num_dscp_exceptions = 21;
     limLog(pMac, LOG1, FL("num of dscp exceptions : %d"),
                                    pQosMapSet->num_dscp_exceptions);
     for (i=0; i < pQosMapSet->num_dscp_exceptions; i++)
@@ -763,20 +767,11 @@
 tSirRetStatus
 PopulateDot11fVHTCaps(tpAniSirGlobal           pMac,
                       tDot11fIEVHTCaps *pDot11f,
-                      tANI_U8 nChannelNum,
                       tAniBool isProbeRspAssocRspBeacon)
 {
     tSirRetStatus        nStatus;
     tANI_U32             nCfgValue=0;
-    tAniBool             disableMcs9 = eSIR_FALSE;
 
-    if (nChannelNum <= SIR_11B_CHANNEL_END)
-        disableMcs9 =  pMac->roam.configParam.channelBondingMode24GHz?
-                       eSIR_FALSE:eSIR_TRUE;
-    else
-        disableMcs9 =
-            pMac->roam.configParam.channelBondingMode5GHz?
-                                      eSIR_FALSE: eSIR_TRUE;
     pDot11f->present = 1;
 
     CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
@@ -800,12 +795,6 @@
                                                                 nCfgValue );
     pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
 
-    if (nChannelNum && (SIR_BAND_2_4_GHZ == limGetRFBand(nChannelNum)))
-    {
-        pDot11f->shortGI80MHz = 0;
-        pDot11f->shortGI160and80plus80MHz = 0;
-    }
-
     nCfgValue = 0;
     CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
     pDot11f->txSTBC = (nCfgValue & 0x0001);
@@ -880,9 +869,6 @@
 
     nCfgValue = 0;
     CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
-
-    if (eSIR_TRUE == disableMcs9)
-       nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
     pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
 
     nCfgValue = 0;
@@ -894,9 +880,6 @@
 
     nCfgValue = 0;
     CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
-
-    if (eSIR_TRUE == disableMcs9)
-       nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
     pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
 
     nCfgValue = 0;
@@ -914,20 +897,10 @@
 
 tSirRetStatus
 PopulateDot11fVHTOperation(tpAniSirGlobal   pMac,
-                               tDot11fIEVHTOperation  *pDot11f,
-                               tANI_U8 nChannelNum)
+                               tDot11fIEVHTOperation  *pDot11f)
 {
     tSirRetStatus        nStatus;
     tANI_U32             nCfgValue=0;
-    tAniBool             disableMcs9 = eSIR_FALSE;
-
-    if (nChannelNum <= SIR_11B_CHANNEL_END)
-        disableMcs9 =  pMac->roam.configParam.channelBondingMode24GHz?
-                       eSIR_FALSE:eSIR_TRUE;
-    else
-        disableMcs9 =
-            pMac->roam.configParam.channelBondingMode5GHz?
-                                      eSIR_FALSE: eSIR_TRUE;
 
     pDot11f->present = 1;
 
@@ -946,9 +919,6 @@
 
     nCfgValue = 0;
     CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
-
-    if (eSIR_TRUE == disableMcs9)
-       nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
     pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
 
     limLogVHTOperation(pMac,pDot11f);
@@ -991,48 +961,15 @@
     return eSIR_SUCCESS;
 }
 
-#ifdef WLAN_FEATURE_AP_HT40_24G
-tSirRetStatus
-PopulateDot11fOBSSScanParameters(tpAniSirGlobal pMac,
-                                 tDot11fIEOBSSScanParameters *pDot11f,
-                                 tpPESession psessionEntry)
-{
-    pDot11f->present = 1;
-
-    pDot11f->obssScanPassiveDwell =
-          psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime;
-
-    pDot11f->obssScanActiveDwell =
-          psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime;
-
-    pDot11f->bssChannelWidthTriggerScanInterval =
-          psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval;
-
-    pDot11f->obssScanPassiveTotalPerChannel =
-          psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel;
-
-    pDot11f->obssScanActiveTotalPerChannel =
-          psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel;
-
-    pDot11f->bssWidthChannelTransitionDelayFactor =
-          psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor;
-
-    pDot11f->obssScanActivityThreshold =
-          psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold;
-
-    return eSIR_SUCCESS;
-}
-#endif
-
 tSirRetStatus
 PopulateDot11fExtCap(tpAniSirGlobal      pMac,
                            tDot11fIEExtCap  *pDot11f,
                            tpPESession   psessionEntry)
 {
+    tANI_U32            val;
 
 #ifdef WLAN_FEATURE_11AC
-    if (psessionEntry->vhtCapability &&
-        psessionEntry->limSystemRole != eLIM_STA_IN_IBSS_ROLE )
+    if (psessionEntry->vhtCapability)
     {
         pDot11f->operModeNotification = 1;
         pDot11f->present = 1;
@@ -1042,14 +979,11 @@
                the bss co-ex capability*/
     if (psessionEntry->currentOperChannel <= RF_CHAN_14)
     {
-#ifdef WLAN_FEATURE_AP_HT40_24G
-       if(((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
-         && pMac->roam.configParam.channelBondingMode24GHz)
-         || pMac->roam.configParam.apHT40_24GEnabled)
-#else
-       if((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
-         && pMac->roam.configParam.channelBondingMode24GHz)
-#endif
+       if (wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_24G, &val) !=
+                         eSIR_SUCCESS)
+            PELOGE(limLog(pMac, LOGE, FL("could not retrieve "
+                                         "24G Chan bond Length \n"));)
+       if (TRUE == val)
        {
            pDot11f->bssCoexistMgmtSupport = 1;
            pDot11f->present = 1;
@@ -1101,7 +1035,7 @@
     if (NULL == psessionEntry)
     {
         PELOGE(limLog(pMac, LOG1,
-                FL("Invalid session entry in PopulateDot11fHTInfo()"));)
+                FL("Invalid session entry in PopulateDot11fHTInfo()\n"));)
         return eSIR_FAILURE;
     }
 
@@ -1118,7 +1052,7 @@
     if (psessionEntry == NULL)
     {
         PELOGE(limLog(pMac, LOG1,
-            FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set"));)
+            FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set\n"));)
     }
     else
     {
@@ -1315,7 +1249,7 @@
     tANI_U32  val = 0;
 
     if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS) 
-        PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length "));)
+        PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
    
     pDot11f->more_data_ack = 0;
     pDot11f->max_sp_length = (tANI_U8)val;
@@ -1350,12 +1284,12 @@
         if ( DOT11F_FAILED( status ) )
         {
             dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
-                                   "N (0x%08x)."),
+                                   "N (0x%08x).\n"),
                     status );
             return eSIR_FAILURE;
         }
         dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
-                               "PopulateDot11fRSN."), status );
+                               "PopulateDot11fRSN.\n"), status );
         }
 
     }
@@ -1407,12 +1341,12 @@
                                         pDot11f );
             if ( DOT11F_FAILED( status ) )
             {
-                dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x)."),
+                dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x).\n"),
                         status );
                 return eSIR_FAILURE;
             }
             dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
-                               "PopulateDot11fWAPI."), status );
+                               "PopulateDot11fWAPI.\n"), status );
         }
     }
 
@@ -1542,7 +1476,7 @@
         }
         else
         {
-            dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set"));
+            dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set\n"));
             nRates = 0;
         }
     }
@@ -1568,120 +1502,6 @@
 
 } // End PopulateDot11fSuppRates.
 
-/**
- * PopulateDot11fRatesTdls() - populate supported rates and
- *                                extended supported rates IE.
- * @p_mac gloabl - header.
- * @p_supp_rates - pointer to supported rates IE
- * @p_ext_supp_rates - pointer to extended supported rates IE
- *
- * This function populates the supported rates and extended supported
- * rates IE based in the STA capability. If the number of rates
- * supported is less than MAX_NUM_SUPPORTED_RATES, only supported rates
- * IE is populated.
- *
- * Return: tSirRetStatus eSIR_SUCCESS on Success and eSIR_FAILURE
- *         on failure.
- */
-
-tSirRetStatus
-PopulateDot11fRatesTdls(tpAniSirGlobal p_mac,
-                           tDot11fIESuppRates *p_supp_rates,
-                           tDot11fIEExtSuppRates *p_ext_supp_rates,
-                           tANI_U8 curr_oper_channel)
-{
-    tSirMacRateSet temp_rateset;
-    tSirMacRateSet temp_rateset2;
-    uint32_t val, i;
-    uint32_t self_dot11mode = 0;
-
-    wlan_cfgGetInt(p_mac, WNI_CFG_DOT11_MODE, &self_dot11mode);
-
-    /**
-     * Include 11b rates only when the device configured
-     * in auto, 11a/b/g or 11b_only and also if current base
-     * channel is 5 GHz then no need to advertise the 11b rates.
-     * If devices to move 2.4GHz off-channel then they can communicate
-     * in 11g rates i.e. (6, 9, 12, 18, 24, 36 and 54).
-     */
-    limLog(p_mac, LOG1, FL("Current operating channel %d self_dot11mode = %d"),
-           curr_oper_channel, self_dot11mode);
-
-    if ((curr_oper_channel <= SIR_11B_CHANNEL_END) &&
-        ((self_dot11mode == WNI_CFG_DOT11_MODE_ALL) ||
-        (self_dot11mode == WNI_CFG_DOT11_MODE_11A) ||
-        (self_dot11mode == WNI_CFG_DOT11_MODE_11AC) ||
-        (self_dot11mode == WNI_CFG_DOT11_MODE_11N) ||
-        (self_dot11mode == WNI_CFG_DOT11_MODE_11G) ||
-        (self_dot11mode == WNI_CFG_DOT11_MODE_11B)))
-    {
-            val = WNI_CFG_SUPPORTED_RATES_11B_LEN;
-            wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11B,
-                            (tANI_U8 *)&temp_rateset.rate, &val);
-            temp_rateset.numRates = (tANI_U8) val;
-    }
-    else
-    {
-            temp_rateset.numRates = 0;
-    }
-
-    /* Include 11a rates when the device configured in non-11b mode */
-    if (!IS_DOT11_MODE_11B(self_dot11mode))
-    {
-            val = WNI_CFG_SUPPORTED_RATES_11A_LEN;
-            wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11A,
-                    (tANI_U8 *)&temp_rateset2.rate, &val);
-            temp_rateset2.numRates = (tANI_U8) val;
-    }
-    else
-    {
-            temp_rateset2.numRates = 0;
-    }
-
-    if ((temp_rateset.numRates + temp_rateset2.numRates) >
-                                     SIR_MAC_MAX_NUMBER_OF_RATES)
-    {
-            limLog(p_mac, LOGP, FL("more than %d rates in CFG"),
-                                SIR_MAC_MAX_NUMBER_OF_RATES);
-            return eSIR_FAILURE;
-    }
-
-    /**
-     * copy all rates in temp_rateset,
-     * there are SIR_MAC_MAX_NUMBER_OF_RATES rates max
-     */
-    for (i = 0; i < temp_rateset2.numRates; i++)
-            temp_rateset.rate[i + temp_rateset.numRates] =
-                                          temp_rateset2.rate[i];
-
-    temp_rateset.numRates += temp_rateset2.numRates;
-
-    if (temp_rateset.numRates <= MAX_NUM_SUPPORTED_RATES)
-    {
-            p_supp_rates->num_rates = temp_rateset.numRates;
-            vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
-                         p_supp_rates->num_rates);
-            p_supp_rates->present = 1;
-    }
-    else  /* Populate extended capability as well */
-    {
-            p_supp_rates->num_rates = MAX_NUM_SUPPORTED_RATES;
-            vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
-                         p_supp_rates->num_rates);
-            p_supp_rates->present = 1;
-            p_ext_supp_rates->num_rates = temp_rateset.numRates -
-                                 MAX_NUM_SUPPORTED_RATES;
-            vos_mem_copy(p_ext_supp_rates->rates,
-                         (tANI_U8 *)temp_rateset.rate +
-                         MAX_NUM_SUPPORTED_RATES,
-                         p_ext_supp_rates->num_rates);
-            p_ext_supp_rates->present = 1;
-    }
-
-    return eSIR_SUCCESS;
-
-} /* End PopulateDot11fRatesTdls */
-
 tSirRetStatus
 PopulateDot11fTPCReport(tpAniSirGlobal      pMac,
                         tDot11fIETPCReport *pDot11f,
@@ -1695,7 +1515,7 @@
     {
         dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
                                   "eDot11fTPCReport; limGetMgmtStaid "
-                                  "returned status %d."),
+                                  "returned status %d.\n"),
                    nSirStatus );
         return eSIR_FAILURE;
     }
@@ -1812,7 +1632,6 @@
 {
     tANI_U32  val = 0;
 
-    limLog(pMac, LOG1, FL("populate WMM IE in Setup Request Frame"));
     pInfo->version = SIR_MAC_OUI_VERSION_1;
     pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
     pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
@@ -1820,7 +1639,8 @@
     pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
 
     if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS) 
-        PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length "));)
+        PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
+
     pInfo->max_sp_length = (tANI_U8)val;
     pInfo->present = 1;
 }
@@ -1916,7 +1736,7 @@
         if ( DOT11F_FAILED( status ) )
         {
             dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
-                                   "A (0x%08x)."),
+                                   "A (0x%08x).\n"),
                     status );
             return eSIR_FAILURE;
         }
@@ -1962,12 +1782,12 @@
     if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
         != eSIR_SUCCESS)
     {
-        limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag"));
+        limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag\n"));
         return eSIR_FAILURE;
     }
     if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
     {
-        limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag"));
+        limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag\n"));
         return eSIR_FAILURE;
     }
 
@@ -1992,14 +1812,14 @@
     status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes)"),
+        limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-      limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes)"),
+      limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes):\n"),
                  status, nFrame );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
     }
@@ -2007,7 +1827,7 @@
     // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
     if ( ! pr.SSID.present )
     {
-        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
     }
     else
     {
@@ -2017,7 +1837,7 @@
 
     if ( ! pr.SuppRates.present )
     {
-        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
         return eSIR_FAILURE;
     }
     else
@@ -2105,30 +1925,10 @@
                              RSNIE_CAPABILITY_LEN, DEFAULT_RSNIE_CAP_VAL );
                 *nMissingRsnBytes = RSNIE_CAPABILITY_LEN;
                 limLog(pMac, LOG1,
-                       FL("Added RSN Capability to the RSNIE as 0x00 0x00"));
+                       FL("Added RSN Capability to the RSNIE as 0x00 0x00\n"));
 
                 return eHAL_STATUS_SUCCESS;
-            } else {
-                /* Workaround: Some APs may add extra 0x00 padding after IEs.
-                 * Return true to allow these probe response frames proceed.
-                 */
-                if (nFrameBytes - length > 0) {
-                    tANI_U32 i;
-                    tANI_BOOLEAN zero_padding = VOS_TRUE;
-
-                    for (i = length; i < nFrameBytes; i ++) {
-                        if (pMgmtFrame[i-1] != 0x0) {
-                            zero_padding = VOS_FALSE;
-                            break;
-                        }
-                    }
-
-                    if (zero_padding) {
-                        return eHAL_STATUS_SUCCESS;
-                    }
-                }
             }
-
             return eSIR_FAILURE;
         }
     }
@@ -2146,14 +1946,14 @@
     // Ok, zero-init our [out] parameter,
     vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
 
-    pr = vos_mem_vmalloc(sizeof(tDot11fProbeResponse));
+    pr = vos_mem_malloc(sizeof(tDot11fProbeResponse));
     if ( NULL == pr )
         status = eHAL_STATUS_FAILURE;
     else
         status = eHAL_STATUS_SUCCESS;
     if (!HAL_STATUS_SUCCESS(status))
     {
-        limLog(pMac, LOGE, FL("Failed to allocate memory") );
+        limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
         return eSIR_FAILURE;
     }
 
@@ -2163,15 +1963,15 @@
     status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes)"),
+        limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
-        vos_mem_vfree(pr);
+        vos_mem_free(pr);
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-      limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes)"),
+      limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes):\n"),
                  status, nFrame );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
     }
@@ -2205,7 +2005,7 @@
 
     if ( ! pr->SSID.present )
     {
-        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
     }
     else
     {
@@ -2215,7 +2015,7 @@
 
     if ( ! pr->SuppRates.present )
     {
-        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
     }
     else
     {
@@ -2317,14 +2117,14 @@
     {
         pProbeResp->wmeEdcaPresent = 1;
         ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
-        PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!"));
+        PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!\n"));
                                 __printWMMParams(pMac, &pr->WMMParams);)
     }
 
     if ( pr->WMMInfoAp.present )
     {
         pProbeResp->wmeInfoPresent = 1;
-        PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!"));)
+        PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!\n"));)
     }
 
     if ( pr->WMMCaps.present )
@@ -2348,13 +2148,13 @@
                        sizeof(tANI_U16) );
         pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
 #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
-        limLog(pMac, LOG2, FL("mdie=%02x%02x%02x"), (unsigned int)pProbeResp->mdie[0],
+        limLog(pMac, LOG2, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
                (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
 #endif
     }
 #endif
 
-#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_ROAM_SCAN_OFFLOAD)
+#if defined FEATURE_WLAN_ESE
     if (pr->QBSSLoad.present)
     {
         vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
@@ -2379,8 +2179,7 @@
         vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
     }
 #endif
-
-    vos_mem_vfree(pr);
+    vos_mem_free(pr);
     return eSIR_SUCCESS;
 
 } // End sirConvertProbeFrame2Struct.
@@ -2401,7 +2200,7 @@
         status = eHAL_STATUS_SUCCESS;
     if (!HAL_STATUS_SUCCESS(status))
     {
-        limLog(pMac, LOGE, FL("Failed to allocate memory") );
+        limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
         return eSIR_FAILURE;
     }
         // Zero-init our [out] parameter,
@@ -2412,7 +2211,7 @@
     status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):"),
+        limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
         vos_mem_free(ar);
@@ -2420,7 +2219,7 @@
     }
     else if ( DOT11F_WARNED( status ) )
     {
-      limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):"),
+      limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):\n"),
                  status, nFrame );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
     }
@@ -2546,14 +2345,14 @@
 
     if ( ! pAssocReq->ssidPresent )
     {
-        PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE."));)
+        PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
         vos_mem_free(ar);
         return eSIR_FAILURE;
     }
 
     if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
     {
-        PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE."));)
+        PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
         vos_mem_free(ar);
         return eSIR_FAILURE;
     }
@@ -2562,13 +2361,13 @@
     if ( ar->VHTCaps.present )
     {
         vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
-        limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap"));
+        limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap\n"));
         limLogVHTCap( pMac, &pAssocReq->VHTCaps);
     }
     if ( ar->OperatingMode.present )
     {
         vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
-        limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE"));
+        limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
         limLogOperatingMode( pMac, &pAssocReq->operMode);
     }
 #endif
@@ -2594,14 +2393,14 @@
     status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes)"),
+        limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-        limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes)"),
+        limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes):\n"),
                    status, nFrame );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
     }
@@ -2632,7 +2431,7 @@
     if ( ! ar.SuppRates.present )
     {
         pAssocRsp->suppRatesPresent = 0;
-        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
     }
     else
     {
@@ -2668,12 +2467,11 @@
 
     if ( ar.HTCaps.present )
     {
-        limLog(pMac, LOG1, FL("Received Assoc Response with HT Cap"));
         vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
     }
 
     if ( ar.HTInfo.present )
-    {   limLog(pMac, LOG1, FL("Received Assoc Response with HT Info"));
+    {
         vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
     }
 
@@ -2779,14 +2577,14 @@
     status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes)"),
+        limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-      limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes)"),
+      limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes):\n"),
                  status, nFrame );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
     }
@@ -2892,13 +2690,13 @@
 
     if ( ! pAssocReq->ssidPresent )
     {
-        PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE."));)
+        PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
         return eSIR_FAILURE;
     }
 
     if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
     {
-        PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE."));)
+        PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
         return eSIR_FAILURE;
     }
 
@@ -2934,7 +2732,7 @@
     if ( ar.OperatingMode.present )
     {
         vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode  ) );
-        limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE"));
+        limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
         limLogOperatingMode( pMac, &pAssocReq->operMode);
     }
 #endif
@@ -2970,7 +2768,7 @@
         status = eHAL_STATUS_SUCCESS;
     if (!HAL_STATUS_SUCCESS(status))
     {
-        limLog(pMac, LOGE, FL("Failed to allocate memory") );
+        limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
         return eSIR_FAILURE;
     }
     // delegate to the framesc-generated code,
@@ -2978,14 +2776,14 @@
 
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
+        limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
                   status, nPayload);
         vos_mem_free(pBies);
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-      limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
+      limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
                  status, nPayload );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
     }
@@ -2993,7 +2791,7 @@
     // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
     if ( !pBies->SSID.present )
     {
-        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
     }
     else
     {
@@ -3005,7 +2803,7 @@
 
     if ( !pBies->SuppRates.present )
     {
-        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
     }
     else
     {
@@ -3099,19 +2897,14 @@
            retStatus = eSIR_FAILURE;
            goto err_bcnrep;
        }
-       if (eseBcnReportMandatoryIe.supportedRates.numRates <=
-             SIR_MAC_RATESET_EID_MAX) {
-           *pos = SIR_MAC_RATESET_EID;
-           pos++;
-           *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
-           pos++;
-           vos_mem_copy(pos,
-                        (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
-                        eseBcnReportMandatoryIe.supportedRates.numRates);
-           pos += eseBcnReportMandatoryIe.supportedRates.numRates;
-           freeBytes -= (1 + 1 +
-                         eseBcnReportMandatoryIe.supportedRates.numRates);
-       }
+       *pos = SIR_MAC_RATESET_EID;
+       pos++;
+       *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
+       pos++;
+       vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
+                    eseBcnReportMandatoryIe.supportedRates.numRates);
+       pos += eseBcnReportMandatoryIe.supportedRates.numRates;
+       freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates);
     }
 
     /* Fill FH Parameter set IE */
@@ -3269,7 +3062,7 @@
         status = eHAL_STATUS_SUCCESS;
     if (!HAL_STATUS_SUCCESS(status))
     {
-        limLog(pMac, LOGE, FL("Failed to allocate memory") );
+        limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
         return eSIR_FAILURE;
     }
     // delegate to the framesc-generated code,
@@ -3277,7 +3070,7 @@
 
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
+        limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
                   status, nPayload);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
         vos_mem_free(pBies);
@@ -3285,7 +3078,7 @@
     }
     else if ( DOT11F_WARNED( status ) )
     {
-      limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
+      limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
                  status, nPayload );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
     }
@@ -3293,7 +3086,7 @@
     // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
     if ( ! pBies->SSID.present )
     {
-        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
     }
     else
     {
@@ -3303,7 +3096,7 @@
 
     if ( ! pBies->SuppRates.present )
     {
-        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
     }
     else
     {
@@ -3479,12 +3272,6 @@
     }
 
 #endif
-    if (pBies->ExtCap.present )
-    {
-        pBeaconStruct->ExtCap.present = 1;
-        vos_mem_copy( &pBeaconStruct->ExtCap, &pBies->ExtCap,
-                        sizeof(tDot11fIEExtCap));
-    }
     vos_mem_free(pBies);
 
 
@@ -3513,14 +3300,14 @@
     // Zero-init our [out] parameter,
     vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
 
-    pBeacon = vos_mem_vmalloc(sizeof(tDot11fBeacon));
+    pBeacon = vos_mem_malloc(sizeof(tDot11fBeacon));
     if ( NULL == pBeacon )
         status = eHAL_STATUS_FAILURE;
     else
         status = eHAL_STATUS_SUCCESS;
     if (!HAL_STATUS_SUCCESS(status))
     {
-        limLog(pMac, LOGE, FL("Failed to allocate memory") );
+        limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
         return eSIR_FAILURE;
     }
 
@@ -3533,15 +3320,15 @@
     status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
+        limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
                   status, nPayload);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
-        vos_mem_vfree(pBeacon);
+        vos_mem_free(pBeacon);
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-      limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
+      limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
                  status, nPayload );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
     }
@@ -3574,7 +3361,7 @@
  
     if ( ! pBeacon->SSID.present )
     {
-        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
     }
     else
     {
@@ -3584,7 +3371,7 @@
 
     if ( ! pBeacon->SuppRates.present )
     {
-        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
+        PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
     }
     else
     {
@@ -3719,14 +3506,14 @@
     {
         pBeaconStruct->wmeEdcaPresent = 1;
         ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
-        PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!"));
+        PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!\n"));
         __printWMMParams(pMac, &pBeacon->WMMParams); )
     }
 
     if ( pBeacon->WMMInfoAp.present )
     {
         pBeaconStruct->wmeInfoPresent = 1;
-        PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!"));)
+        PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!\n"));)
     }
 
     if ( pBeacon->WMMCaps.present )
@@ -3796,8 +3583,7 @@
                      &pBeacon->OBSSScanParameters,
                      sizeof( tDot11fIEOBSSScanParameters));
     }
-
-    vos_mem_vfree(pBeacon);
+    vos_mem_free(pBeacon);
     return eSIR_SUCCESS;
 
 } // End sirConvertBeaconFrame2Struct.
@@ -3818,14 +3604,14 @@
     status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
     if ( DOT11F_FAILED( status ) )
     {
-        limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes)"),
+        limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-      limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes)"),
+      limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes):\n"),
                  status, nFrame );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
     }
@@ -3890,7 +3676,7 @@
     if ( DOT11F_FAILED( status ) )
     {
         limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
-                                 "rame (0x%08x, %d bytes)"),
+                                 "rame (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
         return eSIR_FAILURE;
@@ -3899,7 +3685,7 @@
     {
         limLog( pMac, LOGW, FL("There were warnings while unpackin"
                                   "g an Add TS Request frame (0x%08x,"
-                                  "%d bytes)"),
+                                  "%d bytes):\n"),
                    status, nFrame );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
     }
@@ -3916,7 +3702,7 @@
         }
         else
         {
-            limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.") );
+            limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.\n") );
             return eSIR_FAILURE;
         }
 
@@ -3928,7 +3714,7 @@
             {
                 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
                 {
-                    limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
+                    limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
                     return eSIR_FAILURE;
                 }
             }
@@ -3955,7 +3741,7 @@
             {
                 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
                 {
-                    limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
+                    limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
                     return eSIR_FAILURE;
                 }
             }
@@ -3969,7 +3755,7 @@
 
         if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
         {
-            limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE."),
+            limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
                        pAddTs->numTclas );
             return eSIR_FAILURE;
         }
@@ -3985,7 +3771,7 @@
         }
         else
         {
-            limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
+            limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
             return eSIR_FAILURE;
         }
     }
@@ -4041,7 +3827,7 @@
     if ( DOT11F_FAILED( status ) )
     {
         limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
-                                 "rame (0x%08x, %d bytes)"),
+                                 "rame (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
         return eSIR_FAILURE;
@@ -4050,7 +3836,7 @@
     {
         limLog( pMac, LOGW, FL("There were warnings while unpackin"
                                   "g an Add TS Response frame (0x%08x,"
-                                  "%d bytes)"),
+                                  "%d bytes):\n"),
                    status, nFrame );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
     }
@@ -4070,7 +3856,7 @@
         // TS Delay is present iff status indicates its presence
         if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
         {
-            limLog( pMac, LOGW, FL("Missing TSDelay IE.") );
+            limLog( pMac, LOGW, FL("Missing TSDelay IE.\n") );
         }
 
         if ( addts.TSPEC.present )
@@ -4079,7 +3865,7 @@
         }
         else
         {
-            limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.") );
+            limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.\n") );
             return eSIR_FAILURE;
         }
 
@@ -4091,7 +3877,7 @@
             {
                 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
                 {
-                    limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
+                    limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
                     return eSIR_FAILURE;
                 }
             }
@@ -4137,7 +3923,7 @@
             {
                 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
                 {
-                    limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
+                    limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
                     return eSIR_FAILURE;
                 }
             }
@@ -4151,7 +3937,7 @@
 
         if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
         {
-            limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE."),
+            limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
                        pAddTs->numTclas );
             return eSIR_FAILURE;
         }
@@ -4168,7 +3954,7 @@
         }
         else
         {
-            limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
+            limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
             return eSIR_FAILURE;
         }
 
@@ -4229,7 +4015,7 @@
     if ( DOT11F_FAILED( status ) )
     {
         limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
-                                 "rame (0x%08x, %d bytes)"),
+                                 "rame (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
         return eSIR_FAILURE;
@@ -4238,7 +4024,7 @@
     {
         dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
                                   "g an Del TS Request frame (0x%08x,"
-                                  "%d bytes):"),
+                                  "%d bytes):\n"),
                    status, nFrame );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
     }
@@ -4267,7 +4053,7 @@
         }
         else
         {
-            dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
+            dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
             return eSIR_FAILURE;
         }
     }
@@ -4285,16 +4071,16 @@
     tDot11fQosMapConfigure mapConfigure;
     tANI_U32 status;
     status = dot11fUnpackQosMapConfigure(pMac, pFrame, nFrame, &mapConfigure);
-    if ( DOT11F_FAILED( status ) || !mapConfigure.QosMapSet.present )
+    if ( DOT11F_FAILED( status ) )
     {
-        dot11fLog(pMac, LOGE, FL("Failed to parse or QosMapSet not present(0x%08x, %d bytes):"),
+        dot11fLog(pMac, LOGE, FL("Failed to parse Qos Map Configure frame (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-      dot11fLog( pMac, LOGW, FL("There were warnings while unpacking Qos Map Configure frame (0x%08x, %d bytes):"),
+      dot11fLog( pMac, LOGW, FL("There were warnings while unpacking Qos Map Configure frame (0x%08x, %d bytes):\n"),
                  status, nFrame );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
     }
@@ -4321,14 +4107,14 @@
     status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
     if ( DOT11F_FAILED( status ) )
     {
-        dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):"),
+        dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-      dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):"),
+      dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):\n"),
                  status, nFrame );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
     }
@@ -4345,7 +4131,7 @@
     }
     else
     {
-        dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!") );
+        dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!\n") );
         return eSIR_FAILURE;
     }
 
@@ -4364,20 +4150,20 @@
     tANI_U32                       status;
 
     // Zero-init our [out] parameter,
-    vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(*pMeasReqFrame), 0 );
+    vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(tpSirMacMeasReqActionFrame), 0 );
 
     // delegate to the framesc-generated code,
     status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
     if ( DOT11F_FAILED( status ) )
     {
-        dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):"),
+        dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
     {
-      dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes)"),
+      dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes):\n"),
                  status, nFrame );
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
     }
@@ -4390,7 +4176,7 @@
 
     if ( 0 == mr.num_MeasurementRequest )
     {
-        dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.") );
+        dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.\n") );
         return eSIR_FAILURE;
     }
     else if ( 1 < mr.num_MeasurementRequest )
@@ -4610,7 +4396,7 @@
         pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
         break;
     default:
-        limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS."),
+        limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
                 pDot11f->classifier_type );
         return eSIR_FAILURE;
     }
@@ -4682,7 +4468,7 @@
         pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
         break;
     default:
-        limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS."),
+        limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
                 pDot11f->classifier_type );
         return eSIR_FAILURE;
     }
@@ -4705,7 +4491,7 @@
     pDot11f->Version.minor = 0x00;
 
     if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
-        limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_STATE );
+        limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
 
     pDot11f->WPSState.present = 1;
     pDot11f->WPSState.state = (tANI_U8) wpsState;
@@ -4740,7 +4526,7 @@
     pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
 
     if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
-        limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
+        limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
 
     pDot11f->DevicePasswordID.present = 1;
     pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
@@ -5042,14 +4828,14 @@
 
 
     if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
-        limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_VERSION );
+        limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_VERSION );
 
     pDot11f->Version.present = 1;
     pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
     pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
 
     if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
-        limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_STATE );
+        limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
 
     pDot11f->WPSState.present = 1;
     pDot11f->WPSState.state = (tANI_U8) wpsState;
@@ -5095,7 +4881,7 @@
     else
     {
         pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
-        pDot11f->Manufacturer.name[cfgStrLen - 1] = '\0';
+        pDot11f->Manufacturer.name[cfgStrLen] = '\0';
     }
 
     pDot11f->ModelName.present = 1;
@@ -5111,7 +4897,7 @@
     else
     {
         pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
-        pDot11f->ModelName.text[cfgStrLen - 1] = '\0';
+        pDot11f->ModelName.text[cfgStrLen] = '\0';
     }
 
     pDot11f->ModelNumber.present = 1;
@@ -5127,7 +4913,7 @@
     else
     {
         pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
-        pDot11f->ModelNumber.text[cfgStrLen - 1] = '\0';
+        pDot11f->ModelNumber.text[cfgStrLen] = '\0';
     }
 
     pDot11f->SerialNumber.present = 1;
@@ -5143,21 +4929,21 @@
     else
     {
         pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
-        pDot11f->SerialNumber.text[cfgStrLen - 1] = '\0';
+        pDot11f->SerialNumber.text[cfgStrLen] = '\0';
     }
 
     pDot11f->PrimaryDeviceType.present = 1;
 
     if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
     {
-       limLog(pMac, LOGP, FL("cfg get prim device category failed"));
+       limLog(pMac, LOGP, FL("cfg get prim device category failed\n"));
     }
     else
        pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
 
     if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
     {
-       limLog(pMac, LOGP, FL("cfg get prim device OUI failed"));
+       limLog(pMac, LOGP, FL("cfg get prim device OUI failed\n"));
     }
     else
     {
@@ -5169,7 +4955,7 @@
 
     if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
     {
-       limLog(pMac, LOGP, FL("cfg get prim device sub category failed"));
+       limLog(pMac, LOGP, FL("cfg get prim device sub category failed\n"));
     }
     else
        pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
@@ -5187,7 +4973,7 @@
     else
     {
         pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
-        pDot11f->DeviceName.text[cfgStrLen - 1] = '\0';
+        pDot11f->DeviceName.text[cfgStrLen] = '\0';
     }
 
     if (wlan_cfgGetInt(pMac,
@@ -5222,7 +5008,7 @@
     pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
 
     if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
-       limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
+       limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
 
     pDot11f->DevicePasswordID.present = 1;
     pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
diff --git a/wlan/prima/CORE/SYS/legacy/src/utils/src/utilsParser.c b/wlan/prima/CORE/SYS/legacy/src/utils/src/utilsParser.c
index 3292b5c..98b09b6 100644
--- a/wlan/prima/CORE/SYS/legacy/src/utils/src/utilsParser.c
+++ b/wlan/prima/CORE/SYS/legacy/src/utils/src/utilsParser.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -689,8 +689,6 @@
 void ConvertQosMapsetFrame(tpAniSirGlobal pMac, tSirQosMapSet* Qos, tDot11fIEQosMapSet* dot11fIE)
 {
     tANI_U8 i,j=0;
-    if (dot11fIE->num_dscp_exceptions > 58)
-        dot11fIE->num_dscp_exceptions = 58;
     Qos->num_dscp_exceptions = (dot11fIE->num_dscp_exceptions - 16)/2;
     for (i=0;i<Qos->num_dscp_exceptions;i++)
     {
diff --git a/wlan/prima/CORE/TL/inc/wlan_qct_tl.h b/wlan/prima/CORE/TL/inc/wlan_qct_tl.h
index b309a1b..cbb2fa0 100644
--- a/wlan/prima/CORE/TL/inc/wlan_qct_tl.h
+++ b/wlan/prima/CORE/TL/inc/wlan_qct_tl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -102,10 +102,7 @@
 #define WLANTL_LLC_SNAP_OFFSET                0
 
 /*Size of the LLC/SNAP header*/
-#define WLANTL_LLC_SNAP_SIZE                  8
-
-/* Number of Tx Queues, this should be same as NUM_TX_QUEUES in HDD */
-#define WLANTL_NUM_TX_QUEUES                  5
+#define WLANTL_LLC_SNAP_SIZE                   8
 
 /*============================================================================
  *     GENERIC STRUCTURES - not belonging to TL 
@@ -156,26 +153,12 @@
  --------------------------------------------------------------------------*/
 typedef enum
 {
-  /* The values from 0-3 correspond both to the TL tx queue
-   * id and the also the AC corresponding to the packets queued
-   */
   WLANTL_AC_BK = 0,
   WLANTL_AC_BE = 1,
   WLANTL_AC_VI = 2,
-  WLANTL_AC_VO = 3,
-  /* WLANTL_AC_HIGH_PRIO corresponds to the new queue
-   * added for handling eapol/wapi/dhcp packets. The AC for the
-   * packets in this queue has to be extracted separately
-   */
-  WLANTL_AC_HIGH_PRIO = 4
+  WLANTL_AC_VO = 3
 }WLANTL_ACEnumType; 
 
-typedef struct
-{
-   v_MACADDR_t    selfMac;
-   v_MACADDR_t    spoofMac;
-}WLANTL_SpoofMacAddr;
-
 /*---------------------------------------------------------------------------
   STA Type
 ---------------------------------------------------------------------------*/
@@ -319,7 +302,7 @@
 typedef struct
 {
   /*AC weight for WFQ*/
-  v_U8_t   ucAcWeights[WLANTL_NUM_TX_QUEUES];
+  v_U8_t   ucAcWeights[WLANTL_MAX_AC]; 
 
   /*Delayed trigger frame timmer: - used by TL to send trigger frames less 
     often when it has established that the App is suspended*/
@@ -406,9 +389,6 @@
 ---------------------------------------------------------------------------*/      
 typedef struct
 {
-  /* Save the AC of the packet */
-  WLANTL_ACEnumType ac;
-
   /* TID of the packet being sent */
   v_U8_t    ucTID;
 
@@ -440,7 +420,6 @@
   v_BOOL_t  bMorePackets;
   /* notifying TL if this is an ARP frame or not */
   v_U8_t    ucIsArp;
-  v_U32_t   ucTxBdToken;
 }WLANTL_MetaInfoType;
 
 /*---------------------------------------------------------------------------
@@ -609,8 +588,8 @@
 typedef enum
 {
   WLANTL_DEBUG_TX_SNAPSHOT = 1<<0,
+
   WLANTL_DEBUG_FW_CLEANUP = 1<<1,
-  WLANTL_DEBUG_KICKDXE = 1<<2
 }WLANTL_DebugFlags;
 
 /*----------------------------------------------------------------------------
@@ -691,9 +670,6 @@
                                             vos_pkt_t**           vosDataBuff,
                                             WLANTL_MetaInfoType*  tlMetaInfo);
 
-typedef VOS_STATUS (*WLANTL_MonRxCBType)( v_PVOID_t              pvosGCtx,
-                                          vos_pkt_t*             vosDataBuff,
-                                          int                    conversion);
 /*----------------------------------------------------------------------------
 
   DESCRIPTION   
@@ -1118,8 +1094,6 @@
   v_BOOL_t enableFrameXlation
 );
 
-VOS_STATUS WLANTL_SetMonRxCbk(v_PVOID_t pvosGCtx, WLANTL_MonRxCBType pfnMonRx);
-void WLANTL_SetIsConversionReq(v_PVOID_t pvosGCtx, v_BOOL_t isConversionReq);
 /*===========================================================================
 
   FUNCTION    WLANTL_RegisterSTAClient
@@ -1836,42 +1810,6 @@
 
 /*==========================================================================
 
-  FUNCTION    WLANTL_updateSpoofMacAddr
-
-  DESCRIPTION
-    Called by HDD to update macaddr
-
-  DEPENDENCIES
-    TL must be initialized before this API can be called.
-
-  PARAMETERS
-
-    IN
-    pvosGCtx:           pointer to the global vos context; a handle to
-                        TL's control block can be extracted from its context
-    spoofMacAddr:     spoofed mac adderess
-    selfMacAddr:        self Mac Address
-
-  RETURN VALUE
-    The result code associated with performing the operation
-
-    VOS_STATUS_E_INVAL:  Input parameters are invalid
-    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a
-                         page fault
-    VOS_STATUS_SUCCESS:  Everything is good :)
-
-  SIDE EFFECTS
-
-============================================================================*/
-VOS_STATUS
-WLANTL_updateSpoofMacAddr
-(
-  v_PVOID_t               pvosGCtx,
-  v_MACADDR_t*            spoofMacAddr,
-  v_MACADDR_t*            selfMacAddr
-);
-/*==========================================================================
-
   FUNCTION    WLANTL_RegisterMgmtFrmClient
 
   DESCRIPTION 
@@ -2008,8 +1946,7 @@
   v_U8_t               tid,
   WLANTL_TxCompCBType  pfnCompTxFunc,
   v_PVOID_t            voosBDHeader,
-  v_U32_t              ucAckResponse,
-  v_U32_t              ucTxBdToken
+  v_U32_t              ucAckResponse
 );
 
 
@@ -2225,41 +2162,6 @@
 );
 
 /*==========================================================================
-
-  FUNCTION    WLANTL_IsEAPOLPending
-
-  DESCRIPTION
-
-    HDD calls this function when hdd_tx_timeout occurs. This checks whether
-    EAPOL is pending.
-
-  DEPENDENCIES
-
-    HDD must have registered with TL at least one STA before this function
-    can be called.
-
-  PARAMETERS
-
-    IN
-    pvosGCtx:       pointer to the global vos context
-
-  RETURN VALUE
-
-    The result code associated with performing the operation
-
-    Success : Indicates EAPOL frame is pending and sta is in connected state
-
-    Failure : EAPOL frame is not pending
-
-  SIDE EFFECTS
-============================================================================*/
-VOS_STATUS
-WLANTL_IsEAPOLPending
-(
-  v_PVOID_t     pvosGCtx
-);
-
-/*==========================================================================
     VOSS SCHEDULER INTERACTION
   ==========================================================================*/
 
@@ -2945,15 +2847,15 @@
 
   DESCRIPTION
      This function is used by HDD to notify TL to finish Upper layer authentication
-     incase the last EAPOL packet is pending in the TL queue.
-     To avoid the race condition between sme set key and the last EAPOL packet
+     incase the last EAPOL packet is pending in the TL queue. 
+     To avoid the race condition between sme set key and the last EAPOL packet 
      the HDD module calls this function just before calling the sme_RoamSetKey.
-
+   
   DEPENDENCIES
 
     TL must have been initialized before this gets called.
 
-
+   
   PARAMETERS
 
    callbackRoutine:   HDD Callback function.
@@ -2962,9 +2864,9 @@
   RETURN VALUE
 
    VOS_STATUS_SUCCESS/VOS_STATUS_FAILURE
-
+   
   SIDE EFFECTS
-
+   
 ============================================================================*/
 
 VOS_STATUS WLANTL_Finish_ULA( void (*callbackRoutine) (void *callbackContext),
@@ -3289,67 +3191,4 @@
  v_VOID_t
 );
 
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-void WLANTL_StartRxRateMonitor(v_PVOID_t pvosGCtx, wpt_uint8 staId,
-                  wpt_uint16 minRate,
-                  wpt_uint16 maxRate, wpt_uint8 minPercentage,
-                  wpt_uint16 minPktRequired, void *hHal,
-                  wpt_uint64 timeToWait,
-                  void (*triggerRoamScanfn) (void *, wpt_uint8));
-
-void WLANTL_StopRxRateMonitor(v_PVOID_t pvosGCtx);
-#endif
-#ifdef WLAN_FEATURE_RMC
-VOS_STATUS
-WLANTL_EnableRMC
-(
-    v_PVOID_t     pvosGCtx,
-    v_MACADDR_t   *pMcastAddr
-);
-
-
-VOS_STATUS
-WLANTL_DisableRMC
-(
-    v_PVOID_t     pvosGCtx,
-    v_MACADDR_t   *pMcastAddr
-);
-
-/*=============================================================================
-  FUNCTION    WLANTL_SetMcastDuplicateDetection
-
-  DESCRIPTION
-    This function sets multicate duplicate detection operation.
-    If enable is 1, the detection is enabled, else it is disabled.
-
-  DEPENDENCIES
-
-  PARAMETERS
-
-   IN
-
-   pvosGCtx   : Pointer to VOS global context
-   enable : Boolean to enable or disable
-
-  RETURN VALUE
-    The result code associated with performing the operation
-
-    VOS_STATUS_E_FAULT:   Sanity check on input failed
-
-    VOS_STATUS_SUCCESS:   Everything is good :)
-
-   Other return values are possible coming from the called functions.
-   Please check API for additional info.
-
-  SIDE EFFECTS
-
-==============================================================================*/
-VOS_STATUS
-WLANTL_SetMcastDuplicateDetection
-(
-    v_PVOID_t     pvosGCtx,
-    v_U8_t        enable
-);
-#endif /* WLAN_FEATURE_RMC */
-
 #endif /* #ifndef WLAN_QCT_WLANTL_H */
diff --git a/wlan/prima/CORE/TL/src/wlan_qct_tl.c b/wlan/prima/CORE/TL/src/wlan_qct_tl.c
index b74b1b6..ecadd49 100644
--- a/wlan/prima/CORE/TL/src/wlan_qct_tl.c
+++ b/wlan/prima/CORE/TL/src/wlan_qct_tl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -45,6 +45,9 @@
   Are listed for each API below.
 
 
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
@@ -61,7 +64,6 @@
 
   when        who     what, where, why
 ----------    ---    --------------------------------------------------------
-2013-08-19    rajekuma Added RMC support
 2010-07-13    c_shinde Fixed an issue where WAPI rekeying was failing because 
                       WAI frame sent out during rekeying had the protected bit
                       set to 1.
@@ -139,7 +141,6 @@
 #include "vos_trace.h"
 #include "wlan_qct_tl_trace.h"
 #include "tlDebug.h"
-#include "cfgApi.h"
 #ifdef FEATURE_WLAN_WAPI
 /*Included to access WDI_RxBdType */
 #include "wlan_qct_wdi_bd.h"
@@ -203,9 +204,6 @@
      ( ( WLANTL_80211_MGMT_ACTION_SUBTYPE == ( (_type_sub) & 0xF )) || \
        ( WLANTL_80211_MGMT_ACTION_NO_ACK_SUBTYPE == ( (_type_sub) & 0xF ))))
 
-#define WLANTL_IS_PROBE_REQ(_type_sub)                                     \
-                     ( WLANTL_MGMT_PROBE_REQ_FRAME_TYPE == ( (_type_sub) & 0x3F ))
-
 #define WLANTL_IS_CTRL_FRAME(_type_sub)                                     \
                      ( WLANTL_CTRL_FRAME_TYPE == ( (_type_sub) & 0x30 ))
 
@@ -217,7 +215,7 @@
 /*MAX Allowed len processed by TL - MAx MTU + 802.3 header + BD+DXE+XTL*/
 #define WLANTL_MAX_ALLOWED_LEN    (1514 + 100)
 
-#define WLANTL_DATA_FLOW_MASK 0x0F
+#define WLANTL_MASK_AC  0x03
 
 //some flow_control define
 //LWM mode will be enabled for this station if the egress/ingress falls below this ratio
@@ -239,10 +237,6 @@
 /* Maximum value of SNR that can be calculated by the HW */
 #define WLANTL_MAX_HW_SNR 35
 
-#define DISABLE_ARP_TOGGLE 0
-#define ENABLE_ARP_TOGGLE  1
-#define SEND_ARP_ON_WQ5    2
-
 /*----------------------------------------------------------------------------
  * Type Declarations
  * -------------------------------------------------------------------------*/
@@ -326,7 +320,7 @@
   do\
   {\
     _ucACMask = 0; \
-    for ( i = 0; i < WLANTL_NUM_TX_QUEUES; i++ ) \
+    for ( i = 0; i < WLANTL_MAX_AC; i++ ) \
     { \
       if ( 0 != (_pSTA)->aucACMask[i] ) \
       { \
@@ -335,178 +329,6 @@
     } \
   } while (0);
 
-
-/* Following is the copy of g11bRateInfo to understand rate index at TL */
-#define WLANTL_MAX_RATE_NUM               137
-typedef struct
-{
-   uint32 phyRate;   //unit in Mega bits per sec X 10
-   uint32 tputRate;  //unit in Mega bits per sec X 10
-   uint32 tputBpms;  //unit in Bytes per msec = (tputRateX1024x1024)/(8x10X1000) ~= (tputRate*13)
-   uint32 tputBpus;  //unit in Bytes per usec: round off to integral value
-}WLANTL_RateInfo;
-
-WLANTL_RateInfo gTLRateInfo[WLANTL_MAX_RATE_NUM]  = {
-    //11b rates
-    {  10,  9,  117, 0}, //index 0
-    {  20,  17, 221, 0}, //index 1
-    {  55,  41, 533, 0}, //index 2
-    { 110,  68, 884, 0}, //index 3
-
-    //11b short preamble
-    {  10,  10,  130, 0}, //index 4
-    {  20,  18,  234, 0}, //index 5
-    {  55,  44,  572, 0}, //index 6
-    { 110,  77, 1001, 0}, //index 7
-
-    //11ag
-    {  60,  50,  650, 1}, //index 8
-    {  90,  70,  910, 1}, //index 9
-    { 120, 100, 1300, 1}, //index 10
-    { 180, 150, 1950, 2}, //index 11
-    { 240, 190, 2470, 2}, //index 12
-    { 360, 280, 3640, 4}, //index 13
-    { 480, 350, 4550, 5}, //index 14
-    { 540, 380, 4940, 6}, //index 15
-
-    //11n SIMO
-    {  65,  54,  702, 1}, //index 16
-    { 130, 108, 1404, 1}, //index 17
-    { 195, 161, 2093, 2}, //index 18
-    { 260, 217, 2821, 3}, //index 19
-    { 390, 326, 4238, 4}, //index 20
-    { 520, 435, 5655, 6}, //index 21
-    { 585, 492, 6396, 6}, //index 22
-    { 650, 548, 7124, 7}, //index 23
-
-    //11n SIMO SGI
-    {  72,  59,  767, 1}, //index 24
-    { 144, 118, 1534, 2}, //index 25
-    { 217, 180, 2340, 2}, //index 26
-    { 289, 243, 3159, 3}, //index 27
-    { 434, 363, 4719, 5}, //index 28
-    { 578, 486, 6318, 6}, //index 29
-    { 650, 548, 7124, 7}, //index 30
-    { 722, 606, 7878, 8}, //index 31
-
-    //11n GF SIMO
-    {  65,  54,  702, 1}, //index 32
-    { 130, 108, 1404, 1}, //index 33
-    { 195, 161, 2093, 2}, //index 34
-    { 260, 217, 2821, 3}, //index 35
-    { 390, 326, 4238, 4}, //index 36
-    { 520, 435, 5655, 6}, //index 37
-    { 585, 492, 6396, 6}, //index 38
-    { 650, 548, 7124, 7}, //index 39
-
-    //11n SIMO CB MCS 0 - 7
-    { 135,   110,  1430,  1}, //index 40
-    { 270,   223,  2899,  3}, //index 41
-    { 405,   337,  4381,  4}, //index 42
-    { 540,   454,  5902,  6}, //index 43
-    { 810,   679,  8827,  9}, //index 44
-    { 1080,  909, 11817, 12}, //index 45
-    { 1215, 1022, 13286, 13}, //index 46
-    { 1350, 1137, 14781, 15}, //index 47
-
-    //11n SIMO CB SGI MCS 0 - 7
-    { 150,   121,  1573,  2}, //index 48
-    { 300,   249,  3237,  3}, //index 49
-    { 450,   378,  4914,  5}, //index 50
-    { 600,   503,  6539,  7}, //index 51
-    { 900,   758,  9854,  10}, //index 52
-    { 1200, 1010, 13130, 13}, //index 53
-    { 1350, 1137, 14781, 15}, //index 54
-    { 1500, 1262, 16406, 16}, //index 55
-
-    //11n SIMO GF CB MCS 0 - 7
-    { 135,   110,   1430,  1}, //index 56
-    { 270,   223,   2899,  3}, //index 57
-    { 405,   337,   4381,  4}, //index 58
-    { 540,   454,   5902,  6}, //index 59
-    { 810,   679,   8827,  9}, //index 60
-    { 1080,  909,  11817, 12}, //index 61
-    { 1215, 1022,  13286, 13}, //index 62
-    { 1350, 1137,  14781, 15}, //index 63
-
-    //11AC
-    { 1350,  675,  8775,  9}, //reserved 64
-    { 1350,  675,  8775,  9}, //reserved 65
-    {   65,   45,   585,  1}, //index 66
-    {  130,   91,  1183,  1}, //index 67
-    {  195,  136,  1768,  2}, //index 68
-    {  260,  182,  2366,  2}, //index 69
-    {  390,  273,  3549,  4}, //index 70
-    {  520,  364,  4732,  5}, //index 71
-    {  585,  409,  5317,  5}, //index 72
-    {  650,  455,  5915,  6}, //index 73
-    {  780,  546,  7098,  7}, //index 74
-    { 1350,  675,  8775,  9}, //reserved 75
-    { 1350,  675,  8775,  9}, //reserved 76
-    { 1350,  675,  8775,  9}, //reserved 77
-    { 1350,  675,  8775,  9}, //index 78
-    { 1350,  675,  8775,  9}, //index 79
-    { 1350,  675,  8775,  9}, //index 80
-    { 1350,  675,  8775,  9}, //index 81
-    { 1350,  675,  8775,  9}, //index 82
-    { 1350,  675,  8775,  9}, //index 83
-    {  655,  458,  5954,  6}, //index 84
-    {  722,  505,  6565,  7}, //index 85
-    {  866,  606,  7878,  8}, //index 86
-    { 1350,  675,  8775,  9}, //reserved 87
-    { 1350,  675,  8775,  9}, //reserved 88
-    { 1350,  675,  8775,  9}, //reserved 89
-    {  135,   94,  1222,  1}, //index 90
-    {  270,  189,  2457,  2}, //index 91
-    {  405,  283,  3679,  4}, //index 92
-    {  540,  378,  4914,  5}, //index 93
-    {  810,  567,  7371,  7}, //index 94
-    { 1080,  756,  9828, 10}, //index 95
-    { 1215,  850, 11050, 11}, //index 96
-    { 1350,  675,  8775,  9}, //index 97
-    { 1350,  675,  8775,  9}, //index 98
-    { 1620,  810, 10530, 11}, //index 99
-    { 1800,  900, 11700, 12}, //index 100
-    { 1350,  675,  8775,  9}, //reserved 101
-    { 1350,  675,  8775,  9}, //index 102
-    { 1350,  675,  8775,  9}, //index 103
-    { 1350,  675,  8775,  9}, //index 104
-    { 1350,  675,  8775,  9}, //index 105
-    { 1350,  675,  8775,  9}, //index 106
-    { 1200,  840, 10920, 11}, //index 107
-    { 1350,  675,  8775,  9}, //index 108
-    { 1500,  750,  9750, 10}, //index 109
-    { 1350,  675,  8775,  9}, //index 110
-    { 1800,  900, 11700, 12}, //index 111
-    { 2000, 1000, 13000, 13}, //index 112
-    { 1350,  675,  8775,  9}, //index 113
-    {  292,  204,  2652,  3}, //index 114
-    {  585,  409,  5317,  5}, //index 115
-    {  877,  613,  7969,  8}, //index 116
-    { 1170,  819, 10647, 11}, //index 117
-    { 1755,  877, 11401, 11}, //index 118
-    { 2340, 1170, 15210, 15}, //index 119
-    { 2632, 1316, 17108, 17}, //index 120
-    { 2925, 1462, 19006, 19}, //index 121
-    { 1350,  675,  8775,  9}, //index 122
-    { 3510, 1755, 22815, 23}, //index 123
-    { 3900, 1950, 25350, 25}, //index 124
-    { 1350,  675,  8775,  9}, //reserved 125
-    { 1350,  675,  8775,  9}, //index 126
-    { 1350,  675,  8775,  9}, //index 127
-    { 1350,  675,  8775,  9}, //index 128
-    { 1350,  675,  8775,  9}, //index 129
-    { 1350,  675,  8775,  9}, //index 130
-    { 1350,  675,  8775,  9}, //index 131
-    { 2925, 1462, 19006, 19}, //index 132
-    { 3250, 1625, 21125, 21}, //index 133
-    { 1350,  675,  8775,  9}, //index 134
-    { 3900, 1950, 25350, 25}, //index 135
-    { 4333, 2166, 28158, 28}  //index 136
- };
-
-
-
 /*----------------------------------------------------------------------------
  * Static Variable Definitions
  * -------------------------------------------------------------------------*/
@@ -524,6 +346,32 @@
   v_U16_t              * usEtherType
 );
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/* FIXME_MUST: during TDLS integration to main/latest, WLANTL_GetEtherType() conflicts.
+But there is difference. existing WLANTL_GetEtherType() expects vosDataBuff->offset points to MPDU Header,
+wherease TDLS expect vosDataBuff->offset should still points to RxBd. 
+So far, data frmae stripped RxBD and passed to data frame handler.
+(RxBd should not be stripped in case TDLS, because it will be eventually routed to mgmt packet 
+handler, where RX BD should be preserved)
+To avoid breaking existing functionality, for now, I temporarily rename to
+WLANTL_GetEtherType_2(). Eventually this function should be removed and merged to WLANTL_GetEtherType()
+*/
+static VOS_STATUS 
+WLANTL_GetEtherType_2
+(
+  v_U8_t               * aucBDHeader,
+  vos_pkt_t            * vosDataBuff,
+  v_U8_t                 ucMPDUHLen,
+  v_U16_t              * usEtherType
+);
+#endif
+#ifdef FEATURE_WLAN_WAPI
+/*---------------------------------------------------------------------------
+ * Adding a global variable to be used when doing frame translation in TxAuth
+ * state so as to not set the protected bit to 1 in the case of WAI frames
+ *---------------------------------------------------------------------------*/
+v_U8_t gUcIsWai;
+#endif
 
 /*----------------------------------------------------------------------------
  * Externalized Function Definitions
@@ -668,7 +516,7 @@
       }
   }
 
-  pTLCb->reorderBufferPool = vos_mem_vmalloc(sizeof(WLANTL_REORDER_BUFFER_T) * WLANTL_MAX_BA_SESSION);
+  pTLCb->reorderBufferPool = vos_mem_malloc(sizeof(WLANTL_REORDER_BUFFER_T) * WLANTL_MAX_BA_SESSION);
   if (NULL == pTLCb->reorderBufferPool)
   {
     TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WLAN TL: Reorder buffer allocation failed"));
@@ -681,7 +529,7 @@
 
   WLANTL_CleanCB(pTLCb, 0 /*do not empty*/);
 
-  for ( ucIndex = 0; ucIndex < WLANTL_NUM_TX_QUEUES ; ucIndex++)
+  for ( ucIndex = 0; ucIndex < WLANTL_MAX_AC ; ucIndex++)
   {
     pTLCb->tlConfigInfo.ucAcWeights[ucIndex] = pTLConfig->ucAcWeights[ucIndex];
   }
@@ -730,22 +578,12 @@
     TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "Handoff support module init fail"));
     WLANTL_FreeClientMemory(pTLCb->atlSTAClients);
-    vos_mem_vfree(pTLCb->reorderBufferPool);
+    vos_mem_free(pTLCb->reorderBufferPool);
     vos_free_context(pvosGCtx, VOS_MODULE_ID_TL, pTLCb);
     return status;
   }
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-   status = WLANTL_RmcInit(pvosGCtx);
-   if (!VOS_IS_STATUS_SUCCESS(status))
-   {
-    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-              "RMC module init fail"));
-    return status;
-  }
-#endif
-
   pTLCb->isBMPS = VOS_FALSE;
   pmcRegisterDeviceStateUpdateInd( smeContext,
                                    WLANTL_PowerStateChangedCB, pvosGCtx );
@@ -1003,14 +841,6 @@
   }
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-  if(VOS_STATUS_SUCCESS != WLANTL_RmcDeInit(pvosGCtx))
-  {
-    TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
-               "RMC module DeInit fail"));
-  }
-#endif
-
   /*------------------------------------------------------------------------
     Cleanup TL control block.
    ------------------------------------------------------------------------*/
@@ -1020,7 +850,7 @@
 
   WLANTL_FreeClientMemory(pTLCb->atlSTAClients);
 
-  vos_mem_vfree(pTLCb->reorderBufferPool);
+  vos_mem_free(pTLCb->reorderBufferPool);
 
   /*------------------------------------------------------------------------
     Free TL context from VOSS global
@@ -1253,7 +1083,7 @@
        " %s fails to start forwarding (staId %d)", __func__, staId);
   }
 }
-
+  
   /*===========================================================================
 
   FUNCTION  WLANTL_Finish_ULA
@@ -1267,18 +1097,18 @@
   DEPENDENCIES
 
      TL must have been initialized before this gets called.
-
+  
   PARAMETERS
 
    callbackRoutine:   HDD Callback function.
    callbackContext : HDD userdata context.
-
+  
    RETURN VALUE
 
    VOS_STATUS_SUCCESS/VOS_STATUS_FAILURE
-
+   
   SIDE EFFECTS
-
+   
 ============================================================================*/
 
 VOS_STATUS WLANTL_Finish_ULA( void (*callbackRoutine) (void *callbackContext),
@@ -1346,8 +1176,6 @@
   WLANTL_CbType*  pTLCb = NULL;
   WLANTL_STAClientType* pClientSTA = NULL;
   v_U8_t    ucTid = 0;/*Local variable to clear previous replay counters of STA on all TIDs*/
-  v_U32_t   istoggleArpEnb = 0;
-  tpAniSirGlobal pMac;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
   /*------------------------------------------------------------------------
@@ -1430,20 +1258,11 @@
   pClientSTA->tlPri    = WLANTL_STA_PRI_NORMAL;
   pClientSTA->wSTADesc.ucSTAId  = pwSTADescType->ucSTAId;
   pClientSTA->ptkInstalled = 0;
-  pClientSTA->disassoc_progress = VOS_FALSE;
-
-  pMac = vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
-  if ( NULL != pMac )
-  {
-    wlan_cfgGetInt(pMac, WNI_CFG_TOGGLE_ARP_BDRATES, &istoggleArpEnb);
-  }
-  pClientSTA->arpRate = istoggleArpEnb ? ENABLE_ARP_TOGGLE : DISABLE_ARP_TOGGLE;
-  pClientSTA->arpOnWQ5 = istoggleArpEnb == SEND_ARP_ON_WQ5;
 
   TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
-   "WLAN TL:Registering STA Client ID: %d with UC %d and BC %d toggleArp :%hhu",
-    pwSTADescType->ucSTAId, pwSTADescType->ucUcastSig,
-    pwSTADescType->ucBcastSig, pClientSTA->arpRate));
+             "WLAN TL:Registering STA Client ID: %d with UC %d and BC %d", 
+             pwSTADescType->ucSTAId, 
+              pwSTADescType->ucUcastSig, pwSTADescType->ucBcastSig));
 
   pClientSTA->wSTADesc.wSTAType = pwSTADescType->wSTAType;
 
@@ -1513,7 +1332,7 @@
       made in the main TL loop after the supported mask is properly
       updated in the pending packets call
     --------------------------------------------------------------------*/
-  pClientSTA->ucCurrentAC     = WLANTL_AC_HIGH_PRIO;
+  pClientSTA->ucCurrentAC     = WLANTL_AC_VO;
   pClientSTA->ucCurrentWeight = 0;
   pClientSTA->ucServicedAC    = WLANTL_AC_BK;
   pClientSTA->ucEapolPktPending = 0;
@@ -1565,7 +1384,6 @@
      data to calculate RSSI. So to avoid reporting zero, we are initializing
      RSSI with RSSI saved in BssDescription during scanning. */
   pClientSTA->rssiAvg = rssi;
-  pClientSTA->rssiAvgBmps = rssi;
 #ifdef FEATURE_WLAN_TDLS
   if(WLAN_STA_TDLS == pClientSTA->wSTADesc.wSTAType)
   {
@@ -1643,10 +1461,6 @@
         pTLCb->ucTdlsPeerCount++;
 #endif
   }
-#ifdef WLAN_FEATURE_RMC
-  vos_lock_init(&pClientSTA->mcLock);
-#endif /* WLAN_FEATURE_RMC */
-
   return VOS_STATUS_SUCCESS;
 }/* WLANTL_RegisterSTAClient */
 
@@ -1751,15 +1565,6 @@
              "WLAN TL:Clearing STA Client ID: %d", ucSTAId ));
   WLANTL_CleanSTA(pTLCb->atlSTAClients[ucSTAId], 1 /*empty packets*/);
 
-#ifdef WLAN_FEATURE_RMC
-  /*--------------------------------------------------------------------
-    Delete multicast entries for duplicate detection
-    --------------------------------------------------------------------*/
-  WLANTL_McastDeleteAllEntries(pTLCb->atlSTAClients[ucSTAId]);
-
-  vos_lock_destroy(&pTLCb->atlSTAClients[ucSTAId]->mcLock);
-#endif /* WLAN_FEATURE_RMC */
-
   TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
              "WLAN TL:Clearing STA Reset History RSSI and Region number"));
   pTLCb->hoSupport.currentHOState.historyRSSI = 0;
@@ -1945,44 +1750,10 @@
 
   pClientSTA->wSTADesc.ucQosEnabled = pwSTADescType->ucQosEnabled;
 
-  TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-         "WLAN TL: %s: ucQosEnabled of pwSTADescType: %d"
-          "pClientSTA->wSTADesc: %d",
-          __func__, pwSTADescType->ucQosEnabled,
-          pClientSTA->wSTADesc.ucQosEnabled));
-
   return VOS_STATUS_SUCCESS;
 
 }
 
-VOS_STATUS WLANTL_SetMonRxCbk(v_PVOID_t pvosGCtx, WLANTL_MonRxCBType pfnMonRx)
-{
-  WLANTL_CbType*  pTLCb = NULL ;
-  pTLCb = VOS_GET_TL_CB(pvosGCtx);
-  if ( NULL == pTLCb )
-  {
-    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-      "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterSTAClient"));
-    return VOS_STATUS_E_FAULT;
-  }
-  pTLCb->pfnMonRx = pfnMonRx;
-  return VOS_STATUS_SUCCESS;
-}
-
-void WLANTL_SetIsConversionReq(v_PVOID_t pvosGCtx, v_BOOL_t isConversionReq)
-{
-  WLANTL_CbType*  pTLCb = NULL ;
-  pTLCb = VOS_GET_TL_CB(pvosGCtx);
-  if ( NULL == pTLCb )
-  {
-    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-      "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_RegisterSTAClient"));
-    return;
-  }
-  pTLCb->isConversionReq = isConversionReq;
-  return;
-}
-
 
 /*===========================================================================
 
@@ -2384,6 +2155,8 @@
        if (( pTLCb->uResCount >=  WDA_TLI_MIN_RES_DATA ) &&
           ( 0 == pTLCb->ucTxSuspended ))
       {
+        MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_STA_PKT_PENDING,
+                      ucSTAId, pClientSTA->tlState ));
 
         TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
               "Issuing Xmit start request to BAL"));
@@ -2752,8 +2525,7 @@
                     ucWDSEnabled, extraHeadSpace, pMetaInfo->ucType,
                             &pTLCb->atlSTAClients[ucStaId]->wSTADesc.vSelfMACAddress,
                     pMetaInfo->ucTID, 0 /* No ACK */, pMetaInfo->usTimeStamp,
-                    pMetaInfo->ucIsEapol || pMetaInfo->ucIsWai, pMetaInfo->ucUP,
-                    pMetaInfo->ucTxBdToken);
+                    pMetaInfo->ucIsEapol || pMetaInfo->ucIsWai, pMetaInfo->ucUP );
 
   if ( VOS_STATUS_SUCCESS != vosStatus )
   {
@@ -3270,68 +3042,7 @@
 /*----------------------------------------------------------------------------
     INTERACTION WITH PE
  ---------------------------------------------------------------------------*/
-/*==========================================================================
 
-  FUNCTION    WLANTL_updateSpoofMacAddr
-
-  DESCRIPTION
-    Called by HDD to update macaddr
-
-  DEPENDENCIES
-    TL must be initialized before this API can be called.
-
-  PARAMETERS
-
-    IN
-    pvosGCtx:           pointer to the global vos context; a handle to
-                        TL's control block can be extracted from its context
-    spoofMacAddr:     spoofed mac adderess
-    selfMacAddr:        self Mac Address
-
-  RETURN VALUE
-    The result code associated with performing the operation
-
-    VOS_STATUS_E_INVAL:  Input parameters are invalid
-    VOS_STATUS_E_FAULT:  pointer to TL cb is NULL ; access would cause a
-                         page fault
-    VOS_STATUS_SUCCESS:  Everything is good :)
-
-  SIDE EFFECTS
-
-============================================================================*/
-VOS_STATUS
-WLANTL_updateSpoofMacAddr
-(
-  v_PVOID_t               pvosGCtx,
-  v_MACADDR_t*            spoofMacAddr,
-  v_MACADDR_t*            selfMacAddr
-)
-{
-  WLANTL_CbType*  pTLCb = NULL;
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-  /*------------------------------------------------------------------------
-    Extract TL control block
-   ------------------------------------------------------------------------*/
-  pTLCb = VOS_GET_TL_CB(pvosGCtx);
-  if ( NULL == pTLCb )
-  {
-    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-          "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_ChangeSTAState");
-    return VOS_STATUS_E_FAULT;
-  }
-
-  vos_mem_copy(pTLCb->spoofMacAddr.selfMac.bytes, selfMacAddr,
-                                                         VOS_MAC_ADDRESS_LEN);
-  vos_mem_copy(pTLCb->spoofMacAddr.spoofMac.bytes, spoofMacAddr,
-                                                         VOS_MAC_ADDRESS_LEN);
-
-  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
-                "TL: SelfSTA mac Addr for current Scan "MAC_ADDRESS_STR,
-                        MAC_ADDR_ARRAY(pTLCb->spoofMacAddr.selfMac.bytes));
-
-  return VOS_STATUS_SUCCESS;
-}/* WLANTL_updateSpoofMacAddr */
 /*==========================================================================
 
   FUNCTION    WLANTL_RegisterMgmtFrmClient
@@ -3569,8 +3280,7 @@
   v_U8_t               ucTid,
   WLANTL_TxCompCBType  pfnCompTxFunc,
   v_PVOID_t            pvBDHeader,
-  v_U32_t              ucAckResponse,
-  v_U32_t               ucTxBdToken
+  v_U32_t              ucAckResponse
 )
 {
   WLANTL_CbType*  pTLCb = NULL;
@@ -3675,26 +3385,13 @@
     {
         uQosHdr = VOS_TRUE;
     }
-
-    if (WLANTL_IS_PROBE_REQ(wFrmType))
-    {
-        if (VOS_TRUE == vos_mem_compare((v_VOID_t*) pvAddr2MacAddr,
-            (v_VOID_t*) &pTLCb->spoofMacAddr.spoofMac, VOS_MAC_ADDRESS_LEN))
-        {
-            pvAddr2MacAddr = (v_PVOID_t)pTLCb->spoofMacAddr.selfMac.bytes;
-            VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-                "TL: using self sta addr to get staidx for spoofed probe req "
-                    MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pvAddr2MacAddr->bytes));
-        }
-    }
-
     /*----------------------------------------------------------------------
       Call WDA to build TX header
      ----------------------------------------------------------------------*/
     vosStatus = WDA_DS_BuildTxPacketInfo( pvosGCtx, vosFrmBuf , &vDestMacAddr, 
                    1 /* always 802.11 frames*/, &usPktLen, uQosHdr /*qos not enabled !!!*/, 
-                   0 /* WDS off */, 0, wFrmType, pvAddr2MacAddr, ucTid,
-                   ucAckResponse, usTimeStamp, 0, 0, ucTxBdToken);
+                   0 /* WDS off */, 0, wFrmType, pvAddr2MacAddr, ucTid, 
+                   ucAckResponse, usTimeStamp, 0, 0 );
 
 
     if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
@@ -4334,71 +4031,6 @@
 (
   v_PVOID_t       pvosGCtx
 );
-
-/*==========================================================================
-
-  FUNCTION    WLANTL_IsEAPOLPending
-
-  DESCRIPTION
-
-    HDD calls this function when hdd_tx_timeout occurs. This checks whether
-    EAPOL is pending.
-
-  DEPENDENCIES
-
-    HDD must have registered with TL at least one STA before this function
-    can be called.
-
-  PARAMETERS
-
-    IN
-    pvosGCtx:       pointer to the global vos context
-
-  RETURN VALUE
-
-    The result code associated with performing the operation
-
-    Success : Indicates EAPOL frame is pending and sta is in connected state
-
-    Failure : EAPOL frame is not pending
-
-  SIDE EFFECTS
-============================================================================*/
-VOS_STATUS
-WLANTL_IsEAPOLPending
-(
-  v_PVOID_t       pvosGCtx
-)
-{
-   WLANTL_CbType*      pTLCb = NULL;
-   v_U32_t             i = 0;
-  /*------------------------------------------------------------------------
-    Sanity check
-    Extract TL control block
-   ------------------------------------------------------------------------*/
-    pTLCb = VOS_GET_TL_CB(pvosGCtx);
-    if (NULL == pTLCb)
-    {
-      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-           "WLAN TL:Invalid TL pointer for pvosGCtx"));
-      return VOS_STATUS_E_FAILURE;
-    }
-    /*---------------------------------------------------------------------
-     Check to see if there was any EAPOL packet is pending
-     *--------------------------------------------------------------------*/
-    for ( i = 0; i < WLAN_MAX_STA_COUNT; i++)
-    {
-       if ((NULL != pTLCb->atlSTAClients[i]) &&
-           (pTLCb->atlSTAClients[i]->ucExists) &&
-           (0 == pTLCb->atlSTAClients[i]->ucTxSuspended) &&
-           (WLANTL_STA_CONNECTED == pTLCb->atlSTAClients[i]->tlState) &&
-           (pTLCb->atlSTAClients[i]->ucPktPending)
-           )
-           return VOS_STATUS_SUCCESS;
-    }
-    return VOS_STATUS_E_FAILURE;
-}
-
 /*============================================================================
                       TL INTERNAL API DEFINITION
 ============================================================================*/
@@ -4682,33 +4314,19 @@
         /* Serve EAPOL frame with HI_FLOW_MASK */
         ucSTAId = i;
 
-        pClientSTA = pTLCb->atlSTAClients[ucSTAId];
-
         MTRACE(vos_trace(VOS_MODULE_ID_TL,
-               TRACE_CODE_TL_GET_FRAMES_EAPOL, ucSTAId, pClientSTA->tlState));
+                   TRACE_CODE_TL_GET_FRAMES_EAPOL, ucSTAId, pTLCb->atlSTAClients[i]->tlState));
 
-        if (pClientSTA->wSTADesc.wSTAType == WLAN_STA_INFRA)
+        for (j = WLANTL_MAX_AC ; j > 0; j--)
         {
-            if(0 != pClientSTA->aucACMask[WLANTL_AC_HIGH_PRIO])
-            {
-              pClientSTA->ucCurrentAC = WLANTL_AC_HIGH_PRIO;
-              pTLCb->uCurServedAC = WLANTL_AC_HIGH_PRIO;
-            }
-            else
-                break;
+          if (0 != pTLCb->atlSTAClients[ucSTAId]->aucACMask[j-1])
+          {
+            pTLCb->atlSTAClients[ucSTAId]->ucCurrentAC = j-1;
+            pTLCb->uCurServedAC = j-1;
+          }
         }
-        else
-        {
-            for (j = WLANTL_MAX_AC ; j > 0; j--)
-            {
-              if (0 != pClientSTA->aucACMask[j-1])
-              {
-                pClientSTA->ucCurrentAC = j-1;
-                pTLCb->uCurServedAC = j-1;
-                break;
-              }
-            }
-        }
+
+        pClientSTA = pTLCb->atlSTAClients[ucSTAId];
 
         wSTAEvent = WLANTL_TX_EVENT;
 
@@ -4783,7 +4401,10 @@
 
     else if (( WDA_TLI_MIN_RES_DATA <= pTLCb->uResCount ) &&
              ( 0 == pTLCb->ucTxSuspended ) &&
-             ( uFlowMask & WLANTL_DATA_FLOW_MASK))
+             (( uFlowMask & ( 1 << WDA_TXFLOW_AC_BK ) ) ||
+              ( uFlowMask & ( 1 << WDA_TXFLOW_AC_BE ) ) ||
+              ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VI ) ) ||
+              ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VO ) )) )
     {
       /*---------------------------------------------------------------------
         Check to see if there was any packet left behind previously due to
@@ -4893,7 +4514,7 @@
 
         if ( ( pTLCb->uResCount >= (uResLen + WDA_TLI_MIN_RES_BAP ) ) &&
              ( uRemaining > uTotalPktLen ) &&
-             ( uFlowMask & WLANTL_DATA_FLOW_MASK ) )
+             ( uFlowMask & ( 1 << ucAC ) ) )
         {
           TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
                     "WLAN TL:Chaining data frame on GetFrame"));
@@ -4930,8 +4551,7 @@
            for ( i = 0; i < WLAN_MAX_STA_COUNT; i++)
            {
               if (NULL != pTLCb->atlSTAClients[i] && (pTLCb->atlSTAClients[i]->ucExists) &&
-                  (pTLCb->atlSTAClients[i]->ucPktPending) &&
-                  (pTLCb->atlSTAClients[i]->disassoc_progress == VOS_FALSE))
+                  (pTLCb->atlSTAClients[i]->ucPktPending))
               {
                   /* There is station to be Served */
                   break;
@@ -4957,7 +4577,10 @@
       /* TL is starving even when DXE is not in low resource condition 
          Return min resource number required and Let DXE deceide what to do */
       if(( 0 == pTLCb->ucTxSuspended ) && 
-         ( uFlowMask & WLANTL_DATA_FLOW_MASK ) )
+         (( uFlowMask & ( 1 << WDA_TXFLOW_AC_BK ) ) || 
+          ( uFlowMask & ( 1 << WDA_TXFLOW_AC_BE ) ) ||
+          ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VI ) ) || 
+          ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VO ) )))
       {
          TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
              "WLAN TL:Returning from GetFrame: resources = %d",
@@ -6010,6 +5633,10 @@
   static v_U8_t       first_data_pkt_arrived;
   v_U32_t             uDPUSig; 
   v_U16_t             usPktLen;
+#ifdef FEATURE_WLAN_TDLS_INTERNAL 
+  v_U8_t              ucMPDUHLen = 0 ;
+  v_U16_t             usEtherType = 0;
+#endif
   v_BOOL_t            bForwardIAPPwithLLC = VOS_FALSE;
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
   v_S7_t              currentAvgRSSI = 0;
@@ -6060,16 +5687,6 @@
 
     vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 1/*true*/ );
 
-    if( vos_get_conparam() == VOS_MONITOR_MODE )
-      {
-         if( pTLCb->isConversionReq )
-            WLANTL_MonTranslate80211To8023Header(vosTempBuff, pTLCb);
-
-         pTLCb->pfnMonRx(pvosGCtx, vosTempBuff, pTLCb->isConversionReq);
-         vosTempBuff = vosDataBuff;
-         continue;
-      }
-
     /*---------------------------------------------------------------------
       Peek at BD header - do not remove
       !!! Optimize me: only part of header is needed; not entire one
@@ -6126,13 +5743,24 @@
       continue;
     }
 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+    if ( WLANTL_IS_DATA_FRAME(ucFrmType))
+    {
+       ucMPDUHLen    = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(pvBDHeader);
+       WLANTL_GetEtherType_2(pvBDHeader, vosTempBuff, ucMPDUHLen, &usEtherType) ;
+    }
+#endif
     vos_pkt_get_packet_length(vosTempBuff, &usPktLen);
 
     /*---------------------------------------------------------------------
       Check if management and send to PE
     ---------------------------------------------------------------------*/
 
-    if ( WLANTL_IS_MGMT_FRAME(ucFrmType))
+    if ( WLANTL_IS_MGMT_FRAME(ucFrmType) 
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+        || (WLANTL_IS_TDLS_FRAME(usEtherType)) 
+#endif
+       )
     {
       TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
                  "WLAN TL:Sending packet to management client"));
@@ -6194,6 +5822,9 @@
     {
       ucSTAId = (v_U8_t)WDA_GET_RX_STAID( pvBDHeader );
       ucTid   = (v_U8_t)WDA_GET_RX_TID( pvBDHeader );
+#ifdef WLAN_FEATURE_LINK_LAYER_STATS
+      ac = WLANTL_TID_2_AC[ucTid];
+#endif
 
       TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
                  "WLAN TL:Data packet received for STA %d", ucSTAId));
@@ -6218,29 +5849,16 @@
         }
       }/*if bcast*/
 
-      if (WLANTL_STA_ID_INVALID(ucSTAId))
+      if ( WLANTL_STA_ID_INVALID(ucSTAId) )
       {
         TLLOGW(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
-                   "WLAN TL:STAId %d. Invalid STA ID dropping pkt",
-                   ucSTAId));
+                   "WLAN TL:STA ID invalid - dropping pkt"));
         /* Drop packet */
         vos_pkt_return_packet(vosTempBuff);
         vosTempBuff = vosDataBuff;
         continue;
       }
 
-      if (WLANTL_TID_INVALID( ucTid)) {
-         /* There is a possibility AP uses wrong TID. In that case to avoid
-            dropping EAPOL packet in the driver use TID to zero.*/
-         VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-             "WLAN TL:Invalid Tid: %d Frame type: %d", ucTid, ucFrmType);
-         ucTid = 0;
-      }
-
-#ifdef WLAN_FEATURE_LINK_LAYER_STATS
-      ac = WLANTL_TID_2_AC[ucTid];
-#endif
-
       /*----------------------------------------------------------------------
         No need to lock cache access because cache manipulation only happens
         in the transport thread/task context
@@ -7271,12 +6889,13 @@
    WLANTL_CbType* pTLCb = NULL;
    WLANTL_STAClientType* pClientSTA = NULL;
    int i = 0;
-   v_U8_t uFlowMask; // TX FlowMask from WDA
+   tWDA_CbContext *pWDA = NULL;
 
    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
         "WLAN TL: %s Enter ", __func__));
 
    pTLCb = VOS_GET_TL_CB(pVosContext);
+   pWDA = (tWDA_CbContext *)vos_get_global_context(VOS_MODULE_ID_WDA, pVosContext);
 
    if ( NULL == pVosContext || NULL == pTLCb )
    {
@@ -7285,12 +6904,11 @@
         return;
    }
 
-   if (VOS_STATUS_SUCCESS == WDA_DS_GetTxFlowMask(pVosContext, &uFlowMask))
+   if (NULL != pWDA)
    {
         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-              "WDA uTxFlowMask: 0x%x", uFlowMask));
+              "WDA uTxFlowMask: %d", pWDA->uTxFlowMask));
    }
-
    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
           "************************TL DUMP INFORMATION**************"));
 
@@ -7327,7 +6945,7 @@
           "TDLS Peer Count: %d", pTLCb->ucTdlsPeerCount));
 #endif
 
-   TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
           "++++++++++++++++++++Registerd Client Information++++++++++"));
 
    for ( i =0; i<WLAN_MAX_STA_COUNT; i++ )
@@ -7338,73 +6956,71 @@
                 continue;
         }
 
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "######################STA Index: %d ############################",i));
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "WLAN_STADescType:"));
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WLAN_STADescType:"));
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "STAId: %d\t STA MAC Address: %pM", pClientSTA->wSTADesc.ucSTAId,
               pClientSTA->wSTADesc.vSTAMACAddress.bytes));
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "STA Type: %d\tProtectedFrame: %d",
               pClientSTA->wSTADesc.wSTAType, pClientSTA->wSTADesc.ucProtectedFrame));
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                "QoS: %d\tRxFrameTrans: %d\tTxFrameTrans: %d",
                pClientSTA->wSTADesc.ucQosEnabled, pClientSTA->wSTADesc.ucSwFrameRXXlation,
                pClientSTA->wSTADesc.ucSwFrameTXXlation));
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "ucUcastSig: %d\tucBcastSig: %d", pClientSTA->wSTADesc.ucUcastSig,
               pClientSTA->wSTADesc.ucBcastSig));
 
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "ClientIndex: %d\t Exists: %d", i, pClientSTA->ucExists));
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "TL State: %d\t TL Priority: %d", pClientSTA->tlState,
               pClientSTA->tlPri));
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "ucTxSuspended: %d\tucPktPending: %d", pClientSTA->ucTxSuspended,
               pClientSTA->ucPktPending));
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "ucEAPOLPktPending: %d\tucNoMoreData: %d",
               pClientSTA->ucEapolPktPending, pClientSTA->ucNoMoreData));
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                "enableCaching: %d\t fcStaTxDisabled: %d", pClientSTA->enableCaching,
                pClientSTA->fcStaTxDisabled));
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                "ucCurrentAC: %d\tucServicedAC: %d", pClientSTA->ucCurrentAC,
                pClientSTA->ucServicedAC));
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "TID: %d\tautTxCount[0]: %d\tauRxCount[0]: %d",0, pClientSTA->auTxCount[0],
               pClientSTA->auRxCount[0]));
-        TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "aucAcMask[0]: %d\taucAcMask[1]: %d\taucAcMask[2]: %d\taucAcMask[3]: %d\t",
               pClientSTA->aucACMask[0], pClientSTA->aucACMask[1],
               pClientSTA->aucACMask[2], pClientSTA->aucACMask[3]));
         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-
                "ucCurrentWeight: %d", pClientSTA->ucCurrentWeight));
 
         if( WLAN_STA_SOFTAP == pClientSTA->wSTADesc.wSTAType)
         {
-            TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                   "TrafficStatistics for SOFTAP Station:"));
-            TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                   "RUF=%d\tRMF=%d\tRBF=%d", pClientSTA->trafficStatistics.rxUCFcnt,
                                             pClientSTA->trafficStatistics.rxMCFcnt,
                                             pClientSTA->trafficStatistics.rxBCFcnt));
-            TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                   "RUB=%d\tRMB=%d\tRBB=%d", pClientSTA->trafficStatistics.rxUCBcnt,
                                             pClientSTA->trafficStatistics.rxMCBcnt,
                                             pClientSTA->trafficStatistics.rxBCBcnt));
-            TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                   "TUF=%d\tTMF=%d\tTBF=%d", pClientSTA->trafficStatistics.txUCFcnt,
                                             pClientSTA->trafficStatistics.txMCFcnt,
                                             pClientSTA->trafficStatistics.txBCFcnt));
-            TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                   "TUB=%d\tTMB=%d\tTBB=%d", pClientSTA->trafficStatistics.txUCBcnt,
                                             pClientSTA->trafficStatistics.txMCBcnt,
                                             pClientSTA->trafficStatistics.txBCBcnt));
         }
-
     }
    return;
 }
@@ -7510,19 +7126,6 @@
             return;
         }
    }
-   if(debugFlags & WLANTL_DEBUG_KICKDXE)
-   {
-        vosMsg.reserved = 0;
-        vosMsg.bodyptr  = NULL;
-        vosMsg.type     = WLANTL_TX_KICKDXE;
-
-        status = vos_tx_mq_serialize( VOS_MODULE_ID_TL, &vosMsg);
-        if(status != VOS_STATUS_SUCCESS)
-        {
-            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "TX Msg Posting Failed with status: %d",status));
-            return;
-        }
-   }
    return;
 }
 
@@ -7749,7 +7352,7 @@
     Even if this AC is not supported by the station, correction will be
     made in the main TL loop
     --------------------------------------------------------------------*/
-    pClientSTA->ucCurrentAC     = WLANTL_AC_HIGH_PRIO;
+    pClientSTA->ucCurrentAC     = WLANTL_AC_VO;
     pClientSTA->ucCurrentWeight = 0;
 
     VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
@@ -7886,8 +7489,7 @@
                           extraHeadSpace,
                           ucTypeSubtype, &pClientSTA->wSTADesc.vSelfMACAddress,
                           ucTid, txFlag,
-                          tlMetaInfo.usTimeStamp, tlMetaInfo.ucIsEapol || tlMetaInfo.ucIsWai, tlMetaInfo.ucUP,
-                          tlMetaInfo.ucTxBdToken);
+                          tlMetaInfo.usTimeStamp, tlMetaInfo.ucIsEapol || tlMetaInfo.ucIsWai, tlMetaInfo.ucUP );
 
   if ( VOS_STATUS_SUCCESS != vosStatus )
   {
@@ -7979,7 +7581,7 @@
    WLANTL_STAClientType *pStaClient = NULL;
    v_U8_t                ucWDSEnabled = 0;
    v_U32_t               ucTxFlag   = 0;
-   v_U8_t                ucACMask, i;
+   v_U8_t                ucACMask, i; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
   /*------------------------------------------------------------------------
@@ -8081,8 +7683,8 @@
   {
 
     VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-               "WLAN TL:Failed while attempting to fetch pkt from HDD QId:%d status:%d",
-               ucAC, vosStatus);
+               "WLAN TL:Failed while attempting to fetch pkt from HDD %d",
+                   vosStatus);
     *pvosDataBuff = NULL;
     /*--------------------------------------------------------------------
       Reset AC for the serviced station to the highest priority AC
@@ -8090,7 +7692,7 @@
       Even if this AC is not supported by the station, correction will be
       made in the main TL loop
     --------------------------------------------------------------------*/
-    pStaClient->ucCurrentAC     = WLANTL_AC_HIGH_PRIO;
+    pStaClient->ucCurrentAC     = WLANTL_AC_VO;
     pStaClient->ucCurrentWeight = 0;
 
     return vosStatus;
@@ -8155,11 +7757,7 @@
     -----------------------------------------------------------------------*/
     while ( 0 != ucACMask ) 
     {
-      if(tempAC == WLANTL_AC_BK)
-         ucNextAC = WLANTL_AC_HIGH_PRIO;
-      else
-         ucNextAC = (tempAC - 1);
-
+      ucNextAC = (WLANTL_ACEnumType)(( tempAC - 1 ) & WLANTL_MASK_AC); 
       if ( 0 != pStaClient->aucACMask[ucNextAC] )
       {
          pStaClient->ucCurrentAC     = ucNextAC;
@@ -8240,6 +7838,10 @@
      {
         /* SW based translation */
 
+#ifdef FEATURE_WLAN_WAPI
+       gUcIsWai = tlMetaInfo.ucIsWai,
+#endif
+
        vosStatus =  WLANTL_Translate8023To80211Header( vosDataBuff, &vosStatus,
                                                     pTLCb, &ucSTAId,
                                                     &tlMetaInfo, &ucWDSEnabled,
@@ -8279,11 +7881,7 @@
     ucTypeSubtype |= (WLANTL_80211_DATA_QOS_SUBTYPE);
   }
 
-  /* ucAC now points to TL Q ID with a new queue added in TL,
-   * hence look for the uapsd info for the correct AC that
-   * this packet belongs to.
-   */
-  ucTxFlag  = (0 != pStaClient->wUAPSDInfo[tlMetaInfo.ac].ucSet)?
+  ucTxFlag  = (0 != pStaClient->wUAPSDInfo[ucAC].ucSet)?
               HAL_TRIGGER_ENABLED_AC_MASK:0;
 
 #ifdef FEATURE_WLAN_WAPI
@@ -8306,21 +7904,8 @@
 #endif /* FEATURE_WLAN_TDLS */
   if( tlMetaInfo.ucIsArp )
   {
-    if (pStaClient->arpOnWQ5)
-    {
-        ucTxFlag |= HAL_USE_FW_IN_TX_PATH;
-    }
-    if (pStaClient->arpRate == 0)
-    {
-        ucTxFlag |= HAL_USE_BD_RATE_1_MASK;
-    }
-    else if (pStaClient->arpRate == 1 || pStaClient->arpRate == 3)
-    {
-        pStaClient->arpRate ^= 0x2;
-        ucTxFlag |= HAL_USE_BD_RATE_1_MASK<<(pStaClient->arpRate-1);
-    }
-    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-           "arp pkt sending on BD rate: %hhu", pStaClient->arpRate));
+    /*Send ARP at lowest Phy rate and through WQ5 */
+    ucTxFlag |= HAL_USE_BD_RATE_MASK;
   }
 
   vosStatus = (VOS_STATUS)WDA_DS_BuildTxPacketInfo( pvosGCtx, 
@@ -8330,8 +7915,7 @@
                      extraHeadSpace,
                      ucTypeSubtype, &pStaClient->wSTADesc.vSelfMACAddress,
                      ucTid, ucTxFlag, tlMetaInfo.usTimeStamp, 
-                     tlMetaInfo.ucIsEapol, tlMetaInfo.ucUP,
-                     tlMetaInfo.ucTxBdToken);
+                     tlMetaInfo.ucIsEapol, tlMetaInfo.ucUP );
 
   if(!VOS_IS_STATUS_SUCCESS(vosStatus))
   {
@@ -8662,8 +8246,6 @@
         TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                "WLAN TL:Invalid tid  %d (Station ID %d) on %s",
                ucTid, ucSTAId, __func__));
-        vos_pkt_return_packet(vosDataBuff);
-        return VOS_STATUS_E_FAILURE;
       }
 
       TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
@@ -8849,235 +8431,6 @@
    return VOS_STATUS_SUCCESS;
 }
 
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-void WLANTL_StopRxRateMonitor(v_PVOID_t pvosGCtx)
-{
-   WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pvosGCtx);
-   if (!pTLCb)
-     return;
-   pTLCb->gDsRxRoamStats.running = eWLAN_PAL_FALSE;
-}
-
-void WLANTL_StartRxRateMonitor(v_PVOID_t pvosGCtx, v_U8_t staId,
-                  v_U16_t minRate,
-                  v_U16_t maxRate, v_U8_t minPercentage,
-                  v_U16_t minPktRequired, void *hHal,
-                  v_U64_t timeToWait,
-                  void (*triggerRoamScanfn) (void *, v_U8_t))
-{
-
-   WLANTL_CbType *pTLCb = VOS_GET_TL_CB(pvosGCtx);
-   if (!pTLCb)
-     return;
-
-   pTLCb->gDsRxRoamStats.running = eWLAN_PAL_TRUE;
-   pTLCb->gDsRxRoamStats.index = 0;
-   pTLCb->gDsRxRoamStats.lastTriggerTime = jiffies_to_msecs(jiffies);
-   pTLCb->gDsRxRoamStats.maxRate = maxRate;
-   pTLCb->gDsRxRoamStats.minRate = minRate;
-   pTLCb->gDsRxRoamStats.staId = staId;
-   pTLCb->gDsRxRoamStats.minPercentage = minPercentage;
-   pTLCb->gDsRxRoamStats.timeToWait = timeToWait * 1000;
-   pTLCb->gDsRxRoamStats.intialPktToStart = 0;
-   pTLCb->gDsRxRoamStats.minPktRequired = minPktRequired;
-   pTLCb->gDsRxRoamStats.triggerRoamScanfn = triggerRoamScanfn;
-   pTLCb->gDsRxRoamStats.hHal = hHal;
-   vos_mem_zero(pTLCb->gDsRxRoamStats.rxRoamStats, ROAM_MAX_INDEX_NUM *
-                                sizeof(WLANTL_RoamTrafficStatsType));
-   VOS_TRACE(VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_DEBUG,
-       "staId=%d, minRate=%d maxRate=%d minPercentage=%d minPktRequired=%d",
-       staId, minRate, maxRate, minPercentage, minPktRequired);
-}
-
-void static WLANTL_ClearAllRoamStats(WLANTL_CbType *pTLCb)
-{
-   pTLCb->gDsRxRoamStats.index = 0;
-   pTLCb->gDsRxRoamStats.totalPkt = 0;
-   pTLCb->gDsRxRoamStats.lowRatePkt = 0;
-   pTLCb->gDsRxRoamStats.intialPktToStart = 0;
-   vos_mem_zero(pTLCb->gDsRxRoamStats.rxRoamStats, ROAM_MAX_INDEX_NUM *
-                                sizeof(WLANTL_RoamTrafficStatsType));
-}
-
-/*
- * WLANTL_ClearRoamStatsTillIndex : This API will clear older data
- * at the indexes.
- *
- * Since its a circular buffer we don't know if we are filling
- * data first time or some older data was already present at
- * the index. In that case we should clear the older data from
- * current index to new index and subtract this data from
- * global count as well before filling new one.
- */
-static inline void WLANTL_ClearRoamStatsTillIndex(WLANTL_CbType *pTLCb,
-                                           v_U8_t newIndex)
-{
-   while (pTLCb->gDsRxRoamStats.index < newIndex)
-   {
-     pTLCb->gDsRxRoamStats.index++;
-     pTLCb->gDsRxRoamStats.totalPkt -=
-         pTLCb->gDsRxRoamStats.
-             rxRoamStats[pTLCb->gDsRxRoamStats.index].totalPktRcvd;
-     pTLCb->gDsRxRoamStats.lowRatePkt -=
-         pTLCb->gDsRxRoamStats.
-             rxRoamStats[pTLCb->gDsRxRoamStats.index].lowRateRxPacketsRcvd;
-     pTLCb->gDsRxRoamStats.
-         rxRoamStats[pTLCb->gDsRxRoamStats.index].totalPktRcvd = 0;
-     pTLCb->gDsRxRoamStats.
-         rxRoamStats[pTLCb->gDsRxRoamStats.index].lowRateRxPacketsRcvd = 0;
-   }
-}
-
-
-static void WLANTL_ClearOldPERStats(WLANTL_CbType *pTLCb, v_U8_t incrementCnt)
-{
-   v_U8_t newIndex;
-
-   newIndex = (pTLCb->gDsRxRoamStats.index + incrementCnt) %
-                                             ROAM_MAX_INDEX_NUM;
-
-   /* We have crossed the max limit of buffer, clear the stats
-    * till ROAM_MAX_INDEX_NUM and set index as 0 */
-   if ((pTLCb->gDsRxRoamStats.index + incrementCnt) >=
-                                             ROAM_MAX_INDEX_NUM)
-   {
-       WLANTL_ClearRoamStatsTillIndex(pTLCb, ROAM_MAX_INDEX_NUM - 1);
-       pTLCb->gDsRxRoamStats.index = -1;
-   }
-   /* Clear the stats from current index till new index */
-   WLANTL_ClearRoamStatsTillIndex(pTLCb, newIndex);
-}
-
-/*
- * This API implements a circular buffer to store rate stats for a station to
- * trigger PER based roam scan.
- * API will start monitoring only if DUT gets continues packets which are below
- * configured rate. In the upper rates, this should have minimal effect on data
- * throughput.
- *
- * This API will store stats in a circular buffer of size ROAM_MAX_INDEX_NUM
- * where each index will have time duration of ROAM_PER_INDEX_TIME.
- * Using a buffer instead of counter will help to maintain stats of time
- * duration ROAM_PER_INDEX_TIME * ROAM_MAX_INDEX_NUM. Whenever host gets a new
- * packet, it will remove last ROAM_PER_INDEX_TIME duration of packets from
- * global entry and index entry and fill new data.
- *
- * Global stats of data also be maintained so that host need not to parse whole
- * buffer while checking the trigger condition
- * Each of the index will be having the packets stats at duration of
- * ROAM_PER_INDEX_TIME from the first packet which arrived in that.
- * Global index will be used to calculate new index position to fill once host
- * gets a packet.
- */
-static void WLANTL_updatePERStats(WLANTL_CbType *pTLCb,
-                                  v_U8_t rateIndex)
-{
-   v_U8_t incrementCnt;
-   v_U64_t currentTime, timeDifference;
-
-   /*
-    * Host will start monitoring Rx rates only if it gets
-    * MIN_PKTS_TO_START_MONTIOR number of pkts continuously below min rate
-    * This will make sure we never do this much processing in high
-    * rates/throughput cases
-    */
-
-   if(pTLCb->gDsRxRoamStats.intialPktToStart < MIN_PKTS_TO_START_MONTIOR)
-   {
-       if (gTLRateInfo[rateIndex].phyRate < pTLCb->gDsRxRoamStats.minRate)
-          pTLCb->gDsRxRoamStats.intialPktToStart++;
-       else
-          pTLCb->gDsRxRoamStats.intialPktToStart = 0;
-       return;
-   }
-
-   currentTime = jiffies_to_msecs(jiffies);
-   /*
-    * scan was triggered in last timeToWait time duration
-    * Wait for timeToWait before monitoring again.
-    */
-   if((currentTime - pTLCb->gDsRxRoamStats.lastTriggerTime) <
-       pTLCb->gDsRxRoamStats.timeToWait)
-       return;
-
-   /* paket above max rate, clear current stats and montior again */
-   if (gTLRateInfo[rateIndex].phyRate >=
-           pTLCb->gDsRxRoamStats.maxRate)
-   {
-       WLANTL_ClearAllRoamStats(pTLCb);
-       /* Stop any PER based scan if going on */
-       pTLCb->gDsRxRoamStats.
-                  triggerRoamScanfn(pTLCb->gDsRxRoamStats.hHal, 0);
-       return;
-   }
-
-   timeDifference = currentTime -
-       pTLCb->gDsRxRoamStats.rxRoamStats[pTLCb->gDsRxRoamStats.index].time;
-
-   if (timeDifference)
-       incrementCnt = do_div(timeDifference, ROAM_PER_INDEX_TIME);
-
-   /* More that ROAM_PER_INDEX_TIME has esclapsed,
-    * fill data at new index */
-   if (incrementCnt)
-   {
-       if (incrementCnt > ROAM_MAX_INDEX_NUM)
-       {
-           /*
-            * Clear all stats, these are older than
-            * ROAM_MAX_INDEX_NUM * ROAM_PER_INDEX_TIME (Max buffer time)
-            */
-           WLANTL_ClearAllRoamStats(pTLCb);
-           pTLCb->gDsRxRoamStats.index = 0;
-       }
-       else
-           WLANTL_ClearOldPERStats(pTLCb, incrementCnt);
-
-       pTLCb->gDsRxRoamStats.rxRoamStats
-                    [pTLCb->gDsRxRoamStats.index].time = currentTime;
-   }
-
-   /* If pkt rate below minRate, increment low pkts counts */
-   if (gTLRateInfo[rateIndex].phyRate <
-           pTLCb->gDsRxRoamStats.minRate)
-   {
-       pTLCb->gDsRxRoamStats.
-           rxRoamStats[pTLCb->gDsRxRoamStats.index].
-               lowRateRxPacketsRcvd++;
-       pTLCb->gDsRxRoamStats.lowRatePkt++;
-   }
-   /* Increment total pkts counts */
-   pTLCb->gDsRxRoamStats.
-           rxRoamStats[pTLCb->gDsRxRoamStats.index].totalPktRcvd++;
-   pTLCb->gDsRxRoamStats.totalPkt++;
-
-   /* Check if we have reached threshold value to trigger a roam scan */
-   if ((pTLCb->gDsRxRoamStats.totalPkt != 0) &&
-       (pTLCb->gDsRxRoamStats.totalPkt >
-                pTLCb->gDsRxRoamStats.minPktRequired)&&
-       ((pTLCb->gDsRxRoamStats.lowRatePkt * 100) >
-                (pTLCb->gDsRxRoamStats.totalPkt *
-       pTLCb->gDsRxRoamStats.minPercentage)))
-   {
-       /* callback handler to trigger a roam scan */
-       if (pTLCb->gDsRxRoamStats.triggerRoamScanfn)
-           pTLCb->gDsRxRoamStats.
-                   triggerRoamScanfn(pTLCb->gDsRxRoamStats.hHal, 1);
-
-       VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_DEBUG,
-           "PER Roam: triggerring roam scan totalPkt =%lu lowRatePkt %lu minPktRequired %u minPercentage %d",
-           (long unsigned int) pTLCb->gDsRxRoamStats.totalPkt,
-           (long unsigned int) pTLCb->gDsRxRoamStats.lowRatePkt,
-           (unsigned int) pTLCb->gDsRxRoamStats.minPktRequired,
-           pTLCb->gDsRxRoamStats.minPercentage);
-
-       WLANTL_ClearAllRoamStats(pTLCb);
-       /*  save current time as last trigger time */
-       pTLCb->gDsRxRoamStats.lastTriggerTime = currentTime;
-   }
-}
-#endif
-
 /*==========================================================================
   FUNCTION    WLANTL_STARxAuth
 
@@ -9124,13 +8477,8 @@
    v_U8_t                   ucMPDUHLen;
    v_U16_t                  usActualHLen = 0;   
    v_U8_t                   ucTid;
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-   v_U8_t                   rxRate;
-   v_U8_t                   type;
-#endif
 #ifdef FEATURE_WLAN_WAPI
    v_U16_t                  usEtherType = 0;
-   tSirMacMgmtHdr           *hdr;
 #endif
    v_U16_t                  usPktLen;
    vos_pkt_t*               vosDataBuff ;
@@ -9186,10 +8534,6 @@
   usMPDULen     = (v_U16_t)WDA_GET_RX_MPDU_LEN(aucBDHeader);
   ucMPDUHLen    = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader);
   ucTid         = (v_U8_t)WDA_GET_RX_TID(aucBDHeader);
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-  rxRate        = (v_U8_t)WDA_GET_RX_MAC_RATE_IDX(aucBDHeader);
-  type          = (v_U8_t)WDA_GET_RX_TYPE(aucBDHeader);
-#endif
 
   /* Fix for a hardware bug. 
    * H/W does not update the tid field in BD header for BAR frames.
@@ -9247,25 +8591,6 @@
   }
   }
 
-#ifdef WLAN_FEATURE_RMC
-  if (pTLCb->multicastDuplicateDetectionEnabled &&
-      (WLAN_STA_IBSS == pClientSTA->wSTADesc.wSTAType) &&
-       WLANTL_IS_DATA_FRAME(WDA_GET_RX_TYPE_SUBTYPE(aucBDHeader)))
-  {
-    /*
-     * Multicast duplicate detection is only for frames received in
-     * IBSS mode.
-     */
-    if (VOS_TRUE == WLANTL_IsDuplicateMcastFrm(pClientSTA, vosDataBuff))
-    {
-         pTLCb->mcastDupCnt++;
-         /* Duplicate multicast data packet, drop the packet */
-         vos_pkt_return_packet(vosDataBuff);
-         return VOS_STATUS_SUCCESS;
-    }
-  }
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_WAPI
   if ( pClientSTA->wSTADesc.ucIsWapiSta )
   {
@@ -9273,16 +8598,15 @@
     if( VOS_IS_STATUS_SUCCESS(vosStatus) )
     {
       if ( WLANTL_LLC_WAI_TYPE  == usEtherType )
-      {
-        hdr = WDA_GET_RX_MAC_HEADER(aucBDHeader);
-        if ( hdr->fc.wep )
+      {        
+        if ( !( WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(aucBDHeader)) )
         {
           TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                      "WLAN TL:WAI frame was received encrypted - dropping"));
           /* Drop packet */
           /*Temporary fix added to fix wapi rekey issue*/
-          vos_pkt_return_packet(vosDataBuff);
-          return vosStatus; //returning success
+          //vos_pkt_return_packet(vosDataBuff);
+          //return vosStatus; //returning success
         }
       }
       else
@@ -9322,18 +8646,8 @@
     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
            "WLAN TL:Invalid tid  %d (Station ID %d) on %s",
            ucTid, ucSTAId, __func__));
-    vos_pkt_return_packet(vosDataBuff);
-    return VOS_STATUS_E_FAILURE;
   }
 
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-  if (pTLCb->gDsRxRoamStats.running &&
-     (ucSTAId == pTLCb->gDsRxRoamStats.staId) &&
-     (rxRate < WLANTL_MAX_RATE_NUM) && (type == SIR_MAC_DATA_FRAME))
-  {
-      WLANTL_updatePERStats(pTLCb, rxRate);
-  }
-#endif
   /*------------------------------------------------------------------------
     Check if AMSDU and send for processing if so
    ------------------------------------------------------------------------*/
@@ -9937,11 +9251,7 @@
     break;
 
   case WLANTL_TX_FW_DEBUG:
-    vos_fwDumpReq(274, 0, 0, 0, 0, 1); //Async event
-    break;
-
-  case WLANTL_TX_KICKDXE:
-    WDA_TransportKickDxe();
+    vos_fwDumpReq(274, 0, 0, 0, 0);
     break;
 
   default:
@@ -10500,7 +9810,7 @@
 
 #ifdef FEATURE_WLAN_WAPI
   if (( WLANTL_STA_AUTHENTICATED == pClientSTA->tlState ||
-        pClientSTA->ptkInstalled ) && (tlMetaInfo->ucIsWai != 1))
+        pClientSTA->ptkInstalled ) && gUcIsWai != 1)
 #else
   if ( WLANTL_STA_AUTHENTICATED == pClientSTA->tlState ||
        pClientSTA->ptkInstalled )
@@ -10542,8 +9852,21 @@
         pw80211Header->wFrmCtrl.toDS          = 0;
         pw80211Header->wFrmCtrl.fromDS        = 0;
 
-        vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
+        /*
+         * If the frame is a multicast frame, then, the Address1
+         * should be the destination address filled in the packet. Which is
+         * the multicast address. Otherwise, set it to BSSID
+         */
+        if (0 == tlMetaInfo->ucBcast && 1 == tlMetaInfo->ucMcast)
+        {
+           vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
                              (v_MACADDR_t*)&w8023Header.vDA);
+        }
+        else
+        {
+           vos_copy_macaddr( (v_MACADDR_t*)&pw80211Header->vA1,
+                 &pClientSTA->wSTADesc.vSTAMACAddress);
+        }
         vos_mem_copy( pw80211Header->vA3,
               &pClientSTA->wSTADesc.vBSSIDforIBSS ,
               VOS_MAC_ADDR_SIZE);
@@ -10871,119 +10194,6 @@
   return VOS_STATUS_SUCCESS;
 }/*WLANTL_Translate80211To8023Header*/
 
-VOS_STATUS
-WLANTL_MonTranslate80211To8023Header
-(
-  vos_pkt_t*      vosDataBuff,
-  WLANTL_CbType*  pTLCb
-)
-{
-   v_U16_t                  usMPDUDOffset;
-   v_U8_t                   ucMPDUHOffset;
-   v_U8_t                   ucMPDUHLen;
-   v_U16_t                  usActualHLen = 0;
-   v_U16_t                  usDataStartOffset = 0;
-   v_PVOID_t                aucBDHeader;
-   WLANTL_8023HeaderType    w8023Header;
-   WLANTL_80211HeaderType   w80211Header;
-   VOS_STATUS               vosStatus;
-   v_U8_t                   aucLLCHeader[WLANTL_LLC_HEADER_LEN];
-
-   WDA_DS_PeekRxPacketInfo( vosDataBuff, (v_PVOID_t)&aucBDHeader, 0 );
-   ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
-   usMPDUDOffset = (v_U16_t)WDA_GET_RX_MPDU_DATA_OFFSET(aucBDHeader);
-   ucMPDUHLen    = (v_U8_t)WDA_GET_RX_MPDU_HEADER_LEN(aucBDHeader);
-   if (usMPDUDOffset > ucMPDUHOffset)
-   {
-      usActualHLen = usMPDUDOffset - ucMPDUHOffset;
-   }
-
-  if ( sizeof(w80211Header) < ucMPDUHLen )
-  {
-     TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
-       "Warning !: Check the header size for the Rx frame structure=%d received=%dn",
-       sizeof(w80211Header), ucMPDUHLen));
-     ucMPDUHLen = sizeof(w80211Header);
-  }
-
-  vosStatus = vos_pkt_pop_head( vosDataBuff, &w80211Header, ucMPDUHLen);
-  if ( VOS_STATUS_SUCCESS != vosStatus )
-  {
-     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                "WLAN TL: Failed to pop 80211 header from packet %d",
-                vosStatus));
-
-     return vosStatus;
-  }
-  switch ( w80211Header.wFrmCtrl.fromDS )
-  {
-  case 0:
-    if ( w80211Header.wFrmCtrl.toDS )
-    {
-      vos_mem_copy( w8023Header.vDA, w80211Header.vA3, VOS_MAC_ADDR_SIZE);
-      vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
-      TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
-                  "WLAN TL SoftAP: 802 3 DA %08x SA %08x",
-                  w8023Header.vDA, w8023Header.vSA));
-    }
-    else
-    {
-      vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
-      vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
-    }
-    break;
-  case 1:
-    if ( w80211Header.wFrmCtrl.toDS )
-    {
-      vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
-      vos_mem_copy( w8023Header.vSA, w80211Header.vA2, VOS_MAC_ADDR_SIZE);
-    }
-    else
-    {
-      vos_mem_copy( w8023Header.vDA, w80211Header.vA1, VOS_MAC_ADDR_SIZE);
-      vos_mem_copy( w8023Header.vSA, w80211Header.vA3, VOS_MAC_ADDR_SIZE);
-    }
-    break;
-  }
-  if( usActualHLen > ucMPDUHLen )
-  {
-     usDataStartOffset = usActualHLen - ucMPDUHLen;
-  }
-
-  if ( 0 < usDataStartOffset )
-  {
-    vosStatus = vos_pkt_trim_head( vosDataBuff, usDataStartOffset );
-
-    if ( VOS_STATUS_SUCCESS != vosStatus )
-    {
-      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                  "WLAN TL: Failed to trim header from packet %d",
-                  vosStatus));
-      return vosStatus;
-    }
-  }
-   // Extract the LLC header
-   vosStatus = vos_pkt_pop_head( vosDataBuff, aucLLCHeader,
-                                 WLANTL_LLC_HEADER_LEN);
-
-   if ( VOS_STATUS_SUCCESS != vosStatus )
-   {
-      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,
-                 "WLAN TL: Failed to pop LLC header from packet %d",
-                 vosStatus));
-
-      return vosStatus;
-   }
-
-   //Extract the length
-   vos_mem_copy(&w8023Header.usLenType,
-     &aucLLCHeader[WLANTL_LLC_HEADER_LEN - sizeof(w8023Header.usLenType)],
-     sizeof(w8023Header.usLenType) );
-
-   vos_pkt_push_head(vosDataBuff, &w8023Header, sizeof(w8023Header));
-   return VOS_STATUS_SUCCESS;
-}
-
 /*==========================================================================
   FUNCTION    WLANTL_FindFrameTypeBcMcUc
 
@@ -11417,7 +10627,7 @@
   v_U8_t          ucACFilter = 1;
   v_U8_t          ucNextSTA ; 
   v_BOOL_t        isServed = TRUE;  //current round has find a packet or not
-  v_U8_t          ucACLoopNum = WLANTL_AC_HIGH_PRIO + 1; //number of loop to go
+  v_U8_t          ucACLoopNum = WLANTL_AC_VO + 1; //number of loop to go
   v_U8_t          uFlowMask; // TX FlowMask from WDA
   uint8           ucACMask; 
   uint8           i = 0; 
@@ -11441,22 +10651,6 @@
     return VOS_STATUS_E_FAULT;
   }
 
-  /* The flow mask does not differentiate between different ACs/Qs
-   * since we use a single dxe channel for all ACs/Qs, hence it is
-   * enough to check that there are dxe resources on data channel
-   */
-  uFlowMask &= WLANTL_DATA_FLOW_MASK;
-
-  if (0 == uFlowMask)
-  {
-    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-           "WLAN TL: No resources to send packets"));
-
-    // Setting STA Id to invalid if mask is 0
-    *pucSTAId = WLAN_MAX_STA_COUNT;
-    return VOS_STATUS_E_FAULT;
-  }
-
   ucNextSTA = pTLCb->ucCurrentSTA;
 
   ++ucNextSTA;
@@ -11473,7 +10667,7 @@
       if ( WLANTL_AC_BK == (WLANTL_ACEnumType)pTLCb->uCurServedAC )
       {
         //end of current VO, VI, BE, BK loop. Reset priority.
-        pTLCb->uCurServedAC = WLANTL_AC_HIGH_PRIO;
+        pTLCb->uCurServedAC = WLANTL_AC_VO;
       }
       else 
       {
@@ -11500,7 +10694,7 @@
     ucACFilter = 1 << pTLCb->uCurServedAC;
 
     // pTLCb->ucCurLeftWeight keeps previous results.
-    for (; (pTLCb->ucCurLeftWeight > 0) ; pTLCb->ucCurLeftWeight-- )
+    for (; (pTLCb->ucCurLeftWeight > 0) && (uFlowMask & ucACFilter); pTLCb->ucCurLeftWeight-- )
     {
 
       for ( ; ucNextSTA < WLAN_MAX_STA_COUNT; ucNextSTA ++ )
@@ -11520,8 +10714,7 @@
           continue;
         }
 
-        if ((WLANTL_STA_AUTHENTICATED != pTLCb->atlSTAClients[ucNextSTA]->tlState)
-           || (pTLCb->atlSTAClients[ucNextSTA]->disassoc_progress == VOS_TRUE ))
+        if (WLANTL_STA_AUTHENTICATED != pTLCb->atlSTAClients[ucNextSTA]->tlState)
         {
           TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
                  "%s Sta %d not in auth state so skipping it.",
@@ -11567,7 +10760,7 @@
 
     if (WLANTL_AC_BK == pTLCb->uCurServedAC)
     {
-      pTLCb->uCurServedAC = WLANTL_AC_HIGH_PRIO;
+      pTLCb->uCurServedAC = WLANTL_AC_VO;
     }
     else
     {
@@ -11657,11 +10850,9 @@
 
 #ifdef FEATURE_WLAN_TDLS
   if ((eSYSTEM_AP_ROLE == systemRole) ||
-      (eSYSTEM_STA_IN_IBSS_ROLE == systemRole) ||
       (vos_concurrent_open_sessions_running()) || pTLCb->ucTdlsPeerCount)
 #else
   if ((eSYSTEM_AP_ROLE == systemRole) ||
-      (eSYSTEM_STA_IN_IBSS_ROLE == systemRole) ||
       (vos_concurrent_open_sessions_running()))
 #endif
   {
@@ -11676,22 +10867,6 @@
     return VOS_STATUS_E_FAULT;
   }
 
-  /* The flow mask does not differentiate between different ACs/Qs
-   * since we use a single dxe channel for all ACs/Qs, hence it is
-   * enough to check that there are dxe resources on data channel
-   */
-  uFlowMask &= WLANTL_DATA_FLOW_MASK;
-
-  if (0 == uFlowMask)
-  {
-    TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-      "WLAN TL: No resources to send packets"));
-
-    // Setting STA id to invalid if mask is 0
-    *pucSTAId = WLAN_MAX_STA_COUNT;
-    return VOS_STATUS_E_FAULT;
-  }
-
   /*STA id - no priority yet implemented */
   /*-----------------------------------------------------------------------
     Choose the next STA for tx - for now go in a round robin fashion
@@ -11781,7 +10956,7 @@
              " AC Mask: %d Next: %d Res : %d",
                ucACMask, ( 1 << ucNextAC ), ( ucACMask & ( 1 << ucNextAC ))));
 
-    if ( 0 != ( ucACMask & ( 1 << ucNextAC )))
+    if ( 0 != ( ucACMask & ( 1 << ucNextAC ) & uFlowMask ))
     {
        pTLCb->atlSTAClients[*pucSTAId]->ucCurrentAC     =
                                    (WLANTL_ACEnumType)ucNextAC;
@@ -11795,13 +10970,11 @@
        break;
     }
 
-    if (ucNextAC == WLANTL_AC_BK)
-        ucNextAC = WLANTL_AC_HIGH_PRIO;
-    else
-        ucNextAC--;
+    ucNextAC = ( ucNextAC - 1 ) & WLANTL_MASK_AC;
 
     TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
                "Next AC %d", ucNextAC));
+
   }
 
   TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
@@ -12189,7 +11362,7 @@
   ptlSTAClient->wSTADesc.ucSwFrameTXXlation = 0;
   ptlSTAClient->wSTADesc.ucSwFrameRXXlation = 0;
   ptlSTAClient->wSTADesc.ucProtectedFrame = 0;
-  ptlSTAClient->disassoc_progress = VOS_FALSE;
+
   /*-------------------------------------------------------------------------
     AMSDU information for the STA
    -------------------------------------------------------------------------*/
@@ -12230,7 +11403,7 @@
   /*-------------------------------------------------------------------------
      QOS information for the STA
     -------------------------------------------------------------------------*/
-   ptlSTAClient->ucCurrentAC     = WLANTL_AC_HIGH_PRIO;
+   ptlSTAClient->ucCurrentAC     = WLANTL_AC_VO;
    ptlSTAClient->ucCurrentWeight = 0;
    ptlSTAClient->ucServicedAC    = WLANTL_AC_BK;
 
@@ -13251,7 +12424,6 @@
     pTLCb->tlConfigInfo.ucAcWeights[ucIndex] = pACWeights[ucIndex];
   }
 
-  pTLCb->tlConfigInfo.ucAcWeights[WLANTL_AC_HIGH_PRIO] = pACWeights[WLANTL_AC_VO];
   return VOS_STATUS_SUCCESS;
 }
 
@@ -13467,6 +12639,83 @@
 
     return vosStatus;
 }
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+/*==========================================================================
+  FUNCTION      WLANTL_GetEtherType_2
+
+  DESCRIPTION   Extract Ether type information from the BD
+
+  DEPENDENCIES  NONE
+    
+  PARAMETERS    in aucBDHeader - BD header
+                in vosDataBuff - data buffer
+                in ucMPDUHLen  - MPDU header length
+                out pUsEtherType - pointer to Ethertype
+
+  RETURN VALUE  VOS_STATUS_SUCCESS : if the EtherType is successfully extracted
+                VOS_STATUS_FAILURE : if the EtherType extraction failed and
+                                     the packet was dropped
+
+  SIDE EFFECTS  NONE
+  
+============================================================================*/
+static VOS_STATUS WLANTL_GetEtherType_2
+(
+   v_U8_t               * aucBDHeader,
+   vos_pkt_t            * vosDataBuff,
+   v_U8_t                 ucMPDUHLen,
+   v_U16_t              * pUsEtherType
+)
+{
+  v_U8_t                   ucOffset;
+  v_U16_t                  usEtherType = *pUsEtherType;
+  v_SIZE_t                 usLLCSize = sizeof(usEtherType);
+  VOS_STATUS               vosStatus  = VOS_STATUS_SUCCESS;
+  //v_U8_t                   ucLLCHeader;
+  v_U8_t                   ucMPDUHOffset ; 
+  /*------------------------------------------------------------------------
+    Check if LLC is present - if not, TL is unable to determine type
+   ------------------------------------------------------------------------*/
+  //ucMPDUHOffset = (v_U8_t)WLANHAL_RX_BD_GET_MPDU_H_OFFSET(aucBDHeader) ;
+  //ucLLCHeader   = (v_U8_t)WLANHAL_RX_BD_GET_LLC(aucBDHeader);
+  ucMPDUHOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(aucBDHeader);
+
+  if ( VOS_TRUE == WDA_IS_RX_LLC_PRESENT(aucBDHeader) )
+  {
+    ucOffset = ucMPDUHOffset + WLANTL_802_3_HEADER_LEN - sizeof(usEtherType); 
+  }
+  else
+  {
+    ucOffset = WLANHAL_RX_BD_HEADER_SIZE + ucMPDUHLen 
+                                            + WLANTL_LLC_PROTO_TYPE_OFFSET;
+  }
+
+  /*------------------------------------------------------------------------
+    Extract LLC type 
+  ------------------------------------------------------------------------*/
+  vosStatus = vos_pkt_extract_data( vosDataBuff, ucOffset, 
+                                    (v_PVOID_t)&usEtherType, &usLLCSize); 
+
+  /* TODO: Do it in better way */
+  if(vos_be16_to_cpu(usEtherType) == 0x890d)
+  {
+     VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, 
+                      ("TDLS frame llc %x"), vos_be16_to_cpu(usEtherType)) ;
+  }
+      
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Ether type retrieved before endianess conv: %d", 
+               usEtherType);
+
+    usEtherType = vos_be16_to_cpu(usEtherType);
+    *pUsEtherType = usEtherType;
+
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+               "WLAN TL:Ether type retrieved: %d", usEtherType);
+  
+  return vosStatus;
+}
+#endif /* FEATURE_WLAN_TDLS */
 
 /*===============================================================================
   FUNCTION      WLANTL_IsReplayPacket
@@ -13773,618 +13022,3 @@
 
     return VOS_STATUS_SUCCESS;
 }/* WLANTL_GetSTALinkCapacity */
-
-
-#ifdef WLAN_FEATURE_RMC
-VOS_STATUS WLANTL_RmcInit
-(
-    v_PVOID_t   pAdapter
-)
-{
-    WLANTL_CbType   *pTLCb = VOS_GET_TL_CB(pAdapter);
-    VOS_STATUS       status = VOS_STATUS_SUCCESS;
-    tANI_U8          count;
-
-    /*sanity check*/
-    if (NULL == pTLCb)
-    {
-        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-            "Invalid TL handle"));
-        return VOS_STATUS_E_INVAL;
-    }
-
-    for ( count = 0; count < WLANTL_RMC_HASH_TABLE_SIZE; count++ )
-    {
-        pTLCb->rmcSession[count] = NULL;
-    }
-
-    vos_lock_init(&pTLCb->rmcLock);
-
-    pTLCb->multicastDuplicateDetectionEnabled = 1;
-    pTLCb->rmcDataPathEnabled = 0;
-
-    return status;
-}
-
-
-VOS_STATUS WLANTL_RmcDeInit
-(
-    v_PVOID_t   pAdapter
-)
-{
-    WLANTL_CbType   *pTLCb = VOS_GET_TL_CB(pAdapter);
-    VOS_STATUS       status = VOS_STATUS_SUCCESS;
-    tANI_U8          count;
-    WLANTL_RMC_SESSION *pNode;
-    WLANTL_RMC_SESSION *pPrev;
-
-    /*sanity check*/
-    if (NULL == pTLCb)
-    {
-        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-            "Invalid TL handle"));
-        return VOS_STATUS_E_INVAL;
-    }
-
-    for ( count = 0; count < WLANTL_RMC_HASH_TABLE_SIZE; count++ )
-    {
-        pNode = pTLCb->rmcSession[count];
-        while (pNode)
-        {
-            pPrev = pNode;
-            pNode = pNode->next;
-            vos_mem_free((v_VOID_t * )pPrev);
-        }
-    }
-
-    vos_lock_destroy(&pTLCb->rmcLock);
-
-    return status;
-}
-
-
-tANI_U8 WLANTL_RmcHashRmcSession ( v_MACADDR_t   *pMcastAddr )
-{
-    tANI_U32 sum;
-    tANI_U8  hash;
-
-    sum = (pMcastAddr->bytes[0] + pMcastAddr->bytes[1] + pMcastAddr->bytes[2] +
-           pMcastAddr->bytes[3] + pMcastAddr->bytes[4] + pMcastAddr->bytes[5]);
-
-    hash = (tANI_U8)(sum & ((WLANTL_RMC_HASH_TABLE_SIZE - 1)));
-
-    return hash;
-}
-
-
-WLANTL_RMC_SESSION* WLANTL_RmcLookUpRmcSession
-(
-    WLANTL_RMC_SESSION *rmcSession[],
-    v_MACADDR_t     *pMcastAddr
-)
-{
-    WLANTL_RMC_SESSION *pNode;
-    tANI_U8               index;
-
-    /*sanity check*/
-    if (NULL == pMcastAddr)
-    {
-        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-            "Sanity check failed pMcastAddr %p", pMcastAddr));
-        return NULL;
-    }
-
-    index = WLANTL_RmcHashRmcSession(pMcastAddr);
-    pNode = rmcSession[index];
-    while ( pNode )
-    {
-        if (vos_is_macaddr_equal( &(pNode->rmcAddr), pMcastAddr))
-        {
-            return pNode;
-        }
-        pNode = pNode->next;
-    }
-
-    return NULL;
-}
-
-WLANTL_RMC_SESSION *WLANTL_RmcAddRmcSession
-(
-  WLANTL_RMC_SESSION *rmcSession[],
-  v_MACADDR_t   *pMcastAddr
-)
-{
-    WLANTL_RMC_SESSION *pNode;
-    tANI_U8               index;
-
-    index = WLANTL_RmcHashRmcSession(pMcastAddr);
-    pNode = WLANTL_RmcLookUpRmcSession(rmcSession, pMcastAddr);
-    if ( NULL != pNode )
-    {
-        /*already exists*/
-        return NULL;
-    }
-    else
-    {
-        pNode = (WLANTL_RMC_SESSION *)vos_mem_malloc(sizeof(*pNode));
-        if (pNode)
-        {
-            vos_mem_copy( &(pNode->rmcAddr), pMcastAddr,
-                sizeof(pNode->rmcAddr) );
-            pNode->next = rmcSession[index];
-            rmcSession[index] = pNode;
-            return pNode;
-        }
-        else
-        {
-            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s: vos_mem_malloc failed can't enable RMC session",
-                __func__);
-            return NULL;
-        }
-    }
-}
-
-tANI_U8
-WLANTL_RmcDeleteRmcSession
-(
-  WLANTL_RMC_SESSION *rmcSession[],
-  v_MACADDR_t   *pMcastAddr
-)
-{
-    WLANTL_RMC_SESSION *pHead;
-    WLANTL_RMC_SESSION *pNode;
-    WLANTL_RMC_SESSION *pPrev;
-    tANI_U8               index;
-
-    index = WLANTL_RmcHashRmcSession(pMcastAddr);
-    pHead = pNode = rmcSession[index];
-    while (pNode)
-    {
-        if (vos_is_macaddr_equal( &(pNode->rmcAddr), pMcastAddr))
-        {
-            if (pHead == pNode)
-            {
-                rmcSession[index] = pNode->next;
-            }
-            else
-            {
-                pPrev->next = pNode->next;
-            }
-            vos_mem_free((v_VOID_t * )pNode);
-            return 1;
-        }
-        pPrev = pNode;
-        pNode = pNode->next;
-    }
-
-    return 0;
-}
-
-VOS_STATUS
-WLANTL_ProcessRmcCommand
-(
-    WLANTL_CbType*  pTLCb,
-    v_MACADDR_t    *pMcastAddr,
-    tANI_U32        command
-)
-{
-    VOS_STATUS status;
-    tANI_U32 count;
-    tANI_U32 rmcActive;
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire( &(pTLCb->rmcLock))))
-    {
-        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-            "%s Get Lock Fail", __func__));
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    /*add or delete node from active rmc hash table*/
-    if (command)
-    {
-        /*add requested rmc session in active rmc session list*/
-        if (WLANTL_RmcAddRmcSession(pTLCb->rmcSession, pMcastAddr))
-        {
-            TLLOGE( VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                "RMC session " MAC_ADDRESS_STR " added in TL hash table",
-                MAC_ADDR_ARRAY(pMcastAddr->bytes) ) );
-            pTLCb->rmcDataPathEnabled = TRUE;
-            status = VOS_STATUS_SUCCESS;
-        }
-        else
-        {
-            TLLOGE( VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                "RMC session " MAC_ADDRESS_STR " already exists in TL hash"
-                " table", MAC_ADDR_ARRAY(pMcastAddr->bytes) ) );
-            status = VOS_STATUS_E_FAILURE;
-        }
-    }
-    else
-    {
-        /*delete requested rmc session from active rmc session list*/
-        if (WLANTL_RmcDeleteRmcSession(pTLCb->rmcSession, pMcastAddr))
-        {
-            TLLOGE( VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-                "RMC session " MAC_ADDRESS_STR " deleted from TL hash table",
-                MAC_ADDR_ARRAY(pMcastAddr->bytes)) );
-            status = VOS_STATUS_SUCCESS;
-            rmcActive = FALSE;
-            for ( count = 0; count < WLANTL_RMC_HASH_TABLE_SIZE; count++ )
-            {
-                if (pTLCb->rmcSession[count])
-                {
-                    rmcActive = TRUE;
-                    break;
-                }
-            }
-            if (TRUE == rmcActive)
-            {
-                pTLCb->rmcDataPathEnabled = TRUE;
-            }
-            else
-            {
-                pTLCb->rmcDataPathEnabled = FALSE;
-            }
-        }
-        else
-        {
-            TLLOGE( VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                "RMC session " MAC_ADDRESS_STR " doesn't exist in TL hash"
-                " table", MAC_ADDR_ARRAY(pMcastAddr->bytes) ) );
-            status = VOS_STATUS_E_FAILURE;
-        }
-    }
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_release(&(pTLCb->rmcLock))))
-    {
-         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-             "%s Release Lock Fail", __func__));
-         return VOS_STATUS_E_FAILURE;
-    }
-
-    return status;
-}/* End of WLANTL_ProcessRmcCommand */
-
-VOS_STATUS
-WLANTL_EnableRMC
-(
-    v_PVOID_t     pvosGCtx,
-    v_MACADDR_t   *pMcastTransmitterAddr
-)
-{
-    WLANTL_CbType*  pTLCb;
-    VOS_STATUS status;
-
-    /*sanity check*/
-    if ( (NULL == pvosGCtx) || (NULL == pMcastTransmitterAddr) )
-    {
-        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-            "WLAN TL %s: Sanity check failed pvosGCtx %p aMcastAddr %p",
-            __func__, pvosGCtx, pMcastTransmitterAddr));
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    /*sanity check*/
-    pTLCb = VOS_GET_TL_CB(pvosGCtx);
-    if ( NULL == pTLCb )
-    {
-        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-            "WLAN TL %s: pTLCb is NULL", __func__));
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    status = WLANTL_ProcessRmcCommand(pTLCb, pMcastTransmitterAddr , 1);
-
-    return status;
-} /* End of WLANTL_EnableRMC */
-
-
-VOS_STATUS
-WLANTL_DisableRMC
-(
-    v_PVOID_t     pvosGCtx,
-    v_MACADDR_t   *pMcastTransmitterAddr
-)
-{
-    WLANTL_CbType* pTLCb;
-    VOS_STATUS status;
-
-    /*Sanity check*/
-    if ((NULL == pvosGCtx) || (NULL == pMcastTransmitterAddr))
-    {
-        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-            "WLAN TL %s: Sanity check failed pvosGCtx %p aMcastAddr %p",
-             __func__, pvosGCtx, pMcastTransmitterAddr));
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    /*Sanity check*/
-    pTLCb = VOS_GET_TL_CB(pvosGCtx);
-    if (NULL == pTLCb)
-    {
-        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-            "WLAN TL %s: pTLCb is NULL", __func__));
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    status = WLANTL_ProcessRmcCommand(pTLCb, pMcastTransmitterAddr, 0);
-
-    return status;
-} /* End of WLANTL_DisableRMC */
-
-
-/*=============================================================================
-        Duplicate Multicast Detection Functions
-==============================================================================*/
-
-/*=============================================================================
-  FUNCTION    WLANTL_IsDuplicateMcastFrm
-
-  DESCRIPTION
-    This function checks for duplicast multicast frames and drops them.
-
-  DEPENDENCIES
-
-  PARAMETERS
-
-   IN
-
-   pClientSTA  : Pointer to WLANTL_STAClientType
-   aucBDHeader : Pointer to BD header
-
-  RETURN VALUE
-
-    VOS_FALSE:  This frame is not a duplicate
-
-    VOS_TRUE:   This frame is a duplicate
-
-==============================================================================*/
-v_U8_t
-WLANTL_IsDuplicateMcastFrm
-(
-    WLANTL_STAClientType *pClientSTA,
-    vos_pkt_t *vosDataBuff
-)
-{
-    v_U8_t duplicate = VOS_FALSE;
-    WLANTL_RMC_SESSION *pNode;
-    v_U16_t     usSeqCtrl;
-    v_MACADDR_t mcastAddr;
-    VOS_STATUS  vosStatus;
-    v_PVOID_t   pvPeekData;
-
-    /* Get address 1 of Data Frame */
-    vosStatus = vos_pkt_peek_data(vosDataBuff, WLANTL_MAC_ADDR_ALIGN(1),
-                                  (v_PVOID_t)&pvPeekData, VOS_MAC_ADDR_SIZE);
-
-    if ( VOS_STATUS_SUCCESS != vosStatus )
-    {
-        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                "WLAN TL: Failed to get Addr 1 of 80211 header from packet %d",
-                vosStatus));
-        return VOS_FALSE;
-    }
-
-    /* Copy address 1 of Data Frame */
-    vos_mem_copy(&mcastAddr.bytes, pvPeekData, VOS_MAC_ADDR_SIZE);
-
-    /*
-     * We perform duplicate detection for only multicast data frames
-     */
-    if (vos_is_macaddr_group(&mcastAddr) &&
-         !vos_is_macaddr_broadcast(&mcastAddr))
-    {
-        /* Get sequence control of Data Frame */
-        vosStatus = vos_pkt_peek_data(vosDataBuff,
-                    (WLANTL_MAC_ADDR_ALIGN(1) + (3 * VOS_MAC_ADDR_SIZE)),
-                      (v_PVOID_t)&pvPeekData, sizeof(v_U16_t));
-
-        if ( VOS_STATUS_SUCCESS != vosStatus )
-        {
-            TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                    "WLAN TL: Failed to get Sequence Control from packet %d",
-                    vosStatus));
-            return VOS_FALSE;
-        }
-
-        /* Copy sequence control from the Data Frame */
-        usSeqCtrl = *(v_U16_t *)pvPeekData;
-
-        if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&(pClientSTA->mcLock))))
-        {
-            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                    "%s Get Lock Fail", __func__));
-            return VOS_FALSE;
-        }
-
-        pNode = WLANTL_RmcLookUpRmcSession(pClientSTA->mcastSession,
-                                                      &mcastAddr);
-        if (NULL == pNode)
-        {
-            /* If the session does not exist, add it. */
-            pNode = WLANTL_RmcAddRmcSession(pClientSTA->mcastSession,
-                                              &mcastAddr);
-            /* If we could not add a entry, skip duplicate detection */
-            if (NULL == pNode)
-            {
-                TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                    "%s Failed to add multicast session", __func__));
-                if (!VOS_IS_STATUS_SUCCESS
-                     (vos_lock_release(&(pClientSTA->mcLock))))
-                {
-                    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                        "%s Release Lock Fail", __func__));
-                }
-                return VOS_FALSE;
-            }
-            /* Initialize the sequence control value. */
-            pNode->mcSeqCtl = usSeqCtrl;
-        }
-        else
-        {
-            /*
-             * Check if the sequence number of this frame matches the last
-             * we have seen.
-             */
-            if (pNode->mcSeqCtl == usSeqCtrl)
-            {
-                pNode->rxMCDupcnt++;
-                TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-                     "%s Rx Multicast Duplicate %d " MAC_ADDRESS_STR
-                     " (Seq %x)", __func__,
-                     pNode->rxMCDupcnt, MAC_ADDR_ARRAY(mcastAddr.bytes),
-                     usSeqCtrl));
-                duplicate = VOS_TRUE;
-            }
-            else
-            {
-                /* Update the last seen sequence number */
-                pNode->mcSeqCtl = usSeqCtrl;
-            }
-        }
-
-        if (!VOS_IS_STATUS_SUCCESS (vos_lock_release(&(pClientSTA->mcLock))))
-        {
-            TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                    "%s Release Lock Fail", __func__));
-        }
-    }
-
-    return duplicate;
-}
-
-/*=============================================================================
-  FUNCTION    WLANTL_McastDeleteAllEntries
-
-  DESCRIPTION
-    This function removes all multicast entries used for duplicate detection
-
-  DEPENDENCIES
-
-  PARAMETERS
-
-   IN
-
-   pClientSTA  : Pointer to WLANTL_STAClientType
-
-  RETURN VALUE
-
-    None
-
-==============================================================================*/
-void
-WLANTL_McastDeleteAllEntries(WLANTL_STAClientType * pClientSTA)
-{
-    WLANTL_RMC_SESSION *pNode, **head;
-    int index;
-
-    TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-                        "%s Deleting all multicast entries", __func__));
-
-    if (!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(&(pClientSTA->mcLock))))
-    {
-        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                "%s Get Lock Fail", __func__));
-        return;
-    }
-
-    for (index = 0; index < WLANTL_RMC_HASH_TABLE_SIZE; index++)
-    {
-        head = &pClientSTA->mcastSession[index];
-
-        pNode = *head;
-
-        while (pNode)
-        {
-            *head = pNode->next;
-            /* free the group entry */
-            vos_mem_free(pNode);
-            pNode = *head;
-        }
-    }
-
-    if (!VOS_IS_STATUS_SUCCESS (vos_lock_release(&(pClientSTA->mcLock))))
-    {
-        TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                "%s Release Lock Fail", __func__));
-    }
-}
-
-/*=============================================================================
-  FUNCTION    WLANTL_SetMcastDuplicateDetection
-
-  DESCRIPTION
-    This function sets multicate duplicate detection operation.
-    If enable is 1, the detection is enabled, else it is disabled.
-
-  DEPENDENCIES
-
-  PARAMETERS
-
-   IN
-
-   pvosGCtx   : Pointer to VOS global context
-   enable : Boolean to enable or disable
-
-  RETURN VALUE
-    The result code associated with performing the operation
-
-    VOS_STATUS_E_FAULT:   Sanity check on input failed
-
-    VOS_STATUS_SUCCESS:   Everything is good :)
-
-   Other return values are possible coming from the called functions.
-   Please check API for additional info.
-
-  SIDE EFFECTS
-
-==============================================================================*/
-VOS_STATUS
-WLANTL_SetMcastDuplicateDetection
-(
-    v_PVOID_t     pvosGCtx,
-    v_U8_t        enable
-)
-{
-    WLANTL_CbType* pTLCb;
-
-    /*Sanity check*/
-    if (NULL == pvosGCtx)
-    {
-        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-            "WLAN TL %s: Sanity check failed pvosGCtx %p",
-             __func__, pvosGCtx));
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    /*Sanity check*/
-    pTLCb = VOS_GET_TL_CB(pvosGCtx);
-    if (NULL == pTLCb)
-    {
-        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-            "WLAN TL %s: pTLCb is NULL", __func__));
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    switch (enable)
-    {
-    default:
-        /*
-         * Any value other than 0 or 1 is used to dump the
-         * duplicate count.
-         */
-        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-            "WLAN TL %s: Multicast Duplicate Count %d",
-             __func__, pTLCb->mcastDupCnt));
-        break;
-    case 0:
-    case 1:
-        pTLCb->multicastDuplicateDetectionEnabled = enable;
-        break;
-    }
-
-    return VOS_STATUS_SUCCESS;
-}
-
-#endif /* WLAN_FEATURE_RMC */
diff --git a/wlan/prima/CORE/TL/src/wlan_qct_tl_ba.c b/wlan/prima/CORE/TL/src/wlan_qct_tl_ba.c
index 9f60188..a991a2b 100644
--- a/wlan/prima/CORE/TL/src/wlan_qct_tl_ba.c
+++ b/wlan/prima/CORE/TL/src/wlan_qct_tl_ba.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1204,9 +1204,6 @@
          }
          if(VOS_STATUS_E_RESOURCES == status)
          {
-            MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_QUEUE_CURRENT,
-                    currentReorderInfo->sessionID , ucOpCode ));
-
             /* This is the case slot index is already cycle one route, route all the frames Qed */
             vosPktIdx = NULL;
             status = WLANTL_ChainFrontPkts(ucFwdIdx,
@@ -1335,9 +1332,6 @@
            }
          if(VOS_STATUS_E_RESOURCES == status)
          {
-            MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_QUEUE_CURRENT,
-                                  currentReorderInfo->sessionID , ucOpCode ));
-
             /* This is the case slot index is already cycle one route, route all the frames Qed */
             vosPktIdx = NULL;
             status = WLANTL_ChainFrontPkts(ucFwdIdx,
@@ -1399,9 +1393,6 @@
            }
          if(VOS_STATUS_E_RESOURCES == status)
          {
-            MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_QUEUE_CURRENT,
-                                   currentReorderInfo->sessionID , ucOpCode ));
-
             vos_pkt_return_packet(vosPktIdx); 
             /* This is the case slot index is already cycle one route, route all the frames Qed */
             vosPktIdx = NULL;
@@ -1535,13 +1526,6 @@
                WLANTL_FillReplayCounter(currentReorderInfo,
                                  ullreplayCounter, ucSlotIdx);
            }
-
-         if(VOS_STATUS_E_RESOURCES == status)
-         {
-             MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_QUEUE_CURRENT,
-                                   currentReorderInfo->sessionID , ucOpCode ));
-         }
-
          if(!VOS_IS_STATUS_SUCCESS(status))
          {
             TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Q Current frame fail %d",
@@ -1733,10 +1717,7 @@
       MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_QUEUE_CURRENT,
                       pwBaReorder->sessionID , pwBaReorder->pendingFramesCount ));
 
-      MTRACE(vos_trace(VOS_MODULE_ID_TL, TRACE_CODE_TL_QUEUE_CURRENT,
-                                        pwBaReorder->sessionID , ucSlotIndex ));
-
-      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"One Cycle rounded, lost many frames already, not in Q %d",
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"One Cycle rounded, lost many frames already, not in Q %d",
                   pwBaReorder->pendingFramesCount));
       return VOS_STATUS_E_RESOURCES;
    }
diff --git a/wlan/prima/CORE/TL/src/wlan_qct_tl_hosupport.c b/wlan/prima/CORE/TL/src/wlan_qct_tl_hosupport.c
index 950f3f0..03f213b 100644
--- a/wlan/prima/CORE/TL/src/wlan_qct_tl_hosupport.c
+++ b/wlan/prima/CORE/TL/src/wlan_qct_tl_hosupport.c
@@ -36,6 +36,9 @@
   Are listed for each API below. 
   
   
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
@@ -377,12 +380,12 @@
    {
       if(VOS_TRUE == tlCtxt->isBMPS)
       {
-         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO," ----> CRegion %d, hRSSI:NA, BMPS, Alpha %d",
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR," ----> CRegion %d, hRSSI:NA, BMPS, Alpha %d",
                       currentHO->regionNumber, currentHO->alpha));
       }
       else
       {
-         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO," ----> CRegion %d, hRSSI %d, Alpha %d",
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR," ----> CRegion %d, hRSSI %d, Alpha %d",
                       currentHO->regionNumber,
                       currentHO->historyRSSI,
                       currentHO->alpha));
@@ -848,7 +851,7 @@
    currentHO = &tlCtxt->hoSupport.currentHOState;
 
    currentRSSI0 = WLANTL_GETRSSI0(pBDHeader);
-   currentRSSI1 = WLANTL_GETRSSI1(pBDHeader);
+   currentRSSI1 = WLANTL_GETRSSI0(pBDHeader);
    currentRSSI  = (currentRSSI0 > currentRSSI1) ? currentRSSI0 : currentRSSI1;
 
    if (0 == currentRSSI)
@@ -1313,15 +1316,6 @@
       (WLANTL_MGMT_FRAME_TYPE != frameType))
    {
       tid = WDA_GET_RX_TID( pBDHeader );
-
-      /* If AP uses TID greater than 8 for EAPOL packet connection will not
-         be established. To ensure no connection fail use TID as zero.*/
-      if (WLANTL_TID_INVALID(tid)) {
-         VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-             "WLAN TL:Invalid Tid: %d", tid);
-         tid = 0;
-      }
-
       ac = WLANTL_HO_TID_2_AC[(v_U8_t)tid];
 
       /* Only Voice traffic is handled as real time traffic */
diff --git a/wlan/prima/CORE/TL/src/wlan_qct_tl_hosupport.h b/wlan/prima/CORE/TL/src/wlan_qct_tl_hosupport.h
index b2b0c69..fcffea7 100644
--- a/wlan/prima/CORE/TL/src/wlan_qct_tl_hosupport.h
+++ b/wlan/prima/CORE/TL/src/wlan_qct_tl_hosupport.h
@@ -36,6 +36,8 @@
                    
 DESCRIPTION
         
+  Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
diff --git a/wlan/prima/CORE/TL/src/wlan_qct_tl_trace.c b/wlan/prima/CORE/TL/src/wlan_qct_tl_trace.c
index 39b4a5f..8241670 100644
--- a/wlan/prima/CORE/TL/src/wlan_qct_tl_trace.c
+++ b/wlan/prima/CORE/TL/src/wlan_qct_tl_trace.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -52,10 +52,6 @@
          CASE_RETURN_STRING(TRACE_CODE_TL_QUEUE_CURRENT);
          CASE_RETURN_STRING(TRACE_CODE_TL_REORDER_TIMER_EXP_CB);
          CASE_RETURN_STRING(TRACE_CODE_TL_BA_SESSION_DEL);
-         CASE_RETURN_STRING(TRACE_CODE_TL_ASSOC_FAILED);
-         CASE_RETURN_STRING(TRACE_CODE_TL_FORWARD_CACHED_FRAMES);
-         CASE_RETURN_STRING(TRACE_CODE_TL_FLUSH_CACHED_FRAMES);
-         CASE_RETURN_STRING(TRACE_CODE_TL_CACHE_FRAME);
          default:
                return ("UNKNOWN");
                break;
@@ -64,12 +60,10 @@
 
 void tlTraceDump(void *pMac, tpvosTraceRecord pRecord, v_U16_t recIndex)
 {
-   TLLOGE( VOS_TRACE (VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-                       "%04d %012u S%-3d %-14s %-30s(0x%x)",
-                       recIndex, pRecord->time, pRecord->session,
-                       "  TL Event:  ",
-                       tlTraceGetEventString (pRecord->code),
-                       pRecord->data));
+   TLLOGE( VOS_TRACE (VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                       "%04d    %012u  S%-3d    %-14s  %-30s(0x%x)",
+                       recIndex, pRecord->time, pRecord->session, "  TL Event:  ",
+                       tlTraceGetEventString (pRecord->code), pRecord->data));
 }
 
 void tlTraceInit()
diff --git a/wlan/prima/CORE/TL/src/wlan_qct_tli.h b/wlan/prima/CORE/TL/src/wlan_qct_tli.h
index 5069863..f6349a5 100644
--- a/wlan/prima/CORE/TL/src/wlan_qct_tli.h
+++ b/wlan/prima/CORE/TL/src/wlan_qct_tli.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -58,7 +58,6 @@
 
 when        who    what, where, why
 --------    ---    ----------------------------------------------------------
-08/19/13    rajekuma Added RMC support in TL
 02/19/10    bad     Fixed 802.11 to 802.3 ft issues with WAPI
 01/14/10    rnair   Fixed the byte order for the WAI packet type.
 01/08/10    lti     Added TL Data Caching
@@ -123,7 +122,6 @@
 
 /*WAPI protocol type */
 #define WLANTL_LLC_WAI_TYPE              0x88b4
-#define WLANTL_ETHERTYPE_ARP             0x0806
 
 #ifdef FEATURE_WLAN_TDLS
 #define WLANTL_LLC_TDLS_TYPE             0x890d
@@ -170,8 +168,6 @@
 #define WLANTL_CTRL_FRAME_TYPE       0x10
 #define WLANTL_DATA_FRAME_TYPE       0x20
 
-#define WLANTL_MGMT_PROBE_REQ_FRAME_TYPE    0x04
-
 /*Value of the data type field in the 802.11 frame */
 #define WLANTL_80211_DATA_TYPE         0x02
 #define WLANTL_80211_DATA_QOS_SUBTYPE  0x08
@@ -186,10 +182,6 @@
 
 #define WLANTL_FRAME_TYPESUBTYPE_MASK 0x3F
 
-#ifdef WLAN_FEATURE_RMC
-#define WLANTL_RMC_HASH_TABLE_SIZE (32)
-#endif
-
 /*-------------------------------------------------------------------------
   BT-AMP related definition - !!! should probably be moved to BT-AMP header
 ---------------------------------------------------------------------------*/
@@ -287,8 +279,6 @@
 
   WLANTL_TX_FW_DEBUG = 8,
 
-  WLANTL_TX_KICKDXE = 9,
-
   WLANTL_TX_MAX
 }WLANTL_TxSignalsType;
 
@@ -496,18 +486,6 @@
   v_U8_t              ucSet;
 }WLANTL_UAPSDInfoType;
 
-#ifdef WLAN_FEATURE_RMC
-struct tTL_RMCList
-{
-  struct tTL_RMCList    *next;
-  v_MACADDR_t           rmcAddr;
-  v_U16_t               mcSeqCtl;
-  v_U32_t               rxMCDupcnt;
-};
-
-typedef struct tTL_RMCList WLANTL_RMC_SESSION;
-#endif
-
 /*---------------------------------------------------------------------------
   per-STA cache info
 ---------------------------------------------------------------------------*/
@@ -598,7 +576,7 @@
   v_U8_t                        ucMPDUHeaderLen;
 
   /* Enabled ACs currently serviced by TL (automatic setup in TL)*/
-  v_U8_t                        aucACMask[WLANTL_NUM_TX_QUEUES];
+  v_U8_t                        aucACMask[WLANTL_MAX_AC];
 
   /* Current AC to be retrieved */
   WLANTL_ACEnumType             ucCurrentAC;
@@ -702,11 +680,6 @@
 
   v_U32_t       linkCapacity;
 
-#ifdef WLAN_FEATURE_RMC
-  WLANTL_RMC_SESSION *mcastSession[WLANTL_RMC_HASH_TABLE_SIZE];
-  vos_lock_t mcLock;
-#endif
-
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
 
   /* Value of the averaged Data RSSI for this station */
@@ -720,12 +693,6 @@
 
   WLANTL_InterfaceStatsType         interfaceStats;
 #endif
-  /* BD Rate for transmitting ARP packets */
-  v_U8_t arpRate;
-  v_BOOL_t arpOnWQ5;
-
-  /* Disassoc in progress */
-  v_BOOL_t disassoc_progress;
 }WLANTL_STAClientType;
 
 /*---------------------------------------------------------------------------
@@ -810,37 +777,6 @@
    vos_lock_t                           hosLock;
 } WLANTL_HO_SUPPORT_TYPE;
 
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-#define ROAM_MAX_INDEX_NUM              50
-#define ROAM_PER_INDEX_TIME             500 /* (msec) */
-#define MIN_PKTS_TO_START_MONTIOR       10
-
-typedef struct
-{
-  v_U64_t lowRateRxPacketsRcvd;
-  v_U64_t totalPktRcvd;
-  v_U64_t time;
-}WLANTL_RoamTrafficStatsType;
-
-typedef struct {
-   v_U8_t running;
-   v_U8_t staId;
-   v_S7_t index;
-   v_U8_t intialPktToStart;
-   v_U8_t minPercentage;
-   v_U16_t minRate;
-   v_U16_t maxRate;
-   v_U32_t minPktRequired;
-   v_U64_t totalPkt;
-   v_U64_t timeToWait;
-   v_U64_t lowRatePkt;
-   v_U64_t lastTriggerTime;
-   WLANTL_RoamTrafficStatsType rxRoamStats[ROAM_MAX_INDEX_NUM];
-   void (*triggerRoamScanfn) (void *, v_U8_t);
-   void *hHal;
-}WLANTL_RoamMonitorType;
-#endif
-
 /*---------------------------------------------------------------------------
   TL control block type
 ---------------------------------------------------------------------------*/
@@ -929,8 +865,6 @@
   /* Current served station ID in round-robin method to traverse all stations.*/
   WLANTL_ACEnumType uCurServedAC;
 
-  WLANTL_SpoofMacAddr   spoofMacAddr;
-
   /* How many weights have not been served in current AC. */
   v_U8_t ucCurLeftWeight;
 
@@ -952,23 +886,8 @@
   v_BOOL_t                  isBMPS;
   /* Whether WDA_DS_TX_START_XMIT msg is pending or not */
   v_BOOL_t   isTxTranmitMsgPending;
-
-#ifdef WLAN_FEATURE_RMC
-  WLANTL_RMC_SESSION *rmcSession[WLANTL_RMC_HASH_TABLE_SIZE];
-  vos_lock_t rmcLock;
-  v_U8_t multicastDuplicateDetectionEnabled;
-  v_U8_t rmcDataPathEnabled;
-  v_U32_t mcastDupCnt;
-#endif
-  WLANTL_MonRxCBType           pfnMonRx;
-  v_BOOL_t              isConversionReq;
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-  WLANTL_RoamMonitorType gDsRxRoamStats;
-#endif
-
 }WLANTL_CbType;
 
-
 /*==========================================================================
 
   FUNCTION    WLANTL_GetFrames
@@ -1463,15 +1382,9 @@
   v_U8_t          ucHeaderLen,
   WLANTL_CbType*  pTLCb,
   v_U8_t          ucSTAId,
-  v_BOOL_t       bForwardIAPPwithLLC
+  v_BOOL_t	  bForwardIAPPwithLLC
 );
 
-VOS_STATUS
-WLANTL_MonTranslate80211To8023Header
-(
-  vos_pkt_t*      vosDataBuff,
-  WLANTL_CbType*  pTLCb
-);
 /*==========================================================================
   FUNCTION    WLANTL_FindFrameTypeBcMcUc
 
@@ -1822,99 +1735,4 @@
   v_U8_t          ucSTAId
 );
 
-#ifdef WLAN_FEATURE_RMC
-VOS_STATUS WLANTL_RmcInit
-(
-     v_PVOID_t   pAdapter
-);
-
-VOS_STATUS WLANTL_RmcDeInit
-(
-    v_PVOID_t   pAdapter
-);
-
-
-tANI_U8 WLANTL_RmcHashRmcSession ( v_MACADDR_t   *pMcastAddr );
-
-
-WLANTL_RMC_SESSION *WLANTL_RmcLookUpRmcSession
-(
-    WLANTL_RMC_SESSION *rmcSession[],
-    v_MACADDR_t     *pMcastAddr
-);
-
-WLANTL_RMC_SESSION *WLANTL_RmcAddRmcSession
-(
-    WLANTL_RMC_SESSION *rmcSession[],
-    v_MACADDR_t   *pMcastAddr
-);
-
-tANI_U8
-WLANTL_RmcDeleteRmcSession
-(
-    WLANTL_RMC_SESSION *rmcSession[],
-    v_MACADDR_t   *pMcastAddr
-);
-
-VOS_STATUS
-WLANTL_ProcessRmcCommand
-(
-    WLANTL_CbType*  pTLCb,
-    v_MACADDR_t    *pMcastAddr,
-    tANI_U32        command
-);
-
-/*=============================================================================
-  FUNCTION    WLANTL_IsDuplicateMcastFrm
-
-  DESCRIPTION
-    This function checks for duplicast multicast frames and drops them.
-
-  DEPENDENCIES
-
-  PARAMETERS
-
-   IN
-
-   pClientSTA  : Pointer to WLANTL_STAClientType
-   aucBDHeader : Pointer to BD header
-
-  RETURN VALUE
-
-    VOS_FALSE:  This frame is not a duplicate
-
-    VOS_TRUE:   This frame is a duplicate
-
-==============================================================================*/
-v_U8_t
-WLANTL_IsDuplicateMcastFrm
-(
-    WLANTL_STAClientType *pClientSTA,
-    vos_pkt_t* vosDataBuff
-);
-
-/*=============================================================================
-  FUNCTION    WLANTL_McastDeleteAllEntries
-
-  DESCRIPTION
-    This function removes all multicast entries used for duplicate detection
-
-  DEPENDENCIES
-
-  PARAMETERS
-
-   IN
-
-   pClientSTA  : Pointer to WLANTL_STAClientType
-
-  RETURN VALUE
-
-    None
-
-==============================================================================*/
-void
-WLANTL_McastDeleteAllEntries(WLANTL_STAClientType * pClientSTA);
-
-#endif /*WLAN_FEATURE_RMC*/
-
 #endif /* #ifndef WLAN_QCT_TLI_H */
diff --git a/wlan/prima/CORE/TL/src/wlan_qct_tli_ba.h b/wlan/prima/CORE/TL/src/wlan_qct_tli_ba.h
index 6265e89..0677b89 100644
--- a/wlan/prima/CORE/TL/src/wlan_qct_tli_ba.h
+++ b/wlan/prima/CORE/TL/src/wlan_qct_tli_ba.h
@@ -39,6 +39,8 @@
   layer module for BA session support, AMSDU de-aggregation and 
   MSDU reordering.
         
+  Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
diff --git a/wlan/prima/CORE/VOSS/inc/event_defs.h b/wlan/prima/CORE/VOSS/inc/event_defs.h
index 6907456..ec792b3 100644
--- a/wlan/prima/CORE/VOSS/inc/event_defs.h
+++ b/wlan/prima/CORE/VOSS/inc/event_defs.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1901,16 +1901,7 @@
   EVENT_FDPCH_CONFIG_ACTION = 0x766,
   EVENT_SNS_DRV_MOTION_DETECT_SIG = 0x767,
   EVENT_SNS_DRV_OPMODE_CHANGE = 0x768,
-  EVENT_WLAN_EAPOL = 0xA8D,/* 18 bytes payload */
-  EVENT_WLAN_WAKE_LOCK = 0xAA2, /* 96 bytes payload */
-  EVENT_WLAN_LOG_COMPLETE = 0xAA7, /* 16 bytes payload */
-  EVENT_WLAN_STATUS_V2 = 0xAB3,
-  EVENT_WLAN_TDLS_TEARDOWN = 0xAB5,
-  EVENT_WLAN_TDLS_ENABLE_LINK = 0XAB6,
-  EVENT_WLAN_SUSPEND_RESUME = 0xAB7,
-  EVENT_OFFLOAD_REQ = 0xAB8,
-  EVENT_TDLS_SCAN_BLOCK = 0xAB9,
-  EVENT_WLAN_TX_RX_MGMT = 0xABA,
+
   EVENT_NEXT_UNUSED_EVENT,
   EVENT_RSVD_START = 0x0800,
   EVENT_RSVD_END   = 0x083F,
diff --git a/wlan/prima/CORE/VOSS/inc/i_vos_diag_core_event.h b/wlan/prima/CORE/VOSS/inc/i_vos_diag_core_event.h
index 5d8bb09..682a02e 100644
--- a/wlan/prima/CORE/VOSS/inc/i_vos_diag_core_event.h
+++ b/wlan/prima/CORE/VOSS/inc/i_vos_diag_core_event.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -34,6 +34,9 @@
   
   \brief Android specific definitions for vOSS DIAG events
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -87,17 +90,6 @@
 /*------------------------------------------------------------------------- 
   Function declarations and documenation
   ------------------------------------------------------------------------*/
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-void vos_log_wlock_diag(uint32_t reason, const char *wake_lock_name,
-                              uint32_t timeout, uint32_t status);
-#else
-static inline void vos_log_wlock_diag(uint32_t reason,
-                                 const char *wake_lock_name,
-                           uint32_t timeout, uint32_t status)
-{
-
-}
-#endif /* FEATURE_WLAN_DIAG_SUPPORT */
 
 #ifdef __cplusplus
 }
diff --git a/wlan/prima/CORE/VOSS/inc/i_vos_diag_core_log.h b/wlan/prima/CORE/VOSS/inc/i_vos_diag_core_log.h
index 9851497..00e0ecb 100644
--- a/wlan/prima/CORE/VOSS/inc/i_vos_diag_core_log.h
+++ b/wlan/prima/CORE/VOSS/inc/i_vos_diag_core_log.h
@@ -34,6 +34,9 @@
   
   \brief android-specific definitions for vOSS DIAG logs
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/VOSS/inc/i_vos_event.h b/wlan/prima/CORE/VOSS/inc/i_vos_event.h
index a3f7ac9..bf0c5df 100644
--- a/wlan/prima/CORE/VOSS/inc/i_vos_event.h
+++ b/wlan/prima/CORE/VOSS/inc/i_vos_event.h
@@ -34,6 +34,9 @@
 
   \brief Linux-specific definitions for vOSS Events
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/VOSS/inc/i_vos_list.h b/wlan/prima/CORE/VOSS/inc/i_vos_list.h
index 53b1d4b..3fd2bde 100644
--- a/wlan/prima/CORE/VOSS/inc/i_vos_list.h
+++ b/wlan/prima/CORE/VOSS/inc/i_vos_list.h
@@ -34,6 +34,9 @@
   
   \brief Linux-specific definitions for vOSS lists 
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/VOSS/inc/i_vos_lock.h b/wlan/prima/CORE/VOSS/inc/i_vos_lock.h
index 0a66103..ddda195 100644
--- a/wlan/prima/CORE/VOSS/inc/i_vos_lock.h
+++ b/wlan/prima/CORE/VOSS/inc/i_vos_lock.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -34,6 +34,9 @@
   
   \brief Linux-specific definitions for vOSS Locks
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -46,10 +49,6 @@
 #include <linux/mutex.h>
 #include <linux/spinlock.h>
 #include <linux/sched.h>
-#if defined(WLAN_OPEN_SOURCE)
-#include <linux/wakelock.h>
-#endif
-
 
 /*-------------------------------------------------------------------------- 
   Preprocessor definitions and constants
@@ -72,13 +71,6 @@
 
 typedef spinlock_t vos_spin_lock_t;
 
-#if defined(WLAN_OPEN_SOURCE)
-typedef struct wake_lock vos_wake_lock_t;
-#else
-typedef int vos_wake_lock_t;
-#endif
-
-
 /*------------------------------------------------------------------------- 
   Function declarations and documenation
   ------------------------------------------------------------------------*/
diff --git a/wlan/prima/CORE/VOSS/inc/i_vos_packet.h b/wlan/prima/CORE/VOSS/inc/i_vos_packet.h
index f0bc8ab..e114102 100644
--- a/wlan/prima/CORE/VOSS/inc/i_vos_packet.h
+++ b/wlan/prima/CORE/VOSS/inc/i_vos_packet.h
@@ -36,6 +36,9 @@
 
    Network Protocol packet/buffer internal include file
 
+   Copyright 2009 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/VOSS/inc/i_vos_timer.h b/wlan/prima/CORE/VOSS/inc/i_vos_timer.h
index e789af4..775c0ea 100644
--- a/wlan/prima/CORE/VOSS/inc/i_vos_timer.h
+++ b/wlan/prima/CORE/VOSS/inc/i_vos_timer.h
@@ -34,6 +34,9 @@
   
   \brief Linux-specific definitions for vOSS packets
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/VOSS/inc/i_vos_trace.h b/wlan/prima/CORE/VOSS/inc/i_vos_trace.h
index 4708a3e..2f21b46 100644
--- a/wlan/prima/CORE/VOSS/inc/i_vos_trace.h
+++ b/wlan/prima/CORE/VOSS/inc/i_vos_trace.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -38,6 +38,9 @@
   
   \brief Linux-specific definitions for VOSS trace
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -149,6 +152,4 @@
 
 #define VOS_RETURN_ADDRESS  __builtin_return_address(0)
 
-#define VOS_SMP_MB smp_mb()
-
 #endif
diff --git a/wlan/prima/CORE/VOSS/inc/i_vos_types.h b/wlan/prima/CORE/VOSS/inc/i_vos_types.h
index 72c7421..f8cfdbe 100644
--- a/wlan/prima/CORE/VOSS/inc/i_vos_types.h
+++ b/wlan/prima/CORE/VOSS/inc/i_vos_types.h
@@ -35,7 +35,6 @@
 #include <linux/string.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
-#include <linux/version.h>
 #include <asm/div64.h>
 
 /**=========================================================================
@@ -46,6 +45,9 @@
                
    Linux specific basic type definitions 
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/VOSS/inc/log_codes.h b/wlan/prima/CORE/VOSS/inc/log_codes.h
index 250727d..d5e4e9e 100644
--- a/wlan/prima/CORE/VOSS/inc/log_codes.h
+++ b/wlan/prima/CORE/VOSS/inc/log_codes.h
@@ -2010,11 +2010,8 @@
 
 #define LOG_TRSP_DATA_STALL_C                                       ((0x801) + LOG_1X_BASE_C)
 
-#define LOG_WLAN_PKT_LOG_INFO_C                                     ((0x8E0) + LOG_1X_BASE_C)
-
-
 /* The last defined DMSS log code */
-#define LOG_1X_LAST_C                                   ((0x8E0) + LOG_1X_BASE_C)
+#define LOG_1X_LAST_C                                   ((0x801) + LOG_1X_BASE_C)
 
 
 /* This is only here for old (pre equipment ID update) logging code */
diff --git a/wlan/prima/CORE/VOSS/inc/vos_api.h b/wlan/prima/CORE/VOSS/inc/vos_api.h
index d659281..1eaa40f 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_api.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_api.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,6 +36,9 @@
                
    Header file that inludes all the vOSS API definitions.
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
  /*=========================================================================== 
@@ -75,137 +78,6 @@
 #include <vos_timer.h>
 #include <vos_pack_align.h>
 
-/**
- * enum userspace_log_level - Log level at userspace
- * @LOG_LEVEL_NO_COLLECTION: verbose_level 0 corresponds to no collection
- * @LOG_LEVEL_NORMAL_COLLECT: verbose_level 1 correspond to normal log level,
- * with minimal user impact. this is the default value
- * @LOG_LEVEL_ISSUE_REPRO: verbose_level 2 are enabled when user is lazily
- * trying to reproduce a problem, wifi performances and power can be impacted
- * but device should not otherwise be significantly impacted
- * @LOG_LEVEL_ACTIVE: verbose_level 3+ are used when trying to
- * actively debug a problem
- *
- * Various log levels defined in the userspace for logging applications
- */
-enum userspace_log_level {
-    LOG_LEVEL_NO_COLLECTION,
-    LOG_LEVEL_NORMAL_COLLECT,
-    LOG_LEVEL_ISSUE_REPRO,
-    LOG_LEVEL_ACTIVE,
-};
-
-/**
- * enum wifi_driver_log_level - Log level defined in the driver for logging
- * @WLAN_LOG_LEVEL_OFF: No logging
- * @WLAN_LOG_LEVEL_NORMAL: Default logging
- * @WLAN_LOG_LEVEL_REPRO: Normal debug level
- * @WLAN_LOG_LEVEL_ACTIVE: Active debug level
- *
- * Log levels defined for logging by the wifi driver
- */
-enum wifi_driver_log_level {
-    WLAN_LOG_LEVEL_OFF,
-    WLAN_LOG_LEVEL_NORMAL,
-    WLAN_LOG_LEVEL_REPRO,
-    WLAN_LOG_LEVEL_ACTIVE,
-};
-
-/**
- * enum wifi_logging_ring_id - Ring id of logging entities
- * @RING_ID_WAKELOCK:         Power events ring id
- * @RING_ID_CONNECTIVITY:     Connectivity event ring id
- * @RING_ID_PER_PACKET_STATS: Per packet statistic ring id
- *
- * This enum has the ring id values of logging rings
- */
-enum wifi_logging_ring_id {
-    RING_ID_WAKELOCK,
-    RING_ID_CONNECTIVITY,
-    RING_ID_PER_PACKET_STATS,
-};
-
-/* 15 Min */
-#define WLAN_POWER_COLLAPSE_FAIL_THRESHOLD  (1000 * 60 * 15)
-/**
- * enum log_event_type - Type of event initiating bug report
- * @WLAN_LOG_TYPE_NON_FATAL: Non fatal event
- * @WLAN_LOG_TYPE_FATAL: Fatal event
- *
- * Enum indicating the type of event that is initiating the bug report
- */
-enum log_event_type {
-	WLAN_LOG_TYPE_NON_FATAL,
-	WLAN_LOG_TYPE_FATAL,
-};
-
-/**
- * enum log_event_indicator - Module triggering bug report
- * @WLAN_LOG_INDICATOR_UNUSED: Unused
- * @WLAN_LOG_INDICATOR_FRAMEWORK: Framework triggers bug report
- * @WLAN_LOG_INDICATOR_HOST_DRIVER: Host driver triggers bug report
- * @WLAN_LOG_INDICATOR_FIRMWARE: FW initiates bug report
- * @WLAN_LOG_INDICATOR_IOCTL: Bug report is initiated by IOCTL
- * @WLAN_LOG_INDICATOR_HOST_ONLY: Host initiated and only Host
- * logs are needed
- *
- * Enum indicating the module that triggered the bug report
- */
-enum log_event_indicator {
-	WLAN_LOG_INDICATOR_UNUSED,
-	WLAN_LOG_INDICATOR_FRAMEWORK,
-	WLAN_LOG_INDICATOR_HOST_DRIVER,
-	WLAN_LOG_INDICATOR_FIRMWARE,
-	WLAN_LOG_INDICATOR_IOCTL,
-	WLAN_LOG_INDICATOR_HOST_ONLY,
-};
-
-/**
- * enum log_event_host_reason_code - Reason code for bug report
- * @WLAN_LOG_REASON_CODE_UNUSED: Unused
- * @WLAN_LOG_REASON_ROAM_FAIL: Driver initiated roam has failed
- * @WLAN_LOG_REASON_THREAD_STUCK: Monitor Health of host threads and report
- * fatal event if some thread is stuck
- * @WLAN_LOG_REASON_DATA_STALL: Unable to send/receive data due to low resource
- * scenario for a prolonged period
- * @WLAN_LOG_REASON_SME_COMMAND_STUCK: SME command is stuck in SME active queue
- * @WLAN_LOG_REASON_QUEUE_FULL: Defer queue becomes full for a prolonged period
- * @WLAN_LOG_REASON_POWER_COLLAPSE_FAIL: Unable to allow apps power collapse
- * for a prolonged period
- * @WLAN_LOG_REASON_MALLOC_FAIL: Memory allocation Fails
- * @WLAN_LOG_REASON_VOS_MSG_UNDER_RUN: VOS Core runs out of message wrapper
- * @WLAN_LOG_REASON_IOCTL: Initiated by IOCTL
- * @WLAN_LOG_REASON_CODE_FRAMEWORK: Initiated by framework
- * @WLAN_LOG_REASON_DEL_BSS_STA_FAIL: DEL BSS/STA rsp is failure
- * @WLAN_LOG_REASON_ADD_BSS_STA_FAIL: ADD BSS/STA rsp is failure
- * @WLAN_LOG_REASON_ENTER_IMPS_BMPS_FAIL: Enter IMPS/BMPS rsp failure
- * @WLAN_LOG_REASON_EXIT_IMPS_BMPS_FAIL: Exit IMPS/BMPS rsp failure
- * @WLAN_LOG_REASON_HDD_TIME_OUT: Wait for event Timeout in HDD layer
- * @WLAN_LOG_REASON_MGMT_FRAME_TIMEOUT:Management frame timedout
-   @WLAN_LOG_REASON_SME_OUT_OF_CMD_BUFL sme out of cmd buffer
- * This enum contains the different reason codes for bug report
- */
-enum log_event_host_reason_code {
-	WLAN_LOG_REASON_CODE_UNUSED,
-	WLAN_LOG_REASON_ROAM_FAIL,
-	WLAN_LOG_REASON_THREAD_STUCK,
-	WLAN_LOG_REASON_DATA_STALL,
-	WLAN_LOG_REASON_SME_COMMAND_STUCK,
-	WLAN_LOG_REASON_QUEUE_FULL,
-	WLAN_LOG_REASON_POWER_COLLAPSE_FAIL,
-	WLAN_LOG_REASON_MALLOC_FAIL,
-	WLAN_LOG_REASON_VOS_MSG_UNDER_RUN,
-	WLAN_LOG_REASON_IOCTL,
-	WLAN_LOG_REASON_CODE_FRAMEWORK,
-	WLAN_LOG_REASON_DEL_BSS_STA_FAIL,
-	WLAN_LOG_REASON_ADD_BSS_STA_FAIL,
-	WLAN_LOG_REASON_ENTER_IMPS_BMPS_FAIL,
-	WLAN_LOG_REASON_EXIT_IMPS_BMPS_FAIL,
-	WLAN_LOG_REASON_HDD_TIME_OUT,
-	WLAN_LOG_REASON_MGMT_FRAME_TIMEOUT,
-	WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF,
-};
-
 /*------------------------------------------------------------------------- 
   Function declarations and documenation
   ------------------------------------------------------------------------*/
@@ -242,9 +114,7 @@
 
 VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, void *devHandle );
 
-VOS_STATUS vos_mon_start( v_CONTEXT_t vosContext );
 
-VOS_STATUS vos_mon_stop( v_CONTEXT_t vosContext );
 
 VOS_STATUS vos_start( v_CONTEXT_t vosContext ); 
 
@@ -308,21 +178,6 @@
 
 v_U8_t vos_is_reinit_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext);
 void vos_set_reinit_in_progress(VOS_MODULE_ID moduleId, v_U8_t value);
-VOS_STATUS vos_logger_pkt_serialize(vos_pkt_t *pPacket, uint32 pkt_type);
-bool vos_is_log_report_in_progress(void);
-void vos_reset_log_report_in_progress(void);
-int vos_set_log_completion(uint32 is_fatal, uint32 indicator, uint32 reason_code);
-void vos_get_log_and_reset_completion(uint32 *is_fatal,
-           uint32 *indicator, uint32 *reason_code, bool reset);
-v_BOOL_t vos_isFatalEventEnabled(void);
-VOS_STATUS vos_fatal_event_logs_req( uint32_t is_fatal, uint32_t indicator,
-                                 uint32_t reason_code, bool wait_required,
-                                 bool dump_vos_trace);
-VOS_STATUS vos_process_done_indication(v_U8_t type, v_U32_t reason_code);
-void vos_flush_host_logs_for_fatal(void);
-
-void vos_send_fatal_event_done(void);
-
 
 /**---------------------------------------------------------------------------
   
@@ -399,7 +254,9 @@
   --------------------------------------------------------------------------*/
 VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID,
                              v_VOID_t *pModuleContext );
+                             
 v_BOOL_t vos_is_apps_power_collapse_allowed(void* pHddCtx);
+void vos_abort_mac_scan(tANI_U8 sessionId);
 
 /**
   @brief vos_wlanShutdown() - This API will shutdown WLAN driver
@@ -459,23 +316,16 @@
   This function is called to issue dump commands to Firmware
 
   @param
-       cmd     -  Command No. to execute
-       arg1    -  argument 1 to cmd
-       arg2    -  argument 2 to cmd
-       arg3    -  argument 3 to cmd
-       arg4    -  argument 4 to cmd
-       async   -  asynchronous event. Don't wait for completion.
+       cmd - Command No. to execute
+       arg1 - argument 1 to cmd
+       arg2 - argument 2 to cmd
+       arg3 - argument 3 to cmd
+       arg4 - argument 4 to cmd
   @return
        NONE
 */
 v_VOID_t vos_fwDumpReq(tANI_U32 cmd, tANI_U32 arg1, tANI_U32 arg2,
-                        tANI_U32 arg3, tANI_U32 arg4, tANI_U8 async);
-
-v_VOID_t vos_flush_work(struct work_struct *work);
-v_VOID_t vos_flush_delayed_work(struct delayed_work *dwork);
-
-v_VOID_t vos_init_work(struct work_struct *work , void *callbackptr);
-v_VOID_t vos_init_delayed_work(struct delayed_work *dwork , void *callbackptr);
+                        tANI_U32 arg3, tANI_U32 arg4);
 
 v_U64_t vos_get_monotonic_boottime(void);
 
@@ -483,29 +333,5 @@
 
 v_BOOL_t vos_is_wlan_in_badState(VOS_MODULE_ID moduleId,
                                  v_VOID_t *moduleContext);
-v_VOID_t  vos_set_roam_delay_stats_enabled(v_U8_t value);
-v_U8_t    vos_get_roam_delay_stats_enabled(v_VOID_t);
-v_U32_t   vos_get_dxeReplenishRXTimerVal(void);
-v_BOOL_t  vos_get_dxeSSREnable(void);
-
-v_U8_t vos_is_fw_logging_enabled(void);
-v_U8_t vos_is_fw_ev_logging_enabled(void);
-
-v_U8_t vos_is_fw_logging_supported(void);
-void vos_set_multicast_logging(uint8_t value);
-v_U8_t vos_is_multicast_logging(void);
-void vos_set_ring_log_level(v_U32_t ring_id, v_U32_t log_level);
-v_U8_t vos_get_ring_log_level(v_U32_t ring_id);
-void get_rate_and_MCS(per_packet_stats *stats, uint32 rateindex);
-
-v_BOOL_t vos_isUnloadInProgress(void);
-v_BOOL_t vos_isLoadUnloadInProgress(void);
-
-void vos_probe_threads(void);
-void vos_per_pkt_stats_to_user(void *perPktStat);
-void vos_updatePktStatsInfo(void * pktStat);
-bool vos_is_wlan_logging_enabled(void);
-
-v_BOOL_t vos_is_probe_rsp_offload_enabled(void);
 
 #endif // if !defined __VOS_NVITEM_H
diff --git a/wlan/prima/CORE/VOSS/inc/vos_diag_core_event.h b/wlan/prima/CORE/VOSS/inc/vos_diag_core_event.h
index c52a6f5..a6dd932 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_diag_core_event.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_diag_core_event.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,6 +36,9 @@
                
    Definitions for vOSS Events
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -55,9 +58,6 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#define WAKE_LOCK_NAME_LEN 80
-
-
 /*------------------------------------------------------------------------- 
   Event ID: EVENT_WLAN_SECURITY
   ------------------------------------------------------------------------*/
@@ -74,12 +74,12 @@
 } vos_event_wlan_security_payload_type;
 
 /*------------------------------------------------------------------------- 
-  Event ID: EVENT_WLAN_STATUS_V2
+  Event ID: EVENT_WLAN_STATUS
   ------------------------------------------------------------------------*/
 typedef struct
 {
    v_U8_t eventId;
-   v_U8_t ssid[32];
+   v_U8_t ssid[6];
    v_U8_t bssType;
    v_U8_t rssi;
    v_U8_t channel;
@@ -248,172 +248,11 @@
    v_U8_t  mode;
 } vos_event_wlan_btc_type;
 
-/*-------------------------------------------------------------------------
-  Event ID: EVENT_WLAN_EAPOL
-  ------------------------------------------------------------------------*/
-struct vos_event_wlan_eapol
-{
-       uint8_t   event_sub_type;
-       uint8_t   eapol_packet_type;
-       uint16_t  eapol_key_info;
-       uint16_t  eapol_rate;
-       uint8_t   dest_addr[6];
-       uint8_t   src_addr[6];
-};
-/*-------------------------------------------------------------------------
-  Event ID: EVENT_WLAN_WAKE_LOCK
-  ------------------------------------------------------------------------*/
-/*
- * struct vos_event_wlan_wake_lock - Structure holding the wakelock information
- * @status: Whether the wakelock is taken/released
- * @reason: Reason for taking this wakelock
- * @timeout: Timeout value in case of timed wakelocks
- * @name_len: Length of the name of the wakelock that will follow
- * @name: Name of the wakelock
- *
- * This structure will hold the wakelock informations
- */
-struct vos_event_wlan_wake_lock
-{
-       uint32_t status;
-       uint32_t reason;
-       uint32_t timeout;
-       uint32_t name_len;
-       char     name[WAKE_LOCK_NAME_LEN];
-};
-
-/**
- * struct vos_event_tdls_teardown - tdls teardown diag event
- * @reason: reason for tear down
- * @peer_mac: peer mac
- *
- * This structure contain tdls teardown diag event info
- */
-
-struct vos_event_tdls_teardown {
-   uint32_t reason;
-   uint8_t peer_mac[6];
-};
-
-/**
- * struct vos_event_tdls_enable_link - tdls enable link event
- * @peer_mac: peer mac
- * @is_off_chan_supported: if off channel supported
- * @is_off_chan_configured: if off channel configured
- * @is_off_chan_established: if off channel established
- *
- * This structure contain tdls enable link diag event info
- */
-struct vos_event_tdls_enable_link {
-   uint8_t   peer_mac[6];
-   uint8_t   is_off_chan_supported;
-   uint8_t   is_off_chan_configured;
-   uint8_t   is_off_chan_established;
-};
-
-/**
- * struct vos_event_suspend - suspend/resume state
- * @state: suspend/resume state
- *
- * This structure contains suspend resume diag event info
- */
-
-struct vos_event_suspend {
-   uint8_t state;
-};
-
-/**
- * struct vos_event_offload_req - offload state
- * @offload_type: offload type
- * @state: enabled or disabled state
- *
- * This structure contains offload diag event info
- */
-
-struct vos_event_offload_req {
-   uint8_t offload_type;
-   uint8_t state;
-};
-
-/**
- * struct vos_event_tdls_scan_rejected - scan
- * rejected due to tdls
- * @status: rejected status
- *
- * This structure contains scan rejected due to
- * tdls event info
- */
-struct vos_event_tdls_scan_rejected {
-    uint8_t status;
-};
-
-/**
- * struct vos_event_tx_rx_mgmt - for TX RX management frame
- * @event_id: event ID
- * @tx_rx: tx or rx
- * @type: type of frame
- * @action_sub_type: action frame type
- * @peer_mac: peer mac
- *
- * This structure contains tdls TX RX management frame info
- */
-struct vos_event_tx_rx_mgmt {
-   uint8_t   event_id;
-   uint8_t   tx_rx;
-   uint8_t   type;
-   uint8_t   action_sub_type;
-   uint8_t   peer_mac[6];
-};
-
-
-/*-------------------------------------------------------------------------
-  Event ID: EVENT_WLAN_LOG_COMPLETE
-  ------------------------------------------------------------------------*/
-/**
- * struct vos_event_wlan_log_complete - Holds log completion details
- * @is_fatal: Indicates if the event is fatal or not
- * @indicator: Source of the bug report - Framework/Host/Firmware
- * @reason_code: Reason for triggering bug report
- * @reserved: Reserved field
- *
- * This structure holds the log completion related information
- */
-struct vos_event_wlan_log_complete {
-    uint32_t is_fatal;
-    uint32_t indicator;
-    uint32_t reason_code;
-    uint32_t reserved;
-};
-
 
 /*------------------------------------------------------------------------- 
   Function declarations and documenation
   ------------------------------------------------------------------------*/
-enum wifi_connectivity_events {
-       WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED,
-       WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED,
-};
 
-/*
- * enum wake_lock_reason - Reason for taking wakelock
-* @WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT: Driver initialization
- * @WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT: Driver re-initialization
- * @WIFI_POWER_EVENT_WAKELOCK_SCAN: Scan request/response handling
- * @WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN: Driver resume
- * @WIFI_POWER_EVENT_WAKELOCK_ROC: Remain on channel request/response handling
- * @WIFI_POWER_EVENT_WAKELOCK_HOLD_RX: Wakelocks taken for receive
- * @WIFI_POWER_EVENT_WAKELOCK_SAP: SoftAP related wakelocks
- * This enum has the reason codes why the wakelocks were taken/released
- */
-enum wake_lock_reason {
-       WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT,
-       WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT,
-       WIFI_POWER_EVENT_WAKELOCK_SCAN,
-       WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN,
-       WIFI_POWER_EVENT_WAKELOCK_ROC,
-       WIFI_POWER_EVENT_WAKELOCK_HOLD_RX,
-       WIFI_POWER_EVENT_WAKELOCK_SAP,
-};
 
 #ifdef __cplusplus
 }
diff --git a/wlan/prima/CORE/VOSS/inc/vos_diag_core_log.h b/wlan/prima/CORE/VOSS/inc/vos_diag_core_log.h
index adf6b2f..20c37e8 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_diag_core_log.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_diag_core_log.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,6 +36,9 @@
                
    Definitions for vOSS Events
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -65,88 +68,6 @@
 #define VOS_LOG_MAX_NUM_HO_CANDIDATE_APS                    20
 #define VOS_LOG_MAX_WOW_PTRN_SIZE                           128
 #define VOS_LOG_MAX_WOW_PTRN_MASK_SIZE                      16
-/* Version to be updated whenever format of vos_log_pktlog_info changes */
-#define VERSION_LOG_WLAN_PKT_LOG_INFO_C                     1
-
-enum {
-   PKTLOG_FLG_FRM_TYPE_LOCAL_S = 0,
-   PKTLOG_FLG_FRM_TYPE_REMOTE_S,
-   PKTLOG_FLG_FRM_TYPE_UNKNOWN_S
-};
-
-/* Format of the packet stats event*/
-typedef struct {
-   v_U16_t flags;
-   v_U16_t missed_cnt;
-   v_U16_t log_type;
-   v_U16_t size;
-   v_U32_t timestamp;
-}__attribute__((packed))pkt_stats_hdr ;
-
-/* Per packet data info */
-#define PER_PACKET_ENTRY_FLAGS_DIRECTION_TX  1    // 0: TX, 1: RX
-#define PER_PACKET_ENTRY_FLAGS_TX_SUCCESS    2    // whether packet was transmitted or
-                                                  // received/decrypted successfully
-#define PER_PACKET_ENTRY_FLAGS_80211_HEADER  4    // has full 802.11 header, else has 802.3 header
-#define PER_PACKET_ENTRY_FLAGS_PROTECTED     8    // whether packet was encrypted
-#define STATS_MAX_RATE_INDEX      136
-
-
-enum {
-   S_BW20,
-   S_BW40,
-   S_BW80,
-   S_BW160
-};
-enum {
-   PREAMBLE_CCK,
-   PREAMBLE_OFDM,
-   PREAMBLE_HT,
-   PREAMBLE_VHT
-};
-
-typedef struct{
-   v_U16_t rate;
-   v_U16_t preamble;
-   v_U8_t bw;
-   v_U8_t short_gi;
-}rateidx_to_rate_bw_preamble_sgi;
-
-
-typedef struct {
-   v_U16_t rate       :  4;
-   v_U16_t nss        :  2;
-   v_U16_t preamble   :  2;
-   v_U16_t bw         :  2;
-   v_U16_t short_gi   :  1;
-   v_U16_t reserved   :  5;
-} mcs_stats;
-
-typedef struct {
-   v_U8_t  flags;
-   v_U8_t  tid;     // transmit or received tid
-   mcs_stats MCS;    // modulation and bandwidth
-   v_S7_t  rssi;    // TX: RSSI of ACK for that packet
-                // RX: RSSI of packet
-   v_U8_t  num_retries;                   // number of attempted retries
-   v_U16_t last_transmit_rate;           // last transmit rate in .5 mbps
-   v_U16_t link_layer_transmit_sequence; // receive sequence for that MPDU packet
-   v_U64_t dxe_timestamp;     // DXE timestamp
-   v_U64_t start_contention_timestamp; // 0 Not supported
-   v_U64_t transmit_success_timestamp; // 0 Not Supported
-   /* Whole frame for management/EAPOl/DHCP frames and 802.11 + LLC
-    * header + 40 bytes or full frame whichever is smaller for
-    * remaining Data packets
-    */
-   v_U8_t data[MAX_PKT_STAT_DATA_LEN];
-} __attribute__((packed)) per_packet_stats;
-
-typedef struct
-{
-   pkt_stats_hdr ps_hdr;
-   per_packet_stats stats;
-}tx_rx_pkt_stats;
-
 
 /*---------------------------------------------------------------------------
    This packet contains the scan results of the recent scan operation 
@@ -436,7 +357,7 @@
    log_hdr_type                     hdr;
    v_U32_t                          PowerState;
    v_U32_t                          numFreeBd;
-   vos_log_data_stall_channel_type  dxeChannelInfo[8];
+   vos_log_data_stall_channel_type  dxeChannelInfo[4];
 } vos_log_data_stall_type;
 
 /*---------------------------------------------------------------------------
@@ -449,23 +370,6 @@
   v_S7_t            rssi;
 } vos_log_rssi_pkt_type;
 
-/**
- * struct vos_log_pktlog_info - Packet log info
- * @log_hdr: Log header
- * @buf_len: Length of the buffer that follows
- * @buf:     Buffer containing the packet log info
- *
- * Structure containing the packet log information
- * LOG_WLAN_PKT_LOG_INFO_C          0x18E0
- */
-typedef struct
-{
-  log_hdr_type log_hdr;
-  uint32_t version;
-  uint32_t seq_no;
-  uint32_t buf_len;
-}__attribute__((packed))vos_log_pktlog_info;
-
 /*------------------------------------------------------------------------- 
   Function declarations and documenation
   ------------------------------------------------------------------------*/
diff --git a/wlan/prima/CORE/VOSS/inc/vos_event.h b/wlan/prima/CORE/VOSS/inc/vos_event.h
index c039464..d2480da 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_event.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_event.h
@@ -36,6 +36,9 @@
                
    Definitions for vOSS Events
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -55,10 +58,6 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-#define INIT_COMPLETION(event) reinit_completion(&event)
-#endif
-
 /*-------------------------------------------------------------------------- 
   Type declarations
   ------------------------------------------------------------------------*/
diff --git a/wlan/prima/CORE/VOSS/inc/vos_list.h b/wlan/prima/CORE/VOSS/inc/vos_list.h
index bc43d1b..cd59965 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_list.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_list.h
@@ -61,6 +61,9 @@
    This linked list API is implemented with appropriate locking
    mechanisms to assure operations on the list are thread safe.
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/VOSS/inc/vos_lock.h b/wlan/prima/CORE/VOSS/inc/vos_lock.h
index 9cce950..c74e761 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_lock.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_lock.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,6 +36,9 @@
                
    Definitions for vOSS Locks
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -248,63 +251,5 @@
   ------------------------------------------------------------------------*/
 VOS_STATUS vos_spin_lock_destroy(vos_spin_lock_t *pLock);
 
-/*--------------------------------------------------------------------------
-
-  \brief vos_wake_lock_init() - initializes a vOSS wake lock
-
-  \param pLock - the wake lock to initialize
-              name - wakelock name
-
-  \return VOS_STATUS_SUCCESS - wake lock was successfully initialized and
-          is ready to be used.
-  --------------------------------------------------------------------------*/
-VOS_STATUS vos_wake_lock_init(vos_wake_lock_t *pLock, const char *name);
-
-/*--------------------------------------------------------------------------
-
-  \brief vos_wake_lock_acquire() - acquires a wake lock
-
-  \param pLock - the wake lock to acquire
-         reason - reason for taking wakelock
-
-  \return VOS_STATUS_SUCCESS - the wake lock was successfully acquired
-
-  ------------------------------------------------------------------------*/
-VOS_STATUS vos_wake_lock_acquire(vos_wake_lock_t *pLock, uint32_t reason);
-/*--------------------------------------------------------------------------
-
-  \brief vos_wake_lock_timeout_release() - release a wake lock with a timeout
-
-  \param pLock - the wake lock to release
-         reason - reason for taking wakelock
-
-  \return VOS_STATUS_SUCCESS - the wake lock was successfully released
-
-  ------------------------------------------------------------------------*/
-VOS_STATUS vos_wake_lock_timeout_release(vos_wake_lock_t *pLock,
-                                            v_U32_t msec, uint32_t reason);
-
-/*--------------------------------------------------------------------------
-
-  \brief vos_wake_lock_release() - releases a wake lock
-
-  \param pLock - the wake lock to release
-         reason - reason for taking wakelock
-
-  \return VOS_STATUS_SUCCESS - the lock was successfully released
-
-  ------------------------------------------------------------------------*/
-VOS_STATUS vos_wake_lock_release(vos_wake_lock_t *pLock, uint32_t reason);
-
-/*--------------------------------------------------------------------------
-
-  \brief vos_wake_lock_destroy() - destroys a wake lock
-
-  \param pLock - the wake lock to destroy
-
-  \return VOS_STATUS_SUCCESS - the lock was successfully destroyed
-
-  ------------------------------------------------------------------------*/
-VOS_STATUS vos_wake_lock_destroy(vos_wake_lock_t *pLock);
 
 #endif // __VOSS_LOCK_H
diff --git a/wlan/prima/CORE/VOSS/inc/vos_memory.h b/wlan/prima/CORE/VOSS/inc/vos_memory.h
index fd064c6..85847d1 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_memory.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_memory.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,6 +36,9 @@
                
    Memory management functions
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -45,7 +48,7 @@
   Include Files
   ------------------------------------------------------------------------*/
 #include <vos_types.h>
-#include <linux/version.h>
+
 /*-------------------------------------------------------------------------- 
   Preprocessor definitions and constants
   ------------------------------------------------------------------------*/
@@ -144,15 +147,7 @@
   --------------------------------------------------------------------------*/
 v_VOID_t vos_mem_zero( v_VOID_t *ptr, v_SIZE_t numBytes );
 
-static __inline__ unsigned long vos_htonl(unsigned long ul)
-{
-  return( ( ( ul & 0x000000ff ) << 24 ) |
-          ( ( ul & 0x0000ff00 ) <<  8 ) |
-          ( ( ul & 0x00ff0000 ) >>  8 ) |
-          ( ( ul & 0xff000000 ) >> 24 )   );
-}
 
-void vos_buff_to_hl_buff (v_U8_t *buffer, int size);
 /*----------------------------------------------------------------------------
   
   \brief vos_mem_copy() - Copy memory
@@ -218,18 +213,7 @@
                        locations are equal or not equal. 
     
   -------------------------------------------------------------------------------*/
-v_BOOL_t vos_mem_compare(
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                          const v_VOID_t *pMemory1,
-#else
-                          v_VOID_t *pMemory1,
-#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                          const v_VOID_t *pMemory2,
-#else
-                          v_VOID_t *pMemory2,
-#endif
-                          v_U32_t numBytes);
+v_BOOL_t vos_mem_compare( v_VOID_t *pMemory1, v_VOID_t *pMemory2, v_U32_t numBytes ); 
 
 
 /** ---------------------------------------------------------------------------
@@ -320,32 +304,4 @@
   --------------------------------------------------------------------------*/
 v_VOID_t vos_mem_set_dma_ptr(unsigned char *dmaBuffer);
 #endif /* DMA_DIRECT_ACCESS */
-
-
-/*----------------------------------------------------------------------------
-
-  \brief vos_mem_vmalloc() - allocate memory which is virtually contiguous
-
-  Wrapper function for vmalloc
-
-  \param size memory size to be allocated
-
-  \return on success returns starting address of allocated memory or NULL
-
-  --------------------------------------------------------------------------*/
-v_VOID_t * vos_mem_vmalloc(v_SIZE_t size);
-
-/*----------------------------------------------------------------------------
-
-  \brief vos_mem_vfree() - free memory allocated by vmalloc
-
-  Wrapper function for vfree
-
-  \param address starting address of the memory to be freed
-
-  \return Nothing
-
-  --------------------------------------------------------------------------*/
-v_VOID_t vos_mem_vfree(void *addr);
-
 #endif // __VOSS_LOCK_H
diff --git a/wlan/prima/CORE/VOSS/inc/vos_mq.h b/wlan/prima/CORE/VOSS/inc/vos_mq.h
index e82dd00..7194e35 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_mq.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_mq.h
@@ -156,43 +156,6 @@
   --------------------------------------------------------------------------*/
 VOS_STATUS vos_mq_post_message( VOS_MQ_ID msgQueueId, vos_msg_t *message );
 
-/**--------------------------------------------------------------------------
-  \brief vos_mq_post_message_high_pri() - posts a high priority message to
-           a message queue
-
-  This API allows messages to be posted to the head of a specific message
-  queue. Messages  can be posted to the following message queues:
-
-  <ul>
-    <li> SME
-    <li> PE
-    <li> HAL
-    <li> TL
-  </ul>
-
-  \param msgQueueId - identifies the message queue upon which the message
-         will be posted.
-
-  \param message - a pointer to a message buffer.  Memory for this message
-         buffer is allocated by the caller and free'd by the vOSS after the
-         message is posted to the message queue.  If the consumer of the
-         message needs anything in this message, it needs to copy the contents
-         before returning from the message queue handler.
-
-  \return VOS_STATUS_SUCCESS - the message has been successfully posted
-          to the message queue.
-
-          VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
-          refer to a valid Message Queue Id.
-
-          VOS_STATUS_E_FAULT  - message is an invalid pointer.
-
-          VOS_STATUS_E_FAILURE - the message queue handler has reported
-          an unknown failure.
-  --------------------------------------------------------------------------*/
-
-VOS_STATUS vos_mq_post_message_high_pri(VOS_MQ_ID msgQueueId, vos_msg_t *message);
-
 
 /**---------------------------------------------------------------------------
   
diff --git a/wlan/prima/CORE/VOSS/inc/vos_nvitem.h b/wlan/prima/CORE/VOSS/inc/vos_nvitem.h
index c180d1c..304803a 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_nvitem.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_nvitem.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -34,6 +34,9 @@
 
   \brief virtual Operating System Services (vOSS): Non-Volatile storage API
 
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -51,8 +54,6 @@
 #define MAX_CHANNELS_IGNORE 10
 #define MAX_COUNTRY_IGNORE 5
 
-#define TX_POWER_DEFAULT  30//in dbm
-
 typedef struct sCsrIgnoreChannels
 {
    tANI_U8 countryCode[NV_FIELD_COUNTRY_CODE_SIZE];
@@ -131,10 +132,6 @@
  * to esp_dpp.h where the WLAN_PROVISION_DATA is present.
  */
 #define CLPC_PROVISION_DATA L"WLAN_CLPC.PROVISION"
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-#define IEEE80211_CHAN_PASSIVE_SCAN IEEE80211_CHAN_NO_IR
-#define IEEE80211_CHAN_NO_IBSS IEEE80211_CHAN_NO_IR
-#endif
 /*--------------------------------------------------------------------------
   Type declarations
   ------------------------------------------------------------------------*/
@@ -762,14 +759,6 @@
 v_U16_t vos_chan_to_freq(v_U8_t chanNum);
 
 /**------------------------------------------------------------------------
-  \brief vos_freq_to_chan -
-  \param   - input channel frequency to know channel number
-  \return Channel frequency
-  \sa
-  -------------------------------------------------------------------------*/
-v_U8_t vos_freq_to_chan(v_U32_t freq);
-
-/**------------------------------------------------------------------------
   \brief vos_is_nv_country_non_zero -
   \param   NONE
   \return Success if default Country is Non-Zero
@@ -781,15 +770,6 @@
    void
 );
 
-/**------------------------------------------------------------------------
-  \brief vos_is_channel_valid_for_vht80 -
-  \param   chan
-  \return TRUE if channel is 80 mhz
-  \sa
-  -------------------------------------------------------------------------*/
-
-v_BOOL_t vos_is_channel_valid_for_vht80(v_U32_t chan);
-
 #ifdef CONFIG_ENABLE_LINUX_REG
 /**------------------------------------------------------------------------
   \brief vos_getCurrentCountryCode -
diff --git a/wlan/prima/CORE/VOSS/inc/vos_pack_align.h b/wlan/prima/CORE/VOSS/inc/vos_pack_align.h
index 6dde518..1122978 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_pack_align.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_pack_align.h
@@ -37,6 +37,9 @@
    Definitions for platform independent means of packing and aligning
    data structures
   
+   Copyright 2009 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/VOSS/inc/vos_packet.h b/wlan/prima/CORE/VOSS/inc/vos_packet.h
index 3aa0a33..bedcd59 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_packet.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_packet.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,6 +36,9 @@
                
    Network Protocol packet/buffer support interfaces 
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -52,7 +55,6 @@
   ------------------------------------------------------------------------*/
 #define VOS_PKT_PROTO_TYPE_EAPOL   0x02
 #define VOS_PKT_PROTO_TYPE_DHCP    0x04
-#define VOS_PKT_PROTO_TYPE_ARP     0x08
 /*-------------------------------------------------------------------------- 
   Type declarations
   ------------------------------------------------------------------------*/
@@ -1134,40 +1136,4 @@
    void  *pskb,
    v_U8_t tracking_map
 );
-
-/**
-  @brief vos_get_pkt_head() - Get skb head pointer
-
-  @param
-       pPacket - the voss Packet to operate on
-  @return
-       v_PVOID_t - skb head pointer
-
-*/
-v_PVOID_t vos_get_pkt_head(vos_pkt_t *pPacket);
-
-/**
-
-  @brief vos_get_pkt_end() - Get skb end pointer
-
-  @param
-       pPacket - the voss Packet to operate on
-  @return
-       v_PVOID_t - skb end pointer
-
-*/
-v_PVOID_t vos_get_pkt_end(vos_pkt_t *pPacket);
-
-/**
-
-  @brief vos_recover_tail() - Recover corrupted tail of skb
-
-  @param
-       pPacket - the voss Packet to operate on
-  @return
-       v_VOID_t - None
-
-*/
-v_VOID_t vos_recover_tail(vos_pkt_t *pPacket);
-
 #endif  // !defined( __VOS_PKT_H )
diff --git a/wlan/prima/CORE/VOSS/inc/vos_status.h b/wlan/prima/CORE/VOSS/inc/vos_status.h
index b41f56d..8ef7518 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_status.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_status.h
@@ -36,6 +36,9 @@
                
    Basic status codes/definitions used by vOSS 
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/VOSS/inc/vos_threads.h b/wlan/prima/CORE/VOSS/inc/vos_threads.h
index 2b3bdd7..a87067c 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_threads.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_threads.h
@@ -34,6 +34,9 @@
   
   \brief virtual Operating System Services (vOSS) Threading APIs
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/VOSS/inc/vos_timer.h b/wlan/prima/CORE/VOSS/inc/vos_timer.h
index 70a0977..6e9da65 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_timer.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_timer.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,6 +36,9 @@
                
    Definitions for vOSS Timer services
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -192,26 +195,13 @@
 ---------------------------------------------------------------------------*/
 #ifdef TIMER_MANAGER
 #define vos_timer_init(timer, timerType, callback, userdata) \
-      vos_timer_init_debug(timer, timerType, callback, userdata, \
-      __FILE__, __LINE__)
-
-VOS_STATUS vos_timer_init_debug( vos_timer_t *timer, VOS_TIMER_TYPE timerType,
-                           vos_timer_callback_t callback, v_PVOID_t userData,
-                           char* fileName, v_U32_t lineNum );
-
-#define vos_timer_init_deferrable(timer, timerType, callback, userdata) \
-      vos_timer_init_deferrable_debug(timer, timerType, \
-      callback, userdata, __FILE__, __LINE__)
-
-VOS_STATUS vos_timer_init_deferrable_debug( vos_timer_t *timer,
-                           VOS_TIMER_TYPE timerType,
-                           vos_timer_callback_t callback, v_PVOID_t userData,
-                           char* fileName, v_U32_t lineNum );
+      vos_timer_init_debug(timer, timerType, callback, userdata, __FILE__, __LINE__)
+      
+VOS_STATUS vos_timer_init_debug( vos_timer_t *timer, VOS_TIMER_TYPE timerType, 
+                           vos_timer_callback_t callback, v_PVOID_t userData, 
+                           char* fileName, v_U32_t lineNum );      
 #else
-VOS_STATUS vos_timer_init( vos_timer_t *timer, VOS_TIMER_TYPE timerType,
-                           vos_timer_callback_t callback, v_PVOID_t userData );
-VOS_STATUS vos_timer_init_deferrable( vos_timer_t *timer,
-                           VOS_TIMER_TYPE timerType,
+VOS_STATUS vos_timer_init( vos_timer_t *timer, VOS_TIMER_TYPE timerType, 
                            vos_timer_callback_t callback, v_PVOID_t userData );
 #endif
 
@@ -341,9 +331,6 @@
   ------------------------------------------------------------------------*/
 v_TIME_t vos_timer_get_system_time( v_VOID_t );
 
-v_BOOL_t vos_timer_is_initialized(vos_timer_t *timer);
 
-void vos_process_wd_timer(void);
-void vos_wdthread_init_timer_work(void *callbackptr);
-void vos_wdthread_flush_timer_work(void);
+
 #endif // #if !defined __VOSS_TIMER_H
diff --git a/wlan/prima/CORE/VOSS/inc/vos_trace.h b/wlan/prima/CORE/VOSS/inc/vos_trace.h
index 538f58d..2f3fd2b 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_trace.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_trace.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -81,14 +81,6 @@
     
 } VOS_TRACE_LEVEL;
 
-/* Log types. These types are defined in mailbox*/
-typedef enum
-{
-    WLAN_MGMT_FRAME_LOGS    = 0,
-    WLAN_FW_LOGS            = 1,
-    WLAN_FW_MEMORY_DUMP     = 2
-}FrameLoggingType;
-
 /*-------------------------------------------------------------------------- 
   Preprocessor definitions and constants
   ------------------------------------------------------------------------*/
@@ -191,16 +183,10 @@
 v_BOOL_t vos_trace_getLevel( VOS_MODULE_ID module, VOS_TRACE_LEVEL level );
 
 typedef void (*tpvosTraceCb) (void *pMac, tpvosTraceRecord, v_U16_t);
-typedef void (*tp_vos_state_info_cb) (void);
-
 void vos_trace(v_U8_t module, v_U8_t code, v_U8_t session, v_U32_t data);
 void vosTraceRegister(VOS_MODULE_ID, tpvosTraceCb);
-void vos_register_debug_callback(VOS_MODULE_ID moduleID,
-                                      tp_vos_state_info_cb vosStateInfoCb);
 VOS_STATUS vos_trace_spin_lock_init(void);
 void vosTraceInit(void);
-void vos_register_debugcb_init(void);
 void vosTraceEnable(v_U32_t, v_U8_t enable);
 void vosTraceDumpAll(void*, v_U8_t, v_U8_t, v_U32_t, v_U32_t);
-void vos_state_info_dump_all(void);
 #endif
diff --git a/wlan/prima/CORE/VOSS/inc/vos_types.h b/wlan/prima/CORE/VOSS/inc/vos_types.h
old mode 100755
new mode 100644
index 7038749..20da1fb
--- a/wlan/prima/CORE/VOSS/inc/vos_types.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_types.h
@@ -66,9 +66,6 @@
   (( ( ( (_x) << 24 ) & 0xFF000000 ) | ( ( (_x) >> 24 ) & 0x000000FF ) ) | \
    ( ( ( (_x) << 8 ) & 0x00FF0000 ) | ( ( (_x) >> 8 ) & 0x0000FF00 ) ))
 
-/* Length enough to include full DHCP/EAPOL/Management frame */
-#define MAX_PKT_STAT_DATA_LEN         800
-
 // Endian operations for Big Endian and Small Endian modes
 #ifdef ANI_LITTLE_BYTE_ENDIAN
 
@@ -108,8 +105,8 @@
    VOS_MODULE_ID_BAP        = 0,
    VOS_MODULE_ID_TL         = 1,
    VOS_MODULE_ID_WDI        = 2,
-   VOS_MODULE_ID_SVC        = 3,
-   // 4 is unused for historical purposes
+   // 3 & 4 are unused for historical purposes
+   VOS_MODULE_ID_RSV3       = 3,
    VOS_MODULE_ID_RSV4       = 4,
    VOS_MODULE_ID_HDD        = 5,
    VOS_MODULE_ID_SME        = 6,
diff --git a/wlan/prima/CORE/VOSS/inc/vos_utils.h b/wlan/prima/CORE/VOSS/inc/vos_utils.h
index 59ce112..03968a6 100644
--- a/wlan/prima/CORE/VOSS/inc/vos_utils.h
+++ b/wlan/prima/CORE/VOSS/inc/vos_utils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -37,6 +37,9 @@
                
    Various utility functions
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -47,7 +50,6 @@
   ------------------------------------------------------------------------*/
 #include <vos_types.h>
 #include <vos_status.h>
-#include <vos_event.h>
 //#include <Wincrypt.h>
 
 /*-------------------------------------------------------------------------- 
@@ -59,14 +61,6 @@
 #define VOS_BAND_5GHZ          2
 
 #define VOS_24_GHZ_CHANNEL_14  14
-
-
-/* Type of packet log events.
- */
-#define PKTLOG_TYPE_PKT_STAT         9
-
-
-
 /*-------------------------------------------------------------------------- 
   Type declarations
   ------------------------------------------------------------------------*/
@@ -170,33 +164,9 @@
                            v_U8_t *pKey); /* pointer to authentication key */
 
 v_U8_t vos_chan_to_band(v_U32_t chan);
-void vos_get_wlan_unsafe_channel(v_U16_t *unsafeChannelList,
-                    v_U16_t buffer_size, v_U16_t *unsafeChannelCount);
 
-typedef struct {
-    v_BOOL_t  is_rx;
-    v_U8_t  tid;     // transmit or received tid
-    v_U8_t  num_retries;                   // number of attempted retries
-    v_U8_t  rssi;    // TX: RSSI of ACK for that packet
-                    // RX: RSSI of packet
-    v_U32_t rate_idx;           // last transmit rate in .5 mbps
-    v_U16_t seq_num; // receive sequence for that MPDU packet
-    v_U64_t dxe_timestamp;     // DXE timestamp
-    v_U32_t data_len;
-    /* Whole frame for management/EAPOl/DHCP frames and 802.11 + LLC
-    * header + 40 bytes or full frame whichever is smaller for
-    * remaining Data packets
-    */
-    v_U8_t data[MAX_PKT_STAT_DATA_LEN];
-} tPerPacketStats;
-
-typedef struct {
-    v_U32_t lastTxRate;           // 802.11 data rate at which the last data frame is transmitted.
-    v_U32_t  txAvgRetry;           // Average number of retries per 10 packets.
-    v_S7_t  avgRssi;              // Average of the Beacon RSSI.
-} tPerTxPacketFrmFw;
-
-#define ROAM_DELAY_TABLE_SIZE   10
+#ifdef DEBUG_ROAM_DELAY
+#define ROAM_DELAY_TABLE_SIZE   30
 
 enum e_roaming_event
 {
@@ -253,10 +223,10 @@
     eVOS_AUTH_TYPE_WAPI_WAI_CERTIFICATE,
     eVOS_AUTH_TYPE_WAPI_WAI_PSK,
 #endif /* FEATURE_WLAN_WAPI */
-#ifdef FEATURE_WLAN_ESE
+#ifdef FEATURE_WLAN_CCX
     eVOS_AUTH_TYPE_CCKM_WPA,
     eVOS_AUTH_TYPE_CCKM_RSN,
-#endif /* FEATURE_WLAN_ESE */
+#endif /* FEATURE_WLAN_CCX */
 #ifdef WLAN_FEATURE_11W
     eVOS_AUTH_TYPE_RSN_PSK_SHA256,
 #endif
@@ -316,29 +286,11 @@
 } tRoamDelayMetaInfo, *tpRoamDelayMetaInfo;
 
 extern  tRoamDelayMetaInfo gRoamDelayMetaInfo;
-extern  tRoamDelayMetaInfo *gpRoamDelayTable;
+extern  tRoamDelayMetaInfo gRoamDelayTable[ROAM_DELAY_TABLE_SIZE];
 extern  v_BOOL_t           gRoamDelayCurrentIndex;
 
-v_BOOL_t vos_roam_delay_stats_init(void);
-v_BOOL_t vos_roam_delay_stats_deinit(void);
 void    vos_reset_roam_timer_log(void);
 void    vos_dump_roam_time_log_service(void);
 void    vos_record_roam_event(enum e_roaming_event, void *pBuff, v_ULONG_t buff_len);
-v_U32_t vos_copy_80211_data(void *pBuff, v_U8_t *dst, v_U8_t frametype);
-extern  v_U8_t vos_get_ring_log_level(v_U32_t ring_id);
-bool vos_isPktStatsEnabled(void);
-
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-void vos_tdls_tx_rx_mgmt_event(uint8_t event_id, uint8_t tx_rx,
-              uint8_t type, uint8_t sub_type, uint8_t *peer_mac);
-#else
-static inline
-void vos_tdls_tx_rx_mgmt_event(uint8_t event_id, uint8_t tx_rx,
-              uint8_t type, uint8_t sub_type, uint8_t *peer_mac)
-
-{
-    return;
-}
-#endif /* FEATURE_WLAN_DIAG_SUPPORT */
-
+#endif //#ifdef DEBUG_ROAM_DELAY
 #endif // #if !defined __VOSS_UTILS_H
diff --git a/wlan/prima/CORE/VOSS/src/vos_api.c b/wlan/prima/CORE/VOSS/src/vos_api.c
index 5c76002..b27f4fe 100644
--- a/wlan/prima/CORE/VOSS/src/vos_api.c
+++ b/wlan/prima/CORE/VOSS/src/vos_api.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -69,14 +69,13 @@
 #include "wlan_hdd_main.h"
 #include <linux/vmalloc.h>
 #include "wlan_hdd_cfg80211.h"
-#include "vos_diag_core_log.h"
 
 #include <linux/wcnss_wlan.h>
 
 #include "sapApi.h"
 #include "vos_trace.h"
-#include "vos_utils.h"
-#include <wlan_logging_sock_svc.h>
+
+
 
 #ifdef WLAN_BTAMP_FEATURE
 #include "bapApi.h"
@@ -105,7 +104,6 @@
  * ------------------------------------------------------------------------*/
 static VosContextType  gVosContext;
 static pVosContextType gpVosContext;
-static v_U8_t vos_multicast_logging;
 
 /*---------------------------------------------------------------------------
  * Forward declaration
@@ -168,7 +166,6 @@
    #if defined(TRACE_RECORD)
        vosTraceInit();
    #endif
-   vos_register_debugcb_init();
 
    return VOS_STATUS_SUCCESS;
 
@@ -269,7 +266,6 @@
    /* Initialize the timer module */
    vos_timer_module_init();
 
-   vos_wdthread_init_timer_work(vos_process_wd_timer);
 
    /* Initialize the probe event */
    if (vos_event_init(&gpVosContext->ProbeEvent) != VOS_STATUS_SUCCESS)
@@ -287,14 +283,6 @@
     
       goto err_probe_event;
    }
-   if (vos_event_init( &(gpVosContext->fwLogsComplete) ) != VOS_STATUS_SUCCESS )
-   {
-      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                  "%s: Unable to init fwLogsComplete", __func__);
-      VOS_ASSERT(0);
-
-      goto err_wda_complete_event;
-   }
 
    /* Initialize the free message queue */
    vStatus = vos_mq_init(&gpVosContext->freeVosMq);
@@ -305,7 +293,7 @@
       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
                 "%s: Failed to initialize VOS free message queue", __func__);
       VOS_ASSERT(0);
-      goto err_fw_logs_complete_event;
+      goto err_wda_complete_event;
    }
 
    for (iter = 0; iter < VOS_CORE_MAX_MESSAGES; iter++)
@@ -433,13 +421,6 @@
      goto err_sme_close;
    }
 
-   if (gpVosContext->roamDelayStatsEnabled &&
-       !vos_roam_delay_stats_init())
-   {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Could not init roamDelayStats", __func__);
-   }
-
    VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
                "%s: VOSS successfully Opened", __func__);
 
@@ -477,9 +458,6 @@
 err_msg_queue:
    vos_mq_deinit(&gpVosContext->freeVosMq);
 
-err_fw_logs_complete_event:
-    vos_event_destroy( &gpVosContext->fwLogsComplete);
-
 err_wda_complete_event:
    vos_event_destroy( &gpVosContext->wdaCompleteEvent );
 
@@ -604,179 +582,6 @@
    return VOS_STATUS_SUCCESS;
 }
 
-VOS_STATUS vos_mon_start( v_CONTEXT_t vosContext )
-{
-  VOS_STATUS vStatus          = VOS_STATUS_SUCCESS;
-  pVosContextType pVosContext = (pVosContextType)vosContext;
-
-  if (pVosContext == NULL)
-   {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-          "%s: mismatch in context",__func__);
-       return VOS_STATUS_E_FAILURE;
-   }
-
-  if (( pVosContext->pWDAContext == NULL) || ( pVosContext->pTLContext == NULL))
-  {
-     if (pVosContext->pWDAContext == NULL)
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-            "%s: WDA NULL context", __func__);
-     else
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-            "%s: TL NULL context", __func__);
-
-     return VOS_STATUS_E_FAILURE;
-  }
-
-   /* Reset wda wait event */
-   vos_event_reset(&pVosContext->wdaCompleteEvent);
-
-   /*call WDA pre start*/
-   vStatus = WDA_preStart(pVosContext);
-   if (!VOS_IS_STATUS_SUCCESS(vStatus))
-   {
-      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
-             "Failed to WDA prestart ");
-      VOS_ASSERT(0);
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   /* Need to update time out of complete */
-   vStatus = vos_wait_single_event( &pVosContext->wdaCompleteEvent, 1000);
-   if ( vStatus != VOS_STATUS_SUCCESS )
-   {
-      if ( vStatus == VOS_STATUS_E_TIMEOUT )
-      {
-         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-          "%s: Timeout occurred before WDA complete",__func__);
-      }
-      else
-      {
-         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-           "%s: WDA_preStart reporting  other error",__func__);
-      }
-      VOS_ASSERT( 0 );
-      return VOS_STATUS_E_FAILURE;
-   }
-
-    vStatus = WDA_NVDownload_Start(pVosContext);
-
-    if ( vStatus != VOS_STATUS_SUCCESS )
-    {
-       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                   "%s: Failed to start NV Download",__func__);
-       return VOS_STATUS_E_FAILURE;
-    }
-
-    vStatus = vos_wait_single_event(&(pVosContext->wdaCompleteEvent), 1000 * 30);
-
-    if ( vStatus != VOS_STATUS_SUCCESS )
-    {
-       if ( vStatus == VOS_STATUS_E_TIMEOUT )
-       {
-          VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                     "%s: Timeout occurred before WDA_NVDownload_Start complete",__func__);
-       }
-       else
-       {
-         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                    "%s: WDA_NVDownload_Start reporting  other error",__func__);
-       }
-       VOS_ASSERT(0);
-       return VOS_STATUS_E_FAILURE;
-    }
-
-    vStatus = WDA_start(pVosContext);
-    if (vStatus != VOS_STATUS_SUCCESS)
-    {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Failed to start WDA",__func__);
-       return VOS_STATUS_E_FAILURE;
-    }
-
-  /** START TL */
-  vStatus = WLANTL_Start(pVosContext);
-  if (!VOS_IS_STATUS_SUCCESS(vStatus))
-  {
-    VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-               "%s: Failed to start TL", __func__);
-    goto err_wda_stop;
-  }
-
-  return VOS_STATUS_SUCCESS;
-
-err_wda_stop:
-   vos_event_reset(&(pVosContext->wdaCompleteEvent));
-   WDA_stop(pVosContext, HAL_STOP_TYPE_RF_KILL);
-   vStatus = vos_wait_single_event(&(pVosContext->wdaCompleteEvent), 1000);
-   if(vStatus != VOS_STATUS_SUCCESS)
-   {
-      if(vStatus == VOS_STATUS_E_TIMEOUT)
-      {
-         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                   "%s: Timeout occurred before WDA_stop complete",__func__);
-
-      }
-      else
-      {
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                  "%s: WDA_stop reporting  other error",__func__);
-      }
-      VOS_ASSERT(0);
-   }
-  return VOS_STATUS_E_FAILURE;
-}
-
-VOS_STATUS vos_mon_stop( v_CONTEXT_t vosContext )
-{
-  VOS_STATUS vosStatus;
-
-  vos_event_reset( &(gpVosContext->wdaCompleteEvent) );
-
-  VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-         "%s: HAL_STOP is requested", __func__);
-
-  vosStatus = WDA_stop( vosContext, HAL_STOP_TYPE_RF_KILL );
-
-  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-  {
-     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-         "%s: Failed to stop WDA", __func__);
-     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
-     WDA_setNeedShutdown(vosContext);
-  }
-  else
-  {
-    vosStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent),
-                                       VOS_WDA_STOP_TIMEOUT );
-
-    if ( vosStatus != VOS_STATUS_SUCCESS )
-    {
-       if ( vosStatus == VOS_STATUS_E_TIMEOUT )
-       {
-          VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-           "%s: Timeout occurred before WDA complete", __func__);
-       }
-       else
-       {
-          VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-           "%s: WDA_stop reporting other error", __func__ );
-       }
-       WDA_setNeedShutdown(vosContext);
-    }
-  }
-
-  vosStatus = WLANTL_Stop( vosContext );
-  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-  {
-     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-         "%s: Failed to stop TL", __func__);
-     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
-  }
-
-  return VOS_STATUS_SUCCESS;
-}
-
 /*---------------------------------------------------------------------------
   
   \brief vos_start() - Start the Libra SW Modules 
@@ -816,7 +621,6 @@
   tSirRetStatus sirStatus     = eSIR_SUCCESS;
   pVosContextType pVosContext = (pVosContextType)vosContext;
   tHalMacStartParameters halStartParams;
-  hdd_context_t *pHddCtx = NULL;
 
   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
             "%s: Starting Libra SW", __func__);
@@ -895,28 +699,16 @@
   if ( vStatus != VOS_STATUS_SUCCESS )
   {
      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Failed to start WDA - WDA_shutdown needed %d ",
-                   __func__, vStatus);
+                 "%s: Failed to start WDA - WDA_shutdown needed", __func__);
      if ( vStatus == VOS_STATUS_E_TIMEOUT )
-     {
+      {
          WDA_setNeedShutdown(vosContext);
-     }
-     VOS_ASSERT(0);
+      }
      return VOS_STATUS_E_FAILURE;
   }
   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
             "%s: WDA correctly started", __func__);
 
-  pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
-  if (!pHddCtx)
-  {
-     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-               "%s: HDD context is null", __func__);
-     goto err_wda_stop;
-  }
-
-  pHddCtx->wifi_turn_on_time_since_boot = vos_get_monotonic_boottime();
-
   /* Start the MAC */
   vos_mem_zero((v_PVOID_t)&halStartParams, sizeof(tHalMacStartParameters));
 
@@ -1026,18 +818,8 @@
   }
   else
   {
-    if(wcnss_device_is_shutdown())
-    {
-       vosStatus = VOS_STATUS_E_TIMEOUT;
-       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-        "%s: Wait for WDA_Stop complete event not needed due to SSR",
-         __func__);
-    }
-    else
-    {
-       vosStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent),
+    vosStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent),
                                        VOS_WDA_STOP_TIMEOUT );
-    }
 
     if ( vosStatus != VOS_STATUS_SUCCESS )
     {
@@ -1178,14 +960,6 @@
 
   vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq);
 
-  vosStatus = vos_event_destroy(&gpVosContext->fwLogsComplete);
-  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-  {
-     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-         "%s: failed to destroy fwLogsComplete", __func__);
-     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
-  }
-
   vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent);
   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
   {
@@ -1194,7 +968,6 @@
      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
   }
 
-
   vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent);
   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
   {
@@ -1203,15 +976,6 @@
      VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
   }
 
-  if (gpVosContext->roamDelayStatsEnabled &&
-      !vos_roam_delay_stats_deinit())
-  {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                "%s: Could not deinit roamDelayStats", __func__);
-  }
-
-  vos_wdthread_flush_timer_work();
-
   return VOS_STATUS_SUCCESS;
 }
                   
@@ -1682,318 +1446,7 @@
   return VOS_STATUS_SUCCESS;
 
 } /* vos_free_context() */
-
-
-bool vos_is_log_report_in_progress(void)
-{
-    return wlan_is_log_report_in_progress();
-}
-
-void vos_reset_log_report_in_progress(void)
-{
-    return wlan_reset_log_report_in_progress();
-}
-
-
-
-
-int vos_set_log_completion(uint32 is_fatal,
-                            uint32 indicator,
-                            uint32 reason_code)
-{
-    return wlan_set_log_completion(is_fatal,
-                                   indicator,reason_code);
-}
-
-void vos_get_log_and_reset_completion(uint32 *is_fatal,
-                             uint32 *indicator,
-                             uint32 *reason_code,
-                             bool reset)
-{
-    wlan_get_log_and_reset_completion(is_fatal, indicator, reason_code, reset);
-}
-
-
-
-void vos_send_fatal_event_done(void)
-{
-    /*Complete the fwLogsComplete Event*/
-    VosContextType *vos_context;
-    uint32_t is_fatal, indicator, reason_code;
-
-    vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-    if (!vos_context) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-            "%s: vos context is Invalid", __func__);
-        return;
-    }
-    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-         "%s: vos_event_set for fwLogsComplete", __func__);
-    if (vos_event_set(&vos_context->fwLogsComplete)!= VOS_STATUS_SUCCESS)
-    {
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-         "%s: vos_event_set failed for fwLogsComplete", __func__);
-        return;
-    }
-    /*The below API will reset is_report_in_progress flag*/
-    vos_get_log_and_reset_completion(&is_fatal, &indicator,
-                                         &reason_code, true);
-    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-         "is_fatal : %d, indicator: %d, reason_code=%d",
-         is_fatal, indicator, reason_code);
-    wlan_report_log_completion(is_fatal, indicator, reason_code);
-
-    /* Do ssr after reporting fatal event to recover from
-     * below conditions
-     */
-    if ((WLAN_LOG_INDICATOR_HOST_DRIVER == indicator) &&
-        (WLAN_LOG_REASON_SME_COMMAND_STUCK == reason_code ||
-         WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF == reason_code))
-    {
-         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-           "Do SSR for reason_code=%d", reason_code);
-         vos_wlanRestart();
-    }
-}
-
-/**
- * vos_isFatalEventEnabled()
- *
- * Return TRUE if Fatal event is enabled is in progress.
- *
- */
-v_BOOL_t vos_isFatalEventEnabled(void)
-{
-    hdd_context_t *pHddCtx = NULL;
-    v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-
-    if(!pVosContext)
-    {
-       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
-       return FALSE;
-    }
-
-    pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
-    if(!pHddCtx) {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                "%s: HDD context is Null", __func__);
-       return FALSE;
-    }
-
-    return pHddCtx->cfg_ini->enableFatalEvent;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief __vos_fatal_event_logs_req() - used to send flush command to FW
-
-  This API is wrapper to SME flush API.
-
-  \param is_fatal - fatal or non fatal event
-         indicator - Tyoe of indicator framework/Host/FW
-         reason_code - reason code for flush logs
-
-  \return VOS_STATUS_SUCCESS - if command is sent successfully.
-          VOS_STATUS_E_FAILURE - if command is not sent successfully.
-  --------------------------------------------------------------------------*/
-VOS_STATUS __vos_fatal_event_logs_req( uint32_t is_fatal,
-                        uint32_t indicator,
-                        uint32_t reason_code,
-                        bool wait_required,
-                        bool dump_vos_trace)
-{
-    VOS_STATUS vosStatus;
-    eHalStatus status;
-    VosContextType *vos_context;
-    hdd_context_t *pHddCtx = NULL;
-
-    vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-    if (!vos_context)
-    {
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-            "%s: vos context is Invalid", __func__);
-        return VOS_STATUS_E_FAILURE;
-    }
-    pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, vos_context );
-    if(!pHddCtx) {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                "%s: HDD context is Null", __func__);
-       return VOS_STATUS_E_FAILURE;
-    }
-
-    if(!pHddCtx->cfg_ini->wlanLoggingEnable)
-    {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-            "%s: Wlan logging not enabled", __func__);
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    if(!pHddCtx->cfg_ini->enableFatalEvent)
-    {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-            "%s: Fatal event not enabled", __func__);
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    if (pHddCtx->isLoadUnloadInProgress ||
-        vos_context->isLogpInProgress)
-    {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-            "%s: un/Load/SSR in progress", __func__);
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    if (vos_is_log_report_in_progress() == true)
-    {
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-        "%s: Fatal Event Req already in progress - dropping! type:%d, indicator=%d reason_code=%d",
-        __func__, is_fatal, indicator, reason_code);
-        return VOS_STATUS_E_FAILURE;
-    }
-
-    vosStatus = vos_set_log_completion(is_fatal, indicator, reason_code);
-    if (VOS_STATUS_SUCCESS != vosStatus) {
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-        "%s: Failed to set log trigger params for fatalEvent", __func__);
-        return VOS_STATUS_E_FAILURE;
-    }
-    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-        "%s: Triggering fatal Event: type:%d, indicator=%d reason_code=%d",
-        __func__, is_fatal, indicator, reason_code);
-
-    status = vos_event_reset(&gpVosContext->fwLogsComplete);
-    if(!HAL_STATUS_SUCCESS(status))
-    {
-        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                    FL("fwLogsComplete reset failed:%d"),status);
-        return VOS_STATUS_E_FAILURE;
-    }
-    status = sme_fatal_event_logs_req(vos_context->pMACContext,
-                                      is_fatal, indicator,
-                                      reason_code, dump_vos_trace);
-
-    if (HAL_STATUS_SUCCESS(status) && (wait_required == TRUE))
-    {
-
-        /* Need to update time out of complete */
-        vosStatus = vos_wait_single_event(&gpVosContext->fwLogsComplete,
-                                    WAIT_TIME_FW_LOGS);
-        if ( vosStatus != VOS_STATUS_SUCCESS )
-        {
-            if ( vosStatus == VOS_STATUS_E_TIMEOUT )
-            {
-                VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Timeout occurred before fwLogsComplete", __func__);
-            }
-            else
-            {
-                VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                     "%s: fwLogsComplete reporting other error", __func__);
-            }
-            /*Done indication is not received.So reset the bug report in progress*/
-            vos_reset_log_report_in_progress();
-            return VOS_STATUS_E_FAILURE;
-        }
-    }
-    if (HAL_STATUS_SUCCESS( status ))
-        return VOS_STATUS_SUCCESS;
-    else
-        return VOS_STATUS_E_FAILURE;
-}
-
-VOS_STATUS vos_fatal_event_logs_req( uint32_t is_fatal,
-                        uint32_t indicator,
-                        uint32_t reason_code,
-                        bool wait_required,
-                        bool dump_vos_trace)
-{
-    VOS_STATUS status;
-
-    vos_ssr_protect(__func__);
-    status = __vos_fatal_event_logs_req(is_fatal, indicator, reason_code,
-                                        wait_required, dump_vos_trace);
-    vos_ssr_unprotect(__func__);
-
-    return status;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief vos_process_done_indication() - Process the done indication for fatal event,
-   FW memory dump
-
-  This API processes the done indication and wakeup the logger thread accordingly.
-
-  \param type - Type for which done indication is received.
-
-
-  \return VOS_STATUS_SUCCESS - the pkt has been successfully queued.
-          VOS_STATUS_E_FAILURE - the pkt queue handler has reported
-          a failure.
-  --------------------------------------------------------------------------*/
-
-VOS_STATUS vos_process_done_indication(v_U8_t type, v_U32_t reason_code)
-{
-    wlan_process_done_indication(type, reason_code);
-    return VOS_STATUS_SUCCESS;
-}
-
-/**
- * vos_flush_host_logs_for_fatal() -flush host logs and send
- * fatal event to upper layer.
- */
-void vos_flush_host_logs_for_fatal(void)
-{
-   wlan_flush_host_logs_for_fatal();
-   return;
-}
-
-
-/**---------------------------------------------------------------------------
-
-  \brief vos_logger_pkt_serialize() - queue a logging vos pkt
-
-  This API allows single vos pkt to be queued and later sent to userspace by
-  logger thread.
-
-  \param pPacket - a pointer to a vos pkt to be queued
-         pkt_type - type of pkt to be queued
-
-  \return VOS_STATUS_SUCCESS - the pkt has been successfully queued.
-          VOS_STATUS_E_FAILURE - the pkt queue handler has reported
-          a failure.
-  --------------------------------------------------------------------------*/
-VOS_STATUS vos_logger_pkt_serialize( vos_pkt_t *pPacket, uint32 pkt_type)
-{
-#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
-      return wlan_queue_logpkt_for_app(pPacket, pkt_type);
-#else
-      return vos_pkt_return_packet(pPacket);
-#endif
-}
-
-void vos_per_pkt_stats_to_user(void *perPktStat)
-{
-#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
-     wlan_pkt_stats_to_user(perPktStat);
-#else
-     return;
-#endif
-
-
-
-}
-
-void vos_updatePktStatsInfo(void * pktStat)
-{
-#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
-     wlan_fillTxStruct(pktStat);
-#else
-     return;
-#endif
-
-}
-
+                                                 
 
 /**---------------------------------------------------------------------------
   
@@ -2115,14 +1568,7 @@
   {
     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
               "%s: VOS Core run out of message wrapper", __func__);
-    if (!gpVosContext->vosWrapperFullReported)
-    {
-      gpVosContext->vosWrapperFullReported = 1;
-      vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                      WLAN_LOG_INDICATOR_HOST_ONLY,
-                      WLAN_LOG_REASON_VOS_MSG_UNDER_RUN,
-                      FALSE, TRUE);
-    }
+
     return VOS_STATUS_E_RESOURCES;
   }
   
@@ -2134,7 +1580,7 @@
 
   vos_mq_put(pTargetMq, pMsgWrapper);
 
-  set_bit(MC_POST_EVENT, &gpVosContext->vosSched.mcEventFlag);
+  set_bit(MC_POST_EVENT_MASK, &gpVosContext->vosSched.mcEventFlag);
   wake_up_interruptible(&gpVosContext->vosSched.mcWaitQueue);
 
   return VOS_STATUS_SUCCESS;
@@ -2142,151 +1588,6 @@
 } /* vos_mq_post_message()*/
 
 
-/**--------------------------------------------------------------------------
-  \brief vos_mq_post_message_high_pri() - posts a high priority message to
-           a message queue
-
-  This API allows messages to be posted to the head of a specific message
-  queue. Messages  can be posted to the following message queues:
-
-  <ul>
-    <li> SME
-    <li> PE
-    <li> HAL
-    <li> TL
-  </ul>
-
-  \param msgQueueId - identifies the message queue upon which the message
-         will be posted.
-
-  \param message - a pointer to a message buffer.  Memory for this message
-         buffer is allocated by the caller and free'd by the vOSS after the
-         message is posted to the message queue.  If the consumer of the
-         message needs anything in this message, it needs to copy the contents
-         before returning from the message queue handler.
-
-  \return VOS_STATUS_SUCCESS - the message has been successfully posted
-          to the message queue.
-
-          VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
-          refer to a valid Message Queue Id.
-
-          VOS_STATUS_E_FAULT  - message is an invalid pointer.
-
-          VOS_STATUS_E_FAILURE - the message queue handler has reported
-          an unknown failure.
-  --------------------------------------------------------------------------*/
-VOS_STATUS vos_mq_post_message_high_pri(VOS_MQ_ID msgQueueId, vos_msg_t *pMsg)
-{
-  pVosMqType      pTargetMq   = NULL;
-  pVosMsgWrapper  pMsgWrapper = NULL;
-
-  if ((gpVosContext == NULL) || (pMsg == NULL))
-  {
-    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-        "%s: Null params or global vos context is null", __func__);
-    VOS_ASSERT(0);
-    return VOS_STATUS_E_FAILURE;
-  }
-
-  switch (msgQueueId)
-  {
-    /// Message Queue ID for messages bound for SME
-    case  VOS_MQ_ID_SME:
-    {
-       pTargetMq = &(gpVosContext->vosSched.smeMcMq);
-       break;
-    }
-
-    /// Message Queue ID for messages bound for PE
-    case VOS_MQ_ID_PE:
-    {
-       pTargetMq = &(gpVosContext->vosSched.peMcMq);
-       break;
-    }
-
-    /// Message Queue ID for messages bound for WDA
-    case VOS_MQ_ID_WDA:
-    {
-       pTargetMq = &(gpVosContext->vosSched.wdaMcMq);
-       break;
-    }
-
-    /// Message Queue ID for messages bound for WDI
-    case VOS_MQ_ID_WDI:
-    {
-       pTargetMq = &(gpVosContext->vosSched.wdiMcMq);
-       break;
-    }
-
-    /// Message Queue ID for messages bound for TL
-    case VOS_MQ_ID_TL:
-    {
-       pTargetMq = &(gpVosContext->vosSched.tlMcMq);
-       break;
-    }
-
-    /// Message Queue ID for messages bound for the SYS module
-    case VOS_MQ_ID_SYS:
-    {
-       pTargetMq = &(gpVosContext->vosSched.sysMcMq);
-       break;
-    }
-
-    default:
-
-    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-              ("%s: Trying to queue msg into unknown MC Msg queue ID %d"),
-              __func__, msgQueueId);
-
-    return VOS_STATUS_E_FAILURE;
-  }
-
-  VOS_ASSERT(NULL !=pTargetMq);
-  if (pTargetMq == NULL)
-  {
-     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-         "%s: pTargetMq == NULL", __func__);
-     return VOS_STATUS_E_FAILURE;
-  }
-
-  /*
-  ** Try and get a free Msg wrapper
-  */
-  pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq);
-
-  if (NULL == pMsgWrapper)
-  {
-    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-              "%s: VOS Core run out of message wrapper", __func__);
-    if (!gpVosContext->vosWrapperFullReported)
-    {
-      gpVosContext->vosWrapperFullReported = 1;
-      vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                      WLAN_LOG_INDICATOR_HOST_ONLY,
-                      WLAN_LOG_REASON_VOS_MSG_UNDER_RUN,
-                      FALSE, TRUE);
-    }
-    return VOS_STATUS_E_RESOURCES;
-  }
-
-  /*
-  ** Copy the message now
-  */
-  vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg,
-                (v_VOID_t*)pMsg, sizeof(vos_msg_t));
-
-  vos_mq_put_front(pTargetMq, pMsgWrapper);
-
-  set_bit(MC_POST_EVENT, &gpVosContext->vosSched.mcEventFlag);
-  wake_up_interruptible(&gpVosContext->vosSched.mcWaitQueue);
-
-  return VOS_STATUS_SUCCESS;
-
-} /* vos_mq_post_message_high_pri()*/
-
-
-
 /**---------------------------------------------------------------------------
   
   \brief vos_tx_mq_serialize() - serialize a message to the Tx execution flow
@@ -2385,14 +1686,6 @@
   {
     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
               "%s: VOS Core run out of message wrapper", __func__);
-    if (!gpVosContext->vosWrapperFullReported)
-    {
-      gpVosContext->vosWrapperFullReported = 1;
-      vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                      WLAN_LOG_INDICATOR_HOST_ONLY,
-                      WLAN_LOG_REASON_VOS_MSG_UNDER_RUN,
-                      FALSE, TRUE);
-    }
 
     return VOS_STATUS_E_RESOURCES;
   }
@@ -2405,7 +1698,7 @@
 
   vos_mq_put(pTargetMq, pMsgWrapper);
 
-  set_bit(TX_POST_EVENT, &gpVosContext->vosSched.txEventFlag);
+  set_bit(TX_POST_EVENT_MASK, &gpVosContext->vosSched.txEventFlag);
   wake_up_interruptible(&gpVosContext->vosSched.txWaitQueue);
 
   return VOS_STATUS_SUCCESS;
@@ -2508,14 +1801,6 @@
   {
     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
               "%s: VOS Core run out of message wrapper", __func__);
-    if (!gpVosContext->vosWrapperFullReported)
-    {
-      gpVosContext->vosWrapperFullReported = 1;
-      vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                      WLAN_LOG_INDICATOR_HOST_ONLY,
-                      WLAN_LOG_REASON_VOS_MSG_UNDER_RUN,
-                      FALSE, TRUE);
-    }
 
     return VOS_STATUS_E_RESOURCES;
   }
@@ -2528,7 +1813,7 @@
 
   vos_mq_put(pTargetMq, pMsgWrapper);
 
-  set_bit(RX_POST_EVENT, &gpVosContext->vosSched.rxEventFlag);
+  set_bit(RX_POST_EVENT_MASK, &gpVosContext->vosSched.rxEventFlag);
   wake_up_interruptible(&gpVosContext->vosSched.rxWaitQueue);
 
   return VOS_STATUS_SUCCESS;
@@ -2641,7 +1926,6 @@
   pTLConfig->ucAcWeights[1] = pConfig->WfqBeWeight;
   pTLConfig->ucAcWeights[2] = pConfig->WfqViWeight;
   pTLConfig->ucAcWeights[3] = pConfig->WfqVoWeight;
-  pTLConfig->ucAcWeights[4] = pConfig->WfqVoWeight;
   pTLConfig->ucReorderAgingTime[0] = pConfig->BkReorderAgingTime;/*WLANTL_AC_BK*/
   pTLConfig->ucReorderAgingTime[1] = pConfig->BeReorderAgingTime;/*WLANTL_AC_BE*/
   pTLConfig->ucReorderAgingTime[2] = pConfig->ViReorderAgingTime;/*WLANTL_AC_VI*/
@@ -2656,6 +1940,28 @@
   return hdd_is_apps_power_collapse_allowed((hdd_context_t*) pHddCtx);
 }
 
+void vos_abort_mac_scan(v_U8_t sessionId)
+{
+    hdd_context_t *pHddCtx = NULL;
+    v_CONTEXT_t pVosContext        = NULL;
+
+    /* Get the Global VOSS Context */
+    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
+    if(!pVosContext) {
+       hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__);
+       return;
+    }
+    
+    /* Get the HDD context */
+    pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
+    if(!pHddCtx) {
+       hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__);
+       return;
+    }
+
+    hdd_abort_mac_scan(pHddCtx, sessionId, eCSR_SCAN_ABORT_DEFAULT);
+    return;
+}
 /*---------------------------------------------------------------------------
 
   \brief vos_shutdown() - shutdown VOS
@@ -2733,15 +2039,6 @@
 
   vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq);
 
-  vosStatus = vos_event_destroy(&gpVosContext->fwLogsComplete);
-  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-  {
-     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-         "%s: failed to destroy fwLogsComplete", __func__);
-     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
-  }
-
-
   vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent);
   if (!VOS_IS_STATUS_SUCCESS(vosStatus))
   {
@@ -2892,19 +2189,18 @@
   This function is called to issue dump commands to Firmware
 
   @param
-       cmd     -  Command No. to execute
-       arg1    -  argument 1 to cmd
-       arg2    -  argument 2 to cmd
-       arg3    -  argument 3 to cmd
-       arg4    -  argument 4 to cmd
-       async   -  asynchronous event. Don't wait for completion.
+       cmd - Command No. to execute
+       arg1 - argument 1 to cmd
+       arg2 - argument 2 to cmd
+       arg3 - argument 3 to cmd
+       arg4 - argument 4 to cmd
   @return
        NONE
 */
 v_VOID_t vos_fwDumpReq(tANI_U32 cmd, tANI_U32 arg1, tANI_U32 arg2,
-                        tANI_U32 arg3, tANI_U32 arg4, tANI_U8 async)
+                        tANI_U32 arg3, tANI_U32 arg4)
 {
-   WDA_HALDumpCmdReq(NULL, cmd, arg1, arg2, arg3, arg4, NULL, async);
+   WDA_HALDumpCmdReq(NULL, cmd, arg1, arg2, arg3, arg4, NULL);
 }
 
 v_U64_t vos_get_monotonic_boottime(void)
@@ -2960,599 +2256,3 @@
     }
     return pVosWDCtx->isFatalError;
 }
-
-/**---------------------------------------------------------------------------
-
-  \brief vos_is_fw_logging_enabled() -
-
-  API to check if firmware is configured to send logs using DXE channel
-
-  \param  -  None
-
-  \return -  0: firmware logging is not enabled (it may or may not
-                be supported)
-             1: firmware logging is enabled
-
-  --------------------------------------------------------------------------*/
-v_U8_t vos_is_fw_logging_enabled(void)
-{
-   return hdd_is_fw_logging_enabled();
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief vos_is_fw_ev_logging_enabled() -
-
-  API to check if firmware is configured to send live logs using DXE channel
-
-  \param  -  None
-
-  \return -  0: firmware logging is not enabled (it may or may not
-                be supported)
-             1: firmware logging is enabled
-
-  --------------------------------------------------------------------------*/
-v_U8_t vos_is_fw_ev_logging_enabled(void)
-{
-   return hdd_is_fw_ev_logging_enabled();
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief vos_is_fw_logging_supported() -
-
-  API to check if firmware supports to send logs using DXE channel
-
-  \param  -  None
-
-  \return -  0: firmware logging is not supported
-             1: firmware logging is supported
-
-  --------------------------------------------------------------------------*/
-v_U8_t vos_is_fw_logging_supported(void)
-{
-   return IS_FRAME_LOGGING_SUPPORTED_BY_FW;
-}
-/**---------------------------------------------------------------------------
-
-  \brief vos_set_roam_delay_stats_enabled() -
-
-  API to set value of roamDelayStatsEnabled in vos context
-
-  \param  -  value to be updated
-
-  \return -  NONE
-
-  --------------------------------------------------------------------------*/
-
-v_VOID_t  vos_set_roam_delay_stats_enabled(v_U8_t value)
-{
-    gpVosContext->roamDelayStatsEnabled = value;
-}
-
-
-/**---------------------------------------------------------------------------
-
-  \brief vos_get_roam_delay_stats_enabled() -
-
-  API to get value of roamDelayStatsEnabled from vos context
-
-  \param  -  NONE
-
-  \return -  value of roamDelayStatsEnabled
-
-  --------------------------------------------------------------------------*/
-
-v_U8_t  vos_get_roam_delay_stats_enabled(v_VOID_t)
-{
-    return gpVosContext->roamDelayStatsEnabled;
-}
-
-v_U32_t vos_get_dxeReplenishRXTimerVal(void)
-{
-    hdd_context_t *pHddCtx = NULL;
-    v_CONTEXT_t pVosContext = NULL;
-
-    /* Get the Global VOSS Context */
-    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-    if(!pVosContext) {
-       hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__);
-       return 0;
-    }
-
-    /* Get the HDD context */
-    pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
-    if(!pHddCtx) {
-       hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__);
-       return 0;
-     }
-
-   return pHddCtx->cfg_ini->dxeReplenishRXTimerVal;
-}
-
-v_BOOL_t vos_get_dxeSSREnable(void)
-{
-    hdd_context_t *pHddCtx = NULL;
-    v_CONTEXT_t pVosContext = NULL;
-
-    /* Get the Global VOSS Context */
-    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-    if(!pVosContext) {
-       hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__);
-       return FALSE;
-    }
-
-    /* Get the HDD context */
-    pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
-    if(!pHddCtx) {
-       hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__);
-       return FALSE;
-     }
-
-   return pHddCtx->cfg_ini->dxeSSREnable;
-}
-
-v_VOID_t vos_flush_work(struct work_struct *work)
-{
-#if defined (WLAN_OPEN_SOURCE)
-   cancel_work_sync(work);
-#else
-   wcnss_flush_work(work);
-#endif
-}
-
-v_VOID_t vos_flush_delayed_work(struct delayed_work *dwork)
-{
-#if defined (WLAN_OPEN_SOURCE)
-   cancel_delayed_work_sync(dwork);
-#else
-   wcnss_flush_delayed_work(dwork);
-#endif
-}
-
-v_VOID_t vos_init_work(struct work_struct *work , void *callbackptr)
-{
-#if defined (WLAN_OPEN_SOURCE)
-   INIT_WORK(work,callbackptr);
-#else
-   wcnss_init_work(work, callbackptr);
-#endif
-}
-
-v_VOID_t vos_init_delayed_work(struct delayed_work *dwork , void *callbackptr)
-{
-#if defined (WLAN_OPEN_SOURCE)
-   INIT_DELAYED_WORK(dwork,callbackptr);
-#else
-   wcnss_init_delayed_work(dwork, callbackptr);
-#endif
-}
-
-/**
- * vos_set_multicast_logging() - Set mutlicast logging value
- * @value: Value of multicast logging
- *
- * Set the multicast logging value which will indicate
- * whether to multicast host and fw messages even
- * without any registration by userspace entity
- *
- * Return: None
- */
-void vos_set_multicast_logging(uint8_t value)
-{
-   vos_multicast_logging = value;
-}
-
-/**
- * vos_is_multicast_logging() - Get multicast logging value
- *
- * Get the multicast logging value which will indicate
- * whether to multicast host and fw messages even
- * without any registration by userspace entity
- *
- * Return: 0 - Multicast logging disabled, 1 - Multicast logging enabled
- */
-v_U8_t vos_is_multicast_logging(void)
-{
-   return vos_multicast_logging;
-}
-
-/**
- * vos_isLoadUnloadInProgress()
- *
- * Return TRUE if load/unload is in progress.
- *
- */
-v_BOOL_t vos_isLoadUnloadInProgress(void)
-{
-    hdd_context_t *pHddCtx = NULL;
-    v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-
-    if(!pVosContext)
-    {
-       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
-       return FALSE;
-    }
-
-    pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
-    if(!pHddCtx) {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                "%s: HDD context is Null", __func__);
-       return FALSE;
-    }
-
-    return ( 0 != pHddCtx->isLoadUnloadInProgress);
-}
-
-/**
- * vos_isUnloadInProgress()
- *
- * Return TRUE if unload is in progress.
- *
- */
-v_BOOL_t vos_isUnloadInProgress(void)
-{
-    hdd_context_t *pHddCtx = NULL;
-    v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-
-    if(!pVosContext)
-    {
-       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
-       return FALSE;
-    }
-
-    pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
-    if(!pHddCtx) {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                "%s: HDD context is Null", __func__);
-       return FALSE;
-    }
-
-    return (WLAN_HDD_UNLOAD_IN_PROGRESS == pHddCtx->isLoadUnloadInProgress);
-}
-
-/**
- * vos_probe_threads() - VOS API to post messages
- * to all the threads to detect if they are active or not
- *
- * Return none.
- *
- */
-void vos_probe_threads(void)
-{
-    vos_msg_t msg;
-
-    msg.callback = vos_wd_reset_thread_stuck_count;
-    /* Post Message to MC Thread */
-    sysBuildMessageHeader(SYS_MSG_ID_MC_THR_PROBE, &msg);
-    if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SYS, &msg)) {
-         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-          FL("Unable to post SYS_MSG_ID_MC_THR_PROBE message to MC thread"));
-    }
-
-    /* Post Message to Tx Thread */
-    sysBuildMessageHeader(SYS_MSG_ID_TX_THR_PROBE, &msg);
-    if (VOS_STATUS_SUCCESS != vos_tx_mq_serialize(VOS_MQ_ID_SYS, &msg)) {
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-          FL("Unable to post SYS_MSG_ID_TX_THR_PROBE message to TX thread"));
-    }
-
-    /* Post Message to Rx Thread */
-    sysBuildMessageHeader(SYS_MSG_ID_RX_THR_PROBE, &msg);
-    if (VOS_STATUS_SUCCESS != vos_rx_mq_serialize(VOS_MQ_ID_SYS, &msg)) {
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-          FL("Unable to post SYS_MSG_ID_RX_THR_PROBE message to RX thread"));
-    }
-}
-
-/**
- * vos_set_ring_log_level() - Convert HLOS values to driver log levels
- * @ring_id: ring_id
- * @log_levelvalue: Log level specificed
- *
- * This function sets the log level of a particular ring
- *
- * Return: None
- */
- void vos_set_ring_log_level(v_U32_t ring_id, v_U32_t log_level)
-{
-    VosContextType *vos_context;
-    v_U32_t log_val;
-
-    vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-    if (!vos_context) {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-              "%s: vos context is Invald", __func__);
-      return;
-    }
-
-    switch (log_level) {
-    case LOG_LEVEL_NO_COLLECTION:
-        log_val = WLAN_LOG_LEVEL_OFF;
-        break;
-    case LOG_LEVEL_NORMAL_COLLECT:
-        log_val = WLAN_LOG_LEVEL_NORMAL;
-        break;
-    case LOG_LEVEL_ISSUE_REPRO:
-        log_val = WLAN_LOG_LEVEL_REPRO;
-        break;
-    case LOG_LEVEL_ACTIVE:
-    default:
-        log_val = WLAN_LOG_LEVEL_ACTIVE;
-        break;
-    }
-
-    if (ring_id == RING_ID_WAKELOCK) {
-        vos_context->wakelock_log_level = log_val;
-        return;
-    } else if (ring_id == RING_ID_CONNECTIVITY) {
-        vos_context->connectivity_log_level = log_val;
-        return;
-    } else if (ring_id == RING_ID_PER_PACKET_STATS) {
-        vos_context->packet_stats_log_level = log_val;
-        if (WLAN_LOG_LEVEL_ACTIVE != log_val)
-            wlan_disable_and_flush_pkt_stats();
-
-        return;
-    }
-}
-/**
- * vos_get_ring_log_level() - Get the a ring id's log level
- * @ring_id: Ring id
- *
- * Fetch and return the log level corresponding to a ring id
- *
- * Return: Log level corresponding to the ring ID
- */
-v_U8_t vos_get_ring_log_level(v_U32_t ring_id)
-{
-    VosContextType *vos_context;
-
-     vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-     if (!vos_context) {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-            "%s: vos context is Invald", __func__);
-        return WLAN_LOG_LEVEL_OFF;
-    }
-
-    if (ring_id == RING_ID_WAKELOCK)
-        return vos_context->wakelock_log_level;
-    else if (ring_id == RING_ID_CONNECTIVITY)
-        return vos_context->connectivity_log_level;
-    else if (ring_id == RING_ID_PER_PACKET_STATS)
-        return vos_context->packet_stats_log_level;
-
-    return WLAN_LOG_LEVEL_OFF;
-}
-
-/* elements are rate, preamable, bw, short_gi */
-rateidx_to_rate_bw_preamble_sgi   rateidx_to_rate_bw_preamble_sgi_table[] =
-{
-/*11B CCK Long preamble (0-3)*/
-{ 10, PREAMBLE_CCK, S_BW20, 0},{ 20, PREAMBLE_CCK, S_BW20, 0},
-{ 55, PREAMBLE_CCK, S_BW20, 0},{ 110, PREAMBLE_CCK, S_BW20, 0},
-/*11B CCK Short preamble (4-7)*/
-{ 10, PREAMBLE_CCK, S_BW20, 0},{ 20, PREAMBLE_CCK, S_BW20, 0},
-{ 55, PREAMBLE_CCK, S_BW20, 0},{ 110, PREAMBLE_CCK, S_BW20, 0},
-/*11G/A (8-15)*/
-{ 60, PREAMBLE_OFDM, S_BW20, 0},{ 90, PREAMBLE_OFDM, S_BW20, 0},
-{ 120, PREAMBLE_OFDM, S_BW20, 0},{ 180, PREAMBLE_OFDM, S_BW20, 0},
-{ 240, PREAMBLE_OFDM, S_BW20, 0},{ 360, PREAMBLE_OFDM, S_BW20, 0},
-{ 480, PREAMBLE_OFDM, S_BW20, 0},{ 540, PREAMBLE_OFDM, S_BW20, 0},
-/*HT20 LGI MCS 0-7 (16-23)*/
-{ 65, PREAMBLE_HT, S_BW20, 0},{ 130, PREAMBLE_HT, S_BW20, 0},
-{ 195, PREAMBLE_HT, S_BW20, 0},{ 260, PREAMBLE_HT, S_BW20, 0},
-{ 390, PREAMBLE_HT, S_BW20, 0},{ 520, PREAMBLE_HT, S_BW20, 0},
-{ 585, PREAMBLE_HT, S_BW20, 0},{ 650, PREAMBLE_HT, S_BW20, 0},
-/*HT20 SGI MCS 0-7 (24-31)*/
-{ 72, PREAMBLE_HT, S_BW20, 1},{ 144, PREAMBLE_HT, S_BW20, 1},
-{ 217, PREAMBLE_HT, S_BW20, 1},{ 289, PREAMBLE_HT, S_BW20, 1},
-{ 433, PREAMBLE_HT, S_BW20, 1},{ 578, PREAMBLE_HT, S_BW20, 1},
-{ 650, PREAMBLE_HT, S_BW20, 1},{ 722, PREAMBLE_HT, S_BW20, 1},
-/*HT20 Greenfield MCS 0-7 rates (32-39)*/
-{ 65, PREAMBLE_HT, S_BW20, 0},{ 130, PREAMBLE_HT, S_BW20, 0},
-{ 195, PREAMBLE_HT, S_BW20, 0},{ 260, PREAMBLE_HT, S_BW20, 0},
-{ 390, PREAMBLE_HT, S_BW20, 0},{ 520, PREAMBLE_HT, S_BW20, 0},
-{ 585, PREAMBLE_HT, S_BW20, 0},{ 650, PREAMBLE_HT, S_BW20, 0},
-/*HT40 LGI MCS 0-7 (40-47)*/
-{ 135, PREAMBLE_HT, S_BW40, 0},{ 270, PREAMBLE_HT, S_BW40, 0},
-{ 405, PREAMBLE_HT, S_BW40, 0},{ 540, PREAMBLE_HT, S_BW40, 0},
-{ 810, PREAMBLE_HT, S_BW40, 0},{ 1080, PREAMBLE_HT, S_BW40, 0},
-{ 1215, PREAMBLE_HT, S_BW40, 0},{ 1350, PREAMBLE_HT, S_BW40, 0},
-/*HT40 SGI MCS 0-7 (48-55)*/
-{ 150, PREAMBLE_HT, S_BW40, 1},{ 300, PREAMBLE_HT, S_BW40, 1},
-{ 450, PREAMBLE_HT, S_BW40, 1},{ 600, PREAMBLE_HT, S_BW40, 1},
-{ 900, PREAMBLE_HT, S_BW40, 1},{ 1200, PREAMBLE_HT, S_BW40, 1},
-{ 1350, PREAMBLE_HT, S_BW40, 1},{ 1500, PREAMBLE_HT, S_BW40, 1},
-/*HT40 Greenfield MCS 0-7 rates (56-63) 64-65 are dummy*/
-{ 135, PREAMBLE_HT, S_BW40, 0},{ 270, PREAMBLE_HT, S_BW40, 0},
-{ 405, PREAMBLE_HT, S_BW40, 0},{ 540, PREAMBLE_HT, S_BW40, 0},
-{ 810, PREAMBLE_HT, S_BW40, 0},{ 1080, PREAMBLE_HT, S_BW40, 0},
-{ 1215, PREAMBLE_HT, S_BW40, 0},{ 1350, PREAMBLE_HT, S_BW40, 0},
-/*64-65 are dummy*/
-{ 1350, PREAMBLE_HT, S_BW40, 0},{ 1350, PREAMBLE_HT, S_BW40, 0},
-/*VHT20 LGI  MCS 0-9 rates (66-75)*/
-{ 65, PREAMBLE_VHT, S_BW20, 0},{ 130, PREAMBLE_VHT, S_BW20, 0},
-{ 195, PREAMBLE_VHT, S_BW20, 0},{ 260, PREAMBLE_VHT, S_BW20, 0},
-{ 390, PREAMBLE_VHT, S_BW20, 0},{ 520, PREAMBLE_VHT, S_BW20, 0},
-{ 585, PREAMBLE_VHT, S_BW20, 0},{ 650, PREAMBLE_VHT, S_BW20, 0},
-{ 780, PREAMBLE_VHT, S_BW20, 0},{ 865, PREAMBLE_VHT, S_BW20, 0},
-/*76-77 are dummy*/
-{ 865, PREAMBLE_VHT, S_BW20, 0},{ 865, PREAMBLE_VHT, S_BW20, 0},
-/*VHT20 SGI MCS 0-9 rates (78-87)*/
-{ 72, PREAMBLE_VHT, S_BW20, 1},{ 144, PREAMBLE_VHT, S_BW20, 1},
-{ 217, PREAMBLE_VHT, S_BW20, 1},{ 289, PREAMBLE_VHT, S_BW20, 1},
-{ 433, PREAMBLE_VHT, S_BW20, 1},{ 578, PREAMBLE_VHT, S_BW20, 1},
-{ 650, PREAMBLE_VHT, S_BW20, 1},{ 722, PREAMBLE_VHT, S_BW20, 1},
-{ 867, PREAMBLE_VHT, S_BW20, 1},{ 961, PREAMBLE_VHT, S_BW20, 1},
-/*88-89 are dummy*/
-{ 961, PREAMBLE_VHT, S_BW20, 1},{ 961, PREAMBLE_VHT, S_BW20, 1},
-/*VHT40 LGI MCS 0-9 rates (90-101) 98,101 is Dummy*/
-{ 135, PREAMBLE_VHT, S_BW40, 0},{ 270, PREAMBLE_VHT, S_BW40, 0},
-{ 405, PREAMBLE_VHT, S_BW40, 0},{ 540, PREAMBLE_VHT, S_BW40, 0},
-{ 810, PREAMBLE_VHT, S_BW40, 0},{ 1080, PREAMBLE_VHT, S_BW40, 0},
-{ 1215, PREAMBLE_VHT, S_BW40, 0},{ 1350, PREAMBLE_VHT, S_BW40, 0},
-{ 1350, PREAMBLE_VHT, S_BW40, 0},{ 1620, PREAMBLE_VHT, S_BW40, 0},
-{ 1800, PREAMBLE_VHT, S_BW40, 0},{ 1800, PREAMBLE_VHT, S_BW40, 0},
-/*VHT40 SGI MCS 0-9 rates (102-112) 110, 113 is Dummy*/
-{ 150, PREAMBLE_VHT, S_BW40, 1},{ 300, PREAMBLE_VHT, S_BW40, 1},
-{ 450, PREAMBLE_VHT, S_BW40, 1},{ 600, PREAMBLE_VHT, S_BW40, 1},
-{ 900, PREAMBLE_VHT, S_BW40, 1},{ 1200, PREAMBLE_VHT, S_BW40, 1},
-{ 1350, PREAMBLE_VHT, S_BW40, 1},{ 1500, PREAMBLE_VHT, S_BW40, 1},
-{ 1500, PREAMBLE_VHT, S_BW40, 1},{ 1800, PREAMBLE_VHT, S_BW40, 1},
-{ 2000, PREAMBLE_VHT, S_BW40, 1},{ 2000, PREAMBLE_VHT, S_BW40, 1},
-/*VHT80 LGI MCS 0-9 rates (114-125) 122, 125 is Dummy*/
-{ 293, PREAMBLE_VHT, S_BW80, 0},{ 585, PREAMBLE_VHT, S_BW80, 0},
-{ 878, PREAMBLE_VHT, S_BW80, 0},{ 1170, PREAMBLE_VHT, S_BW80, 0},
-{ 1755, PREAMBLE_VHT, S_BW80, 0},{ 2340, PREAMBLE_VHT, S_BW80, 0},
-{ 2633, PREAMBLE_VHT, S_BW80, 0},{ 2925, PREAMBLE_VHT, S_BW80, 0},
-{ 2925, PREAMBLE_VHT, S_BW80, 0},{ 3510, PREAMBLE_VHT, S_BW80, 0},
-{ 3900, PREAMBLE_VHT, S_BW80, 0},{ 3900, PREAMBLE_VHT, S_BW80, 0},
-/*VHT80 SGI MCS 0-9 rates (126-136) 134 is Dummy*/
-{ 325, PREAMBLE_VHT, S_BW80, 1},{ 650, PREAMBLE_VHT, S_BW80, 1},
-{ 975, PREAMBLE_VHT, S_BW80, 1},{ 1300, PREAMBLE_VHT, S_BW80, 1},
-{ 1950, PREAMBLE_VHT, S_BW80, 1},{ 2600, PREAMBLE_VHT, S_BW80, 1},
-{ 2925, PREAMBLE_VHT, S_BW80, 1},{ 3250, PREAMBLE_VHT, S_BW80, 1},
-{ 3250, PREAMBLE_VHT, S_BW80, 1},{ 3900, PREAMBLE_VHT, S_BW80, 1},
-{ 4333, PREAMBLE_VHT, S_BW80, 1},
-};
-
-void get_rate_and_MCS(per_packet_stats *stats, uint32 rateindex)
-{
-    rateidx_to_rate_bw_preamble_sgi *ratetbl;
-
-    if (STATS_MAX_RATE_INDEX < rateindex)
-        rateindex = STATS_MAX_RATE_INDEX;
-    ratetbl= &rateidx_to_rate_bw_preamble_sgi_table[rateindex];
-    stats->last_transmit_rate = ratetbl->rate/5;
-    stats->MCS.nss = 0;
-    if (0 <= rateindex && rateindex <= 7)
-        stats->MCS.rate = 7 - rateindex;
-    else if (8 <= rateindex && rateindex <= 15)
-    {
-        switch(rateindex)
-        {
-            case 8:stats->MCS.rate = 3; break;
-            case 9:stats->MCS.rate = 7; break;
-            case 10:stats->MCS.rate = 2; break;
-            case 11:stats->MCS.rate = 6; break;
-            case 12:stats->MCS.rate = 1; break;
-            case 13:stats->MCS.rate = 5; break;
-            case 14:stats->MCS.rate = 0; break;
-            case 15:stats->MCS.rate = 4; break;
-        }
-    }
-    else if(16 <= rateindex && rateindex <= 23)
-        stats->MCS.rate = rateindex - 16;
-    else if(24 <= rateindex  && rateindex <= 31)
-        stats->MCS.rate =  rateindex - 24;
-    else if(32 <= rateindex  && rateindex <= 39)
-        stats->MCS.rate = rateindex - 32;
-    else if(40 <= rateindex && rateindex <= 47)
-        stats->MCS.rate = rateindex - 40;
-    else if(48 <= rateindex && rateindex <= 55)
-        stats->MCS.rate = rateindex - 48;
-    else if(56 <= rateindex && rateindex <= 63)
-        stats->MCS.rate = rateindex - 56;
-    else if(66 <= rateindex && rateindex <= 75)
-        stats->MCS.rate = rateindex - 66;
-    else if(78 <= rateindex && rateindex <= 87)
-        stats->MCS.rate = rateindex - 78;
-    else if(90 <= rateindex && rateindex <= 100)
-        stats->MCS.rate = rateindex - 90;
-    else if(78 <= rateindex && rateindex <= 87)
-        stats->MCS.rate = rateindex - 78;
-    else if(90 <= rateindex && rateindex <= 97)
-        stats->MCS.rate = rateindex - 90;
-    else if(99 <= rateindex && rateindex <= 100)
-        stats->MCS.rate = rateindex - 91;
-    else if(102 <= rateindex && rateindex <= 109)
-        stats->MCS.rate = rateindex - 102;
-    else if(111 <= rateindex && rateindex <= 112)
-        stats->MCS.rate = rateindex - 103;
-    else if(114 <= rateindex && rateindex <= 121)
-        stats->MCS.rate = rateindex - 114;
-    else if(123 <= rateindex && rateindex <= 124)
-        stats->MCS.rate = rateindex - 115;
-    else if(126 <= rateindex && rateindex <= 133)
-        stats->MCS.rate = rateindex - 126;
-    else if(135 <= rateindex && rateindex <= 136)
-        stats->MCS.rate = rateindex - 127;
-    else /*Invalid rate index mark it 0*/
-        stats->MCS.rate = 0;
-    stats->MCS.preamble = ratetbl->preamble;
-    stats->MCS.bw = ratetbl->bw;
-    stats->MCS.short_gi = ratetbl->short_gi;
-}
-
-bool vos_isPktStatsEnabled(void)
-{
-    bool value;
-    value = wlan_isPktStatsEnabled();
-    return (value);
-}
-
-bool vos_is_wlan_logging_enabled(void)
-{
-    v_CONTEXT_t vos_ctx = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-    hdd_context_t *hdd_ctx;
-
-    if(!vos_ctx)
-    {
-       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__);
-       return false;
-    }
-
-    hdd_ctx = vos_get_context(VOS_MODULE_ID_HDD, vos_ctx);
-
-    if(!hdd_ctx)
-    {
-       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null", __func__);
-       return false;
-    }
-
-    if (!hdd_ctx->cfg_ini->wlanLoggingEnable)
-    {
-       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Logging framework not enabled!", __func__);
-       return false;
-    }
-
-    return true;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief vos_is_probe_rsp_offload_enabled -
-
-  API to check if probe response offload feature is enabled from ini
-
-  \param  -  None
-
-  \return -  0: probe response offload is disabled
-             1: probe response offload is enabled
-
-  --------------------------------------------------------------------------*/
-v_BOOL_t vos_is_probe_rsp_offload_enabled(void)
-{
-	hdd_context_t *pHddCtx = NULL;
-	v_CONTEXT_t pVosContext = NULL;
-
-	/* Get the Global VOSS Context */
-	pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-	if (!pVosContext) {
-		hddLog(VOS_TRACE_LEVEL_FATAL,
-		       "%s: Global VOS context is Null", __func__);
-		return FALSE;
-	}
-
-	/* Get the HDD context */
-	pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD,
-						   pVosContext);
-	if (!pHddCtx) {
-		hddLog(VOS_TRACE_LEVEL_FATAL,
-		       "%s: HDD context is Null", __func__);
-		return FALSE;
-	}
-
-	return pHddCtx->cfg_ini->sap_probe_resp_offload;
-}
diff --git a/wlan/prima/CORE/VOSS/src/vos_diag.c b/wlan/prima/CORE/VOSS/src/vos_diag.c
index 496ae47..d9c63b7 100644
--- a/wlan/prima/CORE/VOSS/src/vos_diag.c
+++ b/wlan/prima/CORE/VOSS/src/vos_diag.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -40,7 +40,6 @@
 #include "wlan_nlink_common.h"
 #include "vos_sched.h"
 #include "wlan_ptt_sock_svc.h"
-#include "wlan_nlink_srv.h"
 
 
 #define PTT_MSG_DIAG_CMDS_TYPE   0x5050
@@ -142,9 +141,6 @@
         return;
     }
 
-    if (nl_srv_is_initialized() != 0)
-        return;
-
 #ifdef WLAN_KD_READY_NOTIFIER
     /* NL is not ready yet, WLAN KO started first */
     if ((pHddCtx->kd_nl_init) && (!pHddCtx->ptt_pid))
@@ -154,7 +150,7 @@
 #endif /* WLAN_KD_READY_NOTIFIER */
 
    /* Send the log data to the ptt app only if it is registered with the wlan driver*/
-    if(vos_is_multicast_logging())
+    if(pHddCtx->ptt_pid)
     {
         data_len = pHdr->len;
     
@@ -183,60 +179,24 @@
     
     
         vos_mem_copy(pBuf, pHdr,data_len);
-
-        if (ptt_sock_send_msg_to_app(wmsg, 0,
-                  ANI_NL_MSG_PUMAC, INVALID_PID, MSG_DONTWAIT) < 0)
+    
+        if(pHddCtx->ptt_pid)
         {
-            vos_mem_free((v_VOID_t *)wmsg);
-            return;
+            if( ptt_sock_send_msg_to_app(wmsg, 0,
+                      ANI_NL_MSG_PUMAC, pHddCtx->ptt_pid, MSG_DONTWAIT) < 0) {
+        
+                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                          ("Ptt Socket error sending message to the app!!"));
+                vos_mem_free((v_VOID_t *)wmsg);
+                return;
+            }
+       
         }
-
         vos_mem_free((v_VOID_t*)wmsg);
     }
     return;
 }
 
-/**
- * vos_log_wlock_diag() - This function is used to send wake lock diag events
- * @reason: Reason why the wakelock was taken or released
- * @wake_lock_name: Function in which the wakelock was taken or released
- * @timeout: Timeout value in case of timed wakelocks
- * @status: Status field indicating whether the wake lock was taken/released
- *
- * This function is used to send wake lock diag events to user space
- *
- * Return: None
- *
- */
-void vos_log_wlock_diag(uint32_t reason, const char *wake_lock_name,
-                              uint32_t timeout, uint32_t status)
-{
-     VosContextType *vos_context;
-     WLAN_VOS_DIAG_EVENT_DEF(wlan_diag_event,
-     struct vos_event_wlan_wake_lock);
-
-    vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-    if (!vos_context) {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-            "vos context is Invald");
-       return;
-    }
-     if (nl_srv_is_initialized() != 0 ||
-         vos_context->wakelock_log_level == WLAN_LOG_LEVEL_OFF)
-          return;
-
-     wlan_diag_event.status = status;
-     wlan_diag_event.reason = reason;
-     wlan_diag_event.timeout = timeout;
-     wlan_diag_event.name_len = strlen(wake_lock_name);
-     strlcpy(&wlan_diag_event.name[0],
-             wake_lock_name,
-             wlan_diag_event.name_len+1);
-
-     WLAN_VOS_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_WAKE_LOCK);
-}
-
-
 /**---------------------------------------------------------------------------
   
   \brief vos_event_report_payload() - 
@@ -262,24 +222,9 @@
 
      /*Get the global context */
     pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-    if (!pVosContext)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: vos context is NULL", __func__);
-        return;
-    }
 
      /*Get the Hdd Context */
     pHddCtx = ((VosContextType*)(pVosContext))->pHDDContext;
-    if (!pHddCtx)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "%s: hdd context is NULL", __func__);
-        return;
-    }
-
-    if (nl_srv_is_initialized() != 0)
-        return;
 
 #ifdef WLAN_KD_READY_NOTIFIER
     /* NL is not ready yet, WLAN KO started first */
@@ -290,7 +235,7 @@
 #endif /* WLAN_KD_READY_NOTIFIER */
     
     /* Send the log data to the ptt app only if it is registered with the wlan driver*/
-    if(vos_is_multicast_logging())
+    if(pHddCtx->ptt_pid)
     {
         total_len = sizeof(tAniHdr)+sizeof(event_report_t)+length;
         
@@ -317,7 +262,7 @@
         vos_mem_copy(pBuf, pPayload,length);
       
         if( ptt_sock_send_msg_to_app(wmsg, 0,
-                     ANI_NL_MSG_PUMAC, INVALID_PID, MSG_DONTWAIT) < 0) {
+                     ANI_NL_MSG_PUMAC, pHddCtx->ptt_pid, MSG_DONTWAIT) < 0) {
             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                        ("Ptt Socket error sending message to the app!!"));
             vos_mem_free((v_VOID_t*)wmsg);
diff --git a/wlan/prima/CORE/VOSS/src/vos_event.c b/wlan/prima/CORE/VOSS/src/vos_event.c
index 505455e..7432484 100644
--- a/wlan/prima/CORE/VOSS/src/vos_event.c
+++ b/wlan/prima/CORE/VOSS/src/vos_event.c
@@ -35,6 +35,9 @@
 
   DEPENDENCIES:
 
+                Copyright (c) 2007 QUALCOMM Incorporated.
+                All Rights Reserved.
+                Qualcomm Confidential and Proprietary
 ============================================================================*/
 
 /*============================================================================
diff --git a/wlan/prima/CORE/VOSS/src/vos_list.c b/wlan/prima/CORE/VOSS/src/vos_list.c
index 66fbda7..693ea7b 100644
--- a/wlan/prima/CORE/VOSS/src/vos_list.c
+++ b/wlan/prima/CORE/VOSS/src/vos_list.c
@@ -34,6 +34,9 @@
   Description...
 
 
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
 
   ==============================================================================**/
 /* $HEADER$ */
diff --git a/wlan/prima/CORE/VOSS/src/vos_lock.c b/wlan/prima/CORE/VOSS/src/vos_lock.c
index 60e0c3d..8011bcf 100644
--- a/wlan/prima/CORE/VOSS/src/vos_lock.c
+++ b/wlan/prima/CORE/VOSS/src/vos_lock.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -35,6 +35,9 @@
 
   DEPENDENCIES: 
  
+                Copyright (c) 2007 QUALCOMM Incorporated.
+                All Rights Reserved.
+                Qualcomm Confidential and Proprietary
 ============================================================================*/
 
 /*============================================================================
@@ -49,19 +52,12 @@
 #include "vos_lock.h"
 #include "vos_memory.h"
 #include "vos_trace.h"
-#include "i_vos_diag_core_event.h"
-#include "vos_diag_core_event.h"
-#include <linux/wcnss_wlan.h>
 
 
 /*----------------------------------------------------------------------------
  * Preprocessor Definitions and Constants
  * -------------------------------------------------------------------------*/
 
-#define WIFI_POWER_EVENT_DEFAULT_WAKELOCK_TIMEOUT 0
-#define WIFI_POWER_EVENT_WAKELOCK_TAKEN 0
-#define WIFI_POWER_EVENT_WAKELOCK_RELEASED 1
-
 /*----------------------------------------------------------------------------
  * Type Declarations
  * -------------------------------------------------------------------------*/
@@ -481,142 +477,3 @@
 
    return VOS_STATUS_SUCCESS;
 }
-
-/*--------------------------------------------------------------------------
-
-  \brief vos_wake_lock_init() - initializes a vOSS wake lock
-
-  \param pLock - the wake lock to initialize
-              name - wakelock name
-
-  \return VOS_STATUS_SUCCESS - wake lock was successfully initialized and
-          is ready to be used.
-  --------------------------------------------------------------------------*/
-VOS_STATUS vos_wake_lock_init(vos_wake_lock_t *pLock, const char *name)
-{
-#if defined(WLAN_OPEN_SOURCE)
-    wake_lock_init(pLock, WAKE_LOCK_SUSPEND, name);
-#endif
-    return VOS_STATUS_SUCCESS;
-}
-
-
-/*--------------------------------------------------------------------------
- * vos_wake_lock_name() - This function returns the name of the wakelock
- * @pLock: Pointer to the wakelock
- *
- * This function returns the name of the wakelock
- *
- * Return: Pointer to the name if it is valid or a default string
- *
-   --------------------------------------------------------------------------*/
-static const char* vos_wake_lock_name(vos_wake_lock_t *pLock)
-{
-#if !(defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK))
-    return "UNNAMED_WAKELOCK";
-#else
-    if (pLock->ws.name)
-        return pLock->ws.name;
-    else
-        return "UNNAMED_WAKELOCK";
-#endif
-}
-
-/*--------------------------------------------------------------------------
-
-  \brief vos_wake_lock_acquire() - acquires a wake lock
-
-  \param pLock - the wake lock to acquire
-
-  \return VOS_STATUS_SUCCESS - the wake lock was successfully acquired
-
-  ------------------------------------------------------------------------*/
-VOS_STATUS vos_wake_lock_acquire(vos_wake_lock_t *pLock,
-                                 uint32_t reason)
-{
-    vos_log_wlock_diag(reason, vos_wake_lock_name(pLock),
-                       WIFI_POWER_EVENT_DEFAULT_WAKELOCK_TIMEOUT,
-                       WIFI_POWER_EVENT_WAKELOCK_TAKEN);
-#if defined(WLAN_OPEN_SOURCE)
-    wake_lock(pLock);
-#else
-    wcnss_prevent_suspend();
-#endif
-    return VOS_STATUS_SUCCESS;
-
-}
-
-/*--------------------------------------------------------------------------
-
-  \brief vos_wake_lock_timeout_release() - release a wake lock with a timeout
-
-  \param pLock - the wake lock to release
-         reason - reason for taking wakelock
-
-  \return VOS_STATUS_SUCCESS - the wake lock was successfully released
-
-  ------------------------------------------------------------------------*/
-VOS_STATUS vos_wake_lock_timeout_release(vos_wake_lock_t *pLock,
-                                            v_U32_t msec, uint32_t reason)
-{
-    /* Avoid reporting rx and tx wavelocks
-     * event to diag as it may cause performance
-     * issues.
-     */
-    if (WIFI_POWER_EVENT_WAKELOCK_HOLD_RX != reason)
-    {
-        vos_log_wlock_diag(reason, vos_wake_lock_name(pLock), msec,
-                                   WIFI_POWER_EVENT_WAKELOCK_TAKEN);
-    }
-
-#if defined(WLAN_OPEN_SOURCE)
-    wake_lock_timeout(pLock, msecs_to_jiffies(msec));
-#else
-    /* Do nothing as there is no API in wcnss for timeout*/
-#endif
-   return VOS_STATUS_SUCCESS;
-
-}
-
-/*--------------------------------------------------------------------------
-
-  \brief vos_wake_lock_release() - releases a wake lock
-
-  \param pLock - the wake lock to release
-
-  \return VOS_STATUS_SUCCESS - the lock was successfully released
-
-  ------------------------------------------------------------------------*/
-VOS_STATUS vos_wake_lock_release(vos_wake_lock_t *pLock, uint32_t reason)
-{
-    vos_log_wlock_diag(reason, vos_wake_lock_name(pLock),
-                       WIFI_POWER_EVENT_DEFAULT_WAKELOCK_TIMEOUT,
-                       WIFI_POWER_EVENT_WAKELOCK_RELEASED);
-
-#if defined(WLAN_OPEN_SOURCE)
-    wake_unlock(pLock);
-#else
-    wcnss_allow_suspend();
-#endif
-    return VOS_STATUS_SUCCESS;
-
-
-}
-
-/*--------------------------------------------------------------------------
-
-  \brief vos_wake_lock_destroy() - destroys a wake lock
-
-  \param pLock - the wake lock to destroy
-
-  \return VOS_STATUS_SUCCESS - the lock was successfully destroyed
-
-  ------------------------------------------------------------------------*/
-VOS_STATUS vos_wake_lock_destroy(vos_wake_lock_t *pLock)
-{
-
-#if defined(WLAN_OPEN_SOURCE)
-    wake_lock_destroy(pLock);
-#endif
-    return VOS_STATUS_SUCCESS;
-}
diff --git a/wlan/prima/CORE/VOSS/src/vos_memory.c b/wlan/prima/CORE/VOSS/src/vos_memory.c
index e87cfd3..7690c1b 100644
--- a/wlan/prima/CORE/VOSS/src/vos_memory.c
+++ b/wlan/prima/CORE/VOSS/src/vos_memory.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -31,6 +31,9 @@
   @brief Virtual Operating System Services Memory API
 
   
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*=========================================================================== 
@@ -55,14 +58,11 @@
  * ------------------------------------------------------------------------*/
 #include "vos_memory.h"
 #include "vos_trace.h"
-#include "vos_api.h"
-#include <vmalloc.h>
 
 #ifdef CONFIG_WCNSS_MEM_PRE_ALLOC
 #include <linux/wcnss_wlan.h>
 #define WCNSS_PRE_ALLOC_GET_THRESHOLD (4*1024)
 #endif
-#define VOS_GET_MEMORY_TIME_THRESHOLD 300
 
 #ifdef MEMORY_DEBUG
 #include "wlan_hdd_dp_utils.h"
@@ -191,17 +191,16 @@
    v_SIZE_t new_size;
    int flags = GFP_KERNEL;
    unsigned long IrqFlags;
-   unsigned long  time_before_kmalloc;
 
 
-   if (size > (1024*1024) || size == 0)
+   if (size > (1024*1024))
    {
        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-               "%s: called with invalid arg %u !!!", __func__, size);
+               "%s: called with arg > 1024K; passed in %d !!!", __func__,size); 
        return NULL;
    }
 
-   if (in_interrupt() || irqs_disabled() || in_atomic())
+   if (in_interrupt())
    {
       flags = GFP_ATOMIC;
    }
@@ -217,42 +216,12 @@
                return pmem;
       }
 #endif
-      time_before_kmalloc = vos_timer_get_system_time();
-      memPtr = kmalloc(size, flags);
-
-      /* If time taken by kmalloc is greater than VOS_GET_MEMORY_TIME_THRESHOLD
-       * msec */
-      if (vos_timer_get_system_time() - time_before_kmalloc >=
-                                    VOS_GET_MEMORY_TIME_THRESHOLD)
-         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-               "%s: kmalloc took %lu msec for size %d called from %pS at line %d",
-               __func__,
-               vos_timer_get_system_time() - time_before_kmalloc,
-               size, (void *)_RET_IP_, lineNum);
-      if ((flags != GFP_ATOMIC) && (NULL == memPtr))
-      {
-         WARN_ON(1);
-         vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                       WLAN_LOG_INDICATOR_HOST_ONLY,
-                       WLAN_LOG_REASON_MALLOC_FAIL,
-                       false, true);
-      }
-      return memPtr;
+      return kmalloc(size, flags);
    }
 
    new_size = size + sizeof(struct s_vos_mem_struct) + 8; 
 
-   time_before_kmalloc = vos_timer_get_system_time();
    memStruct = (struct s_vos_mem_struct*)kmalloc(new_size, flags);
-   /* If time taken by kmalloc is greater than VOS_GET_MEMORY_TIME_THRESHOLD
-    * msec */
-   if (vos_timer_get_system_time() - time_before_kmalloc >=
-                              VOS_GET_MEMORY_TIME_THRESHOLD)
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-           "%s: kmalloc took %lu msec for size %d called from %pS at line %d",
-            __func__,
-            vos_timer_get_system_time() - time_before_kmalloc,
-            size, (void *)_RET_IP_, lineNum);
 
    if(memStruct != NULL)
    {
@@ -276,14 +245,6 @@
 
       memPtr = (v_VOID_t*)(memStruct + 1); 
    }
-   if ((flags != GFP_ATOMIC) && (NULL == memStruct))
-   {
-      WARN_ON(1);
-      vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                    WLAN_LOG_INDICATOR_HOST_ONLY,
-                    WLAN_LOG_REASON_MALLOC_FAIL,
-                    false, true);
-   }
    return memPtr;
 }
 
@@ -339,16 +300,12 @@
 v_VOID_t * vos_mem_malloc( v_SIZE_t size )
 {
    int flags = GFP_KERNEL;
-   v_VOID_t* memPtr = NULL;
 #ifdef CONFIG_WCNSS_MEM_PRE_ALLOC
     v_VOID_t* pmem;
 #endif    
-   unsigned long  time_before_kmalloc;
-
-   if (size > (1024*1024) || size == 0)
+   if (size > (1024*1024))
    {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-               "%s: called with invalid arg %u !!!", __func__, size);
+       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: called with arg > 1024K; passed in %d !!!", __func__,size); 
        return NULL;
    }
    if (in_interrupt() || irqs_disabled() || in_atomic())
@@ -363,28 +320,7 @@
            return pmem;
    }
 #endif
-   time_before_kmalloc = vos_timer_get_system_time();
-   memPtr = kmalloc(size, flags);
-   /* If time taken by kmalloc is greater than VOS_GET_MEMORY_TIME_THRESHOLD
-    * msec */
-   if (vos_timer_get_system_time() - time_before_kmalloc >=
-                              VOS_GET_MEMORY_TIME_THRESHOLD)
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-          "%s: kmalloc took %lu msec for size %d from %pS",
-          __func__,
-          vos_timer_get_system_time() - time_before_kmalloc,
-          size, (void *)_RET_IP_);
-
-   if ((flags != GFP_ATOMIC) && (NULL == memPtr))
-   {
-       WARN_ON(1);
-       vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                     WLAN_LOG_INDICATOR_HOST_ONLY,
-                     WLAN_LOG_REASON_MALLOC_FAIL,
-                     false, true);
-   }
-   return memPtr;
-
+   return kmalloc(size, flags);
 }   
 
 v_VOID_t vos_mem_free( v_VOID_t *ptr )
@@ -401,45 +337,6 @@
 }
 #endif
 
-v_VOID_t * vos_mem_vmalloc(v_SIZE_t size)
-{
-    v_VOID_t* memPtr = NULL;
-    unsigned long  time_before_vmalloc;
-
-    if (size == 0 || size >= (1024*1024))
-    {
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                  "%s invalid size: %u", __func__, size);
-        return NULL;
-    }
-    time_before_vmalloc = vos_timer_get_system_time();
-    memPtr = vmalloc(size);
-    /* If time taken by vmalloc is greater than VOS_GET_MEMORY_TIME_THRESHOLD
-     * msec
-     */
-    if (vos_timer_get_system_time() - time_before_vmalloc >=
-                              VOS_GET_MEMORY_TIME_THRESHOLD)
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-           "%s: vmalloc took %lu msec for size %d from %pS",
-           __func__,
-           vos_timer_get_system_time() - time_before_vmalloc,
-           size, (void *)_RET_IP_);
-    return memPtr;
-}
-
-v_VOID_t vos_mem_vfree(void *addr)
-{
-    if (addr == NULL)
-    {
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                  "%s NULL address passed to free", __func__);
-        return;
-    }
-
-    vfree(addr);
-    return;
-}
-
 v_VOID_t vos_mem_set( v_VOID_t *ptr, v_SIZE_t numBytes, v_BYTE_t value )
 {
    if (ptr == NULL)
@@ -450,20 +347,6 @@
    memset(ptr, value, numBytes);
 }
 
-void vos_buff_to_hl_buff (tANI_U8 *buffer, int size)
-{
-    int *val, i;
-    if (size % 4 != 0)
-        VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_ERROR,
-                  "%s: size should be multiple of 4, size %d",
-                  __func__, size);
-
-    val = (int *)buffer;
-
-    for (i=0; i<(size/4); i++)
-        *(val+i) = vos_htonl ((unsigned long)(*(val+i)));
-}
-
 v_VOID_t vos_mem_zero( v_VOID_t *ptr, v_SIZE_t numBytes )
 {
    if (0 == numBytes)
@@ -519,18 +402,7 @@
    memmove(pDst, pSrc, numBytes);
 }
 
-v_BOOL_t vos_mem_compare(
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                          const v_VOID_t *pMemory1,
-#else
-                          v_VOID_t *pMemory1,
-#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
-                          const v_VOID_t *pMemory2,
-#else
-                          v_VOID_t *pMemory2,
-#endif
-                          v_U32_t numBytes )
+v_BOOL_t vos_mem_compare( v_VOID_t *pMemory1, v_VOID_t *pMemory2, v_U32_t numBytes )
 { 
    if (0 == numBytes)
    {
diff --git a/wlan/prima/CORE/VOSS/src/vos_mq.c b/wlan/prima/CORE/VOSS/src/vos_mq.c
index 91ed206..8928df0 100644
--- a/wlan/prima/CORE/VOSS/src/vos_mq.c
+++ b/wlan/prima/CORE/VOSS/src/vos_mq.c
@@ -33,6 +33,9 @@
                
    Message Queue Definitions and API
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -163,42 +166,6 @@
 
 } /* vos_mq_put() */
 
-/*---------------------------------------------------------------------------
-
-  \brief vos_mq_put_front() - Add a message to the head of message queue
-
-  The \a vos_mq_put_front() function add a message to the head of Message queue.
-
-  \param  pMq - pointer to the message queue
-
-  \param  pMsgWrapper - Msg Wrapper containing the message
-
-  \return None
-
-  \sa vos_mq_put()
-
----------------------------------------------------------------------------*/
-void vos_mq_put_front(pVosMqType pMq, pVosMsgWrapper pMsgWrapper)
-{
-  unsigned long flags;
-
-  /*
-  ** Some quick sanity check
-  */
-  if ((pMq == NULL) || (pMsgWrapper == NULL)) {
-     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-         "%s: NULL pointer passed",__func__);
-     return ;
-  }
-
-  spin_lock_irqsave(&pMq->mqLock, flags);
-
-  list_add(&pMsgWrapper->msgNode, &pMq->mqList);
-
-  spin_unlock_irqrestore(&pMq->mqLock, flags);
-
-} /* vos_mq_put_front() */
-
 
 /*---------------------------------------------------------------------------
   
diff --git a/wlan/prima/CORE/VOSS/src/vos_nvitem.c b/wlan/prima/CORE/VOSS/src/vos_nvitem.c
index c983af4..f1639d8 100644
--- a/wlan/prima/CORE/VOSS/src/vos_nvitem.c
+++ b/wlan/prima/CORE/VOSS/src/vos_nvitem.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -32,6 +32,9 @@
   FILE:         vos_nvitem.c
   OVERVIEW:     This source file contains definitions for vOS NV Item APIs
   DEPENDENCIES: NV, remote API client, WinCE REX
+                Copyright (c) 2008 QUALCOMM Incorporated.
+                All Rights Reserved.
+                Qualcomm Confidential and Proprietary
 ============================================================================*/
 /*============================================================================
   EDIT HISTORY FOR MODULE
@@ -91,8 +94,6 @@
 #define MAGIC_NUMBER            0xCAFEBABE
 
 #define MIN(a, b) (a > b ? b : a)
-#define MAX(a, b) (a > b ? a : b)
-
 /*----------------------------------------------------------------------------
  * Type Declarations
  * -------------------------------------------------------------------------*/
@@ -123,196 +124,143 @@
 // loaded on driver initialization if available
 
 #ifdef CONFIG_ENABLE_LINUX_REG
-static struct
-chan_to_ht_40_index_map chan_to_ht_40_index[NUM_20MHZ_RF_CHANNELS] =
-{
-  /* ht_40_minus_index, ht_40_plus_index */
-  {INVALID_RF_CHANNEL, RF_CHAN_BOND_3},    //RF_CHAN_1,
-  {INVALID_RF_CHANNEL, RF_CHAN_BOND_4},    //RF_CHAN_2,
-  {INVALID_RF_CHANNEL, RF_CHAN_BOND_5},    //RF_CHAN_3,
-  {INVALID_RF_CHANNEL, RF_CHAN_BOND_6},    //RF_CHAN_4,
-  {RF_CHAN_BOND_3, RF_CHAN_BOND_7},        //RF_CHAN_5,
-  {RF_CHAN_BOND_4, RF_CHAN_BOND_8},        //RF_CHAN_6,
-  {RF_CHAN_BOND_5, RF_CHAN_BOND_9},        //RF_CHAN_7,
-  {RF_CHAN_BOND_6, RF_CHAN_BOND_10},       //RF_CHAN_8,
-  {RF_CHAN_BOND_7, RF_CHAN_BOND_11},       //RF_CHAN_9,
-  {RF_CHAN_BOND_8, INVALID_RF_CHANNEL},    //RF_CHAN_10,
-  {RF_CHAN_BOND_9, INVALID_RF_CHANNEL},    //RF_CHAN_11,
-  {RF_CHAN_BOND_10, INVALID_RF_CHANNEL},   //RF_CHAN_12,
-  {RF_CHAN_BOND_11, INVALID_RF_CHANNEL},   //RF_CHAN_13,
-  {INVALID_RF_CHANNEL, INVALID_RF_CHANNEL},//RF_CHAN_14,
-  {INVALID_RF_CHANNEL, RF_CHAN_BOND_242},  //RF_CHAN_240,
-  {RF_CHAN_BOND_242, RF_CHAN_BOND_246},    //RF_CHAN_244,
-  {RF_CHAN_BOND_246, RF_CHAN_BOND_250},    //RF_CHAN_248,
-  {RF_CHAN_BOND_250, INVALID_RF_CHANNEL},  //RF_CHAN_252,
-  {INVALID_RF_CHANNEL, RF_CHAN_BOND_210},  //RF_CHAN_208,
-  {RF_CHAN_BOND_210, RF_CHAN_BOND_214},    //RF_CHAN_212,
-  {RF_CHAN_BOND_214, INVALID_RF_CHANNEL},  //RF_CHAN_216,
-  {INVALID_RF_CHANNEL, RF_CHAN_BOND_38},   //RF_CHAN_36,
-  {RF_CHAN_BOND_38, RF_CHAN_BOND_42},      //RF_CHAN_40,
-  {RF_CHAN_BOND_42, RF_CHAN_BOND_46},      //RF_CHAN_44,
-  {RF_CHAN_BOND_46, RF_CHAN_BOND_50},      //RF_CHAN_48,
-  {RF_CHAN_BOND_50, RF_CHAN_BOND_54},      //RF_CHAN_52,
-  {RF_CHAN_BOND_54, RF_CHAN_BOND_58},      //RF_CHAN_56,
-  {RF_CHAN_BOND_58, RF_CHAN_BOND_62},      //RF_CHAN_60,
-  {RF_CHAN_BOND_62, INVALID_RF_CHANNEL},   //RF_CHAN_64,
-  {INVALID_RF_CHANNEL, RF_CHAN_BOND_102},  //RF_CHAN_100,
-  {RF_CHAN_BOND_102, RF_CHAN_BOND_106},    //RF_CHAN_104,
-  {RF_CHAN_BOND_106, RF_CHAN_BOND_110},    //RF_CHAN_108,
-  {RF_CHAN_BOND_110, RF_CHAN_BOND_114},    //RF_CHAN_112,
-  {RF_CHAN_BOND_114, RF_CHAN_BOND_118},    //RF_CHAN_116,
-  {RF_CHAN_BOND_118, RF_CHAN_BOND_122},    //RF_CHAN_120,
-  {RF_CHAN_BOND_122, RF_CHAN_BOND_126},    //RF_CHAN_124,
-  {RF_CHAN_BOND_126, RF_CHAN_BOND_130},    //RF_CHAN_128,
-  {RF_CHAN_BOND_130, RF_CHAN_BOND_134},    //RF_CHAN_132,
-  {RF_CHAN_BOND_134, RF_CHAN_BOND_138},    //RF_CHAN_136,
-  {RF_CHAN_BOND_138, RF_CHAN_BOND_142},    //RF_CHAN_140,
-#ifdef FEATURE_WLAN_CH144
-  {RF_CHAN_BOND_142, INVALID_RF_CHANNEL},  //RF_CHAN_144,
-#endif /* FEATURE_WLAN_CH144 */
-  {INVALID_RF_CHANNEL, RF_CHAN_BOND_151},  //RF_CHAN_149,
-  {RF_CHAN_BOND_151, RF_CHAN_BOND_155},    //RF_CHAN_153,
-  {RF_CHAN_BOND_155, RF_CHAN_BOND_159},    //RF_CHAN_157,
-  {RF_CHAN_BOND_159, RF_CHAN_BOND_163},    //RF_CHAN_161,
-  {RF_CHAN_BOND_163, INVALID_RF_CHANNEL},  //RF_CHAN_165,
-};
 
 static CountryInfoTable_t countryInfoTable =
 {
     /* the first entry in the table is always the world domain */
-    139,
+    138,
     {
       {REGDOMAIN_WORLD, {'0', '0'}}, // WORLD DOMAIN
-      {REGDOMAIN_ETSI, {'A', 'D'}}, // ANDORRA
+      {REGDOMAIN_FCC, {'A', 'D'}}, // ANDORRA
       {REGDOMAIN_ETSI, {'A', 'E'}}, //UAE
       {REGDOMAIN_ETSI, {'A', 'L'}}, //ALBANIA
       {REGDOMAIN_ETSI, {'A', 'M'}}, //ARMENIA
       {REGDOMAIN_ETSI, {'A', 'N'}}, //NETHERLANDS ANTILLES
-      {REGDOMAIN_WORLD, {'A', 'R'}}, //ARGENTINA
+      {REGDOMAIN_FCC, {'A', 'R'}}, //ARGENTINA
       {REGDOMAIN_FCC, {'A', 'S'}}, //AMERICAN SOMOA
       {REGDOMAIN_ETSI, {'A', 'T'}}, //AUSTRIA
-      {REGDOMAIN_ETSI, {'A', 'U'}}, //AUSTRALIA
+      {REGDOMAIN_FCC, {'A', 'U'}}, //AUSTRALIA
       {REGDOMAIN_ETSI , {'A', 'W'}}, //ARUBA
       {REGDOMAIN_ETSI,  {'A', 'Z'}}, //AZERBAIJAN
       {REGDOMAIN_ETSI, {'B', 'A'}}, //BOSNIA AND HERZEGOVINA
-      {REGDOMAIN_APAC, {'B', 'B'}}, //BARBADOS
+      {REGDOMAIN_FCC, {'B', 'B'}}, //BARBADOS
       {REGDOMAIN_ETSI, {'B', 'D'}}, //BANGLADESH
       {REGDOMAIN_ETSI, { 'B', 'E'}}, //BELGIUM
       {REGDOMAIN_ETSI, {'B', 'G'}}, //BULGARIA
-      {REGDOMAIN_APAC, {'B', 'H'}}, //BAHRAIN
+      {REGDOMAIN_ETSI, {'B', 'H'}}, //BAHRAIN
       {REGDOMAIN_ETSI, {'B', 'L'}}, //
       {REGDOMAIN_FCC, {'B', 'M'}}, //BERMUDA
-      {REGDOMAIN_APAC, {'B', 'N'}}, //BRUNEI DARUSSALAM
+      {REGDOMAIN_ETSI, {'B', 'N'}}, //BRUNEI DARUSSALAM
       {REGDOMAIN_ETSI, {'B', 'O'}}, //BOLIVIA
-      {REGDOMAIN_WORLD, {'B', 'R'}}, //BRAZIL
-      {REGDOMAIN_APAC, {'B', 'S'}}, //BAHAMAS
+      {REGDOMAIN_ETSI, {'B', 'R'}}, //BRAZIL
+      {REGDOMAIN_FCC, {'B', 'S'}}, //BAHAMAS
       {REGDOMAIN_ETSI, {'B', 'Y'}}, //BELARUS
       {REGDOMAIN_ETSI, {'B', 'Z'}}, //BELIZE
       {REGDOMAIN_FCC, {'C', 'A'}}, //CANADA
       {REGDOMAIN_ETSI, {'C', 'H'}}, //SWITZERLAND
-      {REGDOMAIN_APAC, {'C', 'L'}}, //CHILE
-      {REGDOMAIN_APAC, {'C', 'N'}}, //CHINA
-      {REGDOMAIN_APAC, {'C', 'O'}}, //COLOMBIA
-      {REGDOMAIN_APAC, {'C', 'R'}}, //COSTA RICA
+      {REGDOMAIN_ETSI, {'C', 'L'}}, //CHILE
+      {REGDOMAIN_FCC, {'C', 'N'}}, //CHINA
+      {REGDOMAIN_FCC, {'C', 'O'}}, //COLOMBIA
+      {REGDOMAIN_ETSI, {'C', 'R'}}, //COSTA RICA
       {REGDOMAIN_ETSI, {'C', 'S'}},
       {REGDOMAIN_ETSI, {'C', 'Y'}}, //CYPRUS
       {REGDOMAIN_ETSI, {'C', 'Z'}}, //CZECH REPUBLIC
       {REGDOMAIN_ETSI, {'D', 'E'}}, //GERMANY
       {REGDOMAIN_ETSI, {'D', 'K'}}, //DENMARK
-      {REGDOMAIN_APAC, {'D', 'O'}}, //DOMINICAN REPUBLIC
+      {REGDOMAIN_FCC, {'D', 'O'}}, //DOMINICAN REPUBLIC
       {REGDOMAIN_ETSI, {'D', 'Z'}}, //ALGERIA
-      {REGDOMAIN_APAC, {'E', 'C'}}, //ECUADOR
+      {REGDOMAIN_ETSI, {'E', 'C'}}, //ECUADOR
       {REGDOMAIN_ETSI, {'E', 'E'}}, //ESTONIA
       {REGDOMAIN_ETSI, {'E', 'G'}}, //EGYPT
       {REGDOMAIN_ETSI, {'E', 'S'}}, //SPAIN
       {REGDOMAIN_ETSI, {'F', 'I'}}, //FINLAND
       {REGDOMAIN_ETSI, {'F', 'R'}}, //FRANCE
       {REGDOMAIN_ETSI, {'G', 'B'}}, //UNITED KINGDOM
-      {REGDOMAIN_WORLD, {'G', 'D'}},  //GRENADA
+      {REGDOMAIN_FCC, {'G', 'D'}},  //GRENADA
       {REGDOMAIN_ETSI, {'G', 'E'}}, //GEORGIA
       {REGDOMAIN_ETSI, {'G', 'F'}}, //FRENCH GUIANA
       {REGDOMAIN_ETSI, {'G', 'L'}}, //GREENLAND
       {REGDOMAIN_ETSI, {'G', 'P'}}, //GUADELOUPE
       {REGDOMAIN_ETSI, {'G', 'R'}}, //GREECE
-      {REGDOMAIN_APAC, {'G', 'T'}},  //GUATEMALA
+      {REGDOMAIN_FCC, {'G', 'T'}},  //GUATEMALA
       {REGDOMAIN_FCC, {'G', 'U'}},  //GUAM
       {REGDOMAIN_ETSI, {'H', 'U'}}, //HUNGARY
-      {REGDOMAIN_ETSI, {'I', 'D'}},  //INDONESIA
+      {REGDOMAIN_FCC, {'I', 'D'}},  //INDONESIA
       {REGDOMAIN_ETSI, {'I', 'E'}}, //IRELAND
       {REGDOMAIN_ETSI, {'I', 'L'}}, //ISRAEL
-      {REGDOMAIN_APAC, {'I', 'N'}}, //INDIA
+      {REGDOMAIN_ETSI, {'I', 'N'}}, //INDIA
       {REGDOMAIN_ETSI, {'I', 'R'}}, //IRAN, ISLAMIC REPUBLIC OF
       {REGDOMAIN_ETSI, {'I', 'S'}}, //ICELNAD
       {REGDOMAIN_ETSI, {'I', 'T'}}, //ITALY
-      {REGDOMAIN_WORLD, {'J', 'M'}},  //JAMAICA
+      {REGDOMAIN_FCC, {'J', 'M'}},  //JAMAICA
       {REGDOMAIN_JAPAN, {'J', 'P'}}, //JAPAN
-      {REGDOMAIN_APAC, {'J', 'O'}}, //JORDAN
+      {REGDOMAIN_ETSI, {'J', 'O'}}, //JORDAN
       {REGDOMAIN_ETSI, {'K', 'E'}}, //KENYA
       {REGDOMAIN_ETSI, {'K', 'H'}}, //CAMBODIA
-      {REGDOMAIN_WORLD, {'K', 'P'}}, //KOREA, DEMOCRATIC PEOPLE's REPUBLIC OF
-      {REGDOMAIN_KOREA, {'K', 'R'}}, //KOREA, REPUBLIC OF
+      {REGDOMAIN_ETSI, {'K', 'P'}}, //KOREA, DEMOCRATIC PEOPLE's REPUBLIC OF
+      {REGDOMAIN_ETSI, {'K', 'R'}}, //KOREA, REPUBLIC OF
       {REGDOMAIN_ETSI, {'K', 'W'}}, //KUWAIT
-      {REGDOMAIN_WORLD, {'K', 'Z'}}, //KAZAKHSTAN
-      {REGDOMAIN_WORLD, {'L', 'B'}}, //LEBANON
+      {REGDOMAIN_ETSI, {'K', 'Z'}}, //KAZAKHSTAN
+      {REGDOMAIN_ETSI, {'L', 'B'}}, //LEBANON
       {REGDOMAIN_ETSI, {'L', 'I'}}, //LIECHTENSTEIN
-      {REGDOMAIN_WORLD, {'L', 'K'}}, //SRI-LANKA
+      {REGDOMAIN_ETSI, {'L', 'K'}}, //SRI-LANKA
       {REGDOMAIN_ETSI, {'L', 'T'}}, //LITHUANIA
       {REGDOMAIN_ETSI, {'L', 'U'}}, //LUXEMBOURG
       {REGDOMAIN_ETSI, {'L','V'}},  //LATVIA
       {REGDOMAIN_ETSI, {'M', 'A'}}, //MOROCCO
       {REGDOMAIN_ETSI, {'M', 'C'}}, //MONACO
       {REGDOMAIN_ETSI, {'M', 'K'}}, //MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF
-      {REGDOMAIN_WORLD, {'M','N'}}, //MONGOLIA
-      {REGDOMAIN_APAC, {'M', 'O'}}, //MACAO
+      {REGDOMAIN_FCC, {'M','N'}}, //MONGOLIA
+      {REGDOMAIN_FCC, {'M', 'O'}}, //MACAO
       {REGDOMAIN_FCC, {'M', 'P'}}, //NORTHERN MARIANA ISLANDS
       {REGDOMAIN_ETSI, {'M', 'Q'}}, //MARTINIQUE
-      {REGDOMAIN_ETSI, {'M', 'T'}}, //MALTA
+      {REGDOMAIN_FCC, {'M', 'T'}}, //MALTA
       {REGDOMAIN_ETSI, {'M', 'U'}}, //MAURITIUS
       {REGDOMAIN_ETSI, {'M', 'W'}}, //MALAWI
-      {REGDOMAIN_APAC, {'M', 'X'}}, //MEXICO
-      {REGDOMAIN_APAC, {'M', 'Y'}}, //MALAYSIA
-      {REGDOMAIN_WORLD, {'N', 'G'}}, //NIGERIA
-      {REGDOMAIN_WORLD, {'N', 'I'}}, //NICARAGUA
+      {REGDOMAIN_FCC, {'M', 'X'}}, //MEXICO
+      {REGDOMAIN_ETSI, {'M', 'Y'}}, //MALAYSIA
+      {REGDOMAIN_ETSI, {'N', 'G'}}, //NIGERIA
+      {REGDOMAIN_FCC, {'N', 'I'}}, //NICARAGUA
       {REGDOMAIN_ETSI, {'N', 'L'}}, //NETHERLANDS
       {REGDOMAIN_ETSI, {'N', 'O'}}, //NORWAY
-      {REGDOMAIN_APAC, {'N', 'P'}}, //NEPAL
-      {REGDOMAIN_APAC, {'N', 'Z'}}, //NEW-ZEALAND
-      {REGDOMAIN_ETSI, {'O', 'M'}}, //OMAN
-      {REGDOMAIN_APAC, {'P', 'A'}}, //PANAMA
-      {REGDOMAIN_WORLD, {'P', 'E'}}, //PERU
+      {REGDOMAIN_ETSI, {'N', 'P'}}, //NEPAL
+      {REGDOMAIN_FCC, {'N', 'Z'}}, //NEW-ZEALAND
+      {REGDOMAIN_FCC, {'O', 'M'}}, //OMAN
+      {REGDOMAIN_FCC, {'P', 'A'}}, //PANAMA
+      {REGDOMAIN_ETSI, {'P', 'E'}}, //PERU
       {REGDOMAIN_ETSI, {'P', 'F'}}, //FRENCH POLYNESIA
-      {REGDOMAIN_WORLD, {'P', 'G'}}, //PAPUA NEW GUINEA
-      {REGDOMAIN_WORLD, {'P', 'H'}}, //PHILIPPINES
+      {REGDOMAIN_ETSI, {'P', 'G'}}, //PAPUA NEW GUINEA
+      {REGDOMAIN_FCC, {'P', 'H'}}, //PHILIPPINES
       {REGDOMAIN_ETSI, {'P', 'K'}}, //PAKISTAN
       {REGDOMAIN_ETSI, {'P', 'L'}}, //POLAND
       {REGDOMAIN_FCC, {'P', 'R'}}, //PUERTO RICO
-      {REGDOMAIN_WORLD, {'P', 'S'}}, //PALESTINIAN TERRITORY, OCCUPIED
+      {REGDOMAIN_FCC, {'P', 'S'}}, //PALESTINIAN TERRITORY, OCCUPIED
       {REGDOMAIN_ETSI, {'P', 'T'}}, //PORTUGAL
-      {REGDOMAIN_WORLD, {'P', 'Y'}}, //PARAGUAY
+      {REGDOMAIN_FCC, {'P', 'Y'}}, //PARAGUAY
       {REGDOMAIN_ETSI, {'Q', 'A'}}, //QATAR
       {REGDOMAIN_ETSI, {'R', 'E'}}, //REUNION
       {REGDOMAIN_ETSI, {'R', 'O'}}, //ROMAINIA
       {REGDOMAIN_ETSI, {'R', 'S'}}, //SERBIA
-      {REGDOMAIN_APAC, {'R', 'U'}}, //RUSSIA
-      {REGDOMAIN_WORLD, {'R', 'W'}}, //RWANDA
-      {REGDOMAIN_WORLD, {'S', 'A'}}, //SAUDI ARABIA
+      {REGDOMAIN_ETSI, {'R', 'U'}}, //RUSSIA
+      {REGDOMAIN_FCC, {'R', 'W'}}, //RWANDA
+      {REGDOMAIN_ETSI, {'S', 'A'}}, //SAUDI ARABIA
       {REGDOMAIN_ETSI, {'S', 'E'}}, //SWEDEN
-      {REGDOMAIN_APAC, {'S', 'G'}}, //SINGAPORE
+      {REGDOMAIN_ETSI, {'S', 'G'}}, //SINGAPORE
       {REGDOMAIN_ETSI, {'S', 'I'}}, //SLOVENNIA
       {REGDOMAIN_ETSI, {'S', 'K'}}, //SLOVAKIA
-      {REGDOMAIN_APAC, {'S', 'V'}}, //EL SALVADOR
+      {REGDOMAIN_ETSI, {'S', 'V'}}, //EL SALVADOR
       {REGDOMAIN_ETSI, {'S', 'Y'}}, //SYRIAN ARAB REPUBLIC
-      {REGDOMAIN_WORLD, {'T', 'H'}}, //THAILAND
+      {REGDOMAIN_ETSI, {'T', 'H'}}, //THAILAND
       {REGDOMAIN_ETSI, {'T', 'N'}}, //TUNISIA
       {REGDOMAIN_ETSI, {'T', 'R'}}, //TURKEY
-      {REGDOMAIN_WORLD, {'T', 'T'}}, //TRINIDAD AND TOBAGO
+      {REGDOMAIN_ETSI, {'T', 'T'}}, //TRINIDAD AND TOBAGO
       {REGDOMAIN_FCC, {'T', 'W'}}, //TAIWAN, PRIVINCE OF CHINA
-      {REGDOMAIN_ETSI, {'T', 'Z'}}, //TANZANIA, UNITED REPUBLIC OF
-      {REGDOMAIN_WORLD, {'U', 'A'}}, //UKRAINE
-      {REGDOMAIN_KOREA, {'U', 'G'}}, //UGANDA
+      {REGDOMAIN_FCC, {'T', 'Z'}}, //TANZANIA, UNITED REPUBLIC OF
+      {REGDOMAIN_ETSI, {'U', 'A'}}, //UKRAINE
+      {REGDOMAIN_ETSI, {'U', 'G'}}, //UGANDA
       {REGDOMAIN_FCC, {'U', 'S'}}, //USA
-      {REGDOMAIN_WORLD, {'U', 'Y'}}, //URUGUAY
-      {REGDOMAIN_ETSI, {'U', 'Z'}}, //UZBEKISTAN
+      {REGDOMAIN_ETSI, {'U', 'Y'}}, //URUGUAY
+      {REGDOMAIN_FCC, {'U', 'Z'}}, //UZBEKISTAN
       {REGDOMAIN_ETSI, {'V', 'E'}}, //VENEZUELA
       {REGDOMAIN_FCC, {'V', 'I'}}, //VIRGIN ISLANDS, US
       {REGDOMAIN_ETSI, {'V', 'N'}}, //VIETNAM
@@ -320,7 +268,6 @@
       {REGDOMAIN_ETSI, {'Y', 'T'}}, //MAYOTTE
       {REGDOMAIN_ETSI, {'Z', 'A'}}, //SOUTH AFRICA
       {REGDOMAIN_ETSI, {'Z', 'W'}}, //ZIMBABWE
-      {REGDOMAIN_JAPAN, {'X', 'A'}}, //JAPAN PASSIVE
     }
 };
 
@@ -1181,7 +1128,7 @@
        return VOS_STATUS_E_RESOURCES;
     }
 
-    pnvEncodedBuf = (v_U8_t *)vos_mem_vmalloc(nvReadBufSize);
+    pnvEncodedBuf = (v_U8_t *)vmalloc(nvReadBufSize);
 
     if (NULL == pnvEncodedBuf) {
         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
@@ -1195,26 +1142,23 @@
     vos_mem_copy(&magicNumber, &pnvEncodedBuf[sizeof(v_U32_t)], sizeof(v_U32_t));
 
     /// Allocate buffer with maximum length..
-    pEncodedBuf = (v_U8_t *)vos_mem_vmalloc(nvReadBufSize);
+    pEncodedBuf = (v_U8_t *)vos_mem_malloc(nvReadBufSize);
 
     if (NULL == pEncodedBuf)
     {
         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                     "%s : failed to allocate memory for NV", __func__);
-        vos_mem_vfree(pnvEncodedBuf);
         return VOS_STATUS_E_NOMEM;
     }
 
     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
               "NV Table Size %zu", sizeof(nvEFSTable_t));
 
-    pnvEFSTable = (nvEFSTable_t *)vos_mem_vmalloc(sizeof(nvEFSTable_t));
+    pnvEFSTable = (nvEFSTable_t *)vos_mem_malloc(sizeof(nvEFSTable_t));
     if (NULL == pnvEFSTable)
     {
         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                   "%s : failed to allocate memory for NV", __func__);
-        vos_mem_vfree(pnvEncodedBuf);
-        vos_mem_vfree(pEncodedBuf);
         return VOS_STATUS_E_NOMEM;
     }
     vos_mem_zero((void *)pnvEFSTable, sizeof(nvEFSTable_t));
@@ -1231,9 +1175,6 @@
         {
             VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                       "%s : failed to allocate memory for NV", __func__);
-            vos_mem_vfree(pnvEncodedBuf);
-            vos_mem_vfree(pEncodedBuf);
-            vos_mem_vfree(pnvEFSTable);
             return VOS_STATUS_E_NOMEM;
         }
 
@@ -1255,7 +1196,7 @@
                    "readEncodeBufSize %d",nvReadEncodeBufSize);
 
         if (VOS_STATUS_SUCCESS == status) {
-           VOS_TRACE(VOS_MODULE_ID_VOSS,  VOS_TRACE_LEVEL_INFO,
+           VOS_TRACE(VOS_MODULE_ID_VOSS,  VOS_TRACE_LEVEL_ERROR,
                        "Embedded NV parsed success !!productId %d couple Type %d wlan RevId %d",
                         pnvData->fields.productId,
                         pnvData->fields.couplerType,
@@ -1270,20 +1211,6 @@
            VOS_TRACE(VOS_MODULE_ID_VOSS,  VOS_TRACE_LEVEL_ERROR,
                        "nvParser failed %d",status);
 
-           if (nvReadBufSize != sizeof(sHalNv)) {
-               vos_mem_vfree(pEncodedBuf);
-               pEncodedBuf = (v_U8_t *)vos_mem_vmalloc(sizeof(sHalNv));
-
-               if (!pEncodedBuf) {
-                   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                             "%s : failed to allocate memory for NV", __func__);
-                   vos_mem_free(pnvData);
-                   vos_mem_vfree(pnvEncodedBuf);
-                   vos_mem_vfree(pnvEFSTable);
-                   return VOS_STATUS_E_NOMEM;
-               }
-           }
-
            nvReadBufSize = 0;
 
            vos_mem_copy(pEncodedBuf, &nvDefaults, sizeof(sHalNv));
@@ -1312,9 +1239,6 @@
             VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
                       "Size  mismatch INVALID NV FILE %d %d!!!",
                       nvReadBufSize, bufSize);
-            vos_mem_vfree(pnvEncodedBuf);
-            vos_mem_vfree(pEncodedBuf);
-            vos_mem_vfree(pnvEFSTable);
             return VOS_STATUS_E_FAILURE;
         }
 
@@ -1325,19 +1249,6 @@
         /* From here, NV2 will be stored into NV3 structure */
         dataOffset = sizeof(v_U32_t);
         nvReadEncodeBufSize = sizeof(sHalNvV2);
-        if (nvReadBufSize != nvReadEncodeBufSize)
-        {
-            vos_mem_vfree(pEncodedBuf);
-            pEncodedBuf = (v_U8_t *)vos_mem_vmalloc(nvReadEncodeBufSize);
-            if (!pEncodedBuf)
-            {
-                VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                          "%s : failed to allocate memory for NV", __func__);
-                vos_mem_vfree(pnvEncodedBuf);
-                vos_mem_vfree(pnvEFSTable);
-                return VOS_STATUS_E_NOMEM;
-            }
-        }
         vos_mem_copy(pEncodedBuf,
                      &pnvEncodedBuf[dataOffset],
                      nvReadBufSize - dataOffset);
@@ -1603,9 +1514,9 @@
 
     return VOS_STATUS_SUCCESS;
 error:
-    vos_mem_vfree(pnvEFSTable);
-    vos_mem_vfree(pEncodedBuf);
-    vos_mem_vfree(pnvEncodedBuf);
+    vos_mem_free(pnvEFSTable);
+    vos_mem_free(pEncodedBuf);
+    vfree(pnvEncodedBuf);
     return eHAL_STATUS_FAILURE ;
 }
 
@@ -1616,18 +1527,10 @@
     pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
 
     ((hdd_context_t*)((VosContextType*)(pVosContext))->pHDDContext)->nv = NULL;
-    vos_mem_vfree(pnvEFSTable);
-    vos_mem_vfree(pEncodedBuf);
+    vos_mem_free(pnvEFSTable);
+    vos_mem_free(pEncodedBuf);
     vos_mem_free(pDictFile);
-    vos_mem_vfree(pnvEncodedBuf);
-   /*
-    * Reset the linux_reg identifier to allow
-    * driver to send fresh regulatory hint to
-    * the kernel in case of a static driver reload
-    * under strict regulatory domain.
-    */
-    linux_reg_cc[0] = '0';
-    linux_reg_cc[1] = '0';
+    vfree(pnvEncodedBuf);
 
     gnvEFSTable=NULL;
     return VOS_STATUS_SUCCESS;
@@ -2828,6 +2731,7 @@
           continue;
        if (wiphy->bands[i] == NULL)
        {
+          pr_info("error: wiphy->bands[i] is NULL, i = %d\n", i);
           return -1;
        }
        // internal channels[] is one continous array for both 2G and 5G bands
@@ -3229,28 +3133,6 @@
 
    return (0);
 }
-
-/**------------------------------------------------------------------------
-  \brief vos_freq_to_chan -
-  \param   - input frequency to know channel number
-  \return Channel frequency
-  \sa
-  -------------------------------------------------------------------------*/
-v_U8_t vos_freq_to_chan(v_U32_t freq)
-{
-   int i;
-
-   for (i = 0; i < NUM_RF_CHANNELS; i++)
-   {
-      if (rfChannels[i].targetFreq == freq)
-      {
-         return rfChannels[i].channelNum;
-      }
-   }
-
-   return (0);
-}
-
 /* function to tell about if Default country is Non-Zero */
 v_BOOL_t vos_is_nv_country_non_zero()
 {
@@ -3266,72 +3148,8 @@
     return status ;
 }
 
-v_BOOL_t vos_is_channel_valid_for_vht80(v_U32_t chan)
-{
-    v_CONTEXT_t pVosContext = NULL;
-    hdd_context_t *pHddCtx = NULL;
-    v_U16_t freq;
-    v_U32_t i, band;
-    struct wiphy *wiphy;
-
-    pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-
-    if (NULL != pVosContext)
-    {
-        pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext);
-        if (NULL == pHddCtx)
-        {
-           VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                       ("Invalid pHddCtx pointer") );
-           return VOS_FALSE;
-        }
-    }
-    else
-    {
-       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                  ("Invalid pVosContext pointer") );
-       return VOS_FALSE;
-    }
-    /* no 80Mhz in 2.4 GHz*/
-    if (chan <= RF_CHAN_14)
-        return VOS_FALSE;
-
-    band = IEEE80211_BAND_5GHZ;
-    freq = vos_chan_to_freq(chan);
-    wiphy = pHddCtx->wiphy;
-
-    for (i = 0; i < wiphy->bands[band]->n_channels; i++)
-    {
-        if (freq ==
-             wiphy->bands[band]->channels[i].center_freq)
-        {
-          if (wiphy->bands[band]->channels[i].flags &
-                                 IEEE80211_CHAN_NO_80MHZ)
-          {
-             return VOS_FALSE;
-          }
-          return VOS_TRUE;
-        }
-    }
-    return VOS_FALSE;
-}
-
 #ifdef CONFIG_ENABLE_LINUX_REG
 
-static inline int bw20_ch_index_to_bw40_plus_minus_ch_index(int k,
-                                    eChannnelBondingTypes cbflag )
-{
-   if (k >= NUM_20MHZ_RF_CHANNELS) {
-     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-           "%s invlaid channel index %d",__func__, k);
-     return INVALID_RF_CHANNEL;
-   }
-
-   if (RF_CHAN_BOND_HT40_PLUS == cbflag)
-     return chan_to_ht_40_index[k].ht_40_plus_index;
-   else
-     return chan_to_ht_40_index[k].ht_40_minus_index;
-}
 /**------------------------------------------------------------------------
   \brief vos_nv_setRegDomain -
   \param clientCtxt  - Client Context, Not used for PRIMA
@@ -3438,13 +3256,11 @@
 
     if (REGDOMAIN_COUNT == temp_reg_domain) {
 
-        /* the country was not found in the driver database
-         * so we will return the REGDOMAIN_WORLD to SME/CSR
-         */
+        /* the country was not found in the driver database */
+        /* so we will return the REGDOMAIN_WORLD to SME/CSR */
 
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-            ("Country %c%c does not map to any Regulatory domain"),
-               country_code[0], country_code[1]);
+        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                   ("Country does not map to any Regulatory domain"));
 
         temp_reg_domain = REGDOMAIN_WORLD;
     }
@@ -3538,36 +3354,12 @@
         }
         else if (COUNTRY_IE == source || COUNTRY_USER == source)
         {
-            INIT_COMPLETION(pHddCtx->linux_reg_req);
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
             regulatory_hint_user(country_code,NL80211_USER_REG_HINT_USER);
 #else
             regulatory_hint_user(country_code);
 #endif
-            wait_result = wait_for_completion_interruptible_timeout(
-                               &pHddCtx->linux_reg_req,
-                               msecs_to_jiffies(LINUX_REG_WAIT_TIME));
-
-            /* if the country information does not exist with the kernel,
-               then the driver callback would not be called */
-
-            if (wait_result >= 0)
-            {
-               VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-                           "runtime country code : %c%c is found in kernel db",
-                            country_code[0], country_code[1]);
-               *pRegDomain = temp_reg_domain;
-            }
-
-            else
-            {
-                VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
-                           "runtime country code : %c%c is not found"
-                           " in kernel db",
-                            country_code[0], country_code[1]);
-
-                return VOS_STATUS_E_EXISTS;
-            }
+            *pRegDomain = temp_reg_domain;
         }
 
    }
@@ -3593,7 +3385,7 @@
         if (wiphy->bands[i] == NULL)
         {
 
-            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                       "error: wiphy->bands is NULL, i = %d", i);
             continue;
         }
@@ -3617,6 +3409,10 @@
               n is internal channel index for corresponding 40MHz channel */
 
             k = m + j;
+            n = bw20_ch_index_to_bw40_ch_index(k);
+
+            if (n == -1)
+                return -1;
 
             /* If the regulatory rules for a country do not explicilty
              * require a passive scan on a frequency, lift the passive
@@ -3643,11 +3439,7 @@
                  * will not change channel to active.
                  */
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-                if  (!(wiphy->regulatory_flags & REGULATORY_STRICT_REG))
-#else
                 if  (!(wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY ))
-#endif
                 {
                     if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN))
                     {
@@ -3672,18 +3464,8 @@
                 }
                 pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].enabled =
                     NV_CHANNEL_DISABLE;
-                if (INVALID_RF_CHANNEL !=
-                    (n = bw20_ch_index_to_bw40_plus_minus_ch_index( k , RF_CHAN_BOND_HT40_MINUS)))
-                {
-                    pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
-                       NV_CHANNEL_DISABLE;
-                }
-                if (INVALID_RF_CHANNEL !=
-                    (n = bw20_ch_index_to_bw40_plus_minus_ch_index( k , RF_CHAN_BOND_HT40_PLUS)))
-                {
-                    pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
-                       NV_CHANNEL_DISABLE;
-                }
+                pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
+                    NV_CHANNEL_DISABLE;
             }
             /* nv cannot distinguish between DFS and passive channels */
             else if (wiphy->bands[i]->channels[j].flags &
@@ -3701,26 +3483,8 @@
                         channels[k].enabled = NV_CHANNEL_DFS;
                 }
 
-                if (!gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].pwrLimit
-                    && !wiphy->bands[i]->channels[j].max_power)
-                {
-                    VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                               FL("Both NV and DB.txt power limit is zero."
-                                  "Setting default value %d"),TX_POWER_DEFAULT);
-                    wiphy->bands[i]->channels[j].max_power = TX_POWER_DEFAULT;
-                }
-
-                else if (!gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].pwrLimit
-                         || !wiphy->bands[i]->channels[j].max_power)
-                {
-                        wiphy->bands[i]->channels[j].max_power =
-                           MAX(gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].pwrLimit,
-                              ((wiphy->bands[i]->channels[j].max_power)));
-                }
-
                 // Cap the TX power by the power limits specified in NV for the regdomain
-                if (gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].pwrLimit
-                    && wiphy->bands[i]->channels[j].max_power)
+                if (gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].pwrLimit)
                 {
                     wiphy->bands[i]->channels[j].max_power =
                            MIN(gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].pwrLimit,
@@ -3735,55 +3499,22 @@
                 if ((wiphy->bands[i]->channels[j].flags & IEEE80211_CHAN_NO_HT40) ==
                                                              IEEE80211_CHAN_NO_HT40 )
                 {
-                   if ( INVALID_RF_CHANNEL !=
-                       (n = bw20_ch_index_to_bw40_plus_minus_ch_index( k, RF_CHAN_BOND_HT40_MINUS)))
-                   {
-                       pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
+                   pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
                         NV_CHANNEL_DISABLE;
-                   }
-                   if ( INVALID_RF_CHANNEL !=
-                      (n = bw20_ch_index_to_bw40_plus_minus_ch_index( k, RF_CHAN_BOND_HT40_PLUS)))
-                   {
-                       pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
-                         NV_CHANNEL_DISABLE;
-                   }
                 }
                 else
                 {
-                    if (!(wiphy->bands[i]->channels[j].flags & IEEE80211_CHAN_NO_HT40PLUS))
-                    {
-                      if (INVALID_RF_CHANNEL !=
-                          (n = bw20_ch_index_to_bw40_plus_minus_ch_index( k, RF_CHAN_BOND_HT40_PLUS)))
-                      {
-                          pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
-                            NV_CHANNEL_DFS;
+                    pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
+                        NV_CHANNEL_DFS;
 
-                          /* 40MHz channel power is half of 20MHz (-3dB), so subtract 3dB from
-                           * wiphy limits, since wiphy has same limits for 20MHz and 40MHz
-                           * channels
-                           */
-                          pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].pwrLimit =
-                           MIN(gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].pwrLimit,
+                    /* 40MHz channel power is half of 20MHz (-3dB), so subtract 3dB from
+                     * wiphy limits, since wiphy has same limits for 20MHz and 40MHz
+                     * channels
+                     */
+                    pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].pwrLimit =
+                        MIN(gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].pwrLimit,
                             (tANI_S8) ((wiphy->bands[i]->channels[j].max_power-3)));
-                      }
-                    }
-                    if (!(wiphy->bands[i]->channels[j].flags & IEEE80211_CHAN_NO_HT40MINUS))
-                    {
-                       if (INVALID_RF_CHANNEL !=
-                          (n = bw20_ch_index_to_bw40_plus_minus_ch_index( k, RF_CHAN_BOND_HT40_MINUS)))
-                       {
-                          pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
-                            NV_CHANNEL_DFS;
 
-                          /* 40MHz channel power is half of 20MHz (-3dB), so subtract 3dB from
-                           * wiphy limits, since wiphy has same limits for 20MHz and 40MHz
-                           * channels
-                           */
-                          pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].pwrLimit =
-                           MIN(gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].pwrLimit,
-                             (tANI_S8) ((wiphy->bands[i]->channels[j].max_power-3)));
-                       }
-                    }
                 }
                 if ((wiphy->bands[i]->channels[j].flags & IEEE80211_CHAN_NO_80MHZ) == 0)
                 {
@@ -3812,26 +3543,8 @@
                         channels[k].enabled = NV_CHANNEL_ENABLE;
                 }
 
-                if (!gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].pwrLimit
-                    && !wiphy->bands[i]->channels[j].max_power)
-                {
-                    VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                               FL("Both NV and DB.txt power limit is zero."
-                                  "Setting default value %d"),TX_POWER_DEFAULT);
-                    wiphy->bands[i]->channels[j].max_power = TX_POWER_DEFAULT;
-                }
-
-                else if (!gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].pwrLimit
-                         || !wiphy->bands[i]->channels[j].max_power)
-                {
-                        wiphy->bands[i]->channels[j].max_power =
-                           MAX(gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].pwrLimit,
-                              ((wiphy->bands[i]->channels[j].max_power)));
-                }
-
                 // Cap the TX power by the power limits specified in NV for the regdomain
-                if (gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].pwrLimit
-                    && wiphy->bands[i]->channels[j].max_power)
+                if (gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].pwrLimit)
                 {
                     wiphy->bands[i]->channels[j].max_power =
                            MIN(gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[k].pwrLimit,
@@ -3847,55 +3560,21 @@
                 if ((wiphy->bands[i]->channels[j].flags & IEEE80211_CHAN_NO_HT40) ==
                                                              IEEE80211_CHAN_NO_HT40 )
                 {
-                   if ( INVALID_RF_CHANNEL !=
-                       (n = bw20_ch_index_to_bw40_plus_minus_ch_index( k, RF_CHAN_BOND_HT40_MINUS)))
-                   {
-                       pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
+                   pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
                         NV_CHANNEL_DISABLE;
-                   }
-                   if ( INVALID_RF_CHANNEL !=
-                      (n = bw20_ch_index_to_bw40_plus_minus_ch_index( k, RF_CHAN_BOND_HT40_PLUS)))
-                   {
-                       pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
-                         NV_CHANNEL_DISABLE;
-                   }
                 }
                 else
                 {
-                    if (!(wiphy->bands[i]->channels[j].flags & IEEE80211_CHAN_NO_HT40PLUS))
-                    {
-                      if (INVALID_RF_CHANNEL !=
-                          (n = bw20_ch_index_to_bw40_plus_minus_ch_index( k, RF_CHAN_BOND_HT40_PLUS)))
-                      {
-                          pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
-                            NV_CHANNEL_ENABLE;
+                    pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
+                        NV_CHANNEL_ENABLE;
 
-                          /* 40MHz channel power is half of 20MHz (-3dB), so subtract 3dB from
-                           * wiphy limits, since wiphy has same limits for 20MHz and 40MHz
-                           * channels
-                           */
-                          pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].pwrLimit =
-                           MIN(gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].pwrLimit,
+                    /* 40MHz channel power is half of 20MHz (-3dB), so subtract 3dB from
+                     * wiphy limits, since wiphy has same limits for 20MHz and 40MHz
+                     * channels
+                     */
+                    pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].pwrLimit =
+                        MIN(gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].pwrLimit,
                             (tANI_S8) ((wiphy->bands[i]->channels[j].max_power-3)));
-                      }
-                    }
-                    if (!(wiphy->bands[i]->channels[j].flags & IEEE80211_CHAN_NO_HT40MINUS))
-                    {
-                       if (INVALID_RF_CHANNEL !=
-                            (n = bw20_ch_index_to_bw40_plus_minus_ch_index( k, RF_CHAN_BOND_HT40_MINUS)))
-                       {
-                          pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].enabled =
-                            NV_CHANNEL_ENABLE;
-
-                          /* 40MHz channel power is half of 20MHz (-3dB), so subtract 3dB from
-                           * wiphy limits, since wiphy has same limits for 20MHz and 40MHz
-                           * channels
-                           */
-                          pnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].pwrLimit =
-                           MIN(gnvEFSTable->halnv.tables.regDomains[temp_reg_domain].channels[n].pwrLimit,
-                             (tANI_S8) ((wiphy->bands[i]->channels[j].max_power-3)));
-                       }
-                    }
                 }
                 if ((wiphy->bands[i]->channels[j].flags & IEEE80211_CHAN_NO_80MHZ) == 0)
                 {
@@ -3968,10 +3647,10 @@
  * regulatory setting table.
  */
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
-void __wlan_hdd_linux_reg_notifier(struct wiphy *wiphy,
+void wlan_hdd_linux_reg_notifier(struct wiphy *wiphy,
                 struct regulatory_request *request)
 #else
-int __wlan_hdd_linux_reg_notifier(struct wiphy *wiphy,
+int wlan_hdd_linux_reg_notifier(struct wiphy *wiphy,
                 struct regulatory_request *request)
 #endif
 {
@@ -3984,6 +3663,17 @@
     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
                "cfg80211 reg notifier callback for country for initiator %d", request->initiator);
 
+    if (TRUE == isWDresetInProgress())
+    {
+       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                   ("SSR is in progress") );
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
+       return;
+#else
+       return 0;
+#endif
+    }
+
     if (NULL == pHddCtx)
     {
        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
@@ -3995,18 +3685,15 @@
 #endif
     }
 
-    if (vos_is_logp_in_progress(VOS_MODULE_ID_VOSS, NULL))
-    {
-       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-                   ("SSR is in progress") );
-       goto do_comp;
-    }
-
     if (WLAN_HDD_IS_UNLOAD_IN_PROGRESS(pHddCtx))
     {
        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                    ("%s Unload is in progress"), __func__ );
-       goto do_comp;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
+       return;
+#else
+       return 0;
+#endif
     }
 
     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
@@ -4019,27 +3706,6 @@
     if (request->initiator == NL80211_REGDOM_SET_BY_DRIVER)
     {
 
-        if (vos_is_load_unload_in_progress(VOS_MODULE_ID_VOSS, NULL)) {
-            temp_reg_domain = REGDOMAIN_COUNT;
-            /* lookup the country in the local database */
-            for (i = 0; i < countryInfoTable.countryCount &&
-                         REGDOMAIN_COUNT == temp_reg_domain; i++)
-            {
-                if (memcmp(request->alpha2, countryInfoTable.countryInfo[i].countryCode,
-                           VOS_COUNTRY_CODE_LEN) == 0)
-                {
-                /* country code is found */
-                /* record the temporary regulatory_domain as well */
-                temp_reg_domain = countryInfoTable.countryInfo[i].regDomain;
-                break;
-                }
-            }
-            if (REGDOMAIN_COUNT == temp_reg_domain)
-                temp_reg_domain = REGDOMAIN_WORLD;
-
-            cur_reg_domain = temp_reg_domain;
-        }
-
         isVHT80Allowed = pHddCtx->isVHT80Allowed;
         if (create_linux_regulatory_entry(wiphy, request, nBandCapability) == 0)
         {
@@ -4054,6 +3720,7 @@
         linux_reg_cc[0] =  request->alpha2[0];
         linux_reg_cc[1] =  request->alpha2[1];
 
+        complete(&pHddCtx->linux_reg_req);
     }
 
     else if (request->initiator == NL80211_REGDOM_SET_BY_USER ||
@@ -4068,7 +3735,6 @@
 
         if (!(pnvEFSTable->halnv.tables.defaultCountryTable.countryCode[0] == '0' &&
              pnvEFSTable->halnv.tables.defaultCountryTable.countryCode[1] == '0') &&
-            (request->initiator ==  NL80211_REGDOM_SET_BY_CORE) &&
             (vos_is_load_unload_in_progress( VOS_MODULE_ID_VOSS, NULL)))
         {
            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
@@ -4120,13 +3786,14 @@
         if (request->alpha2[0] == '0' && request->alpha2[1] == '0')
         {
            sme_GenericChangeCountryCode(pHddCtx->hHal, country_code,
-                                       REGDOMAIN_COUNT);
+                                           REGDOMAIN_COUNT);
         }
         else
         {
            sme_GenericChangeCountryCode(pHddCtx->hHal, country_code,
-                                    temp_reg_domain);
+                                        temp_reg_domain);
         }
+
     }
 
     /* Mark channels 36-48 as passive for US CC */
@@ -4153,12 +3820,7 @@
           }
        }
     }
-do_comp:
-    if ((request->initiator == NL80211_REGDOM_SET_BY_DRIVER) ||
-         (request->initiator == NL80211_REGDOM_SET_BY_USER))
-    {
-        complete(&pHddCtx->linux_reg_req);
-    }
+
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
     return;
 #else
@@ -4166,26 +3828,6 @@
 #endif
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
-void wlan_hdd_linux_reg_notifier(struct wiphy *wiphy,
-                struct regulatory_request *request)
-{
-    vos_ssr_protect(__func__);
-    __wlan_hdd_linux_reg_notifier(wiphy, request);
-    vos_ssr_unprotect(__func__);
-    return;
-}
-#else
-int wlan_hdd_linux_reg_notifier(struct wiphy *wiphy,
-                struct regulatory_request *request)
-{
-    int ret;
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_linux_reg_notifier(wiphy, request);
-    vos_ssr_unprotect(__func__);
-    return ret;
-}
-#endif
 
 /* initialize wiphy from NV.bin */
 VOS_STATUS vos_init_wiphy_from_nv_bin(void)
@@ -4220,11 +3862,7 @@
         /* default country is world roaming */
 
         reg_domain = REGDOMAIN_WORLD;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-        wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
-#else
         wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
-#endif
     }
     else if (REGDOMAIN_WORLD ==
 	     pnvEFSTable->halnv.tables.defaultCountryTable.regDomain) {
@@ -4234,11 +3872,7 @@
     else {
 
         reg_domain = pnvEFSTable->halnv.tables.defaultCountryTable.regDomain;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-        wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
-#else
         wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY;
-#endif
     }
 
     temp_reg_domain = cur_reg_domain = reg_domain;
@@ -4249,6 +3883,7 @@
 
         if (wiphy->bands[i] == NULL)
         {
+            pr_info("error: wiphy->bands[i] is NULL, i = %d\n", i);
             continue;
         }
 
@@ -4497,10 +4132,10 @@
  * regulatory setting table.
  */
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
-void __wlan_hdd_crda_reg_notifier(struct wiphy *wiphy,
+void wlan_hdd_crda_reg_notifier(struct wiphy *wiphy,
                 struct regulatory_request *request)
 #else
-int __wlan_hdd_crda_reg_notifier(struct wiphy *wiphy,
+int wlan_hdd_crda_reg_notifier(struct wiphy *wiphy,
                 struct regulatory_request *request)
 #endif
 {
@@ -4654,7 +4289,7 @@
          {
              if (NULL == wiphy->bands[i])
              {
-                 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                 VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                            "error: wiphy->bands[i] is NULL, i = %d", i);
                  continue;
              }
@@ -4803,25 +4438,4 @@
 #endif
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
-void wlan_hdd_crda_reg_notifier(struct wiphy *wiphy,
-                struct regulatory_request *request)
-{
-    vos_ssr_protect(__func__);
-    __wlan_hdd_crda_reg_notifier(wiphy, request);
-    vos_ssr_unprotect(__func__);
-    return;
-}
-#else
-int wlan_hdd_crda_reg_notifier(struct wiphy *wiphy,
-                struct regulatory_request *request)
-{
-    int ret;
-    vos_ssr_protect(__func__);
-    ret = __wlan_hdd_crda_reg_notifier(wiphy, request);
-    vos_ssr_unprotect(__func__);
-    return ret;
-}
-#endif
-
 #endif
diff --git a/wlan/prima/CORE/VOSS/src/vos_packet.c b/wlan/prima/CORE/VOSS/src/vos_packet.c
index 43daf9f..ce4501b 100644
--- a/wlan/prima/CORE/VOSS/src/vos_packet.c
+++ b/wlan/prima/CORE/VOSS/src/vos_packet.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,6 +33,9 @@
 
    Network Protocol packet/buffer support interfaces
 
+   Copyright 2009 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -58,9 +61,6 @@
 #define VOS_PKT_PROT_DHCP_SRV_PORT   67
 #define VOS_PKT_PROT_DHCP_CLI_PORT   68
 #define VOS_PKT_PROT_EAPOL_ETH_TYPE  0x888E
-#define VOS_PKT_PROT_ARP_ETH_TYPE    0x0806
-#define VOS_PKT_GET_HEAD(skb)        (skb->head)
-#define VOS_PKT_GET_END(skb)         (skb->end)
 
 /*--------------------------------------------------------------------------
   Type declarations
@@ -3070,16 +3070,6 @@
       }
    }
 
-   /* ARP Tracking Enabled */
-   if (VOS_PKT_PROTO_TYPE_ARP & tracking_map)
-   {
-      ether_type = (v_U16_t)(*(v_U16_t *)(skb->data + VOS_PKT_PROT_ETH_TYPE_OFFSET));
-      if (VOS_PKT_PROT_ARP_ETH_TYPE == VOS_SWAP_U16(ether_type))
-      {
-         pkt_proto_type |= VOS_PKT_PROTO_TYPE_ARP;
-      }
-   }
-
    /* DHCP Tracking enabled */
    if (VOS_PKT_PROTO_TYPE_DHCP & tracking_map)
    {
@@ -3099,87 +3089,6 @@
    /* Protocol type map */
    return pkt_proto_type;
 }
-
-v_PVOID_t vos_get_pkt_head(vos_pkt_t *pPacket)
-{
-   struct sk_buff *skb;
-
-   // Validate the parameter pointers
-   if (unlikely(NULL == pPacket))
-   {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                "VPKT [%d]: NULL pointer", __LINE__);
-      return NULL;
-   }
-
-   if ( VOS_STATUS_SUCCESS !=
-        vos_pkt_get_os_packet(pPacket, (void**)&skb, VOS_FALSE ))
-   {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                "OS-PKT [%d]: OS PKT pointer is NULL", __LINE__);
-      return NULL;
-   }
-
-   return VOS_PKT_GET_HEAD(skb);
-}
-
-v_PVOID_t vos_get_pkt_end(vos_pkt_t *pPacket)
-{
-   struct sk_buff *skb;
-
-    // Validate the parameter pointers
-   if (unlikely(NULL == pPacket))
-   {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                "VPKT [%d]: NULL pointer", __LINE__);
-      return NULL;
-   }
-
-   if ( VOS_STATUS_SUCCESS !=
-        vos_pkt_get_os_packet(pPacket, (void**)&skb, VOS_FALSE ))
-   {
-     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                "OS-PKT [%d]: OS PKT pointer is NULL", __LINE__);
-     return NULL;
-   }
-
- /* find end point if skb->end is an offset */
-#ifdef NET_SKBUFF_DATA_USES_OFFSET
-   return VOS_PKT_GET_HEAD(skb) + VOS_PKT_GET_END(skb);
-#else
-   return VOS_PKT_GET_END(skb);
-#endif
-}
-
-v_VOID_t vos_recover_tail(vos_pkt_t *pPacket)
-{
-   struct skb_shared_info *shinfo;
-   struct sk_buff *skb;
-
-   // Validate the parameter pointers
-   if (unlikely(NULL == pPacket))
-   {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                "VPKT [%d]: NULL pointer", __LINE__);
-      return;
-   }
-
-   if ( VOS_STATUS_SUCCESS !=
-        vos_pkt_get_os_packet(pPacket, (void**)&skb, VOS_FALSE ))
-   {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                "OS-PKT [%d]: OS PKT pointer is NULL", __LINE__);
-      return;
-   }
-
-   shinfo = skb_shinfo(skb);
-   memset(shinfo, 0, sizeof(struct skb_shared_info));
-   atomic_set(&shinfo->dataref, 1);
-   kmemcheck_annotate_variable(shinfo->destructor_arg);
-
-   return;
-}
-
 #ifdef VOS_PACKET_UNIT_TEST
 #include "vos_packet_test.c"
 #endif
diff --git a/wlan/prima/CORE/VOSS/src/vos_sched.c b/wlan/prima/CORE/VOSS/src/vos_sched.c
index 95f551b..ee08a86 100644
--- a/wlan/prima/CORE/VOSS/src/vos_sched.c
+++ b/wlan/prima/CORE/VOSS/src/vos_sched.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -29,6 +29,9 @@
   @file vos_sched.c
   @brief VOS Scheduler Implementation
 
+  Copyright (c) 2011 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 /*===========================================================================
                        EDIT HISTORY FOR FILE
@@ -59,8 +62,6 @@
 #include "wlan_qct_pal_msg.h"
 #include <linux/spinlock.h>
 #include <linux/kthread.h>
-#include <linux/wcnss_wlan.h>
-
 /*---------------------------------------------------------------------------
  * Preprocessor Definitions and Constants
  * ------------------------------------------------------------------------*/
@@ -71,13 +72,6 @@
  * we proceed with SSR in WD Thread
  */
 #define MAX_SSR_WAIT_ITERATIONS 200
-/* Timer value for detecting thread stuck issues */
-#define THREAD_STUCK_TIMER_VAL 5000 // 5 seconds
-#define THREAD_STUCK_COUNT 6
-
-#define MC_Thread 0
-#define TX_Thread 1
-#define RX_Thread 2
 
 static atomic_t ssr_protect_entry_count;
 
@@ -252,16 +246,16 @@
 
 RX_THREAD_START_FAILURE:
     //Try and force the Tx thread controller to exit
-    set_bit(MC_SHUTDOWN_EVENT, &pSchedContext->txEventFlag);
-    set_bit(MC_POST_EVENT, &pSchedContext->txEventFlag);
+    set_bit(MC_SHUTDOWN_EVENT_MASK, &pSchedContext->txEventFlag);
+    set_bit(MC_POST_EVENT_MASK, &pSchedContext->txEventFlag);
     wake_up_interruptible(&pSchedContext->txWaitQueue);
      //Wait for TX to exit
     wait_for_completion_interruptible(&pSchedContext->TxShutdown);
 
 TX_THREAD_START_FAILURE:
     //Try and force the Main thread controller to exit
-    set_bit(MC_SHUTDOWN_EVENT, &pSchedContext->mcEventFlag);
-    set_bit(MC_POST_EVENT, &pSchedContext->mcEventFlag);
+    set_bit(MC_SHUTDOWN_EVENT_MASK, &pSchedContext->mcEventFlag);
+    set_bit(MC_POST_EVENT_MASK, &pSchedContext->mcEventFlag);
     wake_up_interruptible(&pSchedContext->mcWaitQueue);
     //Wait for MC to exit
     wait_for_completion_interruptible(&pSchedContext->McShutdown);
@@ -307,7 +301,6 @@
 
   // Initialize the lock
   spin_lock_init(&pWdContext->wdLock);
-  spin_lock_init(&pWdContext->thread_stuck_lock);
 
   //Create the Watchdog thread
   pWdContext->WdThread = kthread_create(VosWDThread, pWdContext,"VosWDThread");
@@ -392,8 +385,8 @@
   {
     // This implements the execution model algorithm
     retWaitStatus = wait_event_interruptible(pSchedContext->mcWaitQueue,
-       test_bit(MC_POST_EVENT, &pSchedContext->mcEventFlag) ||
-       test_bit(MC_SUSPEND_EVENT, &pSchedContext->mcEventFlag));
+       test_bit(MC_POST_EVENT_MASK, &pSchedContext->mcEventFlag) || 
+       test_bit(MC_SUSPEND_EVENT_MASK, &pSchedContext->mcEventFlag));
 
     if(retWaitStatus == -ERESTARTSYS)
     {
@@ -401,18 +394,18 @@
          "%s: wait_event_interruptible returned -ERESTARTSYS", __func__);
       break;
     }
-    clear_bit(MC_POST_EVENT, &pSchedContext->mcEventFlag);
+    clear_bit(MC_POST_EVENT_MASK, &pSchedContext->mcEventFlag);
 
     while(1)
     {
       // Check if MC needs to shutdown
-      if(test_bit(MC_SHUTDOWN_EVENT, &pSchedContext->mcEventFlag))
+      if(test_bit(MC_SHUTDOWN_EVENT_MASK, &pSchedContext->mcEventFlag))
       {
         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
                 "%s: MC thread signaled to shutdown", __func__);
         shutdown = VOS_TRUE;
         /* Check for any Suspend Indication */
-        if (test_and_clear_bit(MC_SUSPEND_EVENT,
+        if (test_and_clear_bit(MC_SUSPEND_EVENT_MASK,
                                &pSchedContext->mcEventFlag))
         {
            /* Unblock anyone waiting on suspend */
@@ -430,6 +423,9 @@
         /*
         ** Service the WDI message queue
         */
+        VOS_TRACE(VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
+                  ("Servicing the VOS MC WDI Message queue"));
+
         pMsgWrapper = vos_mq_get(&pSchedContext->wdiMcMq);
 
         if (pMsgWrapper == NULL)
@@ -605,13 +601,15 @@
         continue;
       }
       /* Check for any Suspend Indication */
-      if (test_and_clear_bit(MC_SUSPEND_EVENT,
+      if (test_and_clear_bit(MC_SUSPEND_EVENT_MASK,
                              &pSchedContext->mcEventFlag))
       {
         spin_lock(&pSchedContext->McThreadLock);
-        INIT_COMPLETION(pSchedContext->ResumeMcEvent);
+
         /* Mc Thread Suspended */
         complete(&pHddCtx->mc_sus_event_var);
+
+        INIT_COMPLETION(pSchedContext->ResumeMcEvent);
         spin_unlock(&pSchedContext->McThreadLock);
 
         /* Wait foe Resume Indication */
@@ -626,6 +624,20 @@
   complete_and_exit(&pSchedContext->McShutdown, 0);
 } /* VosMCThread() */
 
+v_BOOL_t isWDresetInProgress(void)
+{
+   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "%s: Reset is in Progress...",__func__);
+   if(gpVosWatchdogContext!=NULL)
+   {
+      return gpVosWatchdogContext->resetInProgress;
+   }
+   else
+   {
+      return FALSE;
+   }
+}
+
 v_BOOL_t isSsrPanicOnFailure(void)
 {
     hdd_context_t *pHddCtx = NULL;
@@ -649,133 +661,6 @@
 
     return (pHddCtx->cfg_ini->fIsSsrPanicOnFailure);
 }
-/**
- * vos_wd_detect_thread_stuck()- Detect thread stuck
- * by probing the MC, TX, RX threads and take action if
- * Thread doesnt respond.
- *
- * This function is called to detect thread stuck
- * and probe threads.
- *
- * Return: void
- */
-static void vos_wd_detect_thread_stuck(void)
-{
-  unsigned long flags;
-
-  spin_lock_irqsave(&gpVosWatchdogContext->thread_stuck_lock, flags);
-
-  if ((gpVosWatchdogContext->mcThreadStuckCount == THREAD_STUCK_COUNT) ||
-      (gpVosWatchdogContext->txThreadStuckCount == THREAD_STUCK_COUNT) ||
-      (gpVosWatchdogContext->rxThreadStuckCount == THREAD_STUCK_COUNT))
-  {
-       spin_unlock_irqrestore(&gpVosWatchdogContext->thread_stuck_lock, flags);
-       hddLog(LOGE, FL("Thread Stuck count reached threshold!!!"
-              "MC Count %d RX count %d TX count %d"),
-              gpVosWatchdogContext->mcThreadStuckCount,
-              gpVosWatchdogContext->rxThreadStuckCount,
-              gpVosWatchdogContext->txThreadStuckCount);
-       return;
-  }
-
-  if (gpVosWatchdogContext->mcThreadStuckCount ||
-      gpVosWatchdogContext->txThreadStuckCount ||
-      gpVosWatchdogContext->rxThreadStuckCount)
-  {
-     spin_unlock_irqrestore(&gpVosWatchdogContext->thread_stuck_lock, flags);
-
-     hddLog(LOG1, FL("MC Count %d RX count %d TX count %d"),
-        gpVosWatchdogContext->mcThreadStuckCount,
-        gpVosWatchdogContext->rxThreadStuckCount,
-        gpVosWatchdogContext->txThreadStuckCount);
-
-     if (gpVosWatchdogContext->mcThreadStuckCount)
-     {
-         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                             "%s: Invoking dump stack for MC thread",__func__);
-         vos_dump_stack(MC_Thread);
-     }
-     if (gpVosWatchdogContext->txThreadStuckCount)
-     {
-         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                             "%s: Invoking dump stack for TX thread",__func__);
-         vos_dump_stack(TX_Thread);
-     }
-     if (gpVosWatchdogContext->rxThreadStuckCount)
-     {
-         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                             "%s: Invoking dump stack for RX thread",__func__);
-         vos_dump_stack(RX_Thread);
-     }
-
-     vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-              WLAN_LOG_INDICATOR_HOST_ONLY,
-              WLAN_LOG_REASON_THREAD_STUCK,
-              FALSE, TRUE);
-
-     spin_lock_irqsave(&gpVosWatchdogContext->thread_stuck_lock, flags);
-  }
-
-  /* Increment the thread stuck count for all threads */
-  gpVosWatchdogContext->mcThreadStuckCount++;
-  gpVosWatchdogContext->txThreadStuckCount++;
-  gpVosWatchdogContext->rxThreadStuckCount++;
-
-  spin_unlock_irqrestore(&gpVosWatchdogContext->thread_stuck_lock, flags);
-  vos_probe_threads();
-
-  /* Restart the timer */
-  if (VOS_STATUS_SUCCESS !=
-      vos_timer_start(&gpVosWatchdogContext->threadStuckTimer,
-             THREAD_STUCK_TIMER_VAL))
-     hddLog(LOGE, FL("Unable to start thread stuck timer"));
-}
-
-/**
- * wlan_wd_detect_thread_stuck_cb()- Call back of the
- * thread stuck timer.
- * @priv: timer data.
- * This function is called when the thread stuck timer
- * expire to detect thread stuck and probe threads.
- *
- * Return: void
- */
-static void vos_wd_detect_thread_stuck_cb(void *priv)
-{
-  if (!(vos_is_logp_in_progress(VOS_MODULE_ID_SYS, NULL) ||
-       vos_is_load_unload_in_progress(VOS_MODULE_ID_SYS, NULL)))
-  {
-     set_bit(WD_WLAN_DETECT_THREAD_STUCK,
-                      &gpVosWatchdogContext->wdEventFlag);
-     set_bit(WD_POST_EVENT, &gpVosWatchdogContext->wdEventFlag);
-     wake_up_interruptible(&gpVosWatchdogContext->wdWaitQueue);
-  }
-}
-
-/**
- * wlan_logging_reset_thread_stuck_count()- Callback to
- * probe msg sent to Threads.
- *
- * @threadId: passed threadid
- *
- * This function is called to by the thread after
- * processing the probe msg, with their own thread id.
- *
- * Return: void.
- */
-void vos_wd_reset_thread_stuck_count(int threadId)
-{
-  unsigned long flags;
-
-  spin_lock_irqsave(&gpVosWatchdogContext->thread_stuck_lock, flags);
-  if (vos_sched_is_mc_thread(threadId))
-     gpVosWatchdogContext->mcThreadStuckCount = 0;
-  else if (vos_sched_is_tx_thread(threadId))
-     gpVosWatchdogContext->txThreadStuckCount = 0;
-  else if (vos_sched_is_rx_thread(threadId))
-     gpVosWatchdogContext->rxThreadStuckCount = 0;
-  spin_unlock_irqrestore(&gpVosWatchdogContext->thread_stuck_lock, flags);
-}
 
 /*---------------------------------------------------------------------------
   \brief VosWdThread() - The VOSS Watchdog thread
@@ -827,21 +712,6 @@
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
   daemonize("WD_Thread");
 #endif
-  /* Initialize the timer to detect thread stuck issues */
-  if (vos_timer_init_deferrable(&pWdContext->threadStuckTimer,
-          VOS_TIMER_TYPE_SW,
-          vos_wd_detect_thread_stuck_cb, NULL)) {
-       hddLog(LOGE, FL("Unable to initialize thread stuck timer"));
-  }
-  else
-  {
-       if (VOS_STATUS_SUCCESS !=
-             vos_timer_start(&pWdContext->threadStuckTimer,
-                 THREAD_STUCK_TIMER_VAL))
-          hddLog(LOGE, FL("Unable to start thread stuck timer"));
-       else
-          hddLog(LOG1, FL("Successfully started thread stuck timer"));
-  }
 
   /*
   ** Ack back to the context from which the Watchdog thread has been
@@ -855,28 +725,16 @@
   {
     // This implements the Watchdog execution model algorithm
     retWaitStatus = wait_event_interruptible(pWdContext->wdWaitQueue,
-       test_bit(WD_POST_EVENT, &pWdContext->wdEventFlag));
+       test_bit(WD_POST_EVENT_MASK, &pWdContext->wdEventFlag));
     if(retWaitStatus == -ERESTARTSYS)
     {
       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
          "%s: wait_event_interruptible returned -ERESTARTSYS", __func__);
       break;
     }
-    clear_bit(WD_POST_EVENT, &pWdContext->wdEventFlag);
+    clear_bit(WD_POST_EVENT_MASK, &pWdContext->wdEventFlag);
     while(1)
     {
-
-      /* Post Msg to detect thread stuck. */
-      if (test_and_clear_bit(WD_WLAN_DETECT_THREAD_STUCK,
-                                          &pWdContext->wdEventFlag))
-      {
-        vos_wd_detect_thread_stuck();
-        /*
-         * Process here and return without processing any SSR
-         * related logic.
-         */
-        break;
-      }
       /* Check for any Active Entry Points
        * If active, delay SSR until no entry point is active or
        * delay until count is decremented to ZERO
@@ -905,20 +763,21 @@
                      __func__, atomic_read(&ssr_protect_entry_count));
       }
       // Check if Watchdog needs to shutdown
-      if(test_bit(WD_SHUTDOWN_EVENT, &pWdContext->wdEventFlag))
+      if(test_bit(WD_SHUTDOWN_EVENT_MASK, &pWdContext->wdEventFlag))
       {
         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
                 "%s: Watchdog thread signaled to shutdown", __func__);
-        clear_bit(WD_SHUTDOWN_EVENT, &pWdContext->wdEventFlag);
+
+        clear_bit(WD_SHUTDOWN_EVENT_MASK, &pWdContext->wdEventFlag);
         shutdown = VOS_TRUE;
         break;
       }
       /* subsystem restart: shutdown event handler */
-      else if(test_bit(WD_WLAN_SHUTDOWN_EVENT, &pWdContext->wdEventFlag))
+      else if(test_bit(WD_WLAN_SHUTDOWN_EVENT_MASK, &pWdContext->wdEventFlag))
       {
         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
                 "%s: Watchdog thread signaled to perform WLAN shutdown",__func__);
-        clear_bit(WD_WLAN_SHUTDOWN_EVENT, &pWdContext->wdEventFlag);
+        clear_bit(WD_WLAN_SHUTDOWN_EVENT_MASK, &pWdContext->wdEventFlag);
 
         //Perform WLAN shutdown
         if(!pWdContext->resetInProgress)
@@ -936,11 +795,11 @@
         }
       }
       /* subsystem restart: re-init event handler */
-      else if(test_bit(WD_WLAN_REINIT_EVENT, &pWdContext->wdEventFlag))
+      else if(test_bit(WD_WLAN_REINIT_EVENT_MASK, &pWdContext->wdEventFlag))
       {
         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
                 "%s: Watchdog thread signaled to perform WLAN re-init",__func__);
-        clear_bit(WD_WLAN_REINIT_EVENT, &pWdContext->wdEventFlag);
+        clear_bit(WD_WLAN_REINIT_EVENT_MASK, &pWdContext->wdEventFlag);
 
         //Perform WLAN re-init
         if(!pWdContext->resetInProgress)
@@ -961,8 +820,6 @@
         else
         {
           pWdContext->isFatalError = false;
-          pHddCtx->isLogpInProgress = FALSE;
-          vos_set_logp_in_progress(VOS_MODULE_ID_VOSS, FALSE);
         }
         atomic_set(&pHddCtx->isRestartInProgress, 0);
         pWdContext->resetInProgress = false;
@@ -978,7 +835,6 @@
     } // while message loop processing
   } // while shutdown
 
-  vos_timer_destroy(&pWdContext->threadStuckTimer);
   // If we get here the Watchdog thread must exit
   VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
       "%s: Watchdog Thread exiting !!!!", __func__);
@@ -1053,8 +909,8 @@
   {
     // This implements the execution model algorithm
     retWaitStatus = wait_event_interruptible(pSchedContext->txWaitQueue,
-        test_bit(TX_POST_EVENT, &pSchedContext->txEventFlag) ||
-        test_bit(TX_SUSPEND_EVENT, &pSchedContext->txEventFlag));
+        test_bit(TX_POST_EVENT_MASK, &pSchedContext->txEventFlag) || 
+        test_bit(TX_SUSPEND_EVENT_MASK, &pSchedContext->txEventFlag));
 
 
     if(retWaitStatus == -ERESTARTSYS)
@@ -1063,17 +919,17 @@
            "%s: wait_event_interruptible returned -ERESTARTSYS", __func__);
         break;
     }
-    clear_bit(TX_POST_EVENT, &pSchedContext->txEventFlag);
+    clear_bit(TX_POST_EVENT_MASK, &pSchedContext->txEventFlag);
 
     while(1)
     {
-      if(test_bit(TX_SHUTDOWN_EVENT, &pSchedContext->txEventFlag))
+      if(test_bit(TX_SHUTDOWN_EVENT_MASK, &pSchedContext->txEventFlag))
       {
         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
                  "%s: TX thread signaled to shutdown", __func__);
         shutdown = VOS_TRUE;
         /* Check for any Suspend Indication */
-        if (test_and_clear_bit(TX_SUSPEND_EVENT,
+        if (test_and_clear_bit(TX_SUSPEND_EVENT_MASK,
                                &pSchedContext->txEventFlag))
         {
            /* Unblock anyone waiting on suspend */
@@ -1163,14 +1019,17 @@
         continue;
       }
       /* Check for any Suspend Indication */
-      if (test_and_clear_bit(TX_SUSPEND_EVENT,
+      if (test_and_clear_bit(TX_SUSPEND_EVENT_MASK,
                              &pSchedContext->txEventFlag))
       {
         spin_lock(&pSchedContext->TxThreadLock);
-        INIT_COMPLETION(pSchedContext->ResumeTxEvent);
+
         /* Tx Thread Suspended */
         complete(&pHddCtx->tx_sus_event_var);
+
+        INIT_COMPLETION(pSchedContext->ResumeTxEvent);
         spin_unlock(&pSchedContext->TxThreadLock);
+
         /* Wait foe Resume Indication */
         wait_for_completion_interruptible(&pSchedContext->ResumeTxEvent);
       }
@@ -1246,8 +1105,8 @@
   {
     // This implements the execution model algorithm
     retWaitStatus = wait_event_interruptible(pSchedContext->rxWaitQueue,
-        test_bit(RX_POST_EVENT, &pSchedContext->rxEventFlag) ||
-        test_bit(RX_SUSPEND_EVENT, &pSchedContext->rxEventFlag));
+        test_bit(RX_POST_EVENT_MASK, &pSchedContext->rxEventFlag) || 
+        test_bit(RX_SUSPEND_EVENT_MASK, &pSchedContext->rxEventFlag));
 
 
     if(retWaitStatus == -ERESTARTSYS)
@@ -1256,17 +1115,17 @@
            "%s: wait_event_interruptible returned -ERESTARTSYS", __func__);
         break;
     }
-    clear_bit(RX_POST_EVENT, &pSchedContext->rxEventFlag);
+    clear_bit(RX_POST_EVENT_MASK, &pSchedContext->rxEventFlag);
 
     while(1)
     {
-      if(test_bit(RX_SHUTDOWN_EVENT, &pSchedContext->rxEventFlag))
+      if(test_bit(RX_SHUTDOWN_EVENT_MASK, &pSchedContext->rxEventFlag))
       {
         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
                  "%s: RX thread signaled to shutdown", __func__);
         shutdown = VOS_TRUE;
         /* Check for any Suspend Indication */
-        if (test_and_clear_bit(RX_SUSPEND_EVENT,
+        if (test_and_clear_bit(RX_SUSPEND_EVENT_MASK,
                                &pSchedContext->rxEventFlag))
         {
            /* Unblock anyone waiting on suspend */
@@ -1362,13 +1221,15 @@
       }
 
       /* Check for any Suspend Indication */
-      if (test_and_clear_bit(RX_SUSPEND_EVENT,
+      if (test_and_clear_bit(RX_SUSPEND_EVENT_MASK,
                              &pSchedContext->rxEventFlag))
       {
         spin_lock(&pSchedContext->RxThreadLock);
-        INIT_COMPLETION(pSchedContext->ResumeRxEvent);
+
         /* Rx Thread Suspended */
         complete(&pHddCtx->rx_sus_event_var);
+
+        INIT_COMPLETION(pSchedContext->ResumeRxEvent);
         spin_unlock(&pSchedContext->RxThreadLock);
 
         /* Wait for Resume Indication */
@@ -1412,24 +1273,24 @@
     }
 
     // shut down MC Thread
-    set_bit(MC_SHUTDOWN_EVENT, &gpVosSchedContext->mcEventFlag);
-    set_bit(MC_POST_EVENT, &gpVosSchedContext->mcEventFlag);
+    set_bit(MC_SHUTDOWN_EVENT_MASK, &gpVosSchedContext->mcEventFlag);
+    set_bit(MC_POST_EVENT_MASK, &gpVosSchedContext->mcEventFlag);
     wake_up_interruptible(&gpVosSchedContext->mcWaitQueue);
     //Wait for MC to exit
     wait_for_completion(&gpVosSchedContext->McShutdown);
     gpVosSchedContext->McThread = 0;
 
     // shut down TX Thread
-    set_bit(TX_SHUTDOWN_EVENT, &gpVosSchedContext->txEventFlag);
-    set_bit(TX_POST_EVENT, &gpVosSchedContext->txEventFlag);
+    set_bit(TX_SHUTDOWN_EVENT_MASK, &gpVosSchedContext->txEventFlag);
+    set_bit(TX_POST_EVENT_MASK, &gpVosSchedContext->txEventFlag);
     wake_up_interruptible(&gpVosSchedContext->txWaitQueue);
     //Wait for TX to exit
     wait_for_completion(&gpVosSchedContext->TxShutdown);
     gpVosSchedContext->TxThread = 0;
 
     // shut down RX Thread
-    set_bit(RX_SHUTDOWN_EVENT, &gpVosSchedContext->rxEventFlag);
-    set_bit(RX_POST_EVENT, &gpVosSchedContext->rxEventFlag);
+    set_bit(RX_SHUTDOWN_EVENT_MASK, &gpVosSchedContext->rxEventFlag);
+    set_bit(RX_POST_EVENT_MASK, &gpVosSchedContext->rxEventFlag);
     wake_up_interruptible(&gpVosSchedContext->rxWaitQueue);
     //Wait for RX to exit
     wait_for_completion(&gpVosSchedContext->RxShutdown);
@@ -1456,8 +1317,8 @@
            "%s: gpVosWatchdogContext is NULL",__func__);
        return VOS_STATUS_E_FAILURE;
     }
-    set_bit(WD_SHUTDOWN_EVENT, &gpVosWatchdogContext->wdEventFlag);
-    set_bit(WD_POST_EVENT, &gpVosWatchdogContext->wdEventFlag);
+    set_bit(WD_SHUTDOWN_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
+    set_bit(WD_POST_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
     wake_up_interruptible(&gpVosWatchdogContext->wdWaitQueue);
     //Wait for Watchdog thread to exit
     wait_for_completion(&gpVosWatchdogContext->WdShutdown);
@@ -1714,7 +1575,7 @@
   while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->sysMcMq) ))
   {
     VOS_TRACE( VOS_MODULE_ID_VOSS,
-               VOS_TRACE_LEVEL_INFO,
+               VOS_TRACE_LEVEL_ERROR,
                "%s: Freeing MC SYS message type %d ",__func__,
                pMsgWrapper->pVosMsg->type );
     sysMcFreeMsg(pSchedContext->pVContext, pMsgWrapper->pVosMsg);
@@ -1725,7 +1586,7 @@
   {
     if(pMsgWrapper->pVosMsg != NULL) 
     {
-        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                    "%s: Freeing MC WDA MSG message type %d",
                    __func__, pMsgWrapper->pVosMsg->type );
         if (pMsgWrapper->pVosMsg->bodyptr) {
@@ -1744,7 +1605,7 @@
   {
     if(pMsgWrapper->pVosMsg != NULL)
     {
-        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                    "%s: Freeing MC WDI MSG message type %d",
                    __func__, pMsgWrapper->pVosMsg->type );
 
@@ -1777,7 +1638,7 @@
   while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->peMcMq) ))
   {
     VOS_TRACE( VOS_MODULE_ID_VOSS,
-               VOS_TRACE_LEVEL_INFO,
+               VOS_TRACE_LEVEL_ERROR,
                "%s: Freeing MC PE MSG message type %d",__func__,
                pMsgWrapper->pVosMsg->type );
     peFreeMsg(vosCtx->pMACContext, (tSirMsgQ*)pMsgWrapper->pVosMsg);
@@ -1787,7 +1648,7 @@
   while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->smeMcMq) ))
   {
     VOS_TRACE( VOS_MODULE_ID_VOSS,
-               VOS_TRACE_LEVEL_INFO,
+               VOS_TRACE_LEVEL_ERROR,
                "%s: Freeing MC SME MSG message type %d", __func__,
                pMsgWrapper->pVosMsg->type );
     sme_FreeMsg(vosCtx->pMACContext, pMsgWrapper->pVosMsg);
@@ -1797,7 +1658,7 @@
   while( NULL != (pMsgWrapper = vos_mq_get(&pSchedContext->tlMcMq) ))
   {
     VOS_TRACE( VOS_MODULE_ID_VOSS,
-               VOS_TRACE_LEVEL_INFO,
+               VOS_TRACE_LEVEL_ERROR,
                "%s: Freeing MC TL message type %d",__func__,
                pMsgWrapper->pVosMsg->type );
     WLANTL_McFreeMsg(pSchedContext->pVContext, pMsgWrapper->pVosMsg);
@@ -1939,24 +1800,6 @@
    }
    return ((gpVosSchedContext->RxThread) && (threadID == gpVosSchedContext->RxThread->pid));
 }
-
-/*-------------------------------------------------------------------------
- This helper function helps determine if thread id is of MC thread
- ------------------------------------------------------------------------*/
-int vos_sched_is_mc_thread(int threadID)
-{
-   // Make sure that Vos Scheduler context has been initialized
-   VOS_ASSERT( NULL != gpVosSchedContext);
-   if (gpVosSchedContext == NULL)
-   {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-          "%s: gpVosSchedContext == NULL",__func__);
-      return 0;
-   }
-   return ((gpVosSchedContext->McThread) &&
-           (threadID == gpVosSchedContext->McThread->pid));
-}
-
 /*-------------------------------------------------------------------------
  Helper function to get the scheduler context
  ------------------------------------------------------------------------*/
@@ -2019,6 +1862,8 @@
        return VOS_STATUS_E_FAILURE;
     }
 
+    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+        "%s: WLAN driver is shutting down ", __func__);
 
     pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL);
     pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
@@ -2062,7 +1907,6 @@
         /* wcnss has crashed, and SSR has alredy been started by Kernel driver.
          * So disable SSR from WLAN driver */
         hdd_set_ssr_required( HDD_SSR_DISABLED );
-
         /* Release the lock here before returning */
         spin_unlock(&gpVosWatchdogContext->wdLock);
         return VOS_STATUS_E_FAILURE;
@@ -2075,9 +1919,6 @@
     /* Release the lock here */
     spin_unlock(&gpVosWatchdogContext->wdLock);
 
-    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-        "%s: WLAN driver is shutting down ", __func__);
-
     /* Update Riva Reset Statistics */
     pHddCtx->hddRivaResetStats++;
 #ifdef CONFIG_HAS_EARLYSUSPEND
@@ -2087,8 +1928,8 @@
     }
 #endif
 
-    set_bit(WD_WLAN_SHUTDOWN_EVENT, &gpVosWatchdogContext->wdEventFlag);
-    set_bit(WD_POST_EVENT, &gpVosWatchdogContext->wdEventFlag);
+    set_bit(WD_WLAN_SHUTDOWN_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
+    set_bit(WD_POST_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
     wake_up_interruptible(&gpVosWatchdogContext->wdWaitQueue);
 
     return VOS_STATUS_SUCCESS;
@@ -2109,16 +1950,9 @@
 */
 VOS_STATUS vos_watchdog_wlan_re_init(void)
 {
-    /* Make sure that Vos Watchdog context has been initialized */
-    if (gpVosWatchdogContext == NULL) {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-           "%s: gpVosWatchdogContext == NULL", __func__);
-       return VOS_STATUS_E_FAILURE;
-    }
-
     /* watchdog task is still running, it is not closed in shutdown */
-    set_bit(WD_WLAN_REINIT_EVENT, &gpVosWatchdogContext->wdEventFlag);
-    set_bit(WD_POST_EVENT, &gpVosWatchdogContext->wdEventFlag);
+    set_bit(WD_WLAN_REINIT_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
+    set_bit(WD_POST_EVENT_MASK, &gpVosWatchdogContext->wdEventFlag);
     wake_up_interruptible(&gpVosWatchdogContext->wdWaitQueue);
 
     return VOS_STATUS_SUCCESS;
@@ -2138,6 +1972,8 @@
 {
      int count;
      count = atomic_inc_return(&ssr_protect_entry_count);
+     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+               "%s: ENTRY ACTIVE %d", caller_func, count);
 }
 
 /**
@@ -2152,47 +1988,6 @@
 {
    int count;
    count = atomic_dec_return(&ssr_protect_entry_count);
-}
-/**
- * vos_is_wd_thread()- Check if threadid is
- * of Watchdog thread
- *
- * @threadId: passed threadid
- *
- * This function is called to check if threadid is
- * of wd thread.
- *
- * Return: true if threadid is of wd thread.
- */
-bool vos_is_wd_thread(int threadId)
-{
-   /* Make sure that Vos Watchdog context has been initialized */
-   if (gpVosWatchdogContext == NULL)
-   {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-          "%s: gpVosWatchdogContext == NULL", __func__);
-      return false;
-   }
-
-   return ((gpVosWatchdogContext->WdThread) &&
-       (threadId == gpVosWatchdogContext->WdThread->pid));
-}
-
-void vos_dump_stack(uint8_t thread_id)
-{
-   switch (thread_id)
-   {
-      case MC_Thread:
-          wcnss_dump_stack(gpVosSchedContext->McThread);
-          break;
-      case TX_Thread:
-          wcnss_dump_stack(gpVosSchedContext->TxThread);
-          break;
-      case RX_Thread:
-          wcnss_dump_stack(gpVosSchedContext->RxThread);
-          break;
-      default:
-          VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Invalid thread %d invoked",__func__, thread_id);
-   }
+   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+               "%s: ENTRY INACTIVE %d", caller_func, count);
 }
diff --git a/wlan/prima/CORE/VOSS/src/vos_sched.h b/wlan/prima/CORE/VOSS/src/vos_sched.h
index e73cf39..5e4da95 100644
--- a/wlan/prima/CORE/VOSS/src/vos_sched.h
+++ b/wlan/prima/CORE/VOSS/src/vos_sched.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -42,6 +42,9 @@
    by vOSS.
     
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -74,26 +77,21 @@
 #include "i_vos_packet.h"
 #include <linux/wait.h>
 #include <linux/wakelock.h>
-#include <vos_timer.h>
 
-
-#define TX_POST_EVENT               0x000
-#define TX_SUSPEND_EVENT            0x001
-#define MC_POST_EVENT               0x000
-#define MC_SUSPEND_EVENT            0x001
-#define RX_POST_EVENT               0x000
-#define RX_SUSPEND_EVENT            0x001
-#define TX_SHUTDOWN_EVENT           0x002
-#define MC_SHUTDOWN_EVENT           0x002
-#define RX_SHUTDOWN_EVENT           0x002
-
-#define WD_POST_EVENT               0x000
-#define WD_SHUTDOWN_EVENT           0x001
-#define WD_CHIP_RESET_EVENT         0x002
-#define WD_WLAN_SHUTDOWN_EVENT      0x003
-#define WD_WLAN_REINIT_EVENT        0x004
-#define WD_WLAN_DETECT_THREAD_STUCK 0x005
-
+#define TX_POST_EVENT_MASK               0x001
+#define TX_SUSPEND_EVENT_MASK            0x002
+#define MC_POST_EVENT_MASK               0x001
+#define MC_SUSPEND_EVENT_MASK            0x002
+#define RX_POST_EVENT_MASK               0x001
+#define RX_SUSPEND_EVENT_MASK            0x002
+#define TX_SHUTDOWN_EVENT_MASK           0x010
+#define MC_SHUTDOWN_EVENT_MASK           0x010
+#define RX_SHUTDOWN_EVENT_MASK           0x010
+#define WD_POST_EVENT_MASK               0x001
+#define WD_SHUTDOWN_EVENT_MASK           0x002
+#define WD_CHIP_RESET_EVENT_MASK         0x004
+#define WD_WLAN_SHUTDOWN_EVENT_MASK      0x008
+#define WD_WLAN_REINIT_EVENT_MASK        0x010
 
  
  
@@ -265,14 +263,6 @@
 
    /* Lock for preventing multiple reset being triggered simultaneously */
    spinlock_t wdLock;
-   /* Timer to detect thread stuck issue */
-   vos_timer_t threadStuckTimer;
-   /* Count for each thread to determine thread stuck */
-   unsigned int mcThreadStuckCount;
-   unsigned int txThreadStuckCount;
-   unsigned int rxThreadStuckCount;
-   /* lock to synchronize access to the thread stuck counts */
-   spinlock_t thread_stuck_lock;
 
 } VosWatchdogContext, *pVosWatchdogContext;
 
@@ -292,11 +282,6 @@
 } VosMsgWrapper, *pVosMsgWrapper;
 
 
-typedef struct vos_wdthread_timer_work {
-   vos_timer_callback_t callback;
-   v_PVOID_t userData;
-   struct list_head node;
-}vos_wdthread_timer_work_t;
 
 typedef struct _VosContextType
 {                                                  
@@ -352,19 +337,6 @@
    /* NV BIN Version */
    eNvVersionType     nvVersion;
 
-   /* Roam delay statistic enabled in ini*/
-   v_U8_t             roamDelayStatsEnabled;
-
-   /*Fw log complete Event*/
-   vos_event_t fwLogsComplete;
-   v_U32_t wakelock_log_level;
-   v_U32_t connectivity_log_level;
-   v_U32_t packet_stats_log_level;
-   v_U8_t      vosWrapperFullReported;
-   vos_wdthread_timer_work_t wdthread_timer_work;
-   struct list_head wdthread_timer_work_list;
-   struct work_struct wdthread_work;
-   spinlock_t wdthread_work_lock;
 } VosContextType, *pVosContextType;
 
 
@@ -375,7 +347,6 @@
  
 int vos_sched_is_tx_thread(int threadID);
 int vos_sched_is_rx_thread(int threadID);
-int vos_sched_is_mc_thread(int threadID);
 /*---------------------------------------------------------------------------
   
   \brief vos_sched_open() - initialize the vOSS Scheduler  
@@ -514,7 +485,6 @@
 VOS_STATUS vos_mq_init(pVosMqType pMq);
 void vos_mq_deinit(pVosMqType pMq);
 void vos_mq_put(pVosMqType pMq, pVosMsgWrapper pMsgWrapper);
-void vos_mq_put_front(pVosMqType pMq, pVosMsgWrapper pMsgWrapper);
 pVosMsgWrapper vos_mq_get(pVosMqType pMq);
 v_BOOL_t vos_is_mq_empty(pVosMqType pMq);
 pVosSchedContext get_vos_sched_ctxt(void);
@@ -529,12 +499,9 @@
 void vos_timer_module_init( void );
 VOS_STATUS vos_watchdog_wlan_shutdown(void);
 VOS_STATUS vos_watchdog_wlan_re_init(void);
+v_BOOL_t isWDresetInProgress(void);
 v_BOOL_t isSsrPanicOnFailure(void);
 void vos_ssr_protect(const char *caller_func);
 void vos_ssr_unprotect(const char *caller_func);
-void vos_wd_reset_thread_stuck_count(int threadId);
-bool vos_is_wd_thread(int threadId);
-void vos_dump_stack(uint8_t value);
-
 
 #endif // #if !defined __VOSS_SCHED_H
diff --git a/wlan/prima/CORE/VOSS/src/vos_threads.c b/wlan/prima/CORE/VOSS/src/vos_threads.c
index df6f7be..cec787b 100644
--- a/wlan/prima/CORE/VOSS/src/vos_threads.c
+++ b/wlan/prima/CORE/VOSS/src/vos_threads.c
@@ -31,6 +31,9 @@
   
   \brief virtual Operating System Services (vOSS) Threading APIs
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/VOSS/src/vos_timer.c b/wlan/prima/CORE/VOSS/src/vos_timer.c
index 2ce724e..73f80bd 100644
--- a/wlan/prima/CORE/VOSS/src/vos_timer.c
+++ b/wlan/prima/CORE/VOSS/src/vos_timer.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2015-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -44,7 +44,6 @@
 #include <vos_api.h>
 #include "wlan_qct_sys.h"
 #include "vos_sched.h"
-#include <linux/wcnss_wlan.h>
 
 /*-------------------------------------------------------------------------- 
   Preprocessor definitions and constants
@@ -121,10 +120,7 @@
    v_PVOID_t userData=NULL;
    int threadId;
    VOS_TIMER_TYPE type=VOS_TIMER_TYPE_SW;
-   v_CONTEXT_t vos_context = NULL;
-   pVosContextType vos_global_context;
-   vos_wdthread_timer_work_t *wdthread_timer_work;
-
+   
    VOS_ASSERT(timer);
 
    if (timer == NULL)
@@ -219,37 +215,7 @@
       if(vos_rx_mq_serialize( VOS_MQ_ID_SYS, &msg ) == VOS_STATUS_SUCCESS)
          return;
    }
-#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
-   else if (vos_is_wd_thread(threadId))
-   {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-                "TIMER callback: running on wd thread");
-      vos_context = vos_get_global_context(VOS_MODULE_ID_HDD, NULL);
-      if(!vos_context)
-      {
-         VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                   "%s: Global VOS context is Null", __func__);
-         return;
-      }
-      vos_global_context = (pVosContextType)vos_context;
-      wdthread_timer_work = vos_mem_malloc(sizeof(*wdthread_timer_work));
-      if (NULL == wdthread_timer_work) {
-          VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                    "%s: No memory available", __func__);
-          return;
-      }
-      wdthread_timer_work->callback = callback;
-      wdthread_timer_work->userData = userData;
-      spin_lock(&vos_global_context->wdthread_work_lock);
-      list_add(&wdthread_timer_work->node,
-                    &vos_global_context->wdthread_timer_work_list);
-      spin_unlock(&vos_global_context->wdthread_work_lock);
-
-      schedule_work(&vos_global_context->wdthread_work);
-      return;
-   }
-#endif
-   else
+   else 
    {
       VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
           "TIMER callback: running on MC thread");
@@ -262,7 +228,7 @@
        
       if(vos_mq_post_message( VOS_MQ_ID_SYS, &msg ) == VOS_STATUS_SUCCESS)
         return;
-   }
+   }     
 
    VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
              "%s: Could not enqueue timer to any queue", __func__);
@@ -434,20 +400,16 @@
   
 ---------------------------------------------------------------------------*/
 #ifdef TIMER_MANAGER
-static inline VOS_STATUS __vos_timer_init_debug(vos_timer_t *timer,
-                        VOS_TIMER_TYPE timerType,
-                        vos_timer_callback_t callback,
-                        v_PVOID_t userData,
-                        bool deferrable,
-                        char* fileName,
-                        v_U32_t lineNum)
+VOS_STATUS vos_timer_init_debug( vos_timer_t *timer, VOS_TIMER_TYPE timerType, 
+                           vos_timer_callback_t callback, v_PVOID_t userData, 
+                           char* fileName, v_U32_t lineNum )
 {
    VOS_STATUS vosStatus;
     unsigned long flags;
    // Check for invalid pointer
-   if ((timer == NULL) || (callback == NULL))
+   if ((timer == NULL) || (callback == NULL)) 
    {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
                 "%s: Null params being passed",__func__);
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAULT;
@@ -455,11 +417,10 @@
 
    timer->ptimerNode = vos_mem_malloc(sizeof(timer_node_t));
 
-   if (timer->ptimerNode == NULL)
+   if(timer->ptimerNode == NULL)
    {
       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
-                "%s: Not able to allocate memory for timeNode",
-                __func__);
+                "%s: Not able to allocate memory for timeNode",__func__);
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAULT;
    }
@@ -473,78 +434,16 @@
     spin_lock_irqsave(&vosTimerList.lock, flags);
     vosStatus = hdd_list_insert_front(&vosTimerList, &timer->ptimerNode->pNode);
     spin_unlock_irqrestore(&vosTimerList.lock, flags);
-    if (VOS_STATUS_SUCCESS != vosStatus)
+    if(VOS_STATUS_SUCCESS != vosStatus)
     {
          VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
-             "%s: Unable to insert node into List vosStatus %d",
-             __func__, vosStatus);
+             "%s: Unable to insert node into List vosStatus %d", __func__, vosStatus);
     }
-
-   /* set the various members of the timer structure
-    * with arguments passed or with default values
-    */
+   
+   // set the various members of the timer structure 
+   // with arguments passed or with default values
    spin_lock_init(&timer->platformInfo.spinlock);
-   if(deferrable)
-     init_timer_deferrable(&(timer->platformInfo.Timer));
-   else
-     init_timer(&(timer->platformInfo.Timer));
-   timer->platformInfo.Timer.function = vos_linux_timer_callback;
-   timer->platformInfo.Timer.data = (unsigned long)timer;
-   timer->callback = callback;
-   timer->userData = userData;
-   timer->type = timerType;
-   timer->platformInfo.cookie = LINUX_TIMER_COOKIE;
-   timer->platformInfo.threadID = 0;
-   timer->state = VOS_TIMER_STATE_STOPPED;
-
-   return VOS_STATUS_SUCCESS;
-}
-
-VOS_STATUS vos_timer_init_debug(vos_timer_t *timer,
-                        VOS_TIMER_TYPE timerType,
-                        vos_timer_callback_t callback,
-                        v_PVOID_t userData,
-                        char* fileName,
-                        v_U32_t lineNum)
-{
-   return __vos_timer_init_debug(timer, timerType,
-                     callback, userData, false, fileName, lineNum);
-}
-
-VOS_STATUS vos_timer_init_deferrable_debug(vos_timer_t *timer,
-                        VOS_TIMER_TYPE timerType,
-                        vos_timer_callback_t callback,
-                        v_PVOID_t userData,
-                        char* fileName,
-                        v_U32_t lineNum)
-{
-   return __vos_timer_init_debug(timer, timerType,
-                     callback, userData, true, fileName, lineNum);
-}
-#else
-static inline VOS_STATUS __vos_timer_init(vos_timer_t *timer,
-                           VOS_TIMER_TYPE timerType,
-                           vos_timer_callback_t callback,
-                           v_PVOID_t userData,
-                           bool deferrable)
-{
-   /* Check for invalid pointer */
-   if ((timer == NULL) || (callback == NULL))
-   {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                "%s: Null params being passed",__func__);
-      VOS_ASSERT(0);
-      return VOS_STATUS_E_FAULT;
-   }
-
-   /* set the various members of the timer structure
-    * with arguments passed or with default values
-    */
-   spin_lock_init(&timer->platformInfo.spinlock);
-   if(deferrable)
-     init_timer_deferrable(&(timer->platformInfo.Timer));
-   else
-     init_timer(&(timer->platformInfo.Timer));
+   init_timer(&(timer->platformInfo.Timer));
    timer->platformInfo.Timer.function = vos_linux_timer_callback;
    timer->platformInfo.Timer.data = (unsigned long)timer;
    timer->callback = callback;
@@ -556,23 +455,33 @@
    
    return VOS_STATUS_SUCCESS;
 }
-VOS_STATUS vos_timer_init(vos_timer_t *timer,
-                     VOS_TIMER_TYPE timerType,
-                     vos_timer_callback_t callback,
-                     v_PVOID_t userData)
+#else
+VOS_STATUS vos_timer_init( vos_timer_t *timer, VOS_TIMER_TYPE timerType, 
+                           vos_timer_callback_t callback, v_PVOID_t userData )
 {
-   return __vos_timer_init(timer, timerType,
-                   callback, userData, false);
-
-}
-
-VOS_STATUS vos_timer_init_deferrable(vos_timer_t *timer,
-                     VOS_TIMER_TYPE timerType,
-                     vos_timer_callback_t callback,
-                     v_PVOID_t userData)
-{
-   return __vos_timer_init(timer, timerType,
-                   callback, userData, true);
+   // Check for invalid pointer
+   if ((timer == NULL) || (callback == NULL)) 
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
+                "%s: Null params being passed",__func__);
+      VOS_ASSERT(0);
+      return VOS_STATUS_E_FAULT;
+   }
+   
+   // set the various members of the timer structure 
+   // with arguments passed or with default values
+   spin_lock_init(&timer->platformInfo.spinlock);
+   init_timer(&(timer->platformInfo.Timer));
+   timer->platformInfo.Timer.function = vos_linux_timer_callback;
+   timer->platformInfo.Timer.data = (unsigned long)timer;
+   timer->callback = callback;
+   timer->userData = userData;
+   timer->type = timerType;
+   timer->platformInfo.cookie = LINUX_TIMER_COOKIE;
+   timer->platformInfo.threadID = 0;
+   timer->state = VOS_TIMER_STATE_STOPPED;
+   
+   return VOS_STATUS_SUCCESS;
 }
 #endif
 
@@ -961,133 +870,3 @@
    do_gettimeofday(&tv);
    return tv.tv_sec*1000 + tv.tv_usec/1000;  
 }
-
-/*--------------------------------------------------------------------------
-
-  \brief vos_timer_is_initialized() - check if timer is initialized or not
-
-  The \a vos_timer_is_initialized() function returns VOS_TRUE if timer is
-  initialized and VOS_FALSE if timer is not initialized
-
-  \returns - VOS_TRUE or VOS_FALSE
-
-  \sa
-
-  ------------------------------------------------------------------------*/
-v_BOOL_t vos_timer_is_initialized(vos_timer_t *timer)
-{
-    if (LINUX_TIMER_COOKIE == timer->platformInfo.cookie)
-        return VOS_TRUE;
-    else
-        return VOS_FALSE;
-}
-
-/**
- * vos_wdthread_init_timer_work() -  Initialize timer work
- * @callbackptr: timer work callback
- *
- * Initialize watchdog thread timer work structure and linked
- * list.
- * return - void
- */
-void vos_wdthread_init_timer_work(void *callbackptr)
-{
-   pVosContextType context;
-
-   context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-   if (!context) {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                 "%s: Global VOS context is Null", __func__);
-       return;
-   }
-
-   spin_lock_init(&context->wdthread_work_lock);
-   INIT_LIST_HEAD(&context->wdthread_timer_work_list);
-#if defined (WLAN_OPEN_SOURCE)
-    INIT_WORK(&context->wdthread_work, callbackptr);
-#else
-    wcnss_init_work(&context->wdthread_work, callbackptr);
-#endif
-}
-
-/**
- * vos_wdthread_flush_timer_work() -  Flush timer work
- *
- * Flush watchdog thread timer work structure.
- * return - void
- */
-void vos_wdthread_flush_timer_work()
-{
-   pVosContextType context;
-
-   context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-   if (!context) {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                 "%s: Global VOS context is Null", __func__);
-       return;
-   }
-
-#if defined (WLAN_OPEN_SOURCE)
-   cancel_work_sync(&context->wdthread_work);
-#else
-   wcnss_flush_work(&context->wdthread_work);
-#endif
-}
-
-/**
- * __vos_process_wd_timer() -  Handle wathdog thread timer work
- *
- * Process watchdog thread timer work.
- * return - void
- */
-static void __vos_process_wd_timer(void)
-{
-    v_CONTEXT_t vos_context = NULL;
-    pVosContextType vos_global_context;
-    vos_wdthread_timer_work_t *wdthread_timer_work;
-    struct list_head *pos, *next;
-
-    vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
-
-    if(!vos_context)
-    {
-       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                 "%s: Global VOS context is Null", __func__);
-       return;
-    }
-
-    vos_global_context = (pVosContextType)vos_context;
-
-    spin_lock(&vos_global_context->wdthread_work_lock);
-    list_for_each_safe(pos, next,
-                     &vos_global_context->wdthread_timer_work_list) {
-        wdthread_timer_work = list_entry(pos,
-                                         vos_wdthread_timer_work_t,
-                                         node);
-        list_del(pos);
-        spin_unlock(&vos_global_context->wdthread_work_lock);
-        if ((NULL != wdthread_timer_work->callback) &&
-            (NULL != wdthread_timer_work->userData)) {
-            wdthread_timer_work->callback(wdthread_timer_work->userData);
-        }
-        vos_mem_free(wdthread_timer_work);
-        spin_lock(&vos_global_context->wdthread_work_lock);
-    }
-    spin_unlock(&vos_global_context->wdthread_work_lock);
-
-    return;
-}
-
-/**
- * vos_process_wd_timer() -  Wrapper function to handle timer work
- *
- * Wrapper function to process timer work.
- * return - void
- */
-void vos_process_wd_timer(void)
-{
-    vos_ssr_protect(__func__);
-    __vos_process_wd_timer();
-    vos_ssr_unprotect(__func__);
-}
-
diff --git a/wlan/prima/CORE/VOSS/src/vos_trace.c b/wlan/prima/CORE/VOSS/src/vos_trace.c
index fda24aa..253d133 100644
--- a/wlan/prima/CORE/VOSS/src/vos_trace.c
+++ b/wlan/prima/CORE/VOSS/src/vos_trace.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,6 +33,9 @@
 
    Trace, logging, and debugging definitions and APIs
 
+   Copyright 2008,2011 (c) Qualcomm, Incorporated.  All Rights Reserved.
+
+   Qualcomm Confidential and Proprietary.
 
   ========================================================================*/
 
@@ -99,8 +102,6 @@
    [VOS_MODULE_ID_BAP]        = { VOS_DEFAULT_TRACE_LEVEL, "BAP" },
    [VOS_MODULE_ID_TL]         = { VOS_DEFAULT_TRACE_LEVEL, "TL " },
    [VOS_MODULE_ID_WDI]        = { VOS_DEFAULT_TRACE_LEVEL, "WDI" },
-   [VOS_MODULE_ID_SVC]        = { VOS_DEFAULT_TRACE_LEVEL, "SVC" },
-   [VOS_MODULE_ID_RSV4]       = { VOS_DEFAULT_TRACE_LEVEL, "RS4" },
    [VOS_MODULE_ID_HDD]        = { VOS_DEFAULT_TRACE_LEVEL, "HDD" },
    [VOS_MODULE_ID_SME]        = { VOS_DEFAULT_TRACE_LEVEL, "SME" },
    [VOS_MODULE_ID_PE]         = { VOS_DEFAULT_TRACE_LEVEL, "PE " },
@@ -130,8 +131,6 @@
  */
 static tpvosTraceCb vostraceCBTable[VOS_MODULE_ID_MAX];
 static tpvosTraceCb vostraceRestoreCBTable[VOS_MODULE_ID_MAX];
-static tp_vos_state_info_cb vos_state_info_table[VOS_MODULE_ID_MAX];
-
 /*-------------------------------------------------------------------------
   Functions
   ------------------------------------------------------------------------*/
@@ -270,7 +269,8 @@
       va_start(val, strFormat);
 
       // print the prefix string into the string buffer...
-      n = snprintf(strBuffer, VOS_TRACE_BUFFER_SIZE, "wlan: [%2s:%3s] ",
+      n = snprintf(strBuffer, VOS_TRACE_BUFFER_SIZE, "wlan: [%d:%2s:%3s] ",
+                   in_interrupt() ? 0 : current->pid,
                    (char *) TRACE_LEVEL_STR[ level ],
                    (char *) gVosTraceInfo[ module ].moduleNameStr );
 
@@ -453,15 +453,6 @@
     }
 }
 
-void vos_register_debugcb_init()
-{
-    v_U8_t i;
-
-    for (i = 0; i < VOS_MODULE_ID_MAX; i++) {
-        vos_state_info_table[i] = NULL;
-    }
-}
-
 /*-----------------------------------------------------------------------------
   \brief vos_trace() - puts the messages in to ring-buffer
 
@@ -600,7 +591,7 @@
         return;
     }
 
-    VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO,
+    VOS_TRACE( VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR,
                "Total Records: %d, Head: %d, Tail: %d",
                gvosTraceData.num, gvosTraceData.head, gvosTraceData.tail);
 
@@ -676,28 +667,3 @@
         spin_unlock(&ltraceLock);
     }
 }
-
-/**
- * vos_register_debug_callback() - stores callback handlers to print
- *                                                 state information
- */
-void vos_register_debug_callback(VOS_MODULE_ID moduleID,
-                                      tp_vos_state_info_cb vos_state_infocb)
-{
-    vos_state_info_table[moduleID] = vos_state_infocb;
-}
-
-/**
- * vos_state_info_dump_all() - it invokes callback of layer which registered
- * its callback to print its state information.
- * @cb_context: call back context to be passed
- */
-void vos_state_info_dump_all()
-{
-    v_U8_t module;
-
-    for (module = 0; module < VOS_MODULE_ID_MAX; module++) {
-         if (NULL != vos_state_info_table[module])
-             vos_state_info_table[module]();
-    }
-}
diff --git a/wlan/prima/CORE/VOSS/src/vos_types.c b/wlan/prima/CORE/VOSS/src/vos_types.c
index 52de3ad..6445b47 100644
--- a/wlan/prima/CORE/VOSS/src/vos_types.c
+++ b/wlan/prima/CORE/VOSS/src/vos_types.c
@@ -33,6 +33,9 @@
                
    Basic type definitions 
   
+   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/VOSS/src/vos_utils.c b/wlan/prima/CORE/VOSS/src/vos_utils.c
index 879c376..ead4635 100644
--- a/wlan/prima/CORE/VOSS/src/vos_utils.c
+++ b/wlan/prima/CORE/VOSS/src/vos_utils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -44,6 +44,9 @@
 
   DEPENDENCIES:
 
+                Copyright (c) 2007 QUALCOMM Incorporated.
+                All Rights Reserved.
+                Qualcomm Confidential and Proprietary
 ============================================================================*/
 
 /*============================================================================
@@ -58,17 +61,13 @@
 #include "vos_trace.h"
 #include "vos_utils.h"
 #include "vos_memory.h"
-#include <linux/wcnss_wlan.h>
 
 #include <linux/err.h>
 #include <linux/random.h>
 #include <linux/crypto.h>
 #include <linux/scatterlist.h>
 #include <linux/completion.h>
-#include <linux/vmalloc.h>
 #include <crypto/hash.h>
-#include "vos_diag_core_event.h"
-
 
 /*----------------------------------------------------------------------------
  * Preprocessor Definitions and Constants
@@ -299,8 +298,6 @@
     case -EBUSY:
         ret = wait_for_completion_interruptible(&tresult.completion);
         if (!ret && !tresult.err) {
-            for (i=0; i< outlen; i++)
-                output[i] = hash_result[i];
             INIT_COMPLETION(tresult.completion);
             break;
         } else {
@@ -456,10 +453,8 @@
         case -EBUSY:
              ret = wait_for_completion_interruptible(&tresult.completion);
              if (!ret && !tresult.err) {
-                 for (i=0; i< outlen; i++)
-                     output[i] = hash_result[i];
-                 INIT_COMPLETION(tresult.completion);
-                 break;
+                  INIT_COMPLETION(tresult.completion);
+                  break;
              } else {
                  VOS_TRACE(VOS_MODULE_ID_VOSS,VOS_TRACE_LEVEL_ERROR, "wait_for_completion_interruptible failed");
                  if (!ret)
@@ -727,14 +722,7 @@
     return VOS_BAND_5GHZ;
 }
 
-void vos_get_wlan_unsafe_channel(v_U16_t *unsafeChannelList,
-                           v_U16_t buffer_size, v_U16_t *unsafeChannelCount)
-{
-    /* Get unsafe channel list from cached location */
-    wcnss_get_wlan_unsafe_channel(unsafeChannelList, buffer_size,
-                                  unsafeChannelCount);
-}
-
+#ifdef DEBUG_ROAM_DELAY
 
 #include <linux/skbuff.h>
 #include "vos_timer.h"
@@ -747,7 +735,7 @@
 
 //Define gRoamDelayMetaInfo
 tRoamDelayMetaInfo gRoamDelayMetaInfo = {0};
-tRoamDelayMetaInfo *gpRoamDelayTable = NULL;
+tRoamDelayMetaInfo gRoamDelayTable[ROAM_DELAY_TABLE_SIZE];
 v_BOOL_t gRoamDelayCurrentIndex = 0;
 
 #define VOS_ETHERTYPE_802_1_X                           ( 0x888E )
@@ -762,20 +750,6 @@
 #define VOS_QOS_DATA_VALUE                              ( 0x88 )
 #define VOS_NON_QOS_DATA_VALUE                          ( 0x80 )
 
-//802.11 header wil have 24 byte excluding qos
-#define VOS_802_11_HEADER_SIZE ( 24 )
-#define VOS_QOS_SIZE ( 2 )
-#define VOS_LLC_HEADER_SIZE   (8)
-#define VOS_IP_HEADER_SIZE    (20)
-#define VOS_TCP_MIN_HEADER_SIZE   (20)
-#define VOS_DEF_PKT_STATS_LEN_TO_COPY \
-       (VOS_802_11_HEADER_SIZE + VOS_LLC_HEADER_SIZE \
-       + VOS_IP_HEADER_SIZE + VOS_TCP_MIN_HEADER_SIZE)
-// DHCP Port number
-#define VOS_DHCP_SOURCE_PORT 0x4400
-#define VOS_DHCP_DESTINATION_PORT 0x4300
-
-
 
 // Frame Type definitions
 #define VOS_MAC_MGMT_FRAME    0x0
@@ -793,13 +767,15 @@
 {
     void       *pBuffer   = NULL;
     v_BOOL_t   fEAPOL     = VOS_FALSE;
-
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "enter vos_skb_is_eapol");
+    //vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, &skb->data[0], skb->len);
     // Validate the skb
     if (unlikely(NULL == skb))
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                     "vos_skb_is_eapol [%d]: NULL skb", __LINE__);
-        return VOS_FALSE;
+        return VOS_STATUS_E_INVAL;
+        VOS_ASSERT(0);
     }
     // check for overflow
     if (unlikely((pktOffset + numBytes) > skb->len))
@@ -807,7 +783,7 @@
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                   "vos_skb_is_eapol [%d]: Packet overflow, offset %d size %d len %d",
                   __LINE__, pktOffset, numBytes, skb->len);
-        return VOS_FALSE;
+        return VOS_STATUS_E_INVAL;
     }
     //check for the Qos Data, if Offset length is more 12.
     //it means it will 802.11 header skb
@@ -822,54 +798,12 @@
     {
       fEAPOL = VOS_TRUE;
     }
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "exit vos_skb_is_eapol fEAPOL = %d", fEAPOL);
     return fEAPOL;
 }
 
-v_BOOL_t vos_roam_delay_stats_init(void)
-{
-    if (gpRoamDelayTable == NULL)
-    {
-        gpRoamDelayTable = vmalloc(sizeof(tRoamDelayMetaInfo) * ROAM_DELAY_TABLE_SIZE);
-        if (gpRoamDelayTable == NULL)
-        {
-            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "Memory allocation failed");
-            return VOS_FALSE;
-        }
-    }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "Memory is already allocated");
-        return VOS_FALSE;
-    }
-
-    return VOS_TRUE;
-}
-
-
-v_BOOL_t vos_roam_delay_stats_deinit(void)
-{
-    if (gpRoamDelayTable != NULL)
-    {
-        vfree(gpRoamDelayTable);
-        gpRoamDelayTable = NULL;
-    }
-    else
-    {
-        VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "Memory is already freed");
-        return VOS_FALSE;
-    }
-
-    return VOS_TRUE;
-}
-
 void vos_record_roam_event(enum e_roaming_event roam_event, void *pBuff, v_ULONG_t buff_len)
 {
-    if (gpRoamDelayTable == NULL)
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "Roam delay table is not initialized\n");
-        return;
-    }
     switch(roam_event)
     {
         case e_HDD_DISABLE_TX_QUEUE:
@@ -955,14 +889,14 @@
                      {
                           if(gRoamDelayMetaInfo.hdd_eapol_m2 == 0)
                           {
-                              VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"HDD XMIT m2");
+                              VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"HDD XMIT m2");
                               gRoamDelayMetaInfo.hdd_eapol_m2 = vos_timer_get_system_time();
                               gRoamDelayMetaInfo.dxe_monitor_tx = MONITOR_START;
                           }
                           else if((gRoamDelayMetaInfo.hdd_eapol_m2) && (gRoamDelayMetaInfo.hdd_eapol_m4 == 0))
                          {
                               gRoamDelayMetaInfo.hdd_eapol_m4 = vos_timer_get_system_time();
-                              VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"HDD XMIT m4");
+                              VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"HDD XMIT m4");
                               gRoamDelayMetaInfo.hdd_monitor_tx = MONITOR_EAPOL_DONE;
                               //We should return from here so can cache the time for first data pkt
                               return;
@@ -1008,13 +942,13 @@
                      {
                          if(gRoamDelayMetaInfo.hdd_eapol_m1 == 0)
                          {
-                             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"HDD recv m1");
+                             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"HDD recv m1");
                              gRoamDelayMetaInfo.hdd_eapol_m1 = vos_timer_get_system_time();
                          }
                          else if((gRoamDelayMetaInfo.hdd_eapol_m1) && (gRoamDelayMetaInfo.hdd_eapol_m3 == 0))
                          {
                              gRoamDelayMetaInfo.hdd_eapol_m3 = vos_timer_get_system_time();
-                             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"HDD recv m3");
+                             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"HDD recv m3");
                              gRoamDelayMetaInfo.hdd_monitor_rx = MONITOR_EAPOL_DONE;
                          }
                      }
@@ -1059,13 +993,13 @@
                          {
                              if(gRoamDelayMetaInfo.dxe_eapol_m1 == 0)
                              {
-                                 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"DXE recv m1");
+                                 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"DXE recv m1");
                                  gRoamDelayMetaInfo.dxe_eapol_m1 = vos_timer_get_system_time();
                              }
                              else if((gRoamDelayMetaInfo.dxe_eapol_m1) && (gRoamDelayMetaInfo.dxe_eapol_m3 == 0))
                              {
                                  gRoamDelayMetaInfo.dxe_eapol_m3 = vos_timer_get_system_time();
-                                 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"DXE recv m3");
+                                 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"DXE recv m3");
                                  gRoamDelayMetaInfo.dxe_monitor_rx = MONITOR_EAPOL_DONE;
                              }
                          }
@@ -1118,13 +1052,13 @@
                         {
                              if(gRoamDelayMetaInfo.dxe_eapol_m2 == 0)
                              {
-                                 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"DXE XMIT m2");
+                                 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"DXE XMIT m2");
                                  gRoamDelayMetaInfo.dxe_eapol_m2 = vos_timer_get_system_time();
                              }
                              else if((gRoamDelayMetaInfo.dxe_eapol_m2) && (gRoamDelayMetaInfo.dxe_eapol_m4 == 0))
                             {
                                  gRoamDelayMetaInfo.dxe_eapol_m4 = vos_timer_get_system_time();
-                                 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"DXE XMIT m4");
+                                 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"DXE XMIT m4");
                                  gRoamDelayMetaInfo.dxe_monitor_tx = MONITOR_EAPOL_DONE;
                                  //We should return from here so can cache the time for first data pkt
                                  return;
@@ -1167,7 +1101,7 @@
              //Let us copy roam meta info
              if(gRoamDelayCurrentIndex > ROAM_DELAY_TABLE_SIZE)
                  gRoamDelayCurrentIndex = 0;
-             vos_mem_copy(&gpRoamDelayTable[gRoamDelayCurrentIndex++],
+             vos_mem_copy(&gRoamDelayTable[gRoamDelayCurrentIndex++],
                           &gRoamDelayMetaInfo, sizeof(gRoamDelayMetaInfo));
              vos_mem_set(&gRoamDelayMetaInfo, sizeof(gRoamDelayMetaInfo), 0);
              break;
@@ -1180,55 +1114,46 @@
 
 void vos_reset_roam_timer_log(void)
 {
-    if (gpRoamDelayTable != NULL)
-    {
-       //Set zero to whole gpRoamDelayTable
-       vos_mem_set(gpRoamDelayTable, (sizeof(tRoamDelayMetaInfo) * ROAM_DELAY_TABLE_SIZE), 0);
-    }
+    //Set zero to whole gRoamDelayTable
+    vos_mem_set(&gRoamDelayTable, (sizeof(gRoamDelayMetaInfo) * ROAM_DELAY_TABLE_SIZE), 0);
 }
 
 void vos_dump_roam_time_log_service(void)
 {
     v_SLONG_t slA, slB, slC, slD, slE, slF, slG, slH, slI, slJ, slK, slL, slM, slRoamDelay;
     tRoamDelayMetaInfo currentRoamDelayInfo;
-    v_ULONG_t index = 0,i=0;
+    v_ULONG_t index = 0;
 
-    if (gpRoamDelayTable == NULL)
-    {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                  "Roam delay table is not initialized\n");
-        return;
-    }
-    //Let us first copy the current gRoamDelayMetaInfo into gpRoamDelayTable
+    //Let us first copy the current gRoamDelayMetaInfo into gRoamDelayTable
     if(gRoamDelayCurrentIndex > ROAM_DELAY_TABLE_SIZE)
         gRoamDelayCurrentIndex = 0;
-    vos_mem_copy(&gpRoamDelayTable[gRoamDelayCurrentIndex++], &gRoamDelayMetaInfo, sizeof(gRoamDelayMetaInfo));
+    vos_mem_copy(&gRoamDelayTable[gRoamDelayCurrentIndex++], &gRoamDelayMetaInfo, sizeof(gRoamDelayMetaInfo));
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-         "** RoamDelay = ( dxe_first_tx_time - disable_tx_queues_time)\n");
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+         "** RoamDelay = ( B + C + D + E + ABS(F) + H + J + L + M )\n");
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
          "||========================"
          "===============|====== A ======|====== B ======|====== C ======|"
          "====== D ======|====== E ======|====== F ======|====== G ======|"
          "====== H ======|====== I ======|====== J ======|====== K ======|"
          "====== L ======|====== M ======||\n");
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
          "||Sl | Peer MAC address  |"
          " **RoamDelay** | PreAuth Timer | Disassoc Issue| Add BSS Req   |"
          " AddBssRsp to  | ReassocReq to | ReassocRsp to | Disable to    |"
          " M1-M2 DXE SW  | M1-M2 HDD SW  | M3-M4 DXE SW  | M3-M4 HDD SW  |"
          " ReassocRsp to | HDD to DXE    ||\n");
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
          "||No.|                   |"
          " ************* | to Roam Start | to Complete   | to Rsp time   |"
          " Reassoc Req   | ReassocRsp    | Enable Tx Que | Enable Tx Que |"
          "               |               |               |               |"
          " Set GTK       | 1st data frame||\n");
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
          "||========================"
          "================================================================"
          "================================================================"
@@ -1237,7 +1162,7 @@
 
     for (index = 0; index < gRoamDelayCurrentIndex; index++)
     {
-        currentRoamDelayInfo = gpRoamDelayTable[index];
+        currentRoamDelayInfo = gRoamDelayTable[index];
         /* PreAuth Timer to Roam Start */
         slA = (currentRoamDelayInfo.preauth_cb_time -
                currentRoamDelayInfo.preauth_reassoc_start_time);
@@ -1291,10 +1216,10 @@
                currentRoamDelayInfo.hdd_first_xmit_time);
 
         /* Calculate roam delay */
-        slRoamDelay = (currentRoamDelayInfo.dxe_first_tx_time -
-                       currentRoamDelayInfo.disable_tx_queues_time);
+        slRoamDelay= slB + slC + slD + slE + ((slF<0)?-slF:slF) +
+                     slH + slJ + slL + slM;
 
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                 "||%2ld:|<"MAC_ADDRESS_STR">|"
                 "%14ld |%14ld |%14ld |%14ld |"
                 "%14ld |%14ld |%14ld |%14ld |"
@@ -1307,270 +1232,13 @@
                 slL, slM );
     }
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
          "||========================"
          "================================================================"
          "================================================================"
          "================================================================"
          "===============================||\n");
 
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-         "||== More Details ====================="
-         "===============================||\n");
-
-    for (index = 0; index < gRoamDelayCurrentIndex; index++)
-    {
-
-        currentRoamDelayInfo = gpRoamDelayTable[index];
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||%2ld: Peer Mac: <"MAC_ADDRESS_STR">\n",
-                (index+1), MAC_ADDR_ARRAY(currentRoamDelayInfo.peer_mac_addr)
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||preauth_reassoc_start_time : %14ld\n",
-                currentRoamDelayInfo.preauth_reassoc_start_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||preauth_cb_time            : %14ld\n",
-                currentRoamDelayInfo.preauth_cb_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||disable_tx_queues_time     : %14ld\n",
-                currentRoamDelayInfo.disable_tx_queues_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||disassoc_issue_time        : %14ld\n",
-                currentRoamDelayInfo.disassoc_issue_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||lim_add_bss_req_time       : %14ld\n",
-                currentRoamDelayInfo.lim_add_bss_req_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||lim_add_bss_rsp_time       : %14ld\n",
-                currentRoamDelayInfo.lim_add_bss_rsp_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||disassoc_comp_time         : %14ld\n",
-                currentRoamDelayInfo.disassoc_comp_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||send_reassoc_req_time      : %14ld\n",
-                currentRoamDelayInfo.send_reassoc_req_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||hdd_sendassoc_rsp_time     : %14ld\n",
-                currentRoamDelayInfo.hdd_sendassoc_rsp_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||enable_tx_queues_time      : %14ld\n",
-                currentRoamDelayInfo.enable_tx_queues_reassoc_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||hdd_eapol_m1               : %14ld\n",
-                currentRoamDelayInfo.hdd_eapol_m1
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||hdd_eapol_m2               : %14ld\n",
-                currentRoamDelayInfo.hdd_eapol_m2
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||hdd_eapol_m3               : %14ld\n",
-                currentRoamDelayInfo.hdd_eapol_m3
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||hdd_eapol_m4               : %14ld\n",
-                currentRoamDelayInfo.hdd_eapol_m4
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||dxe_eapol_m1               : %14ld\n",
-                currentRoamDelayInfo.dxe_eapol_m1
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||dxe_eapol_m2               : %14ld\n",
-                currentRoamDelayInfo.dxe_eapol_m2
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||dxe_eapol_m3               : %14ld\n",
-                currentRoamDelayInfo.dxe_eapol_m3
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||dxe_eapol_m4               : %14ld\n",
-                currentRoamDelayInfo.dxe_eapol_m4
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||set_ptk_roam_key_time      : %14ld\n",
-                currentRoamDelayInfo.set_ptk_roam_key_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||set_gtk_roam_key_time      : %14ld\n",
-                currentRoamDelayInfo.set_gtk_roam_key_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||tl_fetch_pkt_time          : %14ld\n",
-                currentRoamDelayInfo.tl_fetch_pkt_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||hdd_first_xmit_time        : %14ld\n",
-                currentRoamDelayInfo.hdd_first_xmit_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||dxe_first_tx_time          : %14ld\n",
-                currentRoamDelayInfo.dxe_first_tx_time
-                );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||hdd_first_pkt_data         : \n"
-                );
-
-
-        for (i=0; i<currentRoamDelayInfo.hdd_first_pkt_len && i< (50-8); i+=8)
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                    "||%2X, %2X, %2X, %2X, %2X, %2X, %2X, %2X, ",
-                    currentRoamDelayInfo.hdd_first_pkt_data[i],
-                    currentRoamDelayInfo.hdd_first_pkt_data[i+1],
-                    currentRoamDelayInfo.hdd_first_pkt_data[i+2],
-                    currentRoamDelayInfo.hdd_first_pkt_data[i+3],
-                    currentRoamDelayInfo.hdd_first_pkt_data[i+4],
-                    currentRoamDelayInfo.hdd_first_pkt_data[i+5],
-                    currentRoamDelayInfo.hdd_first_pkt_data[i+6],
-                    currentRoamDelayInfo.hdd_first_pkt_data[i+7]
-                    );
-
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                "||dxe_first_pkt_data         : \n"
-                );
-
-        for (i=0; i<currentRoamDelayInfo.dxe_first_pkt_len && i < (75-8); i+=8)
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                    "||%2X, %2X, %2X, %2X, %2X, %2X, %2X, %2X, ",
-                    currentRoamDelayInfo.dxe_first_pkt_data[i],
-                    currentRoamDelayInfo.dxe_first_pkt_data[i+1],
-                    currentRoamDelayInfo.dxe_first_pkt_data[i+2],
-                    currentRoamDelayInfo.dxe_first_pkt_data[i+3],
-                    currentRoamDelayInfo.dxe_first_pkt_data[i+4],
-                    currentRoamDelayInfo.dxe_first_pkt_data[i+5],
-                    currentRoamDelayInfo.dxe_first_pkt_data[i+6],
-                    currentRoamDelayInfo.dxe_first_pkt_data[i+7]
-                    );
-    }
-    VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-         "||== END ====================="
-         "===============================||\n");
 }
+#endif /* DEBUG_ROAM_DELAY */
 
-v_U32_t vos_copy_80211_data(void *pBuff, v_U8_t *dst, v_U8_t frametype)
-{
-    vos_pkt_t *vos_pkt = NULL;
-    struct sk_buff *skb = NULL;
-    v_U32_t length_to_copy;
-
-    vos_pkt = (vos_pkt_t *)pBuff;
-
-    if(!vos_pkt || !dst)
-    {
-       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                 "vos_pkt/dst is null");
-       return 0;
-    }
-    skb = vos_pkt->pSkb;
-    if(!skb)
-    {
-       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                   " skb is null");
-       return 0;
-    }
-    if (VOS_MAC_MGMT_FRAME == frametype)
-    {
-      length_to_copy = skb->len;
-    }
-    else
-    {
-        length_to_copy = VOS_DEF_PKT_STATS_LEN_TO_COPY;
-           if(skb->data[0] == VOS_QOS_DATA_VALUE)
-              length_to_copy += VOS_QOS_SIZE;
-
-        /* Copy whole skb data if DHCP or EAPOL pkt.Here length_to_copy
-         * will give the pointer to IP header and adding VOS_IP_HEADER_SIZE
-         * to it will give the DHCP port number.
-         */
-        if (((skb->len > (length_to_copy + VOS_IP_HEADER_SIZE)) &&
-             ((*((u16*)((u8*)skb->data + length_to_copy + VOS_IP_HEADER_SIZE))
-              == VOS_DHCP_SOURCE_PORT) ||
-             (*((u16*)((u8*)skb->data + length_to_copy + VOS_IP_HEADER_SIZE))
-              == VOS_DHCP_DESTINATION_PORT)))  ||
-             vos_skb_is_eapol(skb,
-             VOS_ETHERTYPE_802_1_X_FRAME_OFFSET_IN_802_11_PKT,
-             VOS_ETHERTYPE_802_1_X_SIZE))
-        {
-           length_to_copy = skb->len;
-        }
-    }
-
-    if (length_to_copy > skb->len)
-    {
-        length_to_copy = skb->len;
-    }
-    if (length_to_copy > MAX_PKT_STAT_DATA_LEN)
-    {
-        length_to_copy = MAX_PKT_STAT_DATA_LEN;
-    }
-
-    vos_mem_copy(dst, skb->data, length_to_copy);
-    return length_to_copy;
-}
-
-#ifdef FEATURE_WLAN_DIAG_SUPPORT
-/**
- * vos_tdls_tx_rx_mgmt_event()- send tdls mgmt rx tx event
- *
- * @event_id: event id
- * @tx_rx: tx or rx
- * @type: type of frame
- * @action_sub_type: action frame type
- * @peer_mac: peer mac
- *
- * This Function sendsend tdls mgmt rx tx diag event
- *
- * Return: void.
- */
-void vos_tdls_tx_rx_mgmt_event(uint8_t event_id, uint8_t tx_rx,
-              uint8_t type, uint8_t action_sub_type, uint8_t *peer_mac)
-{
-    WLAN_VOS_DIAG_EVENT_DEF(tdls_tx_rx_mgmt,
-                    struct vos_event_tx_rx_mgmt);
-    vos_mem_zero(&tdls_tx_rx_mgmt, sizeof(tdls_tx_rx_mgmt));
-
-    tdls_tx_rx_mgmt.event_id = event_id;
-    tdls_tx_rx_mgmt.tx_rx = tx_rx;
-    tdls_tx_rx_mgmt.type = type;
-    tdls_tx_rx_mgmt.action_sub_type = action_sub_type;
-    vos_mem_copy(tdls_tx_rx_mgmt.peer_mac,
-                     peer_mac, VOS_MAC_ADDR_SIZE);
-    WLAN_VOS_DIAG_EVENT_REPORT(&tdls_tx_rx_mgmt,
-                             EVENT_WLAN_TX_RX_MGMT);
-}
-#endif
diff --git a/wlan/prima/CORE/WDA/inc/legacy/halMsgApi.h b/wlan/prima/CORE/WDA/inc/legacy/halMsgApi.h
index 2711451..2eaaaf1 100644
--- a/wlan/prima/CORE/WDA/inc/legacy/halMsgApi.h
+++ b/wlan/prima/CORE/WDA/inc/legacy/halMsgApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1411,11 +1411,5 @@
     tANI_U8  ucRemIeId[1];
 }  __ani_attr_packed tRemBeaconFilterMsg, *tpRemBeaconFilterMsg;
 
-typedef struct sNanRequest
-{
-    tANI_U16 request_data_len;
-    tANI_U8  request_data[1];
-} tNanRequest, *tpNanRequest;
-
 #endif /* _HALMSGAPI_H_ */
 
diff --git a/wlan/prima/CORE/WDA/inc/legacy/wlan_qct_hal.h b/wlan/prima/CORE/WDA/inc/legacy/wlan_qct_hal.h
index 3d1909c..d1d7901 100644
--- a/wlan/prima/CORE/WDA/inc/legacy/wlan_qct_hal.h
+++ b/wlan/prima/CORE/WDA/inc/legacy/wlan_qct_hal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -230,7 +230,7 @@
 
 /*------------ RSSI and SNR Information extraction -------------*/
 #define WLANHAL_RX_BD_GET_RSSI0( _pvBDHeader )  \
-    (((((tpHalRxBd)_pvBDHeader)->phyStats0) >> 24) & 0x7f)
+    (((((tpHalRxBd)_pvBDHeader)->phyStats0) >> 24) & 0xff)
 #define WLANHAL_RX_BD_GET_RSSI1( _pvBDHeader )  \
     (((((tpHalRxBd)_pvBDHeader)->phyStats0) >> 16) & 0xff)
 #define WLANHAL_RX_BD_GET_RSSI2( _pvBDHeader )  \
@@ -293,7 +293,7 @@
   for UMAC in prima so declared it here */
 #define DPU_FEEDBACK_WPI_UNPROTECTED 0x20   
 #define WLANHAL_RX_IS_UNPROTECTED_WPI_FRAME(_pvBDHeader)  \
-        (DPU_FEEDBACK_WPI_UNPROTECTED == ((WDI_DS_RxMetaInfoType *)_pvBDHeader)->dpuFeedback)
+        (DPU_FEEDBACK_WPI_UNPROTECTED == ((WDI_RxBdType *)_pvBDHeader)->dpuFeedback)
 
 /*==========================================================================
 
@@ -339,13 +339,9 @@
 #define HAL_TDLS_PEER_STA_MASK              0x80 //bit 7 set for TDLS peer station 
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-#define HAL_RMC_REQUESTED_MASK   0x100
-#endif
+#define HAL_RELIABLE_MCAST_REQUESTED_MASK   0x100
 
-#define HAL_USE_BD_RATE_1_MASK              0x1000 // bit 12 for BD RATE 1
-#define HAL_USE_BD_RATE_2_MASK              0x2000 // bit 13 for BD RATE 1
-#define HAL_USE_BD_RATE_3_MASK              0x4000 // bit 14 for BD RATE 1
+#define HAL_USE_BD_RATE_MASK                0x1000
 #define HAL_USE_FW_IN_TX_PATH               0x200 //bit 9 to send via WQ5
 /*==========================================================================
 
diff --git a/wlan/prima/CORE/WDA/inc/wlan_qct_wda.h b/wlan/prima/CORE/WDA/inc/wlan_qct_wda.h
index ef48cd8..5f3a8cb 100644
--- a/wlan/prima/CORE/WDA/inc/wlan_qct_wda.h
+++ b/wlan/prima/CORE/WDA/inc/wlan_qct_wda.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -124,14 +124,17 @@
   eWDA_AUTH_TYPE_WAPI_WAI_PSK,
   eWDA_AUTH_TYPE_CCKM_WPA,
   eWDA_AUTH_TYPE_CCKM_RSN,
-  eWDA_AUTH_TYPE_RSN_PSK_SHA256,
-  eWDA_AUTH_TYPE_RSN_8021X_SHA256,
+  eWDA_AUTH_TYPE_WPA_NONE,
+  eWDA_AUTH_TYPE_AUTOSWITCH,
+  eWDA_AUTH_TYPE_SHARED_KEY,
+  eWDA_NUM_OF_SUPPORT_AUTH_TYPE,
+  eWDA_AUTH_TYPE_FAILED = 0xff,
+  eWDA_AUTH_TYPE_UNKNOWN = eCSR_AUTH_TYPE_FAILED,
 }WDA_AuthType;
 
 #define IS_FW_IN_TX_PATH_FEATURE_ENABLE ((WDI_getHostWlanFeatCaps(FW_IN_TX_PATH)) & (WDA_getFwWlanFeatCaps(FW_IN_TX_PATH)))
 #define IS_MUMIMO_BFORMEE_CAPABLE ((WDI_getHostWlanFeatCaps(MU_MIMO)) & (WDA_getFwWlanFeatCaps(MU_MIMO)))
 #define IS_FEATURE_BCN_FLT_DELTA_ENABLE ((WDI_getHostWlanFeatCaps(BCN_IE_FLT_DELTA)) & (WDA_getFwWlanFeatCaps(BCN_IE_FLT_DELTA)))
-#define IS_FEATURE_FW_STATS_ENABLE ((WDI_getHostWlanFeatCaps(FW_STATS)) & (WDA_getFwWlanFeatCaps(FW_STATS)))
 /*--------------------------------------------------------------------------
   Utilities
  --------------------------------------------------------------------------*/
@@ -168,7 +171,6 @@
 #define IS_ADVANCE_TDLS_ENABLE 0
 #endif
 #define IS_HT40_OBSS_SCAN_FEATURE_ENABLE ((WDA_getFwWlanFeatCaps(HT40_OBSS_SCAN)) & (WDI_getHostWlanFeatCaps(HT40_OBSS_SCAN)))
-#define IS_FRAME_LOGGING_SUPPORTED_BY_FW WDA_getFwWlanFeatCaps(MGMT_FRAME_LOGGING)
 
 typedef enum {
     MODE_11A        = 0,   /* 11a Mode */
@@ -216,10 +218,6 @@
      (pwda_channel)->reg_info_1 &= 0xff00ffff;           \
      (pwda_channel)->reg_info_1 |= ((val&0xff) << 16);   \
      } while(0)
-#define WDA_SET_CUURENT_REG_DOMAIN(pwda_channel, val) do { \
-     (pwda_channel)->reg_info_2 |= ((val&0x7) << 24);   \
-     (pwda_channel)->reg_info_2 |= 0x80000000;   \
-     } while(0)
 #define WDA_SET_CHANNEL_MIN_POWER(pwlan_hal_update_channel,val) do { \
      (pwlan_hal_update_channel)->reg_info_1 &= 0xffffff00;           \
      (pwlan_hal_update_channel)->reg_info_1 |= (val&0xff);           \
@@ -379,11 +377,7 @@
 //callback function for TX complete
 //parameter 1 - global pMac pointer
 //parameter 2 - txComplete status : 1- success, 0 - failure.
-typedef eHalStatus (*pWDAAckFnTxComp)(tpAniSirGlobal, void *pData);
-
-#ifdef WLAN_FEATURE_RMC
-typedef void (*WDA_txFailIndCallback)(tANI_U8 *, tANI_U8);
-#endif /* WLAN_FEATURE_RMC */
+typedef eHalStatus (*pWDAAckFnTxComp)(tpAniSirGlobal, tANI_U32);
 
 typedef struct
 {
@@ -435,18 +429,6 @@
    wpt_uint8            wdaAddSelfStaFailReason;
 } tWDA_AddSelfStaDebugParams;
 
-#define BMPS_IMPS_FAILURE_REPORT_THRESHOLD    10
-
-/* Continous Response failure counts */
-typedef struct
-{
-   wpt_uint8            enterBmpsFailureCount;
-   wpt_uint8            exitBmpsFailureCount;
-   wpt_uint8            enterImpsFailureCount;
-   wpt_uint8            exitImpsFailureCount;
-} tWDA_RespFailureCounts;
-
-
 typedef struct
 {
    v_PVOID_t            pVosContext;             /* global VOSS context*/
@@ -516,14 +498,6 @@
 
    tWDA_AddSelfStaDebugParams wdaAddSelfStaParams;
 
-#ifdef WLAN_FEATURE_RMC
-   WDA_txFailIndCallback txFailIndCallback;
-#endif /* WLAN_FEATURE_RMC */
-   tWDA_RespFailureCounts  failureCounts;
-   wpt_uint8  mgmtTxfailureCnt;
-   uint8_t  mgmt_pktfree_fail;
-   vos_lock_t mgmt_pkt_lock;
-
 } tWDA_CbContext ; 
 
 typedef struct
@@ -533,15 +507,6 @@
    v_PVOID_t            wdaWdiApiMsgParam;      /* WDI API paramter tracking */
 } tWDA_ReqParams; 
 
-typedef struct
-{
-   v_PVOID_t            pWdaContext;             /* pointer to WDA context*/
-   v_PVOID_t            wdaMsgParam;            /* PE parameter tracking */
-   v_PVOID_t            wdaWdiApiMsgParam;      /* WDI API paramter tracking */
-   v_BOOL_t             wdaHALDumpAsync;        /* Async Request */
-
-} tWDA_HalDumpReqParams;
-
 /*
  * FUNCTION: WDA_open
  * open WDA context
@@ -625,9 +590,7 @@
                                     pWDATxRxCompFunc pCompFunc,
                                     void *pData,
                                     pWDAAckFnTxComp pAckTxComp, 
-                                    tANI_U32 txFlag,
-                                    tANI_U32 txBdToken
-                                    );
+                                    tANI_U32 txFlag);
 
 /*
  * FUNCTION: WDA_PostMsgApi
@@ -656,6 +619,9 @@
 #define WDA_TL_TX_SUSPEND_SUCCESS   0
 #define WDA_TL_TX_SUSPEND_FAILURE   1
 
+// FIXME Temporary value for R33D integaration
+//#define WDA_TL_TX_FRAME_TIMEOUT  20000 /* in msec a very high upper limit */
+
 #define DPU_FEEDBACK_UNPROTECTED_ERROR 0x0F
 
 
@@ -785,10 +751,6 @@
 #  define WDA_IS_RX_LLC_PRESENT(pRxMeta)    \
       ( (0 == ((WDI_DS_RxMetaInfoType*)(pRxMeta))->llcr) ? VOS_TRUE : VOS_FALSE )
 
-#  define WDA_IS_LOGGING_DATA(pRxMeta)    \
-        ((0 == ((WDI_DS_RxMetaInfoType*)(pRxMeta))->loggingData) ? VOS_FALSE \
-                                                                 : VOS_TRUE)
-
 #define WLANWDA_HO_IS_AN_AMPDU                    0x4000
 #define WLANWDA_HO_LAST_MPDU_OF_AMPDU             0x400
 
@@ -810,7 +772,6 @@
 #  define WDA_GET_OFFLOADSCANLEARN(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->offloadScanLearn)
 /* WDA_GET_ROAMCANDIDATEIND **************************************************/
 #  define WDA_GET_ROAMCANDIDATEIND(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->roamCandidateInd)
-#  define WDA_IF_PER_ROAMCANDIDATEIND(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->perRoamCndInd)
 #endif
 #ifdef WLAN_FEATURE_EXTSCAN
 #define WDA_GET_EXTSCANFULLSCANRESIND(pRxMeta) (((WDI_DS_RxMetaInfoType*)(pRxMeta))->extscanBuffer)
@@ -818,7 +779,11 @@
 /* WDA_GET_RX_RSSI_DB ********************************************************/
 // Volans RF
 #  define WDA_RSSI_OFFSET             100
-#  define WDA_GET_RSSI_DB(rssi0)     ((int)rssi0 - WDA_RSSI_OFFSET)
+#  define WDA_GET_RSSI0_DB(rssi0)     (rssi0 - WDA_RSSI_OFFSET)
+#  define WDA_GET_RSSI1_DB(rssi0)     (0 - WDA_RSSI_OFFSET)
+#  define WDA_MAX_OF_TWO(val1, val2)  ( ((val1) > (val2)) ? (val1) : (val2))
+#  define WDA_GET_RSSI_DB(rssi0)  \
+                WDA_MAX_OF_TWO(WDA_GET_RSSI0_DB(rssi0), WDA_GET_RSSI1_DB(rssi0))
 #  define WDA_GET_RX_RSSI_DB(pRxMeta) \
                        WDA_GET_RSSI_DB((((WDI_DS_RxMetaInfoType*)(pRxMeta))->rssi0))
 
@@ -926,7 +891,6 @@
 #define WDA_TL_FLUSH_AC_RSP SIR_HAL_TL_FLUSH_AC_RSP
 
 #define WDA_MSG_TYPES_BEGIN            SIR_HAL_MSG_TYPES_BEGIN
-#define WDA_EXT_MSG_TYPES_BEGIN        SIR_HAL_EXT_MSG_TYPES_BEGIN
 #define WDA_ITC_MSG_TYPES_BEGIN        SIR_HAL_ITC_MSG_TYPES_BEGIN
 #define WDA_RADAR_DETECTED_IND         SIR_HAL_RADAR_DETECTED_IND
 #define WDA_WDT_KAM_RSP                SIR_HAL_WDT_KAM_RSP 
@@ -1023,7 +987,6 @@
 #define WDA_DELBA_IND                  SIR_HAL_DELBA_IND
 #define WDA_DEL_BA_IND                 SIR_HAL_DEL_BA_IND
 #define WDA_MIC_FAILURE_IND            SIR_HAL_MIC_FAILURE_IND
-#define WDA_LOST_LINK_PARAMS_IND       SIR_HAL_LOST_LINK_PARAMS_IND
 
 //message from sme to initiate delete block ack session.
 #define WDA_DELBA_REQ                  SIR_HAL_DELBA_REQ
@@ -1182,10 +1145,6 @@
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
 #define WDA_ROAM_SCAN_OFFLOAD_REQ   SIR_HAL_ROAM_SCAN_OFFLOAD_REQ
 #define WDA_ROAM_SCAN_OFFLOAD_RSP   SIR_HAL_ROAM_SCAN_OFFLOAD_RSP
-#define WDA_PER_ROAM_SCAN_OFFLOAD_REQ   SIR_HAL_PER_ROAM_SCAN_OFFLOAD_REQ
-#define WDA_PER_ROAM_SCAN_OFFLOAD_RSP   SIR_HAL_PER_ROAM_SCAN_OFFLOAD_RSP
-#define WDA_PER_ROAM_SCAN_TRIGGER_REQ   SIR_HAL_PER_ROAM_SCAN_TRIGGER_REQ
-#define WDA_PER_ROAM_SCAN_TRIGGER_RSP   SIR_HAL_PER_ROAM_SCAN_TRIGGER_RSP
 #endif
 
 #ifdef WLAN_WAKEUP_EVENTS
@@ -1204,10 +1163,6 @@
 #define WDA_DHCP_START_IND              SIR_HAL_DHCP_START_IND
 #define WDA_DHCP_STOP_IND               SIR_HAL_DHCP_STOP_IND
 
-#ifdef WLAN_FEATURE_RMC
-#define WDA_TX_FAIL_MONITOR_IND         SIR_HAL_TX_FAIL_MONITOR_IND
-#endif /* WLAN_FEATURE_RMC */
-
 
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
 #define WDA_GTK_OFFLOAD_REQ             SIR_HAL_GTK_OFFLOAD_REQ
@@ -1224,8 +1179,6 @@
 #define WDA_GET_ROAM_RSSI_REQ      SIR_HAL_GET_ROAM_RSSI_REQ
 #define WDA_GET_ROAM_RSSI_RSP      SIR_HAL_GET_ROAM_RSSI_RSP
 
-#define WDA_NAN_REQUEST            SIR_HAL_NAN_REQUEST
-
 #define WDA_START_SCAN_OFFLOAD_REQ  SIR_HAL_START_SCAN_OFFLOAD_REQ
 #define WDA_START_SCAN_OFFLOAD_RSP  SIR_HAL_START_SCAN_OFFLOAD_RSP
 #define WDA_STOP_SCAN_OFFLOAD_REQ  SIR_HAL_STOP_SCAN_OFFLOAD_REQ
@@ -1243,31 +1196,19 @@
 #define WDA_ADD_PERIODIC_TX_PTRN_IND    SIR_HAL_ADD_PERIODIC_TX_PTRN_IND
 #define WDA_DEL_PERIODIC_TX_PTRN_IND    SIR_HAL_DEL_PERIODIC_TX_PTRN_IND
 
-#define WDA_RATE_UPDATE_IND         SIR_HAL_RATE_UPDATE_IND
-
-#ifdef WLAN_FEATURE_RMC
-#define WDA_RMC_BECOME_RULER       SIR_HAL_RMC_BECOME_RULER
-#define WDA_RMC_RULER_SELECT_RESP  SIR_HAL_RMC_RULER_SELECT_RESP
-#define WDA_RMC_RULER_REQ          SIR_HAL_RMC_RULER_REQ
-#define WDA_RMC_UPDATE_IND          SIR_HAL_RMC_UPDATE_IND
-/* IBSS peer info related message */
-#define WDA_GET_IBSS_PEER_INFO_REQ  SIR_HAL_IBSS_PEER_INFO_REQ
-#define WDA_GET_IBSS_PEER_INFO_RSP  SIR_HAL_IBSS_PEER_INFO_RSP
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
 #define WDA_SET_BATCH_SCAN_REQ            SIR_HAL_SET_BATCH_SCAN_REQ
 #define WDA_SET_BATCH_SCAN_RSP            SIR_HAL_SET_BATCH_SCAN_RSP
 #define WDA_STOP_BATCH_SCAN_IND           SIR_HAL_STOP_BATCH_SCAN_IND
 #define WDA_TRIGGER_BATCH_SCAN_RESULT_IND SIR_HAL_TRIGGER_BATCH_SCAN_RESULT_IND
 #endif
+#define WDA_RATE_UPDATE_IND         SIR_HAL_RATE_UPDATE_IND
+
 
 #define WDA_HT40_OBSS_SCAN_IND   SIR_HAL_HT40_OBSS_SCAN_IND
 #define WDA_HT40_OBSS_STOP_SCAN_IND SIR_HAL_HT40_OBSS_STOP_SCAN_IND
 
 #define WDA_GET_BCN_MISS_RATE_REQ        SIR_HAL_BCN_MISS_RATE_REQ
-#define WDA_ENCRYPT_MSG_REQ               SIR_HAL_ENCRYPT_MSG_REQ
-#define WDA_ENCRYPT_MSG_RSP               SIR_HAL_ENCRYPT_MSG_RSP
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
 #define WDA_LINK_LAYER_STATS_CLEAR_REQ         SIR_HAL_LL_STATS_CLEAR_REQ
@@ -1281,14 +1222,6 @@
 #define WDA_SET_TDLS_CHAN_SWITCH_REQ           SIR_HAL_TDLS_CHAN_SWITCH_REQ
 #define WDA_SET_TDLS_CHAN_SWITCH_REQ_RSP       SIR_HAL_TDLS_CHAN_SWITCH_REQ_RSP
 #endif
-
-#define WDA_FW_STATS_GET_REQ                   SIR_HAL_FW_STATS_GET_REQ
-#define WDA_SET_RTS_CTS_HTVHT                   SIR_HAL_SET_RTS_CTS_HTVHT
-#define WDA_MON_START_REQ                      SIR_HAL_MON_START_REQ
-#define WDA_MON_STOP_REQ                       SIR_HAL_MON_STOP_REQ
-#define WDA_START_RSSI_MONITOR_REQ             SIR_HAL_RSSI_MON_START_REQ
-#define WDA_STOP_RSSI_MONITOR_REQ              SIR_HAL_RSSI_MON_STOP_REQ
-
 tSirRetStatus wdaPostCtrlMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg);
 
 eHalStatus WDA_SetRegDomain(void * clientCtxt, v_REGDOMAIN_t regId,
@@ -1305,11 +1238,10 @@
 #define WDA_EXTSCAN_SET_BSSID_HOTLIST_RSP      SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP
 #define WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ    SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_REQ
 #define WDA_EXTSCAN_RESET_BSSID_HOTLIST_RSP    SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP
-#define WDA_EXTSCAN_SET_SSID_HOTLIST_REQ       SIR_HAL_EXTSCAN_SET_SSID_HOTLIST_REQ
-#define WDA_EXTSCAN_SET_SSID_HOTLIST_RSP       SIR_HAL_EXTSCAN_SET_SSID_HOTLIST_RSP
-#define WDA_EXTSCAN_RESET_SSID_HOTLIST_REQ     SIR_HAL_EXTSCAN_RESET_SSID_HOTLIST_REQ
-#define WDA_EXTSCAN_RESET_SSID_HOTLIST_RSP     SIR_HAL_EXTSCAN_RESET_SSID_HOTLIST_RSP
-
+#define WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ  SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ
+#define WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP  SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP
+#define WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ  SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ
+#define WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP  SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP
 #define WDA_EXTSCAN_GET_CACHED_RESULTS_REQ    SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_REQ
 #define WDA_EXTSCAN_GET_CACHED_RESULTS_RSP    SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP
 
@@ -1317,38 +1249,10 @@
 #define WDA_EXTSCAN_SCAN_AVAILABLE_IND      SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND
 #define WDA_EXTSCAN_SCAN_RESULT_IND         SIR_HAL_EXTSCAN_SCAN_RESULT_IND
 #define WDA_EXTSCAN_BSSID_HOTLIST_RESULT_IND SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND
-#define WDA_EXTSCAN_SSID_HOTLIST_RESULT_IND  SIR_HAL_EXTSCAN_SSID_HOTLIST_MATCH_IND
+#define WDA_EXTSCAN_SIGNF_RSSI_RESULT_IND    SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND
 #endif /* WLAN_FEATURE_EXTSCAN */
 
 #define WDA_SPOOF_MAC_ADDR_REQ               SIR_HAL_SPOOF_MAC_ADDR_REQ
-#define WDA_SPOOF_MAC_ADDR_RSP               SIR_HAL_SPOOF_MAC_ADDR_RSP
-
-#define WDA_MGMT_LOGGING_INIT_REQ               SIR_HAL_MGMT_LOGGING_INIT_REQ
-#define WDA_GET_FRAME_LOG_REQ                   SIR_HAL_GET_FRAME_LOG_REQ
-#define WDA_SEND_LOG_DONE_IND                   SIR_HAL_SEND_LOG_DONE_IND
-
-#define WDA_FATAL_EVENT_LOGS_REQ                SIR_HAL_FATAL_EVENT_LOGS_REQ
-
-#define WDA_SEND_FREQ_RANGE_CONTROL_IND        SIR_HAL_SEND_FREQ_RANGE_CONTROL_IND
-
-#ifdef WLAN_FEATURE_EXTSCAN
-#define WDA_HIGH_PRIORITY_DATA_INFO_IND         SIR_HAL_HIGH_PRIORITY_DATA_INFO_IND
-#endif /* WLAN_FEATURE_EXTSCAN */
-
-#define WDA_FW_MEM_DUMP_REQ                  SIR_HAL_FW_MEM_DUMP_REQ
-
-#define WDA_WIFI_CONFIG_REQ                    SIR_HAL_WIFI_CONFIG_PARAMS
-
-#define WDA_ANTENNA_DIVERSITY_SELECTION_REQ    SIR_HAL_ANTENNA_DIVERSITY_SELECTION_REQ
-#ifdef FEATURE_OEM_DATA_SUPPORT
-#define WDA_START_OEM_DATA_REQ_IND_NEW         SIR_HAL_START_OEM_DATA_REQ_IND_NEW
-#define WDA_START_OEM_DATA_RSP_IND_NEW         SIR_HAL_START_OEM_DATA_RSP_IND_NEW
-#endif
-
-#define WDA_MODIFY_ROAM_PARAMS_IND             SIR_HAL_MODIFY_ROAM_PARAMS_IND
-#define WDA_SET_ALLOWED_ACTION_FRAMES_IND      SIR_HAL_SET_ALLOWED_ACTION_FRAMES
-
-#define WDA_PAUSE_TL_IND                       SIR_HAL_PAUSE_TL_IND
 
 #define HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME 0x40 // Bit 6 will be used to control BD rate for Management frames
 
@@ -1363,10 +1267,9 @@
          (pCompFunc),\
          (pData),\
          (NULL), \
-         (txFlag), \
-         (0)) )
+         (txFlag)) )
 
-#define halTxFrameWithTxComplete(hHal, pFrmBuf, frmLen, frmType, txDir, tid, pCompFunc, pData, pCBackFnTxComp, txFlag, txBdToken) \
+#define halTxFrameWithTxComplete(hHal, pFrmBuf, frmLen, frmType, txDir, tid, pCompFunc, pData, pCBackFnTxComp, txFlag) \
    (eHalStatus)( WDA_TxPacket(\
          vos_get_context(VOS_MODULE_ID_WDA, vos_get_global_context(VOS_MODULE_ID_WDA, (hHal))),\
          (pFrmBuf),\
@@ -1377,8 +1280,7 @@
          (pCompFunc),\
          (pData),\
          (pCBackFnTxComp), \
-         (txFlag), \
-         (txBdToken)) )
+         (txFlag)) )
 
 /* -----------------------------------------------------------------
   WDA data path API's for TL
@@ -1625,8 +1527,7 @@
   v_U32_t          txFlag,
   v_U32_t         timeStamp,
   v_U8_t          ucIsEapol,
-  v_U8_t          ucUP,
-  v_U32_t         ucTxBdToken
+  v_U8_t          ucUP
 );
 
 /*==========================================================================
@@ -1997,12 +1898,11 @@
 
    IN
     pMac             MAC global pointer
-    cmd              Hal dump command
-    arg1             Dump command argument 1
-    arg2             Dump command argument 2
-    arg3             Dump command argument 3
-    arg4             Dump command argument 4
-    async            Asynchronous event. Doesn't wait for rsp.
+    cmd               Hal dump command
+    arg1              Dump command argument 1
+    arg2              Dump command argument 2
+    arg3              Dump command argument 3
+    arg4              Dump command argument 4
 
    OUT
        pBuffer          Dump command Response buffer
@@ -2016,7 +1916,7 @@
 ============================================================================*/
 VOS_STATUS WDA_HALDumpCmdReq(tpAniSirGlobal   pMac,tANI_U32 cmd, 
                  tANI_U32   arg1, tANI_U32   arg2, tANI_U32   arg3,
-                 tANI_U32   arg4, tANI_U8   *pBuffer, wpt_boolean async);
+                 tANI_U32   arg4, tANI_U8   *pBuffer);
 
 /*==========================================================================
    FUNCTION    WDA_featureCapsExchange
@@ -2120,22 +2020,6 @@
 );
 
 /*==========================================================================
-  FUNCTION   WDA_TransportKickDxe
-
-  DESCRIPTION
-    Request Kick DXE when first hdd TX time out
-    happens
-
-  PARAMETERS
-    NONE
-
-  RETURN VALUE
-    NONE
-
-===========================================================================*/
-void WDA_TransportKickDxe(void);
-
-/*==========================================================================
   FUNCTION   WDA_TrafficStatsTimerActivate
 
   DESCRIPTION
@@ -2163,10 +2047,4 @@
 
 ===========================================================================*/
 void WDA_SetEnableSSR(v_BOOL_t enableSSR);
-
-
-void WDA_FWLoggingDXEdoneInd(v_U32_t logType);
-
-void WDA_SetMgmtPktViaWQ5(v_BOOL_t sendMgmtPktViaWQ5);
-
 #endif
diff --git a/wlan/prima/CORE/WDA/inc/wlan_qct_wda_msg.h b/wlan/prima/CORE/WDA/inc/wlan_qct_wda_msg.h
index 67d2666..a670b7c 100644
--- a/wlan/prima/CORE/WDA/inc/wlan_qct_wda_msg.h
+++ b/wlan/prima/CORE/WDA/inc/wlan_qct_wda_msg.h
@@ -38,6 +38,8 @@
   This file contains the external API exposed by the wlan adaptation layer 
   
       
+  Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
diff --git a/wlan/prima/CORE/WDA/src/wlan_qct_wda.c b/wlan/prima/CORE/WDA/src/wlan_qct_wda.c
index 1685e02..2d63e48 100644
--- a/wlan/prima/CORE/WDA/src/wlan_qct_wda.c
+++ b/wlan/prima/CORE/WDA/src/wlan_qct_wda.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -37,6 +37,9 @@
   DEPENDENCIES:
   Are listed for each API below.
 
+  Copyright (c) 2010-2011 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 /*===========================================================================
                       EDIT HISTORY FOR FILE
@@ -85,13 +88,6 @@
 #define  CONVERT_WDI2SIR_STATUS(x) \
    ((WDI_STATUS_SUCCESS != (x)) ? eSIR_FAILURE : eSIR_SUCCESS)
 
-/* Threshold to print tx time taken in ms*/
-#define WDA_TX_TIME_THRESHOLD 1000
-/* Recover with ssr if tx timeouts continuously
- * for threshold number of times.
- */
-#define WDA_TX_FAILURE_RECOVERY_THRESHOLD 3
-
 #define  IS_WDI_STATUS_FAILURE(status) \
    ((WDI_STATUS_SUCCESS != (status)) && (WDI_STATUS_PENDING != (status)))
 #define  CONVERT_WDI2VOS_STATUS(x) \
@@ -131,13 +127,11 @@
 #define WDA_WAIT_MSEC_TILL_RING_EMPTY    10    /* 10 msec wait per cycle */
 #define WDA_IS_NULL_MAC_ADDRESS(mac_addr) \
    ((mac_addr[0] == 0x00) && (mac_addr[1] == 0x00) && (mac_addr[2] == 0x00) &&\
-    (mac_addr[3] == 0x00) && (mac_addr[4] == 0x00) && (mac_addr[5] == 0x00))
+    (mac_addr[1] == 0x00) && (mac_addr[2] == 0x00) && (mac_addr[3] == 0x00))
 
 #define WDA_MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
 #define WDA_MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
 #define WDA_DUMPCMD_WAIT_TIMEOUT 10000
-#define WDA_BA_MAX_RETRY_THRESHOLD 10
-#define WDA_BA_RETRY_TIME 300000   /* Time is in msec, equal to 5 mins */
 
 /* extern declarations */
 extern void vos_WDAComplete_cback(v_PVOID_t pVosContext);
@@ -162,7 +156,6 @@
                                                           void* pUserData ) ;
 static VOS_STATUS wdaCreateTimers(tWDA_CbContext *pWDA) ;
 static VOS_STATUS wdaDestroyTimers(tWDA_CbContext *pWDA);
-bool WDA_AllowAddBA(tpAniSirGlobal pMAc, tANI_U8 staId, tANI_U8 tid);
 void WDA_BaCheckActivity(tWDA_CbContext *pWDA) ;
 void WDA_TimerTrafficStatsInd(tWDA_CbContext *pWDA);
 void WDA_HALDumpCmdCallback(WDI_HALDumpCmdRspParamsType *wdiRspParams, void* pUserData);
@@ -180,11 +173,7 @@
 #endif // FEATURE_WLAN_SCAN_PNO
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
 VOS_STATUS WDA_ProcessRoamScanOffloadReq(tWDA_CbContext *pWDA,tSirRoamOffloadScanReq *pRoamOffloadScanReqParams);
-VOS_STATUS WDA_ProcessPERRoamScanOffloadReq(tWDA_CbContext *pWDA,
-                    tSirPERRoamOffloadScanReq *pPERRoamOffloadScanReqParams);
 void WDA_RoamOffloadScanReqCallback(WDI_Status status, void* pUserData);
-void WDA_PERRoamOffloadScanReqCallback(WDI_Status status, void* pUserData);
-void WDA_PERRoamTriggerScanReqCallback(WDI_Status status, void* pUserData);
 void WDA_ConvertSirAuthToWDIAuth(WDI_AuthType *AuthType, v_U8_t csrAuthType);
 void WDA_ConvertSirEncToWDIEnc(WDI_EdType *EncrType, v_U8_t csrEncrType);
 #endif
@@ -234,11 +223,6 @@
                                   tSirLPHBReq *pData);
 #endif /* FEATURE_WLAN_LPHB */
 
-#ifdef WLAN_FEATURE_RMC
-void WDA_IBSSPeerInfoRequestHandler(v_PVOID_t pVosContext,
-                                                v_PVOID_t pData);
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef WLAN_FEATURE_EXTSCAN
 VOS_STATUS WDA_ProcessEXTScanStartReq(tWDA_CbContext *pWDA,
                                       tSirEXTScanStartReqParams *wdaRequest);
@@ -252,12 +236,10 @@
                             tSirEXTScanSetBssidHotListReqParams *wdaRequest);
 VOS_STATUS WDA_ProcessEXTScanResetBSSIDHotlistReq(tWDA_CbContext *pWDA,
                             tSirEXTScanResetBssidHotlistReqParams *wdaRequest);
-VOS_STATUS WDA_ProcessEXTScanSetSSIDHotlistReq(tWDA_CbContext *pWDA,
-                            tSirEXTScanSetSsidHotListReqParams *wdaRequest);
-VOS_STATUS WDA_ProcessEXTScanResetSSIDHotlistReq(tWDA_CbContext *pWDA,
-                            tSirEXTScanResetSsidHotlistReqParams *wdaRequest);
-VOS_STATUS WDA_ProcessHighPriorityDataInfoInd(tWDA_CbContext *pWDA,
-                            tSirHighPriorityDataInfoInd *wdaRequest);
+VOS_STATUS WDA_ProcessEXTScanSetSignfRSSIChangeReq(tWDA_CbContext *pWDA,
+                          tSirEXTScanSetSignificantChangeReqParams *wdaRequest);
+VOS_STATUS WDA_ProcessEXTScanResetSignfRSSIChangeReq(tWDA_CbContext *pWDA,
+                        tSirEXTScanResetSignificantChangeReqParams *wdaRequest);
 #endif /* WLAN_FEATURE_EXTSCAN */
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
@@ -270,144 +252,6 @@
 VOS_STATUS WDA_ProcessLLStatsClearReq(tWDA_CbContext *pWDA,
                                       tSirLLStatsClearReq *wdaRequest);
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
-
-v_VOID_t WDA_ProcessFWStatsGetReq(tWDA_CbContext *pWDA,
-                                      tSirFWStatsGetReq *wdaRequest);
-
-VOS_STATUS WDA_ProcessEncryptMsgReq(tWDA_CbContext *pWDA,
-                                      u8 *wdaRequest);
-VOS_STATUS
-WDA_ProcessSetRtsCtsHTVhtInd(tWDA_CbContext *pWDA,
-                         tANI_U32 val);
-
-VOS_STATUS
-WDA_ProcessFwrMemDumpReq(tWDA_CbContext *pWDA,
-                                tAniFwrDumpReq* pFwrMemDumpReq);
-
-VOS_STATUS WDA_ProcessMonStartReq( tWDA_CbContext *pWDA, void* wdaRequest);
-VOS_STATUS WDA_ProcessMonStopReq( tWDA_CbContext *pWDA, void* wdaRequest);
-VOS_STATUS WDA_ProcessEnableDisableCAEventInd(tWDA_CbContext *pWDA, tANI_U8 val);
-
-VOS_STATUS  WDA_ProcessWifiConfigReq(tWDA_CbContext *pWDA,
-                                     tSetWifiConfigParams *pwdaWificonfig);
-
-VOS_STATUS WDA_ProcessStartOemDataReqIndNew(tWDA_CbContext *pWDA,
-                                   tOemDataReqNewConfig *pOemDataReqNewConfig);
-
-
-v_VOID_t WDA_ProcessAntennaDiversitySelectionReq(tWDA_CbContext *pWDA,
-                                   tSirAntennaDiversitySelectionReq *pData);
-
-VOS_STATUS WDA_ProcessBcnMissPenaltyCount(tWDA_CbContext *pWDA,
-                                   tModifyRoamParamsReqParams *params);
-/*
- * FUNCTION: WDA_ProcessNanRequest
- * Process NAN request
- */
-VOS_STATUS WDA_ProcessNanRequest(tWDA_CbContext *pWDA,
-                                 tNanRequest *wdaRequest)
-{
-   WDI_Status status = WDI_STATUS_SUCCESS;
-   tWDA_ReqParams *pWdaParams;
-   WDI_NanRequestType *wdiRequest = NULL;
-   size_t wdiReqLength =  sizeof(WDI_NanRequestType)
-                            - sizeof(wdiRequest->request_data)
-                            + wdaRequest->request_data_len;
-
-   wdiRequest = (WDI_NanRequestType *)vos_mem_malloc(wdiReqLength);
-
-   if (NULL == wdiRequest)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: VOS MEM Alloc Failure, size : %zu", __func__,
-                 wdiReqLength);
-      vos_mem_free(wdaRequest);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-           "WDA: Process Nan Request length: %zu", wdiReqLength);
-
-   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
-   if (NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: VOS MEM Alloc Failure for tWDA_ReqParams", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(wdaRequest);
-      vos_mem_free(wdiRequest);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   wdiRequest->request_data_len = wdaRequest->request_data_len;
-
-   vos_mem_copy( wdiRequest->request_data,
-                 wdaRequest->request_data,
-                 wdaRequest->request_data_len);
-
-   vos_mem_free(wdaRequest);
-
-   pWdaParams->pWdaContext = pWDA;
-   pWdaParams->wdaMsgParam = NULL;
-   pWdaParams->wdaWdiApiMsgParam = wdiRequest;
-
-   status = WDI_NanRequest(wdiRequest, pWdaParams);
-
-   if (IS_WDI_STATUS_FAILURE(status))
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "Failure to request.  Free all the memory " );
-      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-      vos_mem_free(pWdaParams);
-   }
-
-   return CONVERT_WDI2VOS_STATUS(status) ;
-}
-
-/**
- * wda_state_info_dump() - prints state information of wda layer
- */
-static void wda_state_info_dump(void)
-{
-    v_CONTEXT_t vos_ctx_ptr = NULL;
-    tWDA_CbContext *wda = NULL ;
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                       "<------ %s " ,__func__);
-
-    /* Get the Global VOSS Context */
-    vos_ctx_ptr = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL);
-
-    if (NULL != vos_ctx_ptr)
-        wda = (tWDA_CbContext *)vos_get_context( VOS_MODULE_ID_WDA,
-                                                            vos_ctx_ptr );
-    else {
-        VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
-                  "%s: Invalid Global VOSS Context", __func__);
-        VOS_ASSERT(0);
-        return;
-    }
-
-    if (NULL != wda)
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                   "wdaState: %d linkState: %d", wda->wdaState,
-                                                 wda->linkState);
-    else {
-        VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: Invalid WDA Context", __func__);
-        VOS_ASSERT(0);
-    }
-}
-
-/**
- * wda_register_debug_callback() - registration function for wda layer
- * to print wda state information
- */
-static void wda_register_debug_callback(void)
-{
-    vos_register_debug_callback(VOS_MODULE_ID_WDA, &wda_state_info_dump);
-}
-
 /*
  * FUNCTION: WDA_open
  * Allocate the WDA context 
@@ -419,12 +263,10 @@
    VOS_STATUS status;
    WDI_DeviceCapabilityType wdiDevCapability = {0} ;
    /* Allocate WDA context */
-   status = vos_alloc_context(pVosContext, VOS_MODULE_ID_WDA,
+   status = vos_alloc_context(pVosContext, VOS_MODULE_ID_WDA, 
                            (v_VOID_t **)&wdaContext, sizeof(tWDA_CbContext)) ;
    if(!VOS_IS_STATUS_SUCCESS(status))
    {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, "%s: Failed to "
-                "allocate context for WDA - status = %d",__func__, status);
       return VOS_STATUS_E_NOMEM;
    }
    /*__asm int 3;*/
@@ -434,8 +276,7 @@
    wdaContext->pVosContext = pVosContext;
    wdaContext->wdaState = WDA_INIT_STATE;
    wdaContext->uTxFlowMask = WDA_TXFLOWMASK;
-   vos_lock_init(&wdaContext->mgmt_pkt_lock);
-
+   
    /* Initialize WDA-WDI synchronization event */
    status = vos_event_init(&wdaContext->wdaWdiEvent);
    if(!VOS_IS_STATUS_SUCCESS(status)) 
@@ -487,9 +328,6 @@
        */
       wdaContext->frameTransRequired = wdiDevCapability.bFrameXtlSupported;
    }
-
-   wda_register_debug_callback();
-
    return status;
 
 error:
@@ -685,11 +523,6 @@
       {
          wdaContext->wdaTimersCreated = VOS_TRUE;
       }
-      else
-      {
-          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                    FL("wda create timers failed"));
-      }
    }
    else
    {
@@ -2247,155 +2080,6 @@
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct
                            + sizeof(tHalCfg) + tlvStruct->length) ;
 
-   /* QWLAN_HAL_CFG_ENABLE_RTSCTS_HTVHT */
-   tlvStruct->type = QWLAN_HAL_CFG_ENABLE_RTSCTS_HTVHT;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-
-   if (wlan_cfgGetInt(pMac, WNI_CFG_ENABLE_RTSCTS_HTVHT,
-                                            configDataValue ) != eSIR_SUCCESS)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "Failed to get value for WNI_CFG_ENABLE_RTSCTS_HTVHT");
-      goto handle_failure;
-   }
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct
-                           + sizeof(tHalCfg) + tlvStruct->length) ;
-
-
-   /* QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-
-   if (wlan_cfgGetInt(pMac, WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN,
-                                            configDataValue ) != eSIR_SUCCESS)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "Failed to get value for WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN");
-      goto handle_failure;
-   }
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct
-                           + sizeof(tHalCfg) + tlvStruct->length) ;
-
-   /* QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-
-   if (wlan_cfgGetInt(pMac, WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN,
-                                            configDataValue ) != eSIR_SUCCESS)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "Failed to get value for WNI_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN");
-      goto handle_failure;
-   }
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct
-                           + sizeof(tHalCfg) + tlvStruct->length) ;
-
-   /* QWLAN_HAL_CFG_LINK_FAIL_TIMEOUT */
-   tlvStruct->type = QWLAN_HAL_CFG_LINK_FAIL_TIMEOUT ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-
-   if (wlan_cfgGetInt(pMac, WNI_CFG_LINK_FAIL_TIMEOUT,
-                                            configDataValue ) != eSIR_SUCCESS)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "Failed to get value for WNI_CFG_LINK_FAIL_TIMEOUT");
-      goto handle_failure;
-   }
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct
-                           + sizeof(tHalCfg) + tlvStruct->length) ;
-
-   /* QWLAN_HAL_CFG_LINK_FAIL_TX_CNT */
-   tlvStruct->type = QWLAN_HAL_CFG_LINK_FAIL_TX_CNT ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-
-   if (wlan_cfgGetInt(pMac, WNI_CFG_LINK_FAIL_TX_CNT,
-                                            configDataValue ) != eSIR_SUCCESS)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "Failed to get value for WNI_CFG_LINK_FAIL_TX_CNT");
-      goto handle_failure;
-   }
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct
-                           + sizeof(tHalCfg) + tlvStruct->length) ;
-
-   /* QWLAN_HAL_CFG_TOGGLE_ARP_BDRATES */
-   tlvStruct->type = QWLAN_HAL_CFG_TOGGLE_ARP_BDRATES;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-
-   if (wlan_cfgGetInt(pMac, WNI_CFG_TOGGLE_ARP_BDRATES,
-                                            configDataValue ) != eSIR_SUCCESS)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "Failed to get value for WNI_CFG_TOGGLE_ARP_BDRATES");
-      goto handle_failure;
-   }
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct
-                           + sizeof(tHalCfg) + tlvStruct->length) ;
-   /* QWLAN_HAL_CFG_OPTIMIZE_CA_EVENT */
-   tlvStruct->type = QWLAN_HAL_CFG_OPTIMIZE_CA_EVENT ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   if (wlan_cfgGetInt(pMac, WNI_CFG_OPTIMIZE_CA_EVENT,
-                                            configDataValue ) != eSIR_SUCCESS)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "Failed to get value for WNI_CFG_OPTIMIZE_CA_EVENT");
-      goto handle_failure;
-   }
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct
-                           + sizeof(tHalCfg) + tlvStruct->length) ;
-
-   /* QWLAN_HAL_CFG_EXT_SCAN_CONC_MODE  */
-   tlvStruct->type = QWLAN_HAL_CFG_EXT_SCAN_CONC_MODE ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-
-   if (wlan_cfgGetInt(pMac, WNI_CFG_EXT_SCAN_CONC_MODE,
-                                            configDataValue ) != eSIR_SUCCESS)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "Failed to get value for WNI_CFG_EXT_SCAN_CONC_MODE");
-      goto handle_failure;
-   }
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct
-                           + sizeof(tHalCfg) + tlvStruct->length) ;
-
-   /* QWLAN_HAL_CFG_BAR_WAKEUP_HOST_DISABLE */
-   tlvStruct->type = QWLAN_HAL_CFG_BAR_WAKEUP_HOST_DISABLE;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-
-   if (wlan_cfgGetInt(pMac, WNI_CFG_DISABLE_BAR_WAKE_UP_HOST,
-                         configDataValue ) != eSIR_SUCCESS)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "Failed to get value for WNI_CFG_DISABLE_BAR_WAKE_UP_HOST");
-      goto handle_failure;
-   }
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct
-                           + sizeof(tHalCfg) + tlvStruct->length) ;
-
-   /* QWLAN_HAL_CFG_SAR_BOFFSET_CORRECTION_ENABLE */
-   tlvStruct->type = QWLAN_HAL_CFG_SAR_BOFFSET_CORRECTION_ENABLE;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-
-   if (wlan_cfgGetInt(pMac, WNI_CFG_SAR_BOFFSET_SET_CORRECTION,
-                         configDataValue ) != eSIR_SUCCESS)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "Failed to get value for WNI_CFG_SAR_BOFFSET_SET_CORRECTION");
-      goto handle_failure;
-   }
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct
-                           + sizeof(tHalCfg) + tlvStruct->length) ;
-
    wdiStartParams->usConfigBufferLen = (tANI_U8 *)tlvStruct - tlvStructStart ;
 #ifdef WLAN_DEBUG
    {
@@ -2536,7 +2220,7 @@
 
    wdiStopReq->wdiStopReason = reason;
    wdiStopReq->wdiReqStatusCB = NULL;
-
+   
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
@@ -2590,7 +2274,7 @@
 /*
  * FUNCTION: WDA_close
  * call WDI_close and free the WDA context
- */
+ */ 
 VOS_STATUS WDA_close(v_PVOID_t pVosContext)
 {
    VOS_STATUS status = VOS_STATUS_SUCCESS;
@@ -2653,7 +2337,6 @@
                                   "error in WDA close " );
       status = VOS_STATUS_E_FAILURE;
    }
-   vos_lock_destroy(&wdaContext->mgmt_pkt_lock);
    return status;
 }
 /*
@@ -2701,7 +2384,7 @@
 VOS_STATUS WDA_GetWcnssWlanCompiledVersion(v_PVOID_t pvosGCtx,
                                            tSirVersionType *pVersion)
 {
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    if ((NULL == pvosGCtx) || (NULL == pVersion))
    {
       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2728,7 +2411,7 @@
 VOS_STATUS WDA_GetWcnssWlanReportedVersion(v_PVOID_t pvosGCtx,
                                            tSirVersionType *pVersion)
 {
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    if ((NULL == pvosGCtx) || (NULL == pVersion))
    {
       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2755,7 +2438,7 @@
                                        tANI_U8 *pVersion,
                                        tANI_U32 versionBufferSize)
 {
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
              "%s: Entered", __func__);
    if ((NULL == pvosGCtx) || (NULL == pVersion))
@@ -2784,7 +2467,7 @@
                                        tANI_U8 *pVersion,
                                        tANI_U32 versionBufferSize)
 {
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
              "%s: Entered", __func__);
    if ((NULL == pvosGCtx) || (NULL == pVersion))
@@ -2987,8 +2670,8 @@
    /* free WDI command buffer */
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
-
-
+   
+   
    /* assign status to scan params */
    /* without converting the Status to Failure or Success Just
       pass the same status to lim */
@@ -3798,10 +3481,10 @@
 }
 
 /*
- * FUNCTION: WDA_ConfigBssRspCallback
+ * FUNCTION: WDA_ConfigBssReqCallback
  * config BSS Req Callback, called by WDI
  */ 
-void WDA_ConfigBssRspCallback(WDI_ConfigBSSRspParamsType *wdiConfigBssRsp
+void WDA_ConfigBssReqCallback(WDI_ConfigBSSRspParamsType *wdiConfigBssRsp  
                                                           ,void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
@@ -3914,16 +3597,6 @@
       configBssReqParam->txMgmtPower = wdiConfigBssRsp->ucTxMgmtPower;
 #endif
    }
-   else
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Failure with status %d", __func__,
-                    wdiConfigBssRsp->wdiStatus);
-      vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                     WLAN_LOG_INDICATOR_HOST_DRIVER,
-                     WLAN_LOG_REASON_ADD_BSS_STA_FAIL,
-                     FALSE, TRUE);
-   }
    vos_mem_zero(pWdaParams->wdaWdiApiMsgParam,
                  sizeof(WDI_ConfigBSSReqParamsType));
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
@@ -3946,44 +3619,6 @@
    wdiEdcaParam->wdiCW.max = macEdcaParam->cw.max;
    wdiEdcaParam->usTXOPLimit = macEdcaParam->txoplimit;
 }
-void WDA_ConfigBssReqCallback(WDI_Status   wdiStatus,
-                                void*        pUserData)
-{
-   tWDA_ReqParams        *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext        *pWDA;
-   tAddBssParams         *addBssParams;
-
-   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-             "<------ %s, wdiStatus: %d",
-              __func__, wdiStatus);
-
-   if (NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: Invalid pWdaParams pointer", __func__);
-      VOS_ASSERT(0);
-      return;
-   }
-
-   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   addBssParams = (tAddBssParams *)pWdaParams->wdaMsgParam;
-
-   addBssParams->status = wdiStatus;
-
-   if (IS_WDI_STATUS_FAILURE(wdiStatus))
-   {
-         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-         vos_mem_free(pWdaParams) ;
-         vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                     WLAN_LOG_INDICATOR_HOST_DRIVER,
-                     WLAN_LOG_REASON_ADD_BSS_STA_FAIL,
-                     FALSE, TRUE);
-         WDA_SendMsg(pWDA, WDA_ADD_BSS_RSP, (void *)addBssParams , 0);
-   }
-
-   return ;
-}
-
 /*
  * FUNCTION: WDA_ProcessConfigBssReq
  * Configure BSS before starting Assoc with AP
@@ -4027,15 +3662,13 @@
    vos_mem_set(wdiConfigBssReqParam, sizeof(WDI_ConfigBSSReqParamsType), 0);
    WDA_UpdateBSSParams(pWDA, &wdiConfigBssReqParam->wdiReqInfo, 
                        configBssReqParam) ;
-   wdiConfigBssReqParam->wdiReqStatusCB = WDA_ConfigBssReqCallback;
-   wdiConfigBssReqParam->pUserData = pWdaParams;
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = configBssReqParam;
    pWdaParams->wdaWdiApiMsgParam = wdiConfigBssReqParam;
    status = WDI_ConfigBSSReq(wdiConfigBssReqParam, 
-                        (WDI_ConfigBSSRspCb )WDA_ConfigBssRspCallback, pWdaParams) ;
+                        (WDI_ConfigBSSRspCb )WDA_ConfigBssReqCallback, pWdaParams) ;
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4157,10 +3790,10 @@
 }
 #endif
 /*
- * FUNCTION: WDA_AddStaRspCallback
+ * FUNCTION: WDA_AddStaReqCallback
  * ADD STA req callback, send RSP back to PE
  */ 
-void WDA_AddStaRspCallback(WDI_ConfigSTARspParamsType *wdiConfigStaRsp,
+void WDA_AddStaReqCallback(WDI_ConfigSTARspParamsType *wdiConfigStaRsp,  
                                                           void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
@@ -4210,64 +3843,16 @@
          return ;
       }
    }
-   else
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Failure with status %d", __func__,
-                    wdiConfigStaRsp->wdiStatus);
-      vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                     WLAN_LOG_INDICATOR_HOST_DRIVER,
-                     WLAN_LOG_REASON_ADD_BSS_STA_FAIL,
-                     FALSE, TRUE);
-   }
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams) ;
    WDA_SendMsg(pWDA, WDA_ADD_STA_RSP, (void *)addStaReqParam, 0) ;
    return ;
 }
-void WDA_AddStaReqCallback(WDI_Status   wdiStatus,
-                                void*        pUserData)
-{
-   tWDA_ReqParams        *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext        *pWDA;
-   tAddStaParams         *addStaParams;
-
-   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-             "<------ %s, wdiStatus: %d",
-              __func__, wdiStatus);
-
-   if (NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: Invalid pWdaParams pointer", __func__);
-      VOS_ASSERT(0);
-      return;
-   }
-
-   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   addStaParams = (tAddStaParams *)pWdaParams->wdaMsgParam;
-
-   addStaParams->status = wdiStatus;
-
-   if (IS_WDI_STATUS_FAILURE(wdiStatus))
-   {
-         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-         vos_mem_free(pWdaParams) ;
-         vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                     WLAN_LOG_INDICATOR_HOST_DRIVER,
-                     WLAN_LOG_REASON_ADD_BSS_STA_FAIL,
-                     FALSE, TRUE);
-         WDA_SendMsg(pWDA, WDA_ADD_STA_RSP, (void *)addStaParams , 0);
-   }
-
-   return ;
-}
-
 /*
  * FUNCTION: WDA_ConfigStaReq
  * Trigger Config STA processing in WDI
  */ 
-VOS_STATUS WDA_ProcessAddStaReq(tWDA_CbContext *pWDA,
+VOS_STATUS WDA_ProcessAddStaReq(tWDA_CbContext *pWDA, 
                                     tAddStaParams *addStaReqParam)
 {
    WDI_Status status = WDI_STATUS_SUCCESS ;
@@ -4297,16 +3882,13 @@
    /* update STA params into WDI structure */
    WDA_UpdateSTAParams(pWDA, &wdiConfigStaReqParam->wdiReqInfo, 
                        addStaReqParam) ;
-   wdiConfigStaReqParam->wdiReqStatusCB = WDA_AddStaReqCallback;
-   wdiConfigStaReqParam->pUserData = pWdaParams;
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = addStaReqParam;
    pWdaParams->wdaWdiApiMsgParam = wdiConfigStaReqParam;
-
    status = WDI_ConfigSTAReq(wdiConfigStaReqParam, 
-                        (WDI_ConfigSTARspCb )WDA_AddStaRspCallback, pWdaParams) ;
+                        (WDI_ConfigSTARspCb )WDA_AddStaReqCallback, pWdaParams) ;
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4318,12 +3900,11 @@
    }
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
-
 /*
- * FUNCTION: WDA_DelBSSRspCallback
+ * FUNCTION: WDA_DelBSSReqCallback
  * Dens DEL BSS RSP back to PE
- */
-void WDA_DelBSSRspCallback(WDI_DelBSSRspParamsType *wdiDelBssRsp,
+ */ 
+void WDA_DelBSSReqCallback(WDI_DelBSSRspParamsType *wdiDelBssRsp, 
                                                          void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
@@ -4347,16 +3928,6 @@
       vos_mem_copy(delBssReqParam->bssid, wdiDelBssRsp->macBSSID, 
                                              sizeof(tSirMacAddr)) ;
    }
-   else
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Failure with status %d", __func__,
-                    wdiDelBssRsp->wdiStatus);
-      vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                 WLAN_LOG_INDICATOR_HOST_DRIVER,
-                 WLAN_LOG_REASON_DEL_BSS_STA_FAIL,
-                 FALSE, TRUE);
-   }
    if(WDI_DS_GetStaIdxFromBssIdx(pWDA->pWdiContext, delBssReqParam->bssIdx, &staIdx))
    {
      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4398,47 +3969,9 @@
          }
       }
    }
-
    WDA_SendMsg(pWDA, WDA_DELETE_BSS_RSP, (void *)delBssReqParam , 0) ;
    return ;
 }
-void WDA_DelBSSReqCallback(WDI_Status   wdiStatus,
-                                void*        pUserData)
-{
-   tWDA_ReqParams        *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext        *pWDA;
-   tDeleteBssParams      *delbssParams;
-
-   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-             "<------ %s, wdiStatus: %d",
-              __func__, wdiStatus);
-
-   if (NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: Invalid pWdaParams pointer", __func__);
-      VOS_ASSERT(0);
-      return;
-   }
-
-   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   delbssParams = (tDeleteBssParams *)pWdaParams->wdaMsgParam;
-
-   delbssParams->status = wdiStatus ;
-
-   if (IS_WDI_STATUS_FAILURE(wdiStatus))
-   {
-         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-         vos_mem_free(pWdaParams) ;
-         vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                 WLAN_LOG_INDICATOR_HOST_DRIVER,
-                 WLAN_LOG_REASON_DEL_BSS_STA_FAIL,
-                 FALSE, TRUE);
-         WDA_SendMsg(pWDA, WDA_DELETE_BSS_RSP, (void *)delbssParams , 0) ;
-   }
-
-   return ;
-}
 
 /*
  * FUNCTION: WDA_ProcessDelBssReq
@@ -4457,7 +3990,7 @@
    if(NULL == wdiDelBssReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
+                           "%s: VOS MEM Alloc Failure", __func__); 
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
@@ -4471,17 +4004,15 @@
       return VOS_STATUS_E_NOMEM;
    }
    wdiDelBssReqParam->ucBssIdx = delBssParam->bssIdx;
-   wdiDelBssReqParam->wdiReqStatusCB = WDA_DelBSSReqCallback ;
-   wdiDelBssReqParam->pUserData = pWdaParams;
-
+   wdiDelBssReqParam->wdiReqStatusCB = NULL ;
+   
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = delBssParam;
    pWdaParams->wdaWdiApiMsgParam = wdiDelBssReqParam;
-
    status = WDI_DelBSSReq(wdiDelBssReqParam, 
-                        (WDI_DelBSSRspCb )WDA_DelBSSRspCallback, pWdaParams) ;
+                        (WDI_DelBSSRspCb )WDA_DelBSSReqCallback, pWdaParams) ;
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4494,10 +4025,10 @@
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
 /*
- * FUNCTION: WDA_DelSTARspCallback
+ * FUNCTION: WDA_DelSTAReqCallback
  * Dens DEL STA RSP back to PE
- */
-void WDA_DelSTARspCallback(WDI_DelSTARspParamsType *wdiDelStaRsp,
+ */ 
+void WDA_DelSTAReqCallback(WDI_DelSTARspParamsType *wdiDelStaRsp, 
                                                          void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
@@ -4509,7 +4040,7 @@
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                "%s: pWdaParams received NULL", __func__);
-      VOS_ASSERT(0);
+      VOS_ASSERT(0) ;
       return ;
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
@@ -4526,16 +4057,6 @@
       delStaReqParam->staIdx = wdiDelStaRsp->ucSTAIdx ;
       WLANTL_StartForwarding(delStaReqParam->staIdx,0,0);
    }
-   else
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Failure with status %d", __func__,
-                    wdiDelStaRsp->wdiStatus);
-      vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                 WLAN_LOG_INDICATOR_HOST_DRIVER,
-                 WLAN_LOG_REASON_DEL_BSS_STA_FAIL,
-                 FALSE, TRUE);
-   }
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
    /*Reset the BA information corresponding to this STAIdx */
@@ -4546,44 +4067,6 @@
    WDA_SendMsg(pWDA, WDA_DELETE_STA_RSP, (void *)delStaReqParam , 0) ;
    return ;
 }
-void WDA_DelSTAReqCallback(WDI_Status   wdiStatus,
-                                void*        pUserData)
-{
-   tWDA_ReqParams        *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext        *pWDA;
-   tDeleteStaParams      *delStaParams;
-
-   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-             "<------ %s, wdiStatus: %d",
-              __func__, wdiStatus);
-
-   if (NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: Invalid pWdaParams pointer", __func__);
-      VOS_ASSERT(0);
-      return;
-   }
-
-   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   delStaParams = (tDeleteStaParams *)pWdaParams->wdaMsgParam;
-
-   delStaParams->status = wdiStatus ;
-
-   if (IS_WDI_STATUS_FAILURE(wdiStatus))
-   {
-         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-         vos_mem_free(pWdaParams) ;
-         vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                 WLAN_LOG_INDICATOR_HOST_DRIVER,
-                 WLAN_LOG_REASON_DEL_BSS_STA_FAIL,
-                 FALSE, TRUE);
-         WDA_SendMsg(pWDA, WDA_DELETE_STA_RSP, (void *)delStaParams , 0) ;
-   }
-
-   return ;
-}
-
 /*
  * FUNCTION: WDA_ProcessDelStaReq
  * Init DEL STA req with WDI
@@ -4615,16 +4098,14 @@
       return VOS_STATUS_E_NOMEM;
    }
    wdiDelStaReqParam->ucSTAIdx = delStaParam->staIdx ;
-   wdiDelStaReqParam->wdiReqStatusCB = WDA_DelSTAReqCallback ;
-   wdiDelStaReqParam->pUserData = pWdaParams;
+   wdiDelStaReqParam->wdiReqStatusCB = NULL ;
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = delStaParam;
    pWdaParams->wdaWdiApiMsgParam = wdiDelStaReqParam;
-
    status = WDI_DelSTAReq(wdiDelStaReqParam, 
-                        (WDI_DelSTARspCb )WDA_DelSTARspCallback, pWdaParams) ;
+                        (WDI_DelSTARspCb )WDA_DelSTAReqCallback, pWdaParams) ;
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4637,7 +4118,7 @@
    }
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
-void WDA_ProcessAddStaSelfRspCallback(WDI_AddSTASelfRspParamsType* pwdiAddSTASelfRsp, void* pUserData)
+void WDA_ProcessAddStaSelfRsp(WDI_AddSTASelfRspParamsType* pwdiAddSTASelfRsp, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA; 
@@ -4665,62 +4146,10 @@
    {
        pWDA->wdaAddSelfStaParams.wdaAddSelfStaFailReason = WDA_ADDSTA_RSP_WDI_FAIL;
        pWDA->wdaAddSelfStaParams.wdiAddStaSelfStaFailCounter++;
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Failure with status %d failcnter %d", __func__,
-                    pwdiAddSTASelfRsp->wdiStatus,
-                    pWDA->wdaAddSelfStaParams.wdiAddStaSelfStaFailCounter);
-       vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                     WLAN_LOG_INDICATOR_HOST_DRIVER,
-                     WLAN_LOG_REASON_ADD_BSS_STA_FAIL,
-                     FALSE, TRUE);
    }
    WDA_SendMsg( pWDA, WDA_ADD_STA_SELF_RSP, (void *)pAddStaSelfRsp, 0) ;
    return ;
 }
-void WDA_ProcessAddStaSelfReqCallback(WDI_Status   wdiStatus,
-                                void*        pUserData)
-{
-   tWDA_ReqParams        *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext        *pWDA;
-   tAddStaSelfParams     *addStaSelfParams;
-
-   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-             "<------ %s, wdiStatus: %d",
-              __func__, wdiStatus);
-
-   if (NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: Invalid pWdaParams pointer", __func__);
-      VOS_ASSERT(0);
-      return;
-   }
-
-   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   addStaSelfParams = (tAddStaSelfParams *)pWdaParams->wdaMsgParam;
-
-   addStaSelfParams->status = wdiStatus ;
-
-   if (IS_WDI_STATUS_FAILURE(wdiStatus))
-   {
-         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-         vos_mem_free(pWdaParams) ;
-         pWDA->wdaAddSelfStaParams.wdaAddSelfStaFailReason
-                                        = WDA_ADDSTA_REQ_WDI_FAIL;
-         pWDA->wdaAddSelfStaParams.wdiAddStaSelfStaFailCounter++;
-         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Failure with status %d failcnter %d", __func__,
-                    wdiStatus,
-                    pWDA->wdaAddSelfStaParams.wdiAddStaSelfStaFailCounter);
-         vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                     WLAN_LOG_INDICATOR_HOST_DRIVER,
-                     WLAN_LOG_REASON_ADD_BSS_STA_FAIL,
-                     FALSE, TRUE);
-         WDA_SendMsg(pWDA, WDA_ADD_STA_SELF_RSP, (void *)addStaSelfParams , 0);
-   }
-
-   return ;
-}
 
 /*
  * FUNCTION: WDA_ProcessAddStaSelfReq
@@ -4757,18 +4186,15 @@
       vos_mem_free(wdiAddStaSelfReq) ;
       return( VOS_STATUS_E_NOMEM );
    }
-   wdiAddStaSelfReq->wdiReqStatusCB = WDA_ProcessAddStaSelfReqCallback;
-   wdiAddStaSelfReq->pUserData = pWdaParams;
+   wdiAddStaSelfReq->wdiReqStatusCB = NULL;
    vos_mem_copy( wdiAddStaSelfReq->wdiAddSTASelfInfo.selfMacAddr, pAddStaSelfReq->selfMacAddr, 6);
    wdiAddStaSelfReq->wdiAddSTASelfInfo.currDeviceMode = pAddStaSelfReq->currDeviceMode;
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pAddStaSelfReq;
-   pWdaParams->wdaWdiApiMsgParam = wdiAddStaSelfReq;
-
-   wstatus = WDI_AddSTASelfReq( wdiAddStaSelfReq,
-                  WDA_ProcessAddStaSelfRspCallback, pWdaParams);
+   pWdaParams->wdaWdiApiMsgParam = wdiAddStaSelfReq; 
+   wstatus = WDI_AddSTASelfReq( wdiAddStaSelfReq, WDA_ProcessAddStaSelfRsp, pWdaParams);
 
    if(IS_WDI_STATUS_FAILURE(wstatus))
    {
@@ -4811,16 +4237,7 @@
    
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
-   if (WDI_STATUS_SUCCESS != delStaSelfParams->status)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Failure with status %d", __func__,
-                    wdiDelStaSelfRspParams->wdiStatus);
-      vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-               WLAN_LOG_INDICATOR_HOST_DRIVER,
-               WLAN_LOG_REASON_DEL_BSS_STA_FAIL,
-               FALSE, TRUE);
-   }
+   
    WDA_SendMsg(pWDA, WDA_DEL_STA_SELF_RSP, (void *)delStaSelfParams , 0) ;
    return ;
 }
@@ -4857,10 +4274,6 @@
          VOS_ASSERT(0);
          vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
          vos_mem_free(pWdaParams) ;
-         vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                 WLAN_LOG_INDICATOR_HOST_DRIVER,
-                 WLAN_LOG_REASON_DEL_BSS_STA_FAIL,
-                 FALSE, TRUE);
          WDA_SendMsg(pWDA, WDA_DEL_STA_SELF_RSP, (void *)delStaSelfParams , 0) ;
    }
 
@@ -4963,8 +4376,6 @@
                          tAddBssParams *wdaBssParams)
 {
    v_U8_t keyIndex = 0;
-   v_U8_t i = 0;
-
    /* copy bssReq Params to WDI structure */
    vos_mem_copy(wdiBssParams->macBSSID,
                            wdaBssParams->bssId, sizeof(tSirMacAddr)) ;
@@ -5041,43 +4452,16 @@
                   wdaBssParams->extSetStaKeyParam.key[keyIndex].unicast;
                wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].keyDirection =
                   wdaBssParams->extSetStaKeyParam.key[keyIndex].keyDirection;
-
-               if(WDA_getHostWlanFeatCaps(DISA) && WDA_getFwWlanFeatCaps(DISA))
-               {
-                  for (i = 0; i < WLAN_MAX_KEY_RSC_LEN; i ++)
-                  {
-                    wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].keyRsc[i] =
-                     ~(wdaBssParams->extSetStaKeyParam.key[keyIndex].keyRsc[i]);
-                  }
-
-                  for (i = 0; i < SIR_MAC_MAX_KEY_LENGTH; i++)
-                  {
-                      wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].key[i] =
-                        ~(wdaBssParams->extSetStaKeyParam.key[keyIndex].key[i]);
-                  }
-                  VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                          FL("%s: Negated Keys"), __func__);
-               }
-               else
-               {
-                   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                           FL("%s: No change in Keys "), __func__);
-                   vos_mem_copy(
-                       wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].keyRsc,
-                       wdaBssParams->extSetStaKeyParam.key[keyIndex].keyRsc,
-                       WLAN_MAX_KEY_RSC_LEN);
-                   vos_mem_copy(
-                       wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].key,
-                       wdaBssParams->extSetStaKeyParam.key[keyIndex].key,
-                       SIR_MAC_MAX_KEY_LENGTH);
-               }
-
+               vos_mem_copy(wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].keyRsc, 
+                            wdaBssParams->extSetStaKeyParam.key[keyIndex].keyRsc, WLAN_MAX_KEY_RSC_LEN);
                wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].paeRole =
                   wdaBssParams->extSetStaKeyParam.key[keyIndex].paeRole;
                wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].keyLength =
                   wdaBssParams->extSetStaKeyParam.key[keyIndex].keyLength;
+               vos_mem_copy(wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].key, 
+                            wdaBssParams->extSetStaKeyParam.key[keyIndex].key, SIR_MAC_MAX_KEY_LENGTH);
             }
-            wdiBssParams->wdiExtSetKeyParam.ucNumKeys =
+            wdiBssParams->wdiExtSetKeyParam.ucNumKeys = 
                SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
          }
       }
@@ -5302,8 +4686,6 @@
          return QWLAN_HAL_CFG_ENABLE_CLOSE_LOOP;
       case WNI_CFG_ENABLE_LPWR_IMG_TRANSITION:
          return QWLAN_HAL_CFG_ENABLE_LPWR_IMG_TRANSITION;
-      case WNI_CFG_ENABLE_RTSCTS_HTVHT:
-         return QWLAN_HAL_CFG_ENABLE_RTSCTS_HTVHT;
       default:
       {
          VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5643,18 +5025,16 @@
 }
 
 /*
- * FUNCTION: WDA_GetFrameLogRspCallback
- * recieves get frame log response from FW
+ * FUNCTION: WDA_SpoofMacAddrRspCallback
+ * recieves spoof mac addr response from FW
  */
-void WDA_GetFrameLogRspCallback(WDI_GetFrameLogRspParamType* wdiRsp,
-                                                               void* pUserData)
+void WDA_SpoofMacAddrRspCallback(WDI_SpoofMacAddrRspParamType* wdiRsp, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
-   tAniGetFrameLogReq  *pGetFrameLogReqParams = NULL;
-
+   tWDA_CbContext *pWDA;
+   tSirSpoofMacAddrReq *spoofMacAddrReq;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "<------ Entering: %s " ,__func__);
+                                          "<------ %s " ,__func__);
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5663,242 +5043,19 @@
       return ;
    }
 
-   pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-      vos_mem_free(pWdaParams);
-      return ;
-   }
-
-   pGetFrameLogReqParams = (tAniGetFrameLogReq *)pWdaParams->wdaMsgParam;
-   if(NULL == pGetFrameLogReqParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                  "%s: pGetFrameLogReqParams received NULL", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-      vos_mem_free(pWdaParams);
-      return;
-   }
-
-   if (wdiRsp->wdiStatus != WDI_STATUS_SUCCESS) {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s:GetFrameLog with rsp status %d flag %d", __func__,
-               wdiRsp->wdiStatus,pGetFrameLogReqParams->getFrameLogCmdFlag);
-   }
-
-   /* free WDI command buffer only */
-   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-   vos_mem_free(pWdaParams->wdaMsgParam);
-   vos_mem_free(pWdaParams);
-
-   return ;
-
-}
-
-/*
- * FUNCTION: WDA_RssiMonitorStopRspCallback
- * recieves Rssi Monitor stop response from FW
- */
-void WDA_RssiMonitorStopRspCallback(WDI_RssiMonitorStopRspParamType *wdiRsp,
-                                                            void* pUserData)
-{
-   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tSirRssiMonitorReq *pRssiMonitorReqParams;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "<------ %s " ,__func__);
-
-   if(NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams received NULL", __func__);
-      VOS_ASSERT(0);
-      return ;
-   }
-
-   if(NULL == pWdaParams->wdaMsgParam)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams->wdaMsgParam is NULL", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pWdaParams);
-      return ;
-   }
-
-   pRssiMonitorReqParams = (tSirRssiMonitorReq *)pWdaParams->wdaMsgParam;
-
-   if(pRssiMonitorReqParams->rssiMonitorCallback)
-   {
-      pRssiMonitorReqParams->rssiMonitorCallback(
-                               pRssiMonitorReqParams->rssiMonitorCbContext,
-                               CONVERT_WDI2VOS_STATUS(wdiRsp->status));
-   }
-   else
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pFWLoggingInitParams callback is NULL", __func__);
-   }
-
-   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-   vos_mem_free(pWdaParams->wdaMsgParam);
-   vos_mem_free(pWdaParams);
-
-   return;
-}
-
-/*
- * FUNCTION: WDA_RssiMonitorStartRspCallback
- * recieves Rssi Monitor start response from FW
- */
-void WDA_RssiMonitorStartRspCallback(WDI_RssiMonitorStartRspParamType* wdiRsp,
-                                                            void* pUserData)
-{
-   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tSirRssiMonitorReq *pRssiMonitorReqParams;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "<------ %s " ,__func__);
-
-   if(NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams received NULL", __func__);
-      VOS_ASSERT(0);
-      return ;
-   }
-
-   if(NULL == pWdaParams->wdaMsgParam)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams->wdaMsgParam is NULL", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pWdaParams);
-      return ;
-   }
-
-   pRssiMonitorReqParams = (tSirRssiMonitorReq *)pWdaParams->wdaMsgParam;
-
-   if(pRssiMonitorReqParams->rssiMonitorCallback)
-   {
-      pRssiMonitorReqParams->rssiMonitorCallback(
-                               pRssiMonitorReqParams->rssiMonitorCbContext,
-                               CONVERT_WDI2VOS_STATUS(wdiRsp->status));
-   }
-   else
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pFWLoggingInitParams callback is NULL", __func__);
-   }
-
-   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-   vos_mem_free(pWdaParams->wdaMsgParam);
-   vos_mem_free(pWdaParams);
-
-   return;
-}
-
-/*
- * FUNCTION: WDA_FWLoggingInitRspCallback
- * recieves Mgmt Logging init response from FW
- */
-void WDA_FWLoggingInitRspCallback(WDI_FWLoggingInitRspParamType* wdiRsp,
-                                                            void* pUserData)
-{
-   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tSirFWLoggingInitParam *pFWLoggingInitParams;
-   tAniLoggingInitRsp *pLoggingInitRsp;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "<------ %s " ,__func__);
-
-   if(NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams received NULL", __func__);
-      VOS_ASSERT(0);
-      return ;
-   }
-
-   if(NULL == pWdaParams->wdaMsgParam)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams->wdaMsgParam is NULL", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pWdaParams);
-      return ;
-   }
-
-   pLoggingInitRsp = (tAniLoggingInitRsp *)vos_mem_malloc(sizeof(tAniLoggingInitRsp)) ;
-   if(NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: VOS MEM Alloc Failure for pLoggingInitRsp", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pWdaParams);
-      return;
-   }
-
-   pFWLoggingInitParams = (tSirFWLoggingInitParam *)pWdaParams->wdaMsgParam;
-   vos_mem_copy(pLoggingInitRsp, wdiRsp, sizeof(tAniLoggingInitRsp));
-
-   if(pFWLoggingInitParams->fwlogInitCallback)
-   {
-      pFWLoggingInitParams->fwlogInitCallback(
-                               pFWLoggingInitParams->fwlogInitCbContext,
-                               pLoggingInitRsp);
-   }
-   else
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pFWLoggingInitParams callback is NULL", __func__);
-   }
-
-   vos_mem_free(pLoggingInitRsp);
-   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-   vos_mem_free(pWdaParams->wdaMsgParam);
-   vos_mem_free(pWdaParams);
-
-   return;
-}
-
-/*
- * FUNCTION: WDA_SpoofMacAddrRspCallback
- * recieves spoof mac addr response from FW
- */
-void WDA_SpoofMacAddrRspCallback(WDI_SpoofMacAddrRspParamType* wdiRsp, void* pUserData)
-{
-   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "<------ %s " ,__func__);
-
-   if(NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams received NULL", __func__);
-      VOS_ASSERT(0);
-      return ;
-   }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+   spoofMacAddrReq = (tSirSpoofMacAddrReq *)pWdaParams->wdaMsgParam ;
 
-   if (wdiRsp->wdiStatus != WDI_STATUS_SUCCESS) {
+   if(wdiRsp->wdiStatus != WDI_STATUS_SUCCESS )
+   {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s:Spoofing with rsp status %d", __func__, wdiRsp->wdiStatus);
+              "%s: Unable to set Random Mac Addr in FW", __func__);
    }
-   WDA_SendMsg(pWDA, WDA_SPOOF_MAC_ADDR_RSP, NULL,
-                              CONVERT_WDI2SIR_STATUS(wdiRsp->wdiStatus));
 
+   vos_mem_free(spoofMacAddrReq);
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-   vos_mem_free(pWdaParams->wdaMsgParam);
    vos_mem_free(pWdaParams);
-
-   return;
+   return ;
 }
 
 /*
@@ -6361,12 +5518,12 @@
  */ 
 void WDA_SetLinkStateCallback(WDI_Status status, void* pUserData)
 {
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    tLinkStateParams *linkStateParams;
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__func__);
-   if (NULL == pWdaParams)
+   if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
              "%s: pWdaParams received NULL", __func__);
@@ -6374,18 +5531,6 @@
       return ;
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       vos_mem_free(pWdaParams);
-
-       VOS_ASSERT(0);
-       return ;
-   }
-
    linkStateParams = (tLinkStateParams *)pWdaParams->wdaMsgParam ;
    /*
     * In STA mode start the BA activity check timer after association
@@ -6403,9 +5548,14 @@
     * No respone required for WDA_SET_LINK_STATE so free the request 
     * param here
     */
-   vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-   vos_mem_free(pWdaParams);
-
+   if( pWdaParams != NULL )
+   {
+      if( pWdaParams->wdaWdiApiMsgParam != NULL )
+      {
+         vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
+      }
+      vos_mem_free(pWdaParams);
+   }
    return ;
 }
 /*
@@ -6499,8 +5649,8 @@
                               WDI_GetStatsRspParamsType *wdiGetStatsRsp,
                               void* pUserData)
 {
+   tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ;
    tAniGetPEStatsRsp *pGetPEStatsRspParams;
-   vos_msg_t vosMsg;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__func__);
@@ -6516,7 +5666,7 @@
       return;
    }
    vos_mem_set(pGetPEStatsRspParams, wdiGetStatsRsp->usMsgLen, 0);
-   pGetPEStatsRspParams->msgType = eWNI_SME_GET_STATISTICS_RSP;
+   pGetPEStatsRspParams->msgType = wdiGetStatsRsp->usMsgType;
    pGetPEStatsRspParams->msgLen = sizeof(tAniGetPEStatsRsp) + 
                    (wdiGetStatsRsp->usMsgLen - sizeof(WDI_GetStatsRspParamsType));
 
@@ -6529,17 +5679,8 @@
    vos_mem_copy( pGetPEStatsRspParams + 1,
                   wdiGetStatsRsp + 1,
                   wdiGetStatsRsp->usMsgLen - sizeof(WDI_GetStatsRspParamsType));
-
-   vosMsg.type = eWNI_SME_GET_STATISTICS_RSP;
-   vosMsg.bodyptr = (void *)pGetPEStatsRspParams;
-   vosMsg.bodyval = 0;
-   if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME,
-                                (vos_msg_t*)&vosMsg))
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: fail to post eWNI_SME_GET_STATISTICS_RSP", __func__);
-       vos_mem_free(pGetPEStatsRspParams);
-   }
+  /* send response to UMAC*/
+   WDA_SendMsg(pWDA, WDA_GET_STATISTICS_RSP, pGetPEStatsRspParams , 0) ;
    
    return;
 }
@@ -6554,8 +5695,6 @@
    WDI_Status status = WDI_STATUS_SUCCESS ;
    WDI_GetStatsReqParamsType wdiGetStatsParam;
    tAniGetPEStatsRsp *pGetPEStatsRspParams;
-   vos_msg_t vosMsg;
-
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__func__);
    wdiGetStatsParam.wdiGetStatsParamsInfo.ucSTAIdx = 
@@ -6579,21 +5718,12 @@
           vos_mem_free(pGetStatsParams);
           return VOS_STATUS_E_NOMEM;
       }
-      pGetPEStatsRspParams->msgType = eWNI_SME_GET_STATISTICS_RSP;
+      pGetPEStatsRspParams->msgType = WDA_GET_STATISTICS_RSP;
       pGetPEStatsRspParams->msgLen = sizeof(tAniGetPEStatsRsp);
       pGetPEStatsRspParams->staId = pGetStatsParams->staId;
       pGetPEStatsRspParams->rc    = eSIR_FAILURE;
-
-      vosMsg.type = eWNI_SME_GET_STATISTICS_RSP;
-      vosMsg.bodyptr = (void *)pGetPEStatsRspParams;
-      vosMsg.bodyval = 0;
-      if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME,
-                                    (vos_msg_t*)&vosMsg))
-      {
-          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                    "%s: fail to post eWNI_SME_GET_STATISTICS_RSP", __func__);
-          vos_mem_free(pGetPEStatsRspParams);
-      }
+      WDA_SendMsg(pWDA, WDA_GET_STATISTICS_RSP, 
+                                 (void *)pGetPEStatsRspParams, 0) ;
    }
    /* Free the request message */
    vos_mem_free(pGetStatsParams);
@@ -6688,7 +5818,6 @@
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s: VOS MEM Alloc Failure", __func__);
-      vos_mem_free(pGetRoamRssiParams);
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
@@ -6835,7 +5964,7 @@
    tAddBAParams *pAddBAReqParams;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__func__);
-   if (NULL == pWdaParams)
+   if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                 "%s: pWdaParams received NULL", __func__);
@@ -6843,18 +5972,6 @@
       return ;
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       vos_mem_free(pWdaParams);
-
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pAddBAReqParams = (tAddBAParams *)pWdaParams->wdaMsgParam;
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams);
@@ -6868,7 +5985,7 @@
  * Request to WDI to Update the ADDBA REQ params.
  */ 
 VOS_STATUS WDA_ProcessAddBAReq(tWDA_CbContext *pWDA, VOS_STATUS status,
-           tANI_U16 baSessionID, tANI_U8 staIdx, tANI_U8 ucWinSize, tAddBAParams *pAddBAReqParams)
+           tANI_U16 baSessionID, tANI_U8 staIdx, tAddBAParams *pAddBAReqParams)
 {
    WDI_Status wstatus;
    WDI_AddBAReqParamsType *wdiAddBAReqParam = 
@@ -6898,7 +6015,7 @@
       WDI_AddBAReqinfoType *wdiAddBaInfo = &wdiAddBAReqParam->wdiBAInfoType ;
       wdiAddBaInfo->ucSTAIdx = staIdx ;
       wdiAddBaInfo->ucBaSessionID = baSessionID ;
-      wdiAddBaInfo->ucWinSize     = ucWinSize ;
+      wdiAddBaInfo->ucWinSize     = WDA_BA_MAX_WINSIZE ;
    } while(0) ;
    wdiAddBAReqParam->wdiReqStatusCB = NULL ;
    pWdaParams->pWdaContext = pWDA;
@@ -6929,7 +6046,7 @@
 {
    VOS_STATUS status = VOS_STATUS_SUCCESS ;
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA; 
    tAddBAParams *pAddBAReqParams ;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__func__);
@@ -6941,17 +6058,6 @@
       return ;
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       vos_mem_free(pWdaParams);
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pAddBAReqParams = (tAddBAParams *)pWdaParams->wdaMsgParam;
    if( NULL == pAddBAReqParams )
    {
@@ -6965,12 +6071,13 @@
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams);
    /* 
-    * if BA direction is for recipient, update TL with BA session params and send
+    * if WDA in update TL state, update TL with BA session parama and send
     * another request to HAL(/WDI) (ADD_BA_REQ)
     */
+   
    if((VOS_STATUS_SUCCESS == 
                        CONVERT_WDI2VOS_STATUS(wdiAddBaSession->wdiStatus)) && 
-                                 (eBA_RECIPIENT == pAddBAReqParams->baDirection))
+                                 (WDA_BA_UPDATE_TL_STATE == pWDA->wdaState))
    {
       /* Update TL with BA info received from HAL/WDI */
       status =  WDA_TL_BA_SESSION_ADD(pWDA->pVosContext,
@@ -6981,8 +6088,7 @@
                                         wdiAddBaSession->ucWinSize,
                                         wdiAddBaSession->usBaSSN );
       WDA_ProcessAddBAReq(pWDA, status, wdiAddBaSession->usBaSessionID, 
-                                      wdiAddBaSession->ucSTAIdx,
-                                      wdiAddBaSession->ucWinSize, pAddBAReqParams) ;
+                                      wdiAddBaSession->ucSTAIdx, pAddBAReqParams) ;
    }
    else
    {
@@ -7056,7 +6162,11 @@
       wdiBAInfoType->usBaTimeout = pAddBAReqParams->baTimeout;
       wdiBAInfoType->usBaSSN = pAddBAReqParams->baSSN;
       wdiBAInfoType->ucBaDirection = pAddBAReqParams->baDirection;
-
+      /* check the BA direction and update state accordingly */
+      (eBA_RECIPIENT == wdiBAInfoType->ucBaDirection) 
+                                 ? (pWDA->wdaState = WDA_BA_UPDATE_TL_STATE)
+                                 : (pWDA->wdaState = WDA_BA_UPDATE_LIM_STATE);
+ 
    }while(0) ;
    wdiAddBASessionReqParam->wdiReqStatusCB = NULL ;
    pWdaParams->pWdaContext = pWDA;
@@ -7154,7 +6264,6 @@
       return ;
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-
    pDelBAReqParams = (tDelBAParams *)pWdaParams->wdaMsgParam ;
    /* Notify TL about DEL BA in case of recipinet */
    if((VOS_STATUS_SUCCESS == CONVERT_WDI2VOS_STATUS(status)) && 
@@ -7298,7 +6407,7 @@
 
    if(!WDA_getFwWlanFeatCaps(UPDATE_CHANNEL_LIST))
    {
-       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                "Update channel list capability Not Supported");
        vos_mem_free(pChanList);
        return VOS_STATUS_E_INVAL;
@@ -7376,9 +6485,10 @@
 
        WDA_SET_CHANNEL_MAX_POWER(pChanInfoType, pChanList->chanParam[i].pwr);
        WDA_SET_CHANNEL_REG_POWER(pChanInfoType, pChanList->chanParam[i].pwr);
-       WDA_SET_CUURENT_REG_DOMAIN(pChanInfoType, pChanList->regId);
+
        pChanInfoType++;
    }
+
    pwdiUpdateChReqParam->wdiReqStatusCB = NULL;
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = (void *)pChanList;
@@ -7405,7 +6515,7 @@
 void WDA_AddTSReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA; 
    tAddTsParams *pAddTsReqParams;
    
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -7418,18 +6528,6 @@
       return ;
    }
    pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       vos_mem_free(pWdaParams);
-
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pAddTsReqParams = (tAddTsParams *)pWdaParams->wdaMsgParam ;
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams);
@@ -7750,14 +6848,6 @@
       return ;
    }
    pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pGetTsmStatsReqParams = (tAniGetTsmStatsReq *)pWdaParams->wdaMsgParam;
 
    if(NULL == pGetTsmStatsReqParams)
@@ -7911,7 +7001,6 @@
    {
        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                "Invalid p2pIeOffset = %hu ", pSendbeaconParams->p2pIeOffset);
-       vos_mem_free(pSendbeaconParams);
        VOS_ASSERT( 0 );
        return WDI_STATUS_E_FAILURE;
    }
@@ -7958,10 +7047,7 @@
                                           "------> %s " ,__func__);
 
    if (!wdiSendProbeRspParam)
-   {
-      vos_mem_free(pSendProbeRspParams);
       return CONVERT_WDI2VOS_STATUS(WDI_STATUS_MEM_FAILURE);
-   }
 
    /*Copy update probe response parameters*/
    vos_mem_copy(wdiSendProbeRspParam->wdiProbeRspTemplateInfo.macBSSID,
@@ -8013,17 +7099,6 @@
       return ;
    }
    pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       vos_mem_free(pWdaParams);
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pMaxTxPowerParams = (tMaxTxPowerParams *)pWdaParams->wdaMsgParam ;
    if( NULL == pMaxTxPowerParams )
    {
@@ -8132,17 +7207,6 @@
       return ;
    }
    pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       vos_mem_free(pWdaParams);
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pMxTxPwrPerBandParams = (tMaxTxPowerPerBandParams*)pWdaParams->wdaMsgParam;
    if ( NULL == pMxTxPwrPerBandParams )
    {
@@ -8250,17 +7314,6 @@
       return ;
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       vos_mem_free(pWdaParams);
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pTxPowerParams = (tSirSetTxPowerReq *)pWdaParams->wdaMsgParam;
    if(NULL == pTxPowerParams)
    {
@@ -8386,7 +7439,6 @@
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s: VOS MEM Alloc Failure", __func__); 
-      vos_mem_free(pP2pPsConfigParams);
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
@@ -8464,17 +7516,13 @@
    }
    pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
 
-   if (NULL == pWDA)
+   if(NULL == pWdaParams)
    {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       vos_mem_free(pWdaParams);
-       VOS_ASSERT(0);
-       return ;
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __func__);
+      VOS_ASSERT(0) ;
+      return ;
    }
-
    pTdlsLinkEstablishParams = (tTdlsLinkEstablishParams *)pWdaParams->wdaMsgParam ;
    if( NULL == pTdlsLinkEstablishParams )
    {
@@ -8510,7 +7558,6 @@
     {
         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                    "%s: VOS MEM Alloc Failure", __func__);
-        vos_mem_free(pTdlsLinkEstablishParams);
         VOS_ASSERT(0);
         return VOS_STATUS_E_NOMEM;
     }
@@ -8592,17 +7639,13 @@
    }
    pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
 
-   if (NULL == pWDA)
+   if(NULL == pWdaParams)
    {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       vos_mem_free(pWdaParams);
-       VOS_ASSERT(0);
-       return ;
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "%s: pWdaParams received NULL", __func__);
+      VOS_ASSERT(0) ;
+      return ;
    }
-
    pTdlsChanSwitchParams = (tTdlsChanSwitchParams *)pWdaParams->wdaMsgParam ;
    if( NULL == pTdlsChanSwitchParams )
    {
@@ -8638,7 +7681,6 @@
     {
         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                    "%s: VOS MEM Alloc Failure", __func__);
-        vos_mem_free(pTdlsChanSwitchParams);
         VOS_ASSERT(0);
         return VOS_STATUS_E_NOMEM;
     }
@@ -8695,7 +7737,7 @@
 void WDA_AggrAddTSReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData ; 
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    tAggrAddTsParams *pAggrAddTsReqParams;
    int i;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -8709,18 +7751,6 @@
    }
 
    pWDA = pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       vos_mem_free(pWdaParams);
-
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pAggrAddTsReqParams = (tAggrAddTsParams *)pWdaParams->wdaMsgParam ;
    
    for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
@@ -8754,7 +7784,6 @@
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s: VOS MEM Alloc Failure", __func__); 
-      vos_mem_free(pAggrAddTsReqParams);
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
@@ -8873,7 +7902,7 @@
 void WDA_EnterImpsRspCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s status=%d" ,__func__,status);
@@ -8886,39 +7915,9 @@
    }
 
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       vos_mem_free(pWdaParams);
-       VOS_ASSERT(0);
-       return ;
-   }
 
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams);
-   if (WDI_STATUS_SUCCESS != status)
-   {
-       pWDA->failureCounts.enterImpsFailureCount++;
-       if (BMPS_IMPS_FAILURE_REPORT_THRESHOLD ==
-                 pWDA->failureCounts.enterImpsFailureCount)
-       {
-          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: Status %d fail count %d", __func__, status,
-               pWDA->failureCounts.enterImpsFailureCount);
-           pWDA->failureCounts.enterImpsFailureCount = 0;
-           vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                 WLAN_LOG_INDICATOR_HOST_DRIVER,
-                 WLAN_LOG_REASON_ENTER_IMPS_BMPS_FAIL,
-                 FALSE, TRUE);
-       }
-   }
-   else
-   {
-      pWDA->failureCounts.enterImpsFailureCount = 0;
-   }
    WDA_SendMsg(pWDA, WDA_ENTER_IMPS_RSP, NULL , status) ;
    return ;
 }
@@ -8932,7 +7931,7 @@
 void WDA_EnterImpsReqCallback(WDI_Status wdiStatus, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
               "<------ %s, wdiStatus: %d", __func__, wdiStatus);
@@ -8946,36 +7945,11 @@
    }
 
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       vos_mem_free(pWdaParams);
-
-       VOS_ASSERT(0);
-       return ;
-   }
-
 
    if(IS_WDI_STATUS_FAILURE(wdiStatus))
    {
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams);
-      pWDA->failureCounts.enterImpsFailureCount++;
-      if (BMPS_IMPS_FAILURE_REPORT_THRESHOLD ==
-                pWDA->failureCounts.enterImpsFailureCount)
-      {
-         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: wdiStatus %d fail count %d", __func__, wdiStatus,
-               pWDA->failureCounts.enterImpsFailureCount);
-         pWDA->failureCounts.enterImpsFailureCount = 0;
-         vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-               WLAN_LOG_INDICATOR_HOST_DRIVER,
-               WLAN_LOG_REASON_ENTER_IMPS_BMPS_FAIL,
-               FALSE, TRUE);
-      }
       WDA_SendMsg(pWDA, WDA_ENTER_IMPS_RSP, NULL,
                   CONVERT_WDI2SIR_STATUS(wdiStatus));
    }
@@ -8991,7 +7965,6 @@
    WDI_Status status = WDI_STATUS_SUCCESS ;
    WDI_EnterImpsReqParamsType *wdiEnterImpsReqParams;
    tWDA_ReqParams *pWdaParams;
-   static int failcnt = 0;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__func__);
 
@@ -9031,10 +8004,8 @@
                              pWdaParams);
    if(IS_WDI_STATUS_FAILURE(status))
    {
-      if (! (failcnt & 0xF))
-          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "Failure in Enter IMPS REQ WDI API, free all the memory " );
-      failcnt++;
+      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+              "Failure in Enter IMPS REQ WDI API, free all the memory " );
       vos_mem_free(wdiEnterImpsReqParams);
       vos_mem_free(pWdaParams);
       WDA_SendMsg(pWDA, WDA_ENTER_IMPS_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
@@ -9065,27 +8036,6 @@
 
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams);
-   if (WDI_STATUS_SUCCESS != status)
-   {
-       pWDA->failureCounts.exitImpsFailureCount++;
-       if (BMPS_IMPS_FAILURE_REPORT_THRESHOLD ==
-                 pWDA->failureCounts.exitImpsFailureCount)
-       {
-          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: Status %d fail count %d", __func__,
-               status,
-               pWDA->failureCounts.exitImpsFailureCount);
-           pWDA->failureCounts.exitImpsFailureCount = 0;
-           vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                 WLAN_LOG_INDICATOR_HOST_DRIVER,
-                 WLAN_LOG_REASON_EXIT_IMPS_BMPS_FAIL,
-                 FALSE, TRUE);
-       }
-   }
-   else
-   {
-      pWDA->failureCounts.exitImpsFailureCount = 0;
-   }
 
    WDA_SendMsg(pWDA, WDA_EXIT_IMPS_RSP, NULL , (status));
    return;
@@ -9097,7 +8047,6 @@
 void WDA_ExitImpsReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__func__);
    if(NULL == pWdaParams)
@@ -9107,26 +8056,11 @@
       VOS_ASSERT(0);
       return;
    }
-   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+
    if (IS_WDI_STATUS_FAILURE(status))
    {
        vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
        vos_mem_free(pWdaParams);
-
-       pWDA->failureCounts.exitImpsFailureCount++;
-       if (BMPS_IMPS_FAILURE_REPORT_THRESHOLD ==
-                 pWDA->failureCounts.exitImpsFailureCount)
-       {
-          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: wdiStatus %d fail count %d", __func__,
-               status,
-               pWDA->failureCounts.exitImpsFailureCount);
-          pWDA->failureCounts.exitImpsFailureCount = 0;
-          vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                     WLAN_LOG_INDICATOR_HOST_DRIVER,
-                     WLAN_LOG_REASON_EXIT_IMPS_BMPS_FAIL,
-                     FALSE, TRUE);
-       }
        if (WDI_STATUS_DEV_INTERNAL_FAILURE == status)
        {
            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -9195,7 +8129,7 @@
 void WDA_EnterBmpsRespCallback(WDI_EnterBmpsRspParamsType *pwdiEnterBmpsRsp, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    tEnterBmpsParams *pEnterBmpsRspParams;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -9209,21 +8143,6 @@
    }
 
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-
-       if(pWdaParams->wdaWdiApiMsgParam)
-       {
-          vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       }
-       vos_mem_free(pWdaParams);
-
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pEnterBmpsRspParams = (tEnterBmpsParams *)pWdaParams->wdaMsgParam;
 
    pEnterBmpsRspParams->bssIdx = pwdiEnterBmpsRsp->bssIdx;
@@ -9231,27 +8150,6 @@
 
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams) ;
-   if (eHAL_STATUS_SUCCESS != pEnterBmpsRspParams->status)
-   {
-       pWDA->failureCounts.enterBmpsFailureCount++;
-       if (BMPS_IMPS_FAILURE_REPORT_THRESHOLD ==
-                 pWDA->failureCounts.enterBmpsFailureCount)
-       {
-           VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: wdiStatus %d fail count %d", __func__,
-               pwdiEnterBmpsRsp->wdiStatus,
-               pWDA->failureCounts.enterBmpsFailureCount);
-           pWDA->failureCounts.enterBmpsFailureCount = 0;
-           vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                 WLAN_LOG_INDICATOR_HOST_DRIVER,
-                 WLAN_LOG_REASON_ENTER_IMPS_BMPS_FAIL,
-                 FALSE, TRUE);
-       }
-   }
-   else
-   {
-      pWDA->failureCounts.enterBmpsFailureCount = 0;
-   }
    WDA_SendMsg(pWDA, WDA_ENTER_BMPS_RSP, (void *)pEnterBmpsRspParams , 0);
 
    return ;
@@ -9264,7 +8162,7 @@
 void WDA_EnterBmpsReqCallback(WDI_Status wdiStatus, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    tEnterBmpsParams *pEnterBmpsRspParams;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -9279,14 +8177,6 @@
    }
 
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pEnterBmpsRspParams = (tEnterBmpsParams *)pWdaParams->wdaMsgParam;
    pEnterBmpsRspParams->status = wdiStatus;
 
@@ -9294,20 +8184,6 @@
    {
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams);
-      pWDA->failureCounts.enterBmpsFailureCount++;
-      if (BMPS_IMPS_FAILURE_REPORT_THRESHOLD ==
-                 pWDA->failureCounts.enterBmpsFailureCount)
-      {
-         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: wdiStatus %d fail count %d", __func__,
-               wdiStatus,
-               pWDA->failureCounts.enterBmpsFailureCount);
-         pWDA->failureCounts.enterBmpsFailureCount = 0;
-         vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                     WLAN_LOG_INDICATOR_HOST_DRIVER,
-                     WLAN_LOG_REASON_ENTER_IMPS_BMPS_FAIL,
-                     FALSE, TRUE);
-      }
       WDA_SendMsg(pWDA, WDA_ENTER_BMPS_RSP, (void *)pEnterBmpsRspParams, 0);
    }
 
@@ -9401,7 +8277,7 @@
 void WDA_ExitBmpsRespCallback(WDI_ExitBmpsRspParamsType *pwdiExitBmpsRsp, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    tExitBmpsParams *pExitBmpsRspParams;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -9415,50 +8291,13 @@
    }
 
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-
-       if(pWdaParams->wdaWdiApiMsgParam)
-       {
-          vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       }
-       vos_mem_free(pWdaParams);
-
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pExitBmpsRspParams = (tExitBmpsParams *)pWdaParams->wdaMsgParam;
 
    pExitBmpsRspParams->bssIdx = pwdiExitBmpsRsp->bssIdx;
    pExitBmpsRspParams->status = (pwdiExitBmpsRsp->wdiStatus);
 
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-   vos_mem_free(pWdaParams);
-
-   if (WDI_STATUS_SUCCESS != pwdiExitBmpsRsp->wdiStatus)
-   {
-       pWDA->failureCounts.exitBmpsFailureCount++;
-       if (BMPS_IMPS_FAILURE_REPORT_THRESHOLD ==
-                 pWDA->failureCounts.exitBmpsFailureCount)
-       {
-          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: Status %d fail count %d", __func__,
-               pExitBmpsRspParams->status,
-               pWDA->failureCounts.exitBmpsFailureCount);
-           pWDA->failureCounts.exitBmpsFailureCount = 0;
-           vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                 WLAN_LOG_INDICATOR_HOST_DRIVER,
-                 WLAN_LOG_REASON_EXIT_IMPS_BMPS_FAIL,
-                 FALSE, TRUE);
-       }
-   }
-   else
-   {
-      pWDA->failureCounts.exitBmpsFailureCount = 0;
-   }
+   vos_mem_free(pWdaParams) ;
 
    WDA_SendMsg(pWDA, WDA_EXIT_BMPS_RSP, (void *)pExitBmpsRspParams , 0) ;
    return ;
@@ -9471,7 +8310,7 @@
 void WDA_ExitBmpsReqCallback(WDI_Status wdiStatus, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    tExitBmpsParams *pExitBmpsRspParams;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -9486,14 +8325,6 @@
    }
 
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pExitBmpsRspParams = (tExitBmpsParams *)pWdaParams->wdaMsgParam;
    pExitBmpsRspParams->status = wdiStatus;
 
@@ -9501,20 +8332,6 @@
    {
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams);
-      pWDA->failureCounts.exitBmpsFailureCount++;
-      if (BMPS_IMPS_FAILURE_REPORT_THRESHOLD ==
-                 pWDA->failureCounts.exitBmpsFailureCount)
-      {
-         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: wdiStatus %d fail count %d", __func__,
-               wdiStatus,
-               pWDA->failureCounts.exitBmpsFailureCount);
-         pWDA->failureCounts.exitBmpsFailureCount = 0;
-         vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                     WLAN_LOG_INDICATOR_HOST_DRIVER,
-                     WLAN_LOG_REASON_EXIT_IMPS_BMPS_FAIL,
-                     FALSE, TRUE);
-      }
       WDA_SendMsg(pWDA, WDA_EXIT_BMPS_RSP, (void *)pExitBmpsRspParams, 0);
    }
 
@@ -9582,7 +8399,7 @@
 void WDA_EnterUapsdRespCallback(  WDI_EnterUapsdRspParamsType *pwdiEnterUapsdRspParams, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    tUapsdParams *pEnterUapsdRsqParams;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__func__);
@@ -9595,21 +8412,6 @@
    }
 
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-
-       if(pWdaParams->wdaWdiApiMsgParam)
-       {
-          vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       }
-       vos_mem_free(pWdaParams);
-
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pEnterUapsdRsqParams = (tUapsdParams *)pWdaParams->wdaMsgParam;
 
    pEnterUapsdRsqParams->bssIdx = pwdiEnterUapsdRspParams->bssIdx;
@@ -9643,14 +8445,6 @@
    }
 
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pEnterUapsdRsqParams = (tUapsdParams *)pWdaParams->wdaMsgParam;
    pEnterUapsdRsqParams->status = wdiStatus;
 
@@ -9772,7 +8566,7 @@
 void WDA_ExitUapsdReqCallback(WDI_Status wdiStatus, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    tExitUapsdParams *pExitUapsdRspParams;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -9787,14 +8581,6 @@
    }
 
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pExitUapsdRspParams = (tExitUapsdParams *)pWdaParams->wdaMsgParam;
    pExitUapsdRspParams->status = wdiStatus;
 
@@ -10415,410 +9201,6 @@
    }
    return status;
 }
-
-/*
- * FUNCTION: WDA_ProcessGetFrameLogReq
- * Request to WDI to get the Frame Log.
- */
-VOS_STATUS WDA_ProcessGetFrameLogReq(tWDA_CbContext *pWDA,
-                                  tAniGetFrameLogReq *pGetFrameLog)
-{
-   VOS_STATUS status = VOS_STATUS_SUCCESS;
-   WDI_Status wstatus;
-   WDI_GetFrameLogReqInfoType *wdiGetFrameLogInfo;
-   tWDA_ReqParams *pWdaParams ;
-
-   /* Sanity Check*/
-   if(NULL == pGetFrameLog)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: pFWLoggingInitParam received NULL", __func__);
-      VOS_ASSERT(0) ;
-      return VOS_STATUS_E_FAULT;
-   }
-
-   wdiGetFrameLogInfo = (WDI_GetFrameLogReqInfoType *)vos_mem_malloc(
-         sizeof(WDI_GetFrameLogReqInfoType));
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "------> %s " ,__func__);
-
-   if(NULL == wdiGetFrameLogInfo)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pGetFrameLog);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams));
-   if(NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(wdiGetFrameLogInfo);
-      vos_mem_free(pGetFrameLog);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   wdiGetFrameLogInfo->flags = pGetFrameLog->getFrameLogCmdFlag;
-
-   pWdaParams->pWdaContext = pWDA;
-   pWdaParams->wdaMsgParam = pGetFrameLog;
-   pWdaParams->wdaWdiApiMsgParam = (void *)wdiGetFrameLogInfo;
-
-   wstatus = WDI_GetFrameLogReq(wdiGetFrameLogInfo,
-                           (WDI_GetFrameLogRspCb)WDA_GetFrameLogRspCallback,
-                           pWdaParams);
-   if(IS_WDI_STATUS_FAILURE(wstatus))
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "Failure in get frame log REQ WDI API, free all the memory" );
-      status = CONVERT_WDI2VOS_STATUS(wstatus);
-      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-      vos_mem_free(pWdaParams->wdaMsgParam);
-      vos_mem_free(pWdaParams);
-   }
-   return status;
-}
-
-
-/*
- * FUNCTION: WDA_FatalEventLogsRspCallback
- * recieves Flush Logs response from FW
- */
-
-void WDA_FatalEventLogsRspCallback(WDI_FatalEventLogsRspParamType* wdiRsp,
-                                        void* pUserData)
-{
-    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                     "<------ %s,wdiStatus:%d  " ,
-                     __func__, wdiRsp->wdiStatus);
-    if(NULL == pWdaParams)
-    {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: pWdaParams received NULL", __func__);
-       VOS_ASSERT(0);
-       return ;
-    }
-
-    if(NULL == pWdaParams->wdaMsgParam)
-    {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: pWdaParams->wdaMsgParam is NULL", __func__);
-       VOS_ASSERT(0);
-       vos_mem_free(pWdaParams);
-       return ;
-    }
-
-    if(IS_WDI_STATUS_FAILURE(wdiRsp->wdiStatus))
-    {
-        /*
-              * If it is failure, it means JOb is already posted by FW
-              * for logging, so for failure scenario also we will get the
-              * done indication
-              */
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: Fatal Event Rsp Failure,wdiStatus : %d ",
-               __func__, wdiRsp->wdiStatus);
-    }
-
-    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-    vos_mem_free(pWdaParams->wdaMsgParam);
-    vos_mem_free(pWdaParams);
-
-    return;
-
-}
-
-/*
- * FUNCTION: WDA_ProcessFatalEventLogsReq
- * Request to WDI to send the fatal Event Logs Req.
- */
-
-VOS_STATUS WDA_ProcessFatalEventLogsReq(tWDA_CbContext *pWDA,
-                              tSirFatalEventLogsReqParam *pFatalEventLogsReqParam)
-{
-    VOS_STATUS status = VOS_STATUS_SUCCESS;
-    WDI_FatalEventLogsReqInfoType *wdiFatalEventLogsReqInfo;
-    tWDA_ReqParams *pWdaParams ;
-    WDI_Status wstatus;
-
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "------> %s " ,__func__);
-    if (NULL == pFatalEventLogsReqParam)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: pMgmtLoggingInitParam received NULL", __func__);
-        VOS_ASSERT(0) ;
-        return VOS_STATUS_E_FAULT;
-    }
-    wdiFatalEventLogsReqInfo = (WDI_FatalEventLogsReqInfoType *)vos_mem_malloc(
-                                       sizeof(WDI_FatalEventLogsReqInfoType));
-    if(NULL == wdiFatalEventLogsReqInfo)
-    {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                            "%s: VOS MEM Alloc Failure", __func__);
-       VOS_ASSERT(0);
-       vos_mem_free(pFatalEventLogsReqParam);
-       return VOS_STATUS_E_NOMEM;
-    }
-    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
-    if(NULL == pWdaParams)
-    {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                            "%s: VOS MEM Alloc Failure", __func__);
-       VOS_ASSERT(0);
-       vos_mem_free(wdiFatalEventLogsReqInfo);
-       vos_mem_free(pFatalEventLogsReqParam);
-       return VOS_STATUS_E_NOMEM;
-    }
-    wdiFatalEventLogsReqInfo->reason_code = pFatalEventLogsReqParam->reason_code;
-    pWdaParams->pWdaContext = pWDA;
-    pWdaParams->wdaMsgParam = pFatalEventLogsReqParam;
-    pWdaParams->wdaWdiApiMsgParam = (void *)wdiFatalEventLogsReqInfo;
-
-   wstatus = WDI_FatalEventLogsReq(wdiFatalEventLogsReqInfo,
-                       (WDI_FatalEventLogsRspCb)WDA_FatalEventLogsRspCallback,
-                        pWdaParams);
-   if(IS_WDI_STATUS_FAILURE(wstatus))
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "Failure in Mgmt Logging init REQ WDI API, free all the memory" );
-      status = CONVERT_WDI2VOS_STATUS(wstatus);
-      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-      vos_mem_free(pWdaParams->wdaMsgParam);
-      vos_mem_free(pWdaParams);
-   }
-
-   return status;
-
-}
-
-/*
- * FUNCTION: WDA_ProcessFWLoggingInitReq
- *
- */
-VOS_STATUS WDA_ProcessFWLoggingInitReq(tWDA_CbContext *pWDA,
-                                tSirFWLoggingInitParam *pFWLoggingInitParam)
-{
-   VOS_STATUS status = VOS_STATUS_SUCCESS;
-   WDI_Status wstatus;
-   WDI_FWLoggingInitReqInfoType *wdiFWLoggingInitInfo;
-   tWDA_ReqParams *pWdaParams ;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "------> %s " ,__func__);
-
-   /* Sanity Check*/
-   if(NULL == pFWLoggingInitParam)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: pFWLoggingInitParam received NULL", __func__);
-      VOS_ASSERT(0) ;
-      return VOS_STATUS_E_FAULT;
-   }
-
-   wdiFWLoggingInitInfo = (WDI_FWLoggingInitReqInfoType *)vos_mem_malloc(
-                                       sizeof(WDI_FWLoggingInitReqInfoType));
-   if(NULL == wdiFWLoggingInitInfo)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pFWLoggingInitParam);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
-   if(NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(wdiFWLoggingInitInfo);
-      vos_mem_free(pFWLoggingInitParam);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   wdiFWLoggingInitInfo->enableFlag = pFWLoggingInitParam->enableFlag;
-   wdiFWLoggingInitInfo->frameType = pFWLoggingInitParam->frameType;
-   wdiFWLoggingInitInfo->frameSize = pFWLoggingInitParam->frameSize;
-   wdiFWLoggingInitInfo->bufferMode = pFWLoggingInitParam->bufferMode;
-   wdiFWLoggingInitInfo->continuousFrameLogging =
-                                 pFWLoggingInitParam->continuousFrameLogging;
-   wdiFWLoggingInitInfo->minLogBufferSize=
-                                 pFWLoggingInitParam->minLogBufferSize;
-   wdiFWLoggingInitInfo->maxLogBufferSize=
-                                 pFWLoggingInitParam->maxLogBufferSize;
-
-   pWdaParams->pWdaContext = pWDA;
-   pWdaParams->wdaMsgParam = pFWLoggingInitParam;
-   pWdaParams->wdaWdiApiMsgParam = (void *)wdiFWLoggingInitInfo;
-
-   wstatus = WDI_FWLoggingInitReq(wdiFWLoggingInitInfo,
-                       (WDI_FWLoggingInitRspCb)WDA_FWLoggingInitRspCallback,
-                        pWdaParams);
-   if(IS_WDI_STATUS_FAILURE(wstatus))
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "Failure in Mgmt Logging init REQ WDI API, free all the memory" );
-      status = CONVERT_WDI2VOS_STATUS(wstatus);
-      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-      vos_mem_free(pWdaParams->wdaMsgParam);
-      vos_mem_free(pWdaParams);
-   }
-
-   return status;
-}
-
-/*
- * FUNCTION: WDA_ProcessStartRssiMonitorReq
- *
- */
-VOS_STATUS WDA_ProcessStartRssiMonitorReq(tWDA_CbContext *pWDA,
-                                tSirRssiMonitorReq *pRssiMonitorReqParam)
-{
-   VOS_STATUS status = VOS_STATUS_SUCCESS;
-   WDI_Status wstatus;
-   WDI_RssiMonitorReqInfoType *wdiRssiMonitorInfo;
-   tWDA_ReqParams *pWdaParams ;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "------> %s " ,__func__);
-
-   /* Sanity Check*/
-   if(NULL == pRssiMonitorReqParam)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: pRssiMonitorReqParam received NULL", __func__);
-      VOS_ASSERT(0) ;
-      return VOS_STATUS_E_FAULT;
-   }
-
-   wdiRssiMonitorInfo = (WDI_RssiMonitorReqInfoType *)vos_mem_malloc(
-                                       sizeof(WDI_RssiMonitorReqInfoType));
-   if(NULL == wdiRssiMonitorInfo)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pRssiMonitorReqParam);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
-   if(NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(wdiRssiMonitorInfo);
-      vos_mem_free(pRssiMonitorReqParam);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   wdiRssiMonitorInfo->requestId = pRssiMonitorReqParam->requestId;
-   wdiRssiMonitorInfo->minRssi = pRssiMonitorReqParam->minRssi;
-   wdiRssiMonitorInfo->maxRssi = pRssiMonitorReqParam->maxRssi;
-   vos_mem_copy(wdiRssiMonitorInfo->currentBssId,
-                &(pRssiMonitorReqParam->currentBssId), sizeof(tSirMacAddr));
-
-   pWdaParams->pWdaContext = pWDA;
-   pWdaParams->wdaMsgParam = pRssiMonitorReqParam;
-   pWdaParams->wdaWdiApiMsgParam = (void *)wdiRssiMonitorInfo;
-
-   wstatus = WDI_StartRssiMonitorReq(wdiRssiMonitorInfo,
-                       (WDI_RssiMonitorStartRspCb)WDA_RssiMonitorStartRspCallback,
-                        pWdaParams);
-   if(IS_WDI_STATUS_FAILURE(wstatus))
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "Failure in Mgmt Logging init REQ WDI API, free all the memory" );
-      status = CONVERT_WDI2VOS_STATUS(wstatus);
-      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-      vos_mem_free(pWdaParams->wdaMsgParam);
-      vos_mem_free(pWdaParams);
-   }
-
-   return status;
-}
-
-/*
- * FUNCTION: WDA_ProcessStopRssiMonitorReq
- *
- */
-VOS_STATUS WDA_ProcessStopRssiMonitorReq(tWDA_CbContext *pWDA,
-                                tSirRssiMonitorReq *pRssiMonitorReqParam)
-{
-   VOS_STATUS status = VOS_STATUS_SUCCESS;
-   WDI_Status wstatus;
-   WDI_RssiMonitorReqInfoType *wdiRssiMonitorInfo;
-   tWDA_ReqParams *pWdaParams ;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "------> %s " ,__func__);
-
-   /* Sanity Check*/
-   if(NULL == pRssiMonitorReqParam)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: pRssiMonitorReqParam received NULL", __func__);
-      VOS_ASSERT(0) ;
-      return VOS_STATUS_E_FAULT;
-   }
-
-   wdiRssiMonitorInfo = (WDI_RssiMonitorReqInfoType *)vos_mem_malloc(
-                                       sizeof(WDI_RssiMonitorReqInfoType));
-   if(NULL == wdiRssiMonitorInfo)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pRssiMonitorReqParam);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
-   if(NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(wdiRssiMonitorInfo);
-      vos_mem_free(pRssiMonitorReqParam);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   wdiRssiMonitorInfo->requestId = pRssiMonitorReqParam->requestId;
-   vos_mem_copy(wdiRssiMonitorInfo->currentBssId,
-                &(pRssiMonitorReqParam->currentBssId), sizeof(tSirMacAddr));
-
-   pWdaParams->pWdaContext = pWDA;
-   pWdaParams->wdaMsgParam = pRssiMonitorReqParam;
-   pWdaParams->wdaWdiApiMsgParam = (void *)wdiRssiMonitorInfo;
-
-   wstatus = WDI_StopRssiMonitorReq(wdiRssiMonitorInfo,
-                       (WDI_RssiMonitorStopRspCb)WDA_RssiMonitorStopRspCallback,
-                        pWdaParams);
-   if(IS_WDI_STATUS_FAILURE(wstatus))
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "Failure in Mgmt Logging init REQ WDI API, free all the memory" );
-      status = CONVERT_WDI2VOS_STATUS(wstatus);
-      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-      vos_mem_free(pWdaParams->wdaMsgParam);
-      vos_mem_free(pWdaParams);
-   }
-
-   return status;
-}
-
-
 /*
  * FUNCTION: WDA_WdiIndicationCallback
  * 
@@ -11975,7 +10357,7 @@
 void WDA_WowlEnterRespCallback(WDI_WowlEnterRspParamsType *pwdiWowlEnterRspParam, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    tSirHalWowlEnterParams *pWowlEnterParams;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__func__);
@@ -11987,21 +10369,6 @@
       return ;
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-
-       if(pWdaParams->wdaWdiApiMsgParam)
-       {
-          vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       }
-       vos_mem_free(pWdaParams);
-
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pWowlEnterParams =  (tSirHalWowlEnterParams *)pWdaParams->wdaMsgParam ;
 
    pWowlEnterParams->bssIdx = pwdiWowlEnterRspParam->bssIdx;
@@ -12022,7 +10389,7 @@
 void WDA_WowlEnterReqCallback(WDI_Status wdiStatus, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    tSirHalWowlEnterParams *pWowlEnterParams;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -12037,14 +10404,6 @@
    }
 
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pWowlEnterParams =  (tSirHalWowlEnterParams *)pWdaParams->wdaMsgParam;
    pWowlEnterParams->status = wdiStatus;
 
@@ -12158,7 +10517,7 @@
 void WDA_WowlExitRespCallback( WDI_WowlExitRspParamsType *pwdiWowlExitRsp, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    tSirHalWowlExitParams *pWowlExitParams;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                                           "<------ %s " ,__func__);
@@ -12170,21 +10529,6 @@
       return ;
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-
-       if(pWdaParams->wdaWdiApiMsgParam)
-       {
-          vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       }
-       vos_mem_free(pWdaParams);
-
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pWowlExitParams =  (tSirHalWowlExitParams *)pWdaParams->wdaMsgParam ;
 
    pWowlExitParams->bssIdx = pwdiWowlExitRsp->bssIdx;
@@ -12206,7 +10550,7 @@
 void WDA_WowlExitReqCallback(WDI_Status wdiStatus, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    tSirHalWowlExitParams *pWowlExitParams;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -12221,14 +10565,6 @@
    }
 
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       VOS_ASSERT(0);
-       return ;
-   }
-
    pWowlExitParams =  (tSirHalWowlExitParams *)pWdaParams->wdaMsgParam;
    pWowlExitParams->status = wdiStatus;
 
@@ -12334,7 +10670,7 @@
 {
 
    tWDA_ReqParams *pWdaParams= ( tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__func__);
@@ -12348,20 +10684,6 @@
    }
 
    pWDA = pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s:pWDA is NULL", __func__);
-
-       if(pWdaParams->wdaWdiApiMsgParam)
-       {
-          vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       }
-       vos_mem_free(pWdaParams);
-
-      VOS_ASSERT(0);
-      return ;
-   }
 
    /*Cleaning */
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
@@ -12386,14 +10708,14 @@
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__func__);
-   if (NULL == pWDA)
+   if(NULL == pWDA) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s:pWDA is NULL", __func__);
+                           "%s:pWDA is NULL", __func__); 
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
-
+   
    /* Get the NV structure base address and size from VOS */
    vos_nv_getNVEncodedBuffer(&pNvBuffer,&bufferSize);
 
@@ -12545,7 +10867,7 @@
 void WDA_BtAmpEventRespCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA; 
    WDI_BtAmpEventParamsType *wdiBtAmpEventParam;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -12558,18 +10880,6 @@
       return ;
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       vos_mem_free(pWdaParams->wdaMsgParam) ;
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-       vos_mem_free(pWdaParams) ;
-
-       VOS_ASSERT(0);
-       return ;
-   }
-
    wdiBtAmpEventParam = (WDI_BtAmpEventParamsType *)pWdaParams->wdaWdiApiMsgParam;
    if(BTAMP_EVENT_CONNECTION_TERMINATED == 
       wdiBtAmpEventParam->wdiBtAmpEventInfo.ucBtAmpEventType)
@@ -12593,7 +10903,7 @@
 void WDA_BtAmpEventReqCallback(WDI_Status wdiStatus, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA;
    WDI_BtAmpEventParamsType *wdiBtAmpEventParam;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -12608,14 +10918,6 @@
    }
 
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
-   if (NULL == pWDA)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:pWDA is NULL", __func__);
-       VOS_ASSERT(0);
-       return ;
-   }
-
    wdiBtAmpEventParam = (WDI_BtAmpEventParamsType *)pWdaParams->wdaWdiApiMsgParam;
 
    if(BTAMP_EVENT_CONNECTION_TERMINATED ==
@@ -12746,7 +11048,7 @@
 {
    VOS_STATUS status = VOS_STATUS_E_FAILURE;
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tWDA_CbContext *pWDA = NULL;
+   tWDA_CbContext *pWDA; 
    tStartOemDataRsp *pOemDataRspParams = NULL ;
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -12761,14 +11063,14 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
 
-   if (NULL == pWDA)
+   if(NULL == pWDA) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s:pWDA is NULL", __func__);
+                           "%s:pWDA is NULL", __func__); 
       VOS_ASSERT(0);
       return ;
    }
-
+   
    /* 
     * Allocate memory for response params sent to PE
     */
@@ -13232,7 +11534,7 @@
 {
    tANI_U8 *buffer = NULL;
    tWDA_CbContext *pWDA = NULL;
-   tWDA_HalDumpReqParams *pWdaParams = (tWDA_HalDumpReqParams *)pUserData;
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -13240,10 +11542,7 @@
       VOS_ASSERT(0) ;
       return ;
    }
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-              "%s: WDA HAL DUMP Resp Received",__func__);
-
+   
    pWDA = pWdaParams->pWdaContext;
    buffer = (tANI_U8 *)pWdaParams->wdaMsgParam;
    if(wdiRspParams->usBufferLen > 0)
@@ -13251,13 +11550,11 @@
       /*Copy the Resp data to UMAC supplied buffer*/
       vos_mem_copy(buffer, wdiRspParams->pBuffer, wdiRspParams->usBufferLen);
    }
-
-   if (!pWdaParams->wdaHALDumpAsync)
-   {/* Indicate VOSS about the start complete */
-      vos_WDAComplete_cback(pWDA->pVosContext);
-   }
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams);
+   
+   /* Indicate VOSS about the start complete */
+   vos_WDAComplete_cback(pWDA->pVosContext);
    return ;
 }
 
@@ -13267,13 +11564,12 @@
  */ 
 VOS_STATUS WDA_HALDumpCmdReq(tpAniSirGlobal   pMac, tANI_U32  cmd, 
                  tANI_U32   arg1, tANI_U32   arg2, tANI_U32   arg3,
-                 tANI_U32   arg4, tANI_U8   *pBuffer, wpt_boolean async)
+                 tANI_U32   arg4, tANI_U8   *pBuffer)
 {
    WDI_Status             status = WDI_STATUS_SUCCESS;
    WDI_HALDumpCmdReqParamsType *wdiHALDumpCmdReqParam = NULL;
    WDI_HALDumpCmdReqInfoType *wdiHalDumpCmdInfo = NULL ;
-   tWDA_HalDumpReqParams *pWdaParams ;
-
+   tWDA_ReqParams *pWdaParams ;
    pVosContextType pVosContext = NULL; 
    VOS_STATUS vStatus;
    pVosContext = (pVosContextType)vos_get_global_context(VOS_MODULE_ID_PE,
@@ -13294,13 +11590,7 @@
       return VOS_STATUS_E_RESOURCES;
    }
 
-   if (NULL == pVosContext->pWDAContext)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: WDA Context Null", __func__);
-      return VOS_STATUS_E_RESOURCES;
-   }
-   pWdaParams = (tWDA_HalDumpReqParams *)vos_mem_malloc(sizeof(tWDA_HalDumpReqParams)) ;
+   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -13326,39 +11616,28 @@
    wdiHalDumpCmdInfo->argument4   = arg4;
    wdiHALDumpCmdReqParam->wdiReqStatusCB = NULL ;
    pWdaParams->pWdaContext = pVosContext->pWDAContext;
-   pWdaParams->wdaHALDumpAsync = async;
    
    /*  Response message will be passed through the buffer */
    pWdaParams->wdaMsgParam = (void *)pBuffer;
    
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiHALDumpCmdReqParam ;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-              "%s: WDA HAL DUMP Command sent",__func__);
-
    /* Send command to WDI */
-   status = WDI_HALDumpCmdReq(wdiHALDumpCmdReqParam, WDA_HALDumpCmdCallback,
-                                                                   pWdaParams);
-   /* For Sync event only wait for rsp until completion of wdaCompleteEvent*/
-   if (!async)
+   status = WDI_HALDumpCmdReq(wdiHALDumpCmdReqParam, WDA_HALDumpCmdCallback, pWdaParams);
+   vStatus = vos_wait_single_event( &(pVosContext->wdaCompleteEvent), WDA_DUMPCMD_WAIT_TIMEOUT );
+   if ( vStatus != VOS_STATUS_SUCCESS )
    {
-      vStatus = vos_wait_single_event( &(pVosContext->wdaCompleteEvent),
-                                                   WDA_DUMPCMD_WAIT_TIMEOUT );
-      if ( vStatus != VOS_STATUS_SUCCESS )
+      if ( vStatus == VOS_STATUS_E_TIMEOUT )
       {
-         if ( vStatus == VOS_STATUS_E_TIMEOUT )
-         {
-            VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-            "%s: Timeout occurred before WDA_HALDUMP complete",__func__);
-         }
-         else
-         {
-            VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-            "%s: WDA_HALDUMP reporting  other error",__func__);
-         }
-         VOS_BUG(0);
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Timeout occurred before WDA_HALDUMP complete",__func__);
       }
+      else
+      {
+         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: WDA_HALDUMP reporting  other error",__func__);
+      }
+      VOS_ASSERT(0);
    }
    return status;
 }
@@ -13514,56 +11793,6 @@
    return CONVERT_WDI2VOS_STATUS(wdiStatus);
 }
 
-/*
- * FUNCTION: WDA_ProcessRateUpdateInd
- *
- */
-VOS_STATUS WDA_ProcessRateUpdateInd(tWDA_CbContext *pWDA,
-                               tSirRateUpdateInd *pRateUpdateParams)
-{
-   WDI_Status wdiStatus;
-   WDI_RateUpdateIndParams rateUpdateParams;
-
-   vos_mem_copy(rateUpdateParams.bssid,
-            pRateUpdateParams->bssid, sizeof(tSirMacAddr));
-
-   rateUpdateParams.ucastDataRateTxFlag =
-                     pRateUpdateParams->ucastDataRateTxFlag;
-   rateUpdateParams.rmcDataRateTxFlag =
-                     pRateUpdateParams->rmcDataRateTxFlag;
-   rateUpdateParams.mcastDataRate24GHzTxFlag =
-                     pRateUpdateParams->mcastDataRate24GHzTxFlag;
-   rateUpdateParams.mcastDataRate5GHzTxFlag =
-                     pRateUpdateParams->mcastDataRate5GHzTxFlag;
-
-   rateUpdateParams.ucastDataRate = pRateUpdateParams->ucastDataRate;
-   rateUpdateParams.rmcDataRate =
-                                 pRateUpdateParams->rmcDataRate;
-   rateUpdateParams.mcastDataRate24GHz = pRateUpdateParams->mcastDataRate24GHz;
-   rateUpdateParams.mcastDataRate5GHz = pRateUpdateParams->mcastDataRate5GHz;
-
-   rateUpdateParams.wdiReqStatusCB = WDA_WdiIndicationCallback;
-   rateUpdateParams.pUserData = pWDA;
-
-   wdiStatus = WDI_RateUpdateInd(&rateUpdateParams);
-
-   if (WDI_STATUS_PENDING == wdiStatus)
-   {
-      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                "Pending received for %s:%d", __func__, __LINE__ );
-   }
-   else if (WDI_STATUS_SUCCESS_SYNC != wdiStatus)
-   {
-      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                "Failure in %s:%d", __func__, __LINE__ );
-   }
-
-   vos_mem_free(pRateUpdateParams);
-
-   return CONVERT_WDI2VOS_STATUS(wdiStatus);
-}
-
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
 /*
  * FUNCTION: WDA_ProcessStopBatchScanInd
@@ -13894,6 +12123,55 @@
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
 /*
+ * FUNCTION: WDA_ProcessRateUpdateInd
+ *
+ */
+VOS_STATUS WDA_ProcessRateUpdateInd(tWDA_CbContext *pWDA,
+                               tSirRateUpdateInd *pRateUpdateParams)
+{
+   WDI_Status wdiStatus;
+   WDI_RateUpdateIndParams rateUpdateParams;
+
+   vos_mem_copy(rateUpdateParams.bssid,
+            pRateUpdateParams->bssid, sizeof(tSirMacAddr));
+
+   rateUpdateParams.ucastDataRateTxFlag =
+                     pRateUpdateParams->ucastDataRateTxFlag;
+   rateUpdateParams.reliableMcastDataRateTxFlag =
+                     pRateUpdateParams->reliableMcastDataRateTxFlag;
+   rateUpdateParams.mcastDataRate24GHzTxFlag =
+                     pRateUpdateParams->mcastDataRate24GHzTxFlag;
+   rateUpdateParams.mcastDataRate5GHzTxFlag =
+                     pRateUpdateParams->mcastDataRate5GHzTxFlag;
+
+   rateUpdateParams.ucastDataRate = pRateUpdateParams->ucastDataRate;
+   rateUpdateParams.reliableMcastDataRate =
+                                 pRateUpdateParams->reliableMcastDataRate;
+   rateUpdateParams.mcastDataRate24GHz = pRateUpdateParams->mcastDataRate24GHz;
+   rateUpdateParams.mcastDataRate5GHz = pRateUpdateParams->mcastDataRate5GHz;
+
+   rateUpdateParams.wdiReqStatusCB = WDA_WdiIndicationCallback;
+   rateUpdateParams.pUserData = pWDA;
+
+   wdiStatus = WDI_RateUpdateInd(&rateUpdateParams);
+
+   if (WDI_STATUS_PENDING == wdiStatus)
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                "Pending received for %s:%d", __func__, __LINE__ );
+   }
+   else if (WDI_STATUS_SUCCESS_SYNC != wdiStatus)
+   {
+      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "Failure in %s:%d", __func__, __LINE__ );
+   }
+
+   vos_mem_free(pRateUpdateParams);
+
+   return CONVERT_WDI2VOS_STATUS(wdiStatus);
+}
+
+/*
  * -------------------------------------------------------------------------
  * DATA interface with WDI for Mgmt Frames
  * ------------------------------------------------------------------------- 
@@ -13908,9 +12186,7 @@
    
    tWDA_CbContext *wdaContext= (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
    tpAniSirGlobal pMac = (tpAniSirGlobal)VOS_GET_MAC_CTXT((void *)pVosContext) ;
-   uintptr_t uUserData;
-
-   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, "Enter:%s", __func__);
+   tANI_U32 uUserData; 
 
    if(NULL == wdaContext)
    {
@@ -13922,7 +12198,6 @@
       return VOS_STATUS_E_FAILURE;
    }
 
-    vos_lock_acquire(&wdaContext->mgmt_pkt_lock);
     /*Check if frame was timed out or not*/
     vos_pkt_get_user_data_ptr(  pData, VOS_PKT_USER_DATA_ID_WDA,
                                (v_PVOID_t)&uUserData);
@@ -13930,11 +12205,7 @@
     if ( WDA_TL_TX_MGMT_TIMED_OUT == uUserData )
     {
        /*Discard frame - no further processing is needed*/
-       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_WARN,
-                            "%s: MGMT Frame Tx timed out",
-                            __func__);
-       vos_pkt_return_packet(pData);
-       vos_lock_release(&wdaContext->mgmt_pkt_lock);
+       vos_pkt_return_packet(pData); 
        return VOS_STATUS_SUCCESS; 
     }
 
@@ -13952,17 +12223,9 @@
                            "%s:packet (%p) is already freed",
                            __func__, pData);
          //Return from here since we reaching here because the packet already timeout
-         vos_lock_release(&wdaContext->mgmt_pkt_lock);
          return status;
       }
    }
-   else {
-      wdaContext->mgmt_pktfree_fail++;
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                            "%s:packet (%p)  userData (%lx) is not freed",
-                            __func__, pData, uUserData);
-   }
-   vos_lock_release(&wdaContext->mgmt_pkt_lock);
 
    /* 
     * Trigger the event to bring the HAL TL Tx complete function to come 
@@ -13992,9 +12255,7 @@
                            pWDATxRxCompFunc pCompFunc,
                            void *pData,
                            pWDAAckFnTxComp pAckTxComp,
-                           tANI_U32 txFlag,
-                           tANI_U32 txBdToken
-                           )
+                           tANI_U32 txFlag)
 {
    VOS_STATUS status = VOS_STATUS_SUCCESS ;
    tpSirMacFrameCtl pFc = (tpSirMacFrameCtl ) pData;
@@ -14002,9 +12263,6 @@
    tANI_U8 eventIdx = 0;
    tBssSystemRole systemRole = eSYSTEM_UNKNOWN_ROLE;
    tpAniSirGlobal pMac;
-   tpSirTxBdStatus txBdStatus = {0};
-   v_TIME_t time_snapshot;
-
    if((NULL == pWDA)||(NULL == pFrmBuf)) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -14013,10 +12271,9 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
-
+   
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_HIGH, 
-               "Tx Mgmt Frame Subtype: %d alloc(%p) txBdToken = %u",
-               pFc->subType, pFrmBuf, txBdToken);
+               "Tx Mgmt Frame Subtype: %d alloc(%p)", pFc->subType, pFrmBuf);
    pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
    if(NULL == pMac)
    {
@@ -14025,7 +12282,9 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
-
+   
+   
+   
    /* store the call back function in WDA context */
    pWDA->pTxCbFunc = pCompFunc;
    /* store the call back for the function of ackTxComplete */
@@ -14034,9 +12293,9 @@
        if( NULL != pWDA->pAckTxCbFunc )
        {
            /* Already TxComp is active no need to active again */
-           VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+           VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
                    "There is already one request pending for tx complete");
-           pWDA->pAckTxCbFunc( pMac, &txBdStatus);
+           pWDA->pAckTxCbFunc( pMac, 0);
            pWDA->pAckTxCbFunc = NULL;
 
            if( VOS_STATUS_SUCCESS !=
@@ -14047,7 +12306,7 @@
            }
            else
            {
-               VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+               VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                        "Tx Complete timeout Timer Stop Success ");
            }
        }
@@ -14125,15 +12384,6 @@
           txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
        }
    }
-#ifdef FEATURE_WLAN_TDLS
-   /* TDLS Management frames are sent using Peer Sta mask */
-   else if ((pFc->type == SIR_MAC_DATA_FRAME) &&
-            (txFlag & HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME))
-   {
-       txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
-
-   }
-#endif
    vos_atomic_set((uintptr_t*)&pWDA->VosPacketToFree, (uintptr_t)pFrmBuf);/*set VosPacket_freed to pFrmBuf*/
 
    /*Set frame tag to 0 
@@ -14143,8 +12393,8 @@
    
 
    if((status = WLANTL_TxMgmtFrm(pWDA->pVosContext, (vos_pkt_t *)pFrmBuf, 
-                     frmLen, ucTypeSubType, tid, WDA_TxComplete, NULL, txFlag,
-                     txBdToken))!= VOS_STATUS_SUCCESS)
+                     frmLen, ucTypeSubType, tid, 
+                     WDA_TxComplete, NULL, txFlag)) != VOS_STATUS_SUCCESS) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
                        "Sending Mgmt Frame failed - status = %d", status);
@@ -14162,7 +12412,6 @@
       } 
       return VOS_STATUS_E_FAILURE;
    }
-   time_snapshot = vos_timer_get_system_time();
    /* 
     * Wait for the event to be set by the TL, to get the response of TX 
     * complete, this event should be set by the Callback function called by TL 
@@ -14174,30 +12423,24 @@
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
                  "%s: Status %d when waiting for TX Frame Event",
                  __func__, status);
-      vos_lock_acquire(&pWDA->mgmt_pkt_lock);
+
       /*Tag Frame as timed out for later deletion*/
       vos_pkt_set_user_data_ptr( (vos_pkt_t *)pFrmBuf, VOS_PKT_USER_DATA_ID_WDA,
                        (v_PVOID_t)WDA_TL_TX_MGMT_TIMED_OUT);
       pWDA->pTxCbFunc = NULL;   /*To stop the limTxComplete being called again  , 
                                 after the packet gets completed(packet freed once)*/
 
-      vos_atomic_set((uintptr_t*)&pWDA->VosPacketToFree, (uintptr_t)WDA_TX_PACKET_FREED);
-
-      /*
-       * Memory barrier to ensure pFrmBuf is set before TX thread access it in
-       * TX completion call back
-       */
-      VOS_SMP_MB;
-      vos_lock_release(&pWDA->mgmt_pkt_lock);
-
       /* TX MGMT fail with COMP timeout, try to detect DXE stall */
       WDA_TransportChannelDebug(pMac, 1, 0);
 
-      if (vos_isFatalEventEnabled())
-         vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
-                     WLAN_LOG_INDICATOR_HOST_DRIVER,
-                     WLAN_LOG_REASON_MGMT_FRAME_TIMEOUT,
-                     FALSE, TRUE);
+      /* check whether the packet was freed already,so need not free again when 
+      * TL calls the WDA_Txcomplete routine
+      */
+      vos_atomic_set((uintptr_t*)&pWDA->VosPacketToFree, (uintptr_t)WDA_TX_PACKET_FREED);
+      /*if(vos_atomic_set(uintptr_t *)&pWDA->VosPacketToFree, (uintptr_t)WDA_TX_PACKET_FREED) == (v_U32_t)pFrmBuf)
+      {
+         pCompFunc(VOS_GET_MAC_CTXT(pWDA->pVosContext), (vos_pkt_t *)pFrmBuf);
+      } */
 
       if( pAckTxComp )
       {
@@ -14209,19 +12452,8 @@
                                 "Tx Complete timeout Timer Stop Failed ");
          }
       }
-      pWDA->mgmtTxfailureCnt++;
-
-      /* SSR if timeout continously for
-       * WDA_TX_FAILURE_RECOVERY_THRESHOLD times.
-       */
-      if (WDA_TX_FAILURE_RECOVERY_THRESHOLD ==
-                                pWDA->mgmtTxfailureCnt)
-      {
-         vos_wlanRestart();
-      }
       status = VOS_STATUS_E_FAILURE;
    }
-
 #ifdef WLAN_DUMP_MGMTFRAMES
    if (VOS_IS_STATUS_SUCCESS(status))
    {
@@ -14234,15 +12466,6 @@
 
    if (VOS_IS_STATUS_SUCCESS(status))
    {
-      pWDA->mgmtTxfailureCnt = 0;
-      if ((vos_timer_get_system_time() - time_snapshot) >=
-                                        WDA_TX_TIME_THRESHOLD)
-      {
-          VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                     "Tx Complete took %lu ms",
-                     vos_timer_get_system_time() - time_snapshot);
-      }
-
       if (pMac->fEnableDebugLog & 0x1)
       {
          if ((pFc->type == SIR_MAC_MGMT_FRAME) &&
@@ -14320,505 +12543,6 @@
    return CONVERT_WDI2VOS_STATUS(status) ;
  }
 
-#ifdef WLAN_FEATURE_RMC
-
-void
-WDA_RMCRulerRspCallback(WDI_RmcRspParamsType *wdiRmcResponse, void *pUserData)
-{
-    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-    tWDA_CbContext *pWDA = pWdaParams->pWdaContext;
-
-    switch (wdiRmcResponse->cmd)
-    {
-        case eWDI_BECOME_RULER_CMD :
-        {
-            tSirRmcBecomeRulerInd *pRmcBecomeRulerInd;
-
-            pRmcBecomeRulerInd = (tSirRmcBecomeRulerInd *)
-                                   vos_mem_malloc(sizeof(*pRmcBecomeRulerInd));
-
-            if (NULL == pRmcBecomeRulerInd)
-            {
-               VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: unable to allocate pRmcBecomeRulerInd", __func__);
-               break;
-            }
-
-            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                        "Received eWDI_BECOME_RULER_CMD from WDI");
-
-            pRmcBecomeRulerInd->status = wdiRmcResponse->status;
-
-            vos_mem_copy(pRmcBecomeRulerInd->mcastTransmitter,
-                          wdiRmcResponse->mcastTransmitter,
-                          sizeof(tSirMacAddr));
-            vos_mem_copy(pRmcBecomeRulerInd->mcastGroup,
-                          wdiRmcResponse->mcastGroup,
-                          sizeof(tSirMacAddr));
-
-            WDA_SendMsg(pWDA, WDA_RMC_BECOME_RULER,
-                               (void *)pRmcBecomeRulerInd, 0) ;
-            break;
-        }
-        case eWDI_SUGGEST_RULER_CMD :
-        {
-            tSirRmcRulerSelectInd *pRmcRulerSelectInd;
-
-            pRmcRulerSelectInd = (tSirRmcRulerSelectInd *)
-                                   vos_mem_malloc(sizeof(tSirRmcRulerSelectInd));
-
-            if (NULL == pRmcRulerSelectInd)
-            {
-               VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: unable to allocate pRmcRulerSelectInd", __func__);
-               break;
-            }
-
-            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                              "Received eWDI_SUGGEST_RULER_CMD from WDI");
-
-            pRmcRulerSelectInd->status = wdiRmcResponse->status;
-
-            vos_mem_copy(pRmcRulerSelectInd->mcastTransmitter,
-                        wdiRmcResponse->mcastTransmitter,
-                        sizeof(tSirMacAddr));
-            vos_mem_copy(pRmcRulerSelectInd->mcastGroup,
-                        wdiRmcResponse->mcastGroup,
-                        sizeof(tSirMacAddr));
-            vos_mem_copy(pRmcRulerSelectInd->ruler,
-                        wdiRmcResponse->ruler,
-                        sizeof(pRmcRulerSelectInd->ruler));
-
-            WDA_SendMsg(pWDA, WDA_RMC_RULER_SELECT_RESP,
-                                       (void *)pRmcRulerSelectInd, 0) ;
-            break;
-        }
-    }
-
-    /* free the config structure */
-    if (pWdaParams->wdaWdiApiMsgParam != NULL)
-    {
-        vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-    }
-    vos_mem_free(pWdaParams->wdaMsgParam);
-    vos_mem_free(pWdaParams);
-
-}
-
-void WDA_RMCRulerReqCallback(WDI_Status wdiStatus, void* pUserData)
-{
-    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-              "<------ %s, wdiStatus: %d", __func__, wdiStatus);
-
-    if (NULL == pWdaParams)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: pWdaParams received NULL", __func__);
-        VOS_ASSERT(0);
-        return;
-    }
-
-    if (IS_WDI_STATUS_FAILURE(wdiStatus))
-    {
-        vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-        vos_mem_free(pWdaParams->wdaMsgParam);
-        vos_mem_free(pWdaParams);
-    }
-
-   return;
-}
-
-static VOS_STATUS
-WDA_ProcessRMCRulerReq(tWDA_CbContext *pWDA,
-                        tSirRmcRulerReq *rmcRulerReq)
-{
-    WDI_Status status;
-    WDI_RmcRulerReqParams *wdiRulerReq;
-    tWDA_ReqParams *pWdaParams;
-
-    wdiRulerReq = (WDI_RmcRulerReqParams *)
-                        vos_mem_malloc(sizeof(*wdiRulerReq));
-
-    if (NULL == wdiRulerReq)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: VOS MEM Alloc Failure", __func__);
-        VOS_ASSERT(0);
-        vos_mem_free(rmcRulerReq);
-        return VOS_STATUS_E_NOMEM;
-    }
-
-    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams));
-    if (NULL == pWdaParams)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
-        VOS_ASSERT(0);
-        vos_mem_free(rmcRulerReq);
-        vos_mem_free(wdiRulerReq);
-        return VOS_STATUS_E_NOMEM;
-    }
-
-    pWdaParams->wdaWdiApiMsgParam = (v_PVOID_t *)wdiRulerReq;
-    /* Store param pointer as passed in by caller */
-    pWdaParams->wdaMsgParam = rmcRulerReq;
-    pWdaParams->pWdaContext = pWDA;
-
-    wdiRulerReq->cmd = rmcRulerReq->cmd;
-
-    vos_mem_copy(wdiRulerReq->mcastTransmitter,
-            rmcRulerReq->mcastTransmitter, sizeof(tSirMacAddr));
-    vos_mem_copy(wdiRulerReq->mcastGroup,
-            rmcRulerReq->mcastGroup, sizeof(tSirMacAddr));
-    vos_mem_copy(wdiRulerReq->blacklist,
-            rmcRulerReq->blacklist, sizeof(wdiRulerReq->blacklist));
-
-    wdiRulerReq->wdiReqStatusCB = WDA_RMCRulerReqCallback;
-
-    status = WDI_RmcRulerReq(wdiRulerReq,
-                 (WDI_RmcRulerRspCb)WDA_RMCRulerRspCallback,
-                 (void *)pWdaParams);
-    if (IS_WDI_STATUS_FAILURE(status))
-    {
-        vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-        vos_mem_free(pWdaParams->wdaMsgParam);
-        vos_mem_free(pWdaParams) ;
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                   "Ruler Request failed");
-    }
-    return CONVERT_WDI2VOS_STATUS(status) ;
-}
-
-/*
- * FUNCTION: WDA_ProcessRMCUpdateInd
- * Forward Update Indication to WDI
-*/
-static VOS_STATUS
-WDA_ProcessRMCUpdateInd(tWDA_CbContext *pWDA,
-                         tSirRmcUpdateInd *rmcUpdateInd)
-{
-    WDI_Status status;
-    WDI_RmcUpdateIndParams wdiUpdateInd;
-
-    /* Copy the paramters for Update_Ind */
-
-    wdiUpdateInd.indication = rmcUpdateInd->indication;
-    wdiUpdateInd.role = rmcUpdateInd->role;
-
-    vos_mem_copy(wdiUpdateInd.mcastTransmitter,
-            rmcUpdateInd->mcastTransmitter, sizeof(tSirMacAddr));
-
-    vos_mem_copy(wdiUpdateInd.mcastGroup,
-            rmcUpdateInd->mcastGroup, sizeof(tSirMacAddr));
-
-    vos_mem_copy(wdiUpdateInd.mcastRuler,
-            rmcUpdateInd->mcastRuler, sizeof(tSirMacAddr));
-
-    wdiUpdateInd.wdiReqStatusCB = WDA_WdiIndicationCallback;
-    wdiUpdateInd.pUserData = pWDA;
-    status = WDI_RmcUpdateInd(&wdiUpdateInd);
-
-    if (WDI_STATUS_PENDING == status)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                 "Pending received for %s:%d ",__func__,__LINE__ );
-    }
-    else if (WDI_STATUS_SUCCESS_SYNC != status)
-    {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "Failure in %s:%d ",__func__,__LINE__ );
-    }
-
-    vos_mem_free(rmcUpdateInd);
-
-    return CONVERT_WDI2VOS_STATUS(status) ;
-}
-
-void WDA_GetIbssPeerInfoRspCallback(WDI_IbssPeerInfoRspParams *peerInfoRspParams
-                                    ,void* pUserData)
-{
-
-   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   WDI_IbssPeerInfoParams *pIbssPeerInfoParams;
-   tWDA_CbContext *pWDA;
-   tpSirIbssGetPeerInfoRspParams pIbssGetPeerInfoRsp;
-   vos_msg_t vosMsg;
-   v_U32_t wdaCnt = 0;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "<------ %s " ,__func__);
-   if (NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: pWdaParams received NULL", __func__);
-      VOS_ASSERT(0);
-      return;
-   }
-
-   if (NULL == peerInfoRspParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: peerInfoRspParams received NULL", __func__);
-      if(pWdaParams->wdaMsgParam)
-         vos_mem_free(pWdaParams->wdaMsgParam);
-      if(pWdaParams->wdaWdiApiMsgParam)
-         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-      vos_mem_free(pWdaParams);
-
-      VOS_ASSERT(0);
-      return;
-   }
-
-   pIbssPeerInfoParams =
-       (WDI_IbssPeerInfoParams *)peerInfoRspParams->wdiPeerInfoParams;
-
-   pIbssGetPeerInfoRsp =
-                  vos_mem_malloc(sizeof(tSirIbssGetPeerInfoRspParams));
-
-   if(NULL == pIbssGetPeerInfoRsp)
-   {
-      if(pWdaParams->wdaMsgParam)
-         vos_mem_free(pWdaParams->wdaMsgParam);
-      if(pWdaParams->wdaWdiApiMsgParam)
-         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-      vos_mem_free(pWdaParams);
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: Memory allocation failed for pIbssGetPeerInfoRsp",
-                 __func__);
-      VOS_ASSERT(0);
-      return;
-
-   }
-
-   pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
-
-
-   if (peerInfoRspParams->wdiNumPeers > 32)
-   {
-      pr_info("%s] Number of peers is more than 32, returning\n", __func__);
-      /* free the mem and return */
-      vos_mem_free((v_VOID_t *) pIbssGetPeerInfoRsp);
-         if(pWdaParams->wdaMsgParam)
-            vos_mem_free(pWdaParams->wdaMsgParam);
-         if(pWdaParams->wdaWdiApiMsgParam)
-            vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-         vos_mem_free(pWdaParams);
-
-      return;
-   }
-
-   /* Message Header */
-   pIbssGetPeerInfoRsp->mesgType = eWNI_SME_IBSS_PEER_INFO_RSP;
-   pIbssGetPeerInfoRsp->mesgLen = sizeof(tSirIbssGetPeerInfoRspParams);
-   pIbssGetPeerInfoRsp->ibssPeerInfoRspParams.status = peerInfoRspParams->wdiStatus;
-   pIbssGetPeerInfoRsp->ibssPeerInfoRspParams.numPeers = peerInfoRspParams->wdiNumPeers;
-
-   for (wdaCnt = 0; wdaCnt < peerInfoRspParams->wdiNumPeers; wdaCnt++)
-   {
-      WDI_IbssPeerInfoParams *pWdiTmp = &pIbssPeerInfoParams[wdaCnt];
-      tSirIbssPeerInfoParams *pSmeTmp =
-          &pIbssGetPeerInfoRsp->ibssPeerInfoRspParams.peerInfoParams[wdaCnt];
-
-      pSmeTmp->staIdx = pWdiTmp->wdiStaIdx;
-      pSmeTmp->mcsIndex = pWdiTmp->wdiMcsIndex;
-      pSmeTmp->rssi = pWdiTmp->wdiRssi;
-      pSmeTmp->txRate = pWdiTmp->wdiTxRate;
-      pSmeTmp->txRateFlags = pWdiTmp->wdiTxRateFlags;
-   }
-
-   /* VOS message wrapper */
-   vosMsg.type = eWNI_SME_IBSS_PEER_INFO_RSP;
-   vosMsg.bodyptr = (void *)pIbssGetPeerInfoRsp;
-   vosMsg.bodyval = 0;
-
-   if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg))
-   {
-      /* free the mem and return */
-      vos_mem_free((v_VOID_t *) pIbssGetPeerInfoRsp);
-   }
-
-   if(NULL != pWdaParams)
-   {
-      if(pWdaParams->wdaMsgParam)
-         vos_mem_free(pWdaParams->wdaMsgParam);
-      if(pWdaParams->wdaWdiApiMsgParam)
-         vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-      vos_mem_free(pWdaParams);
-   }
-
-   return;
-}
-
-static VOS_STATUS
-WDA_ProcessIbssPeerInfoReq(tWDA_CbContext *pWDA,
-                      tSirIbssGetPeerInfoReqParams *ibssPeerInfoReqParams)
-{
-   WDI_Status status;
-   WDI_IbssPeerInfoReqType *wdiPeerInfoReq;
-   tWDA_ReqParams *pWdaParams;
-
-   wdiPeerInfoReq = (WDI_IbssPeerInfoReqType *)
-                    vos_mem_malloc(sizeof(WDI_IbssPeerInfoReqType));
-   if (NULL == wdiPeerInfoReq)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(ibssPeerInfoReqParams);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams));
-   if (NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                         "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(wdiPeerInfoReq);
-      vos_mem_free(ibssPeerInfoReqParams);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   pWdaParams->wdaWdiApiMsgParam = (v_PVOID_t *)wdiPeerInfoReq;
-   /* Store param pointer as passed in by caller */
-   pWdaParams->wdaMsgParam = ibssPeerInfoReqParams;
-   pWdaParams->pWdaContext = pWDA;
-
-   wdiPeerInfoReq->wdiAllPeerInfoReqd =
-                 ibssPeerInfoReqParams->allPeerInfoReqd;
-   wdiPeerInfoReq->wdiStaIdx =
-                 ibssPeerInfoReqParams->staIdx;
-
-   status = WDI_IbssPeerInfoReq(wdiPeerInfoReq,
-               (WDI_IbssPeerInfoReqCb)WDA_GetIbssPeerInfoRspCallback,
-               (void *)pWdaParams);
-   if (IS_WDI_STATUS_FAILURE(status))
-   {
-      vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-      vos_mem_free(pWdaParams->wdaMsgParam);
-      vos_mem_free(pWdaParams) ;
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "IBSS Peer Info Request failed");
-   }
-   return CONVERT_WDI2VOS_STATUS(status) ;
-
-}
-
-/*
- * FUNCTION: WDA_ProcessTXFailMonitorInd
- * Forward TX Fail Monitor to WDI
- */
-static VOS_STATUS WDA_ProcessTXFailMonitorInd(
-                                        tWDA_CbContext *pWDA,
-                                        tAniTXFailMonitorInd *txFailMonitorInd)
-{
-   WDI_Status status;
-   WDI_TXFailMonitorInd *wdiTXFailMonitorInd =
-         (WDI_TXFailMonitorInd *)vos_mem_malloc(sizeof(WDI_TXFailMonitorInd));
-
-   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-             "<------ %s " ,__func__);
-
-   if (NULL == wdiTXFailMonitorInd)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(txFailMonitorInd);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   wdiTXFailMonitorInd->tx_fail_count = txFailMonitorInd->tx_fail_count;
-
-   wdiTXFailMonitorInd->wdiReqStatusCB = WDA_WdiIndicationCallback;
-   wdiTXFailMonitorInd->pUserData = pWDA;
-
-   status = WDI_TXFailMonitorStartStopInd(wdiTXFailMonitorInd);
-
-   if (WDI_STATUS_PENDING == status)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "TX Fail Monitor Indication Pending");
-   }
-   else if (WDI_STATUS_SUCCESS_SYNC == status)
-   {
-     if (0 == txFailMonitorInd->tx_fail_count)
-       pWDA->txFailIndCallback = NULL;
-     else
-       pWDA->txFailIndCallback = txFailMonitorInd->txFailIndCallback;
-   }
-   else
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "TX Fail Monitor Indication Failed");
-   }
-
-   vos_mem_free(wdiTXFailMonitorInd);
-   vos_mem_free(txFailMonitorInd);
-
-   return CONVERT_WDI2VOS_STATUS(status) ;
-}
-#endif /* WLAN_FEATURE_RMC */
-
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-VOS_STATUS WDA_ProcessPERRoamScanTriggerReq(tWDA_CbContext *pWDA,
-                    tPERRoamScanStart *pPERRoamTriggerScanReqParams)
-{
-   WDI_Status status;
-   tWDA_ReqParams *pWdaParams ;
-   WDI_PERRoamTriggerScanInfo *pwdiPERRoamTriggerScanInfo =
-       (WDI_PERRoamTriggerScanInfo *)vos_mem_malloc(
-                                         sizeof(WDI_PERRoamTriggerScanInfo));
-
-   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-              "------> %s " ,__func__);
-
-   if (NULL == pwdiPERRoamTriggerScanInfo)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
-   if (NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pwdiPERRoamTriggerScanInfo);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   pwdiPERRoamTriggerScanInfo->roamScanReq =
-                                    pPERRoamTriggerScanReqParams->start;
-
-   /* Store Params pass it to WDI */
-   pWdaParams->wdaWdiApiMsgParam = (void *)pwdiPERRoamTriggerScanInfo;
-   pWdaParams->pWdaContext = pWDA;
-
-   /* Store param pointer as passed in by caller */
-   pWdaParams->wdaMsgParam = pPERRoamTriggerScanReqParams;
-   status = WDI_PERRoamScanTriggerReq(pwdiPERRoamTriggerScanInfo,
-                    (WDI_PERRoamTriggerScanCb)WDA_PERRoamTriggerScanReqCallback,
-                    pWdaParams);
-
-   if(IS_WDI_STATUS_FAILURE(status))
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "Failure in Start Roam Candidate trigger Req WDI API" );
-      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-      vos_mem_free(pWdaParams->wdaMsgParam);
-      pWdaParams->wdaWdiApiMsgParam = NULL;
-      pWdaParams->wdaMsgParam = NULL;
-   }
-   return CONVERT_WDI2VOS_STATUS(status) ;
-}
-#endif
-
 /*
  * FUNCTION: WDA_ProcessSetSpoofMacAddrReq
  *
@@ -14847,7 +12571,6 @@
     if(NULL == pWdaParams) {
         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s: VOS MEM Alloc Failure", __func__);
-        vos_mem_free(WDI_SpoofMacAddrInfoParams);
         VOS_ASSERT(0);
         return VOS_STATUS_E_NOMEM;
     }
@@ -14857,17 +12580,13 @@
 
     pWdaParams->pWdaContext = pWDA;
     /* Store Upper layer req pointer, as this will be used for response */
-    pWdaParams->wdaMsgParam = (void *)pReq;
-
-    VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, WDA_MAC_ADDRESS_STR,
-               WDA_MAC_ADDR_ARRAY(WDI_SpoofMacAddrInfoParams->macAddr));
-
+    pWdaParams->wdaMsgParam = (void *)pReq ;
     /* store Params pass it to WDI */
     pWdaParams->wdaWdiApiMsgParam = (void *)WDI_SpoofMacAddrInfoParams ;
 
     wdiStatus = WDI_SetSpoofMacAddrReq(WDI_SpoofMacAddrInfoParams,
-                    (WDI_SetSpoofMacAddrRspCb) WDA_SpoofMacAddrRspCallback,
-                                                        pWdaParams );
+        (WDI_SetSpoofMacAddrRspCb) WDA_SpoofMacAddrRspCallback,
+        pWdaParams );
 
     if(IS_WDI_STATUS_FAILURE(wdiStatus))
     {
@@ -14881,210 +12600,6 @@
     return CONVERT_WDI2VOS_STATUS(wdiStatus) ;
 }
 
-
-/*
- * FUNCTION: WDA_FwrMemDumpRespCallback
- * recieves Mgmt Logging init response from FW
- */
- void WDA_FwrMemDumpRespCallback(WDI_FwrMemDumpRsp* wdiRsp,
-                                                            void* pUserData)
-{
-   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tAniFwrDumpReq *pFwrMemDumpReq;
-   tAniFwrDumpRsp  *pFwrMemDumpRsp;
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "<------ %s " ,__func__);
-
-   if(NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams received NULL", __func__);
-      VOS_ASSERT(0);
-      return ;
-   }
-
-   if(NULL == pWdaParams->wdaMsgParam)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams->wdaMsgParam is NULL", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pWdaParams);
-      return ;
-   }
-
-   pFwrMemDumpRsp = (tAniFwrDumpRsp *)vos_mem_malloc(sizeof(tAniFwrDumpRsp));
-   if(pFwrMemDumpRsp == NULL)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: pFwrMemDumpRsp is NULL", __func__);
-       VOS_ASSERT(0);
-       vos_mem_free(pWdaParams);
-       return ;
-   }
-
-   pFwrMemDumpRsp->dump_status  = wdiRsp->dump_status;
-   pFwrMemDumpReq = (tAniFwrDumpReq *)pWdaParams->wdaMsgParam;
-
-   if(pFwrMemDumpReq->fwMemDumpReqCallback)
-   {
-      pFwrMemDumpReq->fwMemDumpReqCallback(
-                               pFwrMemDumpReq->fwMemDumpReqContext,
-                               pFwrMemDumpRsp);
-   }
-   else
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: FwrMemDump callback is NULL", __func__);
-   }
-
-   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-   vos_mem_free(pWdaParams->wdaMsgParam);
-   vos_mem_free(pWdaParams);
-   vos_mem_free(pFwrMemDumpRsp);
-
-   return ;
-}
-
-VOS_STATUS WDA_ProcessFwrMemDumpReq(tWDA_CbContext * pWDA,
-                         tAniFwrDumpReq* pFwrMemDumpReq)
-{
-   VOS_STATUS status = VOS_STATUS_SUCCESS;
-   WDI_Status wstatus;
-   WDI_FwrMemDumpReqType * pWdiFwrMemDumpReq;
-   tWDA_ReqParams *pWdaParams ;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "------> %s " ,__func__);
-   /* Sanity Check*/
-   if(NULL == pFwrMemDumpReq)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: pFwrMemDumpReq received NULL", __func__);
-      VOS_ASSERT(0) ;
-      return VOS_STATUS_E_FAULT;
-   }
-
-   pWdiFwrMemDumpReq = (WDI_FwrMemDumpReqType *)vos_mem_malloc(sizeof(WDI_FwrMemDumpReqType));
-   if(NULL == pWdiFwrMemDumpReq)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: pWdiFwrMemDumpReq Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
-   if(NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: pWdaParams Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pWdiFwrMemDumpReq);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   /* Store Params pass it to WDI */
-   pWdaParams->wdaWdiApiMsgParam = (void *)pWdiFwrMemDumpReq;
-   pWdaParams->pWdaContext = pWDA;
-   /* Store param pointer as passed in by caller */
-   pWdaParams->wdaMsgParam = pFwrMemDumpReq;
-
-   status = WDI_FwrMemDumpReq(pWdiFwrMemDumpReq,
-                              (WDI_FwrMemDumpCb)WDA_FwrMemDumpRespCallback,
-                              pWdaParams);
-
-   if(IS_WDI_STATUS_FAILURE(wstatus))
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 FL("Fwr Mem Dump Req failed, free all the memory"));
-       status = CONVERT_WDI2VOS_STATUS(wstatus);
-       vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-       pWdaParams->wdaWdiApiMsgParam = NULL;
-       vos_mem_free(pWdaParams->wdaMsgParam);
-       pWdaParams->wdaMsgParam = NULL;
-       vos_mem_free(pWdaParams);
-   }
-
-    return status;
-
-}
-
-/**
- * wda_process_set_allowed_action_frames_ind() - Set allowed action frames to FW
- *
- * @pWDA: WDA Call back context
- * @allowed_action_frames: Pointer to struct sir_allowed_action_frames
- *                          that holds allowed action frames bitmask
- *
- * This function sets the allowed action frames that the FW needs to
- * handover to host.The Action frames other than the requested ones
- * can be dropped in FW
- *
- * Return: VOS_STATUS enumeration
- */
-VOS_STATUS wda_process_set_allowed_action_frames_ind(tWDA_CbContext *pWDA,
-                      struct sir_allowed_action_frames *allowed_action_frames)
-{
-    WDI_Status status;
-    struct WDI_AllowedActionFramesInd *wdi_allowed_action_frames;
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                 FL("---> %s"), __func__);
-
-    wdi_allowed_action_frames = (struct WDI_AllowedActionFramesInd*)
-                                                  vos_mem_malloc(sizeof
-                                                  (*wdi_allowed_action_frames));
-    if (!wdi_allowed_action_frames) {
-        VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                  "%s: VOS MEM Alloc Failure", __func__);
-        vos_mem_free(allowed_action_frames);
-        return VOS_STATUS_E_NOMEM;
-    }
-
-    wdi_allowed_action_frames->bitmask = allowed_action_frames->bitmask;
-    wdi_allowed_action_frames->reserved = allowed_action_frames->reserved;
-
-    status = WDI_SetAllowedActionFramesInd(wdi_allowed_action_frames);
-    if (WDI_STATUS_PENDING == status) {
-        VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                              FL("pending status received"));
-    } else if (WDI_STATUS_SUCCESS_SYNC != status &&
-                                        (WDI_STATUS_SUCCESS != status)) {
-        VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                         FL("Failure in allowed_action_frames API %d"), status);
-    }
-
-    vos_mem_free(wdi_allowed_action_frames);
-    vos_mem_free(allowed_action_frames);
-    return CONVERT_WDI2VOS_STATUS(status) ;
-}
-
-/*
- * FUNCTION: WDA_ProcessBcnMissPenaltyCount
- * Request to WDI.
- */
-VOS_STATUS WDA_ProcessTLPauseInd(tWDA_CbContext *pWDA, v_U32_t params)
-{
-    v_U8_t staId;
-    WLANTL_CbType*  pTLCb = NULL;
-
-    VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, FL("---> %s"), __func__);
-
-    staId = (v_U8_t)params;
-
-    pTLCb = VOS_GET_TL_CB(pWDA->pVosContext);
-    if ( NULL == pTLCb )
-    {
-        VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-           "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_SuspendDataTx");
-        return VOS_STATUS_E_FAULT;
-    }
-
-
-    pTLCb->atlSTAClients[staId]->disassoc_progress = VOS_TRUE;
-    /* Pause TL for Sta ID */
-    return WLANTL_SuspendDataTx(pWDA->pVosContext, &staId, NULL);
-}
-
 /*
  * FUNCTION: WDA_McProcessMsg
  * Trigger DAL-AL to start CFG download 
@@ -15093,7 +12608,7 @@
 {
    VOS_STATUS status = VOS_STATUS_SUCCESS;
    tWDA_CbContext *pWDA = NULL ; 
-   if(NULL == pMsg)
+   if(NULL == pMsg) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s:pMsg is NULL", __func__); 
@@ -15108,7 +12623,7 @@
    if(NULL == pWDA )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s:pWDA is NULL", __func__);
+                           "%s:pWDA is NULL", __func__); 
       VOS_ASSERT(0);
       vos_mem_free(pMsg->bodyptr);
       return VOS_STATUS_E_FAILURE;
@@ -15466,39 +12981,6 @@
                              (tSirWlanSetRxpFilters *)pMsg->bodyptr);
          break;
       }
-      case WDA_MGMT_LOGGING_INIT_REQ:
-      {
-         WDA_ProcessFWLoggingInitReq(pWDA,
-                                 (tSirFWLoggingInitParam *)pMsg->bodyptr);
-         break;
-      }
-      case WDA_GET_FRAME_LOG_REQ:
-      {
-         WDA_ProcessGetFrameLogReq(pWDA,
-                                        (tAniGetFrameLogReq *)pMsg->bodyptr);
-         break;
-      }
-      case WDA_START_RSSI_MONITOR_REQ:
-      {
-         WDA_ProcessStartRssiMonitorReq(pWDA,(tSirRssiMonitorReq *)pMsg->bodyptr);
-         break;
-      }
-      case WDA_STOP_RSSI_MONITOR_REQ:
-      {
-         WDA_ProcessStopRssiMonitorReq(pWDA,(tSirRssiMonitorReq *)pMsg->bodyptr);
-         break;
-      }
-      case WDA_SEND_LOG_DONE_IND:
-      {
-         WDA_FWLoggingDXEdoneInd(pMsg->bodyval);
-         break;
-      }
-      case WDA_FATAL_EVENT_LOGS_REQ:
-      {
-         WDA_ProcessFatalEventLogsReq(pWDA,
-                                       (tSirFatalEventLogsReqParam *)pMsg->bodyptr);
-         break;
-      }
       case WDA_SET_HOST_OFFLOAD:
       {
          WDA_ProcessHostOffloadReq(pWDA, (tSirHostOffloadReq *)pMsg->bodyptr);
@@ -15556,12 +13038,6 @@
          WDA_ProcessBtAmpEventReq(pWDA, (tSmeBtAmpEvent *)pMsg->bodyptr);
          break;
       }
-      case WDA_FW_STATS_GET_REQ:
-      {
-         WDA_ProcessFWStatsGetReq(pWDA,
-                              (tSirFWStatsGetReq *)pMsg->bodyptr);
-         break;
-      }
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
       case WDA_LINK_LAYER_STATS_SET_REQ:
       {
@@ -15616,22 +13092,16 @@
                         (tSirEXTScanResetBssidHotlistReqParams *)pMsg->bodyptr);
          break;
       }
-     case WDA_EXTSCAN_SET_SSID_HOTLIST_REQ:
+      case WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ:
       {
-         WDA_ProcessEXTScanSetSSIDHotlistReq(pWDA,
-                         (tSirEXTScanSetSsidHotListReqParams *)pMsg->bodyptr);
+         WDA_ProcessEXTScanSetSignfRSSIChangeReq(pWDA,
+                     (tSirEXTScanSetSignificantChangeReqParams *)pMsg->bodyptr);
          break;
       }
-      case WDA_EXTSCAN_RESET_SSID_HOTLIST_REQ:
+      case WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ:
       {
-         WDA_ProcessEXTScanResetSSIDHotlistReq(pWDA,
-                        (tSirEXTScanResetSsidHotlistReqParams *)pMsg->bodyptr);
-         break;
-      }
-      case WDA_HIGH_PRIORITY_DATA_INFO_IND:
-      {
-         WDA_ProcessHighPriorityDataInfoInd(pWDA,
-                        (tSirHighPriorityDataInfoInd *)pMsg->bodyptr);
+         WDA_ProcessEXTScanResetSignfRSSIChangeReq(pWDA,
+                   (tSirEXTScanResetSignificantChangeReqParams *)pMsg->bodyptr);
          break;
       }
 #endif /* WLAN_FEATURE_EXTSCAN */
@@ -15765,11 +13235,6 @@
          WDA_ProcessRoamScanOffloadReq(pWDA, (tSirRoamOffloadScanReq *)pMsg->bodyptr);
          break;
       }
-      case WDA_PER_ROAM_SCAN_OFFLOAD_REQ:
-      {
-         WDA_ProcessPERRoamScanOffloadReq(pWDA, (tSirPERRoamOffloadScanReq *)pMsg->bodyptr);
-         break;
-      }
 #endif
       case WDA_SET_TX_PER_TRACKING_REQ:
       {
@@ -15811,12 +13276,6 @@
          WDA_ProcessSetPowerParamsReq(pWDA, (tSirSetPowerParamsReq *)pMsg->bodyptr);
          break;
       }
-      case WDA_FW_MEM_DUMP_REQ:
-      {
-          WDA_ProcessFwrMemDumpReq(pWDA, (tAniFwrDumpReq*)pMsg->bodyptr);
-          break;
-      }
-
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
       case WDA_GTK_OFFLOAD_REQ:
       {
@@ -15900,42 +13359,7 @@
             (tSirDelPeriodicTxPtrn *)pMsg->bodyptr);
          break;
       }
-      case WDA_RATE_UPDATE_IND:
-      {
-          WDA_ProcessRateUpdateInd(pWDA, (tSirRateUpdateInd *)pMsg->bodyptr);
-          break;
-      }
-#ifdef WLAN_FEATURE_RMC
-      case WDA_RMC_RULER_REQ:
-      {
-          WDA_ProcessRMCRulerReq(pWDA, (tSirRmcRulerReq *)pMsg->bodyptr);
-          break;
-      }
-      case WDA_RMC_UPDATE_IND:
-      {
-          WDA_ProcessRMCUpdateInd(pWDA, (tSirRmcUpdateInd *)pMsg->bodyptr);
-          break;
-      }
-      case WDA_GET_IBSS_PEER_INFO_REQ:
-      {
-          WDA_ProcessIbssPeerInfoReq(pWDA,
-                            (tSirIbssGetPeerInfoReqParams *)pMsg->bodyptr);
-          break;
-      }
-      case WDA_TX_FAIL_MONITOR_IND:
-      {
-         WDA_ProcessTXFailMonitorInd(pWDA, (tAniTXFailMonitorInd *)pMsg->bodyptr);
-         break;
-      }
-#endif /* WLAN_FEATURE_RMC */
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-      case WDA_PER_ROAM_SCAN_TRIGGER_REQ:
-      {
-         WDA_ProcessPERRoamScanTriggerReq(pWDA,
-                                          (tPERRoamScanStart *)pMsg->bodyptr);
-         break;
-      }
-#endif
+
 #ifdef FEATURE_WLAN_BATCH_SCAN
       case WDA_SET_BATCH_SCAN_REQ:
       {
@@ -15943,6 +13367,11 @@
             (tSirSetBatchScanReq *)pMsg->bodyptr);
           break;
       }
+      case WDA_RATE_UPDATE_IND:
+      {
+          WDA_ProcessRateUpdateInd(pWDA, (tSirRateUpdateInd *)pMsg->bodyptr);
+          break;
+      }
       case WDA_TRIGGER_BATCH_SCAN_RESULT_IND:
       {
           WDA_ProcessTriggerBatchScanResultInd(pWDA,
@@ -15986,74 +13415,6 @@
           WDA_ProcessSetSpoofMacAddrReq(pWDA, (tpSpoofMacAddrReqParams)pMsg->bodyptr);
           break;
       }
-      case WDA_ENCRYPT_MSG_REQ:
-      {
-         WDA_ProcessEncryptMsgReq(pWDA, (u8 *)pMsg->bodyptr);
-         break;
-      }
-
-      case WDA_NAN_REQUEST:
-      {
-         WDA_ProcessNanRequest( pWDA, (tNanRequest *)pMsg->bodyptr);
-         break;
-      }
-      case WDA_SET_RTS_CTS_HTVHT:
-      {
-         WDA_ProcessSetRtsCtsHTVhtInd( pWDA, pMsg->bodyval);
-         break;
-      }
-
-      case WDA_MON_START_REQ:
-      {
-         WDA_ProcessMonStartReq(pWDA,(v_PVOID_t)pMsg->bodyptr);
-         break;
-      }
-      case WDA_MON_STOP_REQ:
-      {
-         WDA_ProcessMonStopReq(pWDA, (v_PVOID_t)pMsg->bodyptr);
-         break;
-      }
-      case WDA_SEND_FREQ_RANGE_CONTROL_IND:
-      {
-         WDA_ProcessEnableDisableCAEventInd(pWDA, pMsg->bodyval);
-         break;
-      }
-     case WDA_WIFI_CONFIG_REQ:
-     {
-       WDA_ProcessWifiConfigReq(pWDA,(tSetWifiConfigParams *)pMsg->bodyptr);
-       break;
-      }
-#ifdef FEATURE_OEM_DATA_SUPPORT
-      case WDA_START_OEM_DATA_REQ_IND_NEW:
-      {
-         WDA_ProcessStartOemDataReqIndNew(pWDA,
-                                         (tOemDataReqNewConfig *)pMsg->bodyptr);
-         break;
-      }
-#endif
-      case WDA_ANTENNA_DIVERSITY_SELECTION_REQ:
-      {
-         WDA_ProcessAntennaDiversitySelectionReq(pWDA,
-                             (tSirAntennaDiversitySelectionReq *)pMsg->bodyptr);
-         break;
-      }
-      case WDA_MODIFY_ROAM_PARAMS_IND:
-      {
-         WDA_ProcessBcnMissPenaltyCount(pWDA,
-                             (tModifyRoamParamsReqParams *)pMsg->bodyptr);
-         break;
-      }
-
-     case WDA_SET_ALLOWED_ACTION_FRAMES_IND:
-          wda_process_set_allowed_action_frames_ind(pWDA,
-                            (struct sir_allowed_action_frames*)pMsg->bodyptr);
-          break;
-
-      case WDA_PAUSE_TL_IND:
-      {
-         WDA_ProcessTLPauseInd(pWDA, pMsg->bodyval);
-         break;
-      }
       default:
       {
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -16081,10 +13442,10 @@
 #if defined WLAN_FEATURE_NEIGHBOR_ROAMING
    tSirRSSINotification rssiNotification;
 #endif
-   if (NULL == pWDA)
+   if(NULL == pWDA)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s:pWDA is NULL", __func__);
+                           "%s:pWDA is NULL", __func__); 
       VOS_ASSERT(0);
       return ;
    }
@@ -16304,16 +13665,13 @@
             {  
                VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                                   "Tx Complete timeout Timer Stop Failed ");
-            }
-            if (!IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
-                pWDA->pAckTxCbFunc( pMac, &wdiLowLevelInd->wdiIndicationData.tx_complete_status);
-            else
-                pWDA->pAckTxCbFunc( pMac, &wdiLowLevelInd->wdiIndicationData.wdiTxBdInd);
+            }  
+            pWDA->pAckTxCbFunc( pMac, wdiLowLevelInd->wdiIndicationData.tx_complete_status);
             pWDA->pAckTxCbFunc = NULL;
          }
          else
          {
-             VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+             VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                           "Tx Complete Indication is received after timeout ");
          }
          break;
@@ -16543,18 +13901,6 @@
          }
          break;
       }
-#ifdef WLAN_FEATURE_RMC
-      case WDI_TX_FAIL_IND:
-      {
-         if (pWDA->txFailIndCallback)
-         {
-            pWDA->txFailIndCallback(
-                     wdiLowLevelInd->wdiIndicationData.wdiTXFailInd.macAddr,
-                     wdiLowLevelInd->wdiIndicationData.wdiTXFailInd.seqNo);
-         }
-	 break;
-      }
-#endif /* WLAN_FEATURE_RMC */
   
 #ifdef FEATURE_WLAN_LPHB
       case WDI_LPHB_IND:
@@ -16634,48 +13980,6 @@
          break;
       }
 
-#ifdef WLAN_FEATURE_RMC
-      case WDI_RMC_RULER_PICK_NEW :
-      {
-         tSirRmcUpdateInd   *pRmcUpdateInd =
-            (tSirRmcUpdateInd *)vos_mem_malloc(sizeof(tSirRmcUpdateInd));
-
-         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                              "Received WDI_RMC_UPDATE_IND from WDI");
-         if (NULL == pRmcUpdateInd)
-         {
-            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                  "Memory allocation failure, "
-                  "WDI_RMC_UPDATE_IND not forwarded");
-            break;
-         }
-
-         pRmcUpdateInd->indication =
-           wdiLowLevelInd->wdiIndicationData.wdiRmcPickNewRulerInd.indication;
-         pRmcUpdateInd->role =
-           wdiLowLevelInd->wdiIndicationData.wdiRmcPickNewRulerInd.role;
-
-         /* Copy the mcast transmitter which should be us */
-         vos_mem_copy(pRmcUpdateInd->mcastTransmitter,
-              wdiLowLevelInd->wdiIndicationData.wdiRmcPickNewRulerInd. \
-              mcastTransmitter,
-              sizeof(tSirMacAddr));
-         /* Copy the mcast group address */
-         vos_mem_copy(pRmcUpdateInd->mcastGroup,
-              wdiLowLevelInd->wdiIndicationData.wdiRmcPickNewRulerInd.mcastGroup,
-              sizeof(tSirMacAddr));
-         vos_mem_copy(pRmcUpdateInd->mcastRuler,
-              wdiLowLevelInd->wdiIndicationData.wdiRmcPickNewRulerInd.mcastRuler,
-              sizeof(tSirMacAddr));
-         vos_mem_copy(pRmcUpdateInd->ruler,
-              wdiLowLevelInd->wdiIndicationData.wdiRmcPickNewRulerInd.ruler,
-              sizeof(pRmcUpdateInd->ruler));
-
-         WDA_SendMsg(pWDA, WDA_RMC_UPDATE_IND, (void *)pRmcUpdateInd, 0) ;
-         break;
-      }
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
      case  WDI_BATCH_SCAN_RESULT_IND:
      {
@@ -16836,7 +14140,7 @@
      case  WDI_EXTSCAN_SCAN_AVAILABLE_IND:
      case  WDI_EXTSCAN_SCAN_RESULT_IND:
      case  WDI_EXTSCAN_BSSID_HOTLIST_RESULT_IND:
-     case  WDI_EXTSCAN_SSID_HOTLIST_RESULT_IND:
+     case  WDI_EXTSCAN_SIGN_RSSI_RESULT_IND:
      {
          void *pEXTScanData;
          void *pCallbackContext;
@@ -16884,12 +14188,12 @@
               "WDI_EXTSCAN Indication is WDI_EXTSCAN_BSSID_HOTLIST_RESULT_IND");
          }
          if (wdiLowLevelInd->wdiIndicationType ==
-                 WDI_EXTSCAN_SSID_HOTLIST_RESULT_IND)
+                 WDI_EXTSCAN_SIGN_RSSI_RESULT_IND)
          {
-             indType = WDA_EXTSCAN_SSID_HOTLIST_RESULT_IND;
+             indType = WDA_EXTSCAN_SIGNF_RSSI_RESULT_IND;
 
              VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-              "WDI_EXTSCAN Indication is WDI_EXTSCAN_SSID_HOTLIST_RESULT_IND");
+                 "WDI_EXTSCAN Indication is WDA_EXTSCAN_SIGNF_RSSI_RESULT_IND");
          }
 
          pEXTScanData =
@@ -16931,7 +14235,7 @@
       case WDI_DEL_BA_IND:
       {
          tpBADeleteParams  pDelBAInd =
-           (tpBADeleteParams)vos_mem_malloc(sizeof(*pDelBAInd));
+           (tpBADeleteParams)vos_mem_malloc(sizeof(tpBADeleteParams));
 
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                                   "Received WDI_DEL_BA_IND from WDI ");
@@ -16960,209 +14264,6 @@
                                (void *)pDelBAInd , 0) ;
          break;
       }
-      case WDI_NAN_EVENT_IND:
-      {
-         vos_msg_t vosMsg;
-         tpSirNanEvent pSirNanEvent = NULL;
-
-         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                   "Received WDI_NAN_EVENT");
-
-         pSirNanEvent = (tpSirNanEvent)vos_mem_malloc( sizeof( tSirNanEvent )
-              - sizeof( pSirNanEvent->event_data)
-              + wdiLowLevelInd->wdiIndicationData.wdiNanEvent.event_data_len);
-
-         if (NULL == pSirNanEvent)
-         {
-            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                       "%s: VOS MEM Alloc Failure", __func__);
-            VOS_ASSERT(0) ;
-            break;
-         }
-
-         pSirNanEvent->event_data_len =
-             wdiLowLevelInd->wdiIndicationData.wdiNanEvent.event_data_len;
-
-         if (wdiLowLevelInd->wdiIndicationData.wdiNanEvent.event_data_len)
-         {
-            vos_mem_copy( pSirNanEvent->event_data,
-                wdiLowLevelInd->wdiIndicationData.wdiNanEvent.event_data,
-                wdiLowLevelInd->wdiIndicationData.wdiNanEvent.event_data_len);
-         }
-
-         /* VOS message wrapper */
-         vosMsg.type = eWNI_SME_NAN_EVENT;
-         vosMsg.bodyptr = pSirNanEvent;
-         vosMsg.bodyval = 0;
-
-         /* Send message to SME */
-         if (VOS_STATUS_SUCCESS
-             != vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg))
-         {
-            VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_WARN,
-                      "post eWNI_SME_NAN_EVENT to SME Failed");
-            vos_mem_free(pSirNanEvent);
-         }
-         break;
-      }
-      case WDI_LOST_LINK_PARAMS_IND:
-      {
-          tpSirSmeLostLinkParamsInd pLostLinkParamInd =
-            (tpSirSmeLostLinkParamsInd)vos_mem_malloc(sizeof(tSirSmeLostLinkParamsInd));
-
-          if (NULL == pLostLinkParamInd)
-          {
-              VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                                  "%s: VOS MEM Alloc Failure", __func__);
-              break;
-          }
-          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                     "Received WDI_LOST_LINK_PARAMS_IND from WDI ");
-
-          pLostLinkParamInd->messageType = eWNI_SME_LOST_LINK_PARAMS_IND;
-          pLostLinkParamInd->length = sizeof(tSirSmeMicFailureInd);
-          pLostLinkParamInd->info.bssIdx =
-            wdiLowLevelInd->wdiIndicationData.wdiLostLinkParamsInd.bssIdx;
-          pLostLinkParamInd->info.rssi =
-           wdiLowLevelInd->wdiIndicationData.wdiLostLinkParamsInd.rssi;
-          vos_mem_copy(pLostLinkParamInd->info.selfMacAddr,
-                    wdiLowLevelInd->wdiIndicationData.wdiLostLinkParamsInd.selfMacAddr,
-                    sizeof(tSirMacAddr));
-          pLostLinkParamInd->info.linkFlCnt =
-           wdiLowLevelInd->wdiIndicationData.wdiLostLinkParamsInd.linkFlCnt;
-          pLostLinkParamInd->info.linkFlTx =
-            wdiLowLevelInd->wdiIndicationData.wdiLostLinkParamsInd.linkFlTx;
-          pLostLinkParamInd->info.lastDataRate =
-            wdiLowLevelInd->wdiIndicationData.wdiLostLinkParamsInd.lastDataRate;
-          pLostLinkParamInd->info.rsvd1 =
-            wdiLowLevelInd->wdiIndicationData.wdiLostLinkParamsInd.rsvd1;
-          pLostLinkParamInd->info.rsvd2 =
-            wdiLowLevelInd->wdiIndicationData.wdiLostLinkParamsInd.rsvd2;
-          WDA_SendMsg(pWDA, SIR_HAL_LOST_LINK_PARAMS_IND,
-                                       (void *)pLostLinkParamInd , 0) ;
-          break;
-      }
-      case WDI_RSSI_BREACHED_IND:
-      {
-         WDI_RssiBreachedIndType *pRssiBreachedInd;
-         tpAniSirGlobal pMac;
-
-         pRssiBreachedInd =
-             (WDI_RssiBreachedIndType *)vos_mem_malloc(sizeof(WDI_RssiBreachedIndType));
-         VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                   "Received WDI_RSSI_BREACHED_IND from FW");
-
-         vos_mem_copy(pRssiBreachedInd,
-                    &wdiLowLevelInd->wdiIndicationData.wdiRssiBreachedInd,
-                    sizeof(WDI_RssiBreachedIndType));
-
-         /*sanity check*/
-         if (NULL == pWDA)
-         {
-            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s:pWDA is NULL", __func__);
-            vos_mem_free(pRssiBreachedInd);
-            VOS_ASSERT(0);
-            return;
-         }
-
-         if (NULL == pRssiBreachedInd)
-         {
-            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s:Breach indication from FW is null can't invoke HDD callback",
-              __func__);
-            VOS_ASSERT(0);
-            return;
-         }
-
-         pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
-         if (NULL == pMac)
-         {
-            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s:pMac is NULL", __func__);
-            VOS_ASSERT(0);
-            vos_mem_free(pRssiBreachedInd);
-            return;
-         }
-
-         if (pMac->sme.rssiThresholdBreachedCb)
-         {
-            pMac->sme.rssiThresholdBreachedCb(pMac->pAdapter, (void *)pRssiBreachedInd);
-         }
-         else
-         {
-            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s:HDD callback is null", __func__);
-         }
-         vos_mem_free(pRssiBreachedInd);
-         break;
-      }
-#ifdef FEATURE_OEM_DATA_SUPPORT
-      case  WDI_START_OEM_DATA_RSP_IND_NEW:
-      {
-            void *pCallbackContext;
-            tpAniSirGlobal pMac;
-            tANI_U16 indType;
-            void *pOemRspNewIndData;
-            tANI_U32 OemRspNewLen;
-
-            VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-            "Received WDI_START_OEM_DATA_RSP_IND_NEW Indications from FW");
-
-            /*sanity check*/
-            if (NULL == pWDA)
-           {
-                VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s:pWDA is NULL", __func__);
-                VOS_ASSERT(0);
-                return;
-           }
-
-           indType = WDA_START_OEM_DATA_RSP_IND_NEW;
-           pOemRspNewIndData =
-                   (void *)wdiLowLevelInd->wdiIndicationData.wdiOemDataRspNew.
-                                                              pOemRspNewIndData;
-           if (NULL == pOemRspNewIndData)
-           {
-               VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "%s: OEM_DATA_RSP_IND_NEW Indication Data is null, can't invoke HDD callback",
-                __func__);
-               VOS_ASSERT(0);
-               return;
-           }
-
-           OemRspNewLen = wdiLowLevelInd->wdiIndicationData.wdiOemDataRspNew.
-                                                                   OemRspNewLen;
-
-           pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
-           if (NULL == pMac)
-           {
-               VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                         "%s:pMac is NULL", __func__);
-               VOS_ASSERT(0);
-               return;
-           }
-
-           pCallbackContext = pMac->sme.pOemDataCallbackContext;
-
-           VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                 "%s: OemRspNewLen: %d", __func__, OemRspNewLen);
-
-          if(pMac->sme.pOemDataIndCb)
-          {
-             pMac->sme.pOemDataIndCb(pCallbackContext,
-                                     indType,
-                                     pOemRspNewIndData,
-                                     OemRspNewLen);
-          }
-          else
-          {
-             VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                        "%s:HDD callback is null", __func__);
-          }
-          break;
-      }
-#endif /* FEATURE_OEM_DATA_SUPPORT */
 
       default:
       {
@@ -17385,24 +14486,6 @@
    }
 }
 
-bool WDA_AllowAddBA(tpAniSirGlobal pMac, tANI_U8 staId, tANI_U8 tid)
-{
-   if (!pMac->lim.staBaInfo[staId].failed_count[tid])
-      return true;
-   if ((WDA_BA_MAX_RETRY_THRESHOLD <=
-        pMac->lim.staBaInfo[staId].failed_count[tid]) ||
-       ((pMac->lim.staBaInfo[staId].failed_timestamp[tid] +
-        (pMac->lim.staBaInfo[staId].failed_count[tid] * WDA_BA_RETRY_TIME)) >=
-        jiffies_to_msecs(jiffies)))
-   {
-      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-          "%s: AP/STA has declined ADDBA req for tid %d, declined %d times",
-          __func__, tid, pMac->lim.staBaInfo[staId].failed_count[tid]);
-      return false;
-   }
-   return true;
-}
-
 /*
  * BA Activity check timer handler
  */
@@ -17417,10 +14500,10 @@
    WDI_TriggerBAReqCandidateType baCandidate[WDA_MAX_STA] = {{0}} ;
    tpAniSirGlobal pMac;
 
-   if (NULL == pWDA)
+   if(NULL == pWDA)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s:pWDA is NULL", __func__);
+                           "%s:pWDA is NULL", __func__); 
       VOS_ASSERT(0);
       return ;
    }
@@ -17491,11 +14574,8 @@
             }
             else if(!WDA_GET_BA_TXFLAG(pWDA, curSta, tid)
                    && (WLANTL_STA_AUTHENTICATED == tlSTAState)
-                   && WDA_AllowAddBA(pMac, curSta, tid)
-                   && (((eSYSTEM_STA_IN_IBSS_ROLE ==
-                            pWDA->wdaGlobalSystemRole) && txPktCount )
-                   || (txPktCount >= WDA_LAST_POLLED_THRESHOLD(pWDA,
-                                                         curSta, tid))))
+                   && (txPktCount >= WDA_LAST_POLLED_THRESHOLD(pWDA, 
+                                                               curSta, tid)))
             {
                /* get prepare for sending message to HAL */
                //baCandidate[baCandidateCount].staIdx = curSta ;
@@ -17556,7 +14636,7 @@
       pWdaParams->pWdaContext = pWDA;
       pWdaParams->wdaWdiApiMsgParam = wdiTriggerBaReq ;
       pWdaParams->wdaMsgParam = NULL; 
-      status = WDI_TriggerBAReq(wdiTriggerBaReq, size,
+      status = WDI_TriggerBAReq(wdiTriggerBaReq, 
                                    WDA_TriggerBaReqCallback, pWdaParams) ;
       if(IS_WDI_STATUS_FAILURE(status))
       {
@@ -17726,14 +14806,11 @@
 void WDA_ProcessTxCompleteTimeOutInd(tWDA_CbContext* pWDA)
 {
    tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext) ;
-   tpSirTxBdStatus txBdStatus = {0};
-
    if( pWDA->pAckTxCbFunc )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                                       "TxComplete timer expired");
-      /*Indicate failure*/
-      pWDA->pAckTxCbFunc( pMac, &txBdStatus);
+      pWDA->pAckTxCbFunc( pMac, 0);
       pWDA->pAckTxCbFunc = NULL;
    }
    else
@@ -17783,15 +14860,6 @@
                            VOS_STATUS_SUCCESS : VOS_STATUS_E_FAILURE);
    }
 
-   if (pPNOScanReqParams->enable == 1)
-   {
-       if (pPNOScanReqParams->aNetworks)
-           vos_mem_free(pPNOScanReqParams->aNetworks);
-       if (pPNOScanReqParams->p24GProbeTemplate)
-           vos_mem_free(pPNOScanReqParams->p24GProbeTemplate);
-       if (pPNOScanReqParams->p5GProbeTemplate)
-           vos_mem_free(pPNOScanReqParams->p5GProbeTemplate);
-   }
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams->wdaMsgParam);
    vos_mem_free(pWdaParams);
@@ -17828,15 +14896,6 @@
                                            VOS_STATUS_E_FAILURE);
       }
 
-      if (pPNOScanReqParams->enable == 1)
-      {
-          if (pPNOScanReqParams->aNetworks)
-              vos_mem_free(pPNOScanReqParams->aNetworks);
-          if (pPNOScanReqParams->p24GProbeTemplate)
-              vos_mem_free(pPNOScanReqParams->p24GProbeTemplate);
-          if (pPNOScanReqParams->p5GProbeTemplate)
-              vos_mem_free(pPNOScanReqParams->p5GProbeTemplate);
-      }
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams->wdaMsgParam);
       vos_mem_free(pWdaParams);
@@ -17977,18 +15036,9 @@
          pPNOScanReqParams->statusCallback(pPNOScanReqParams->callbackContext,
                                            VOS_STATUS_E_FAILURE);
       }
-      if (pPNOScanReqParams->enable == 1)
-      {
-          if (pPNOScanReqParams->aNetworks)
-              vos_mem_free(pPNOScanReqParams->aNetworks);
-          if (pPNOScanReqParams->p24GProbeTemplate)
-              vos_mem_free(pPNOScanReqParams->p24GProbeTemplate);
-          if (pPNOScanReqParams->p5GProbeTemplate)
-              vos_mem_free(pPNOScanReqParams->p5GProbeTemplate);
-      }
+
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
       vos_mem_free(pWdaParams->wdaMsgParam);
-
       pWdaParams->wdaWdiApiMsgParam = NULL;
       pWdaParams->wdaMsgParam = NULL;
    }
@@ -18047,13 +15097,12 @@
       case eCSR_AUTH_TYPE_AUTOSWITCH:
            *AuthType = eWDA_AUTH_TYPE_OPEN_SYSTEM;
            break;
-#ifdef WLAN_FEATURE_11W
-      case eCSR_AUTH_TYPE_RSN_PSK_SHA256:
-           *AuthType = eWDA_AUTH_TYPE_RSN_PSK_SHA256;
+#if 0
+      case eCSR_AUTH_TYPE_SHARED_KEY:
+           *AuthType = eWDA_AUTH_TYPE_SHARED_KEY;
            break;
-      case eCSR_AUTH_TYPE_RSN_8021X_SHA256:
-           *AuthType = eWDA_AUTH_TYPE_RSN_8021X_SHA256;
-           break;
+      case eCSR_AUTH_TYPE_AUTOSWITCH:
+           *AuthType = eWDA_AUTH_TYPE_AUTOSWITCH;
 #endif
       default:
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
@@ -18103,69 +15152,6 @@
    }
 }
 
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-VOS_STATUS WDA_ProcessPERRoamScanOffloadReq(tWDA_CbContext *pWDA,
-                    tSirPERRoamOffloadScanReq *pPERRoamOffloadScanReqParams)
-{
-   WDI_Status status;
-   tWDA_ReqParams *pWdaParams ;
-   WDI_PERRoamOffloadScanInfo *pwdiPERRoamOffloadScanInfo;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-              "------> %s " ,__func__);
-
-   pwdiPERRoamOffloadScanInfo = (WDI_PERRoamOffloadScanInfo *)
-                             vos_mem_malloc(sizeof(WDI_PERRoamOffloadScanInfo));
-   if (NULL == pwdiPERRoamOffloadScanInfo) {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
-   if (NULL == pWdaParams) {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pwdiPERRoamOffloadScanInfo);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   pwdiPERRoamOffloadScanInfo->rateUpThreshold =
-          pPERRoamOffloadScanReqParams->rateUpThreshold;
-   pwdiPERRoamOffloadScanInfo->rateDownThreshold =
-          pPERRoamOffloadScanReqParams->rateDownThreshold;
-   pwdiPERRoamOffloadScanInfo->waitPeriodForNextPERScan =
-          pPERRoamOffloadScanReqParams->waitPeriodForNextPERScan;
-   pwdiPERRoamOffloadScanInfo->PERtimerThreshold =
-          pPERRoamOffloadScanReqParams->PERtimerThreshold;
-   pwdiPERRoamOffloadScanInfo->isPERRoamCCAEnabled =
-          pPERRoamOffloadScanReqParams->isPERRoamCCAEnabled;
-   pwdiPERRoamOffloadScanInfo->PERroamTriggerPercent =
-          pPERRoamOffloadScanReqParams->PERroamTriggerPercent;
-
-   /* Store Params pass it to WDI */
-   pWdaParams->wdaWdiApiMsgParam = (void *)pwdiPERRoamOffloadScanInfo;
-   pWdaParams->pWdaContext = pWDA;
-
-   /* Store param pointer as passed in by caller */
-   pWdaParams->wdaMsgParam = pPERRoamOffloadScanReqParams;
-   status = WDI_PERRoamScanOffloadReq(pwdiPERRoamOffloadScanInfo,
-                    (WDI_PERRoamOffloadScanCb)WDA_PERRoamOffloadScanReqCallback,
-                    pWdaParams);
-
-   if(IS_WDI_STATUS_FAILURE(status)) {
-      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "Failure in Send config PER roam params");
-      vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-      vos_mem_free(pWdaParams->wdaMsgParam);
-      vos_mem_free(pWdaParams);
-   }
-   return CONVERT_WDI2VOS_STATUS(status) ;
-}
-#endif
-
 /*
  * FUNCTION: WDA_ProcessRoamScanOffloadReq
  * Request to WDI to set Roam Offload Scan
@@ -18353,7 +15339,7 @@
    return;
 }
 /*
- * FUNCTION: WDA_ProcessSetRssiFilterReq
+ * FUNCTION: WDA_ProcessSetPreferredNetworkList
  * Request to WDI to set Preferred Network List.Offload
  */ 
 VOS_STATUS WDA_ProcessSetRssiFilterReq(tWDA_CbContext *pWDA, 
@@ -18561,75 +15547,6 @@
 
    return ;
 }
-
-void WDA_PERRoamTriggerScanReqCallback(WDI_Status status, void* pUserData)
-{
-   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   vos_msg_t vosMsg;
-   wpt_uint8 reason = 0;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "<------ %s " ,__func__);
-   if (NULL == pWdaParams) {
-     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-             "%s: pWdaParams received NULL", __func__);
-     VOS_ASSERT(0) ;
-     return ;
-   }
-   if ( pWdaParams->wdaMsgParam != NULL)
-      vos_mem_free(pWdaParams->wdaMsgParam);
-
-   vos_mem_free(pWdaParams) ;
-   vosMsg.type = eWNI_SME_ROAM_SCAN_TRIGGER_RSP;
-   vosMsg.bodyptr = NULL;
-   if (WDI_STATUS_SUCCESS != status)
-      reason = 0;
-
-   vosMsg.bodyval = reason;
-   if (VOS_STATUS_SUCCESS !=
-       vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg)) {
-      /* free the mem and return */
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                 "%s: Failed to post the rsp to UMAC", __func__);
-   }
-
-   return ;
-}
-
-
-void WDA_PERRoamOffloadScanReqCallback(WDI_Status status, void* pUserData)
-{
-   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   vos_msg_t vosMsg;
-   wpt_uint8 reason = 0;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "<------ %s " ,__func__);
-   if (NULL == pWdaParams) {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams received NULL", __func__);
-      VOS_ASSERT(0) ;
-      return ;
-   }
-   if ( pWdaParams->wdaMsgParam != NULL)
-      vos_mem_free(pWdaParams->wdaMsgParam);
-
-   vos_mem_free(pWdaParams) ;
-   vosMsg.type = eWNI_SME_ROAM_SCAN_OFFLOAD_RSP;
-   vosMsg.bodyptr = NULL;
-   if (WDI_STATUS_SUCCESS != status)
-      reason = 0;
-
-   vosMsg.bodyval = reason;
-   if (VOS_STATUS_SUCCESS !=
-       vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg)) {
-      /* free the mem and return */
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                 "%s: Failed to post the rsp to UMAC", __func__);
-   }
-
-   return ;
-}
 #endif
 
 /*
@@ -19445,18 +16362,6 @@
    return wdaStatus;
 }
 
-void WDA_FWLoggingDXEdoneInd(v_U32_t logType)
-{
-   WDI_Status status;
-   status = WDI_FWLoggingDXEdoneInd(logType);
-
-   if (!(WDI_STATUS_SUCCESS_SYNC == status || WDI_STATUS_PENDING == status))
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 FL("Failure status %d"), status);
-   }
-}
-
  /*  FUNCTION    WDA_featureCapsExchange
   *  WDA API to invoke capability exchange between host and FW.
   */
@@ -19528,18 +16433,16 @@
       VOS_ASSERT(0);
    }
 
-   if (eDRIVER_TYPE_MFG != pWDA->driverMode)
+   if ( (eDRIVER_TYPE_MFG != pWDA->driverMode) &&
+        (VOS_TRUE == pWDA->wdaTimersCreated))
    {
-       if(VOS_TRUE == pWDA->wdaTimersCreated)
-       {
-          wdaDestroyTimers(pWDA);
-          pWDA->wdaTimersCreated = VOS_FALSE;
-       }
+      wdaDestroyTimers(pWDA);
+      pWDA->wdaTimersCreated = VOS_FALSE;
    }
    else
    {
       vos_event_destroy(&pWDA->ftmStopDoneEvent);
-   }
+  }
 
    /* call WDI shutdown */
    wdiStatus = WDI_Shutdown(closeTransport);
@@ -19729,27 +16632,6 @@
 }
 
 /*==========================================================================
-  FUNCTION   WDA_TransportKickDxe
-
-  DESCRIPTION
-    Request Kick Dxe when first hdd TX time out
-    happens
-
-  PARAMETERS
-    NONE
-
-  RETURN VALUE
-    NONE
-
-===========================================================================*/
-void WDA_TransportKickDxe()
-{
-   WDI_TransportKickDxe();
-   return;
-}
-
-
-/*==========================================================================
   FUNCTION   WDA_SetEnableSSR
 
   DESCRIPTION
@@ -19767,17 +16649,6 @@
    WDI_SetEnableSSR(enableSSR);
 }
 
-/**
- * WDA_SetMgmtPktViaWQ5() - Set INI params sendMgmtPktViaWQ5 to WDI.
- * @sendMgmtPktViaWQ5: INI params to enable/disable sending mgmt pkt via WQ5.
- *
- * Return: void
- */
-void WDA_SetMgmtPktViaWQ5(v_BOOL_t sendMgmtPktViaWQ5)
-{
-   WDI_SetMgmtPktViaWQ5(sendMgmtPktViaWQ5);
-}
-
 #ifdef FEATURE_WLAN_LPHB
 /*
  * FUNCTION: WDA_LPHBconfRspCallback
@@ -20386,93 +17257,16 @@
 }
 
 /*==========================================================================
-  FUNCTION   WDA_EXTScanSetSSIDHotlistRspCallback
+  FUNCTION   WDA_EXTScanSetSignfRSSIChangeRspCallback
 
   DESCRIPTION
-    API to send EXTScan Set SSID Hotlist Response to HDD
+    API to send EXTScan Set Significant RSSI Change RSP to HDD
 
   PARAMETERS
     pEventData: Response from FW
    pUserData:
 ===========================================================================*/
-void WDA_EXTScanSetSSIDHotlistRspCallback(void *pEventData, void* pUserData)
-{
-    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-    tWDA_CbContext *pWDA = NULL;
-    void *pCallbackContext;
-    tpAniSirGlobal pMac;
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-            "%s: ", __func__);
-    if (NULL == pWdaParams)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                "%s: pWdaParams received NULL", __func__);
-        VOS_ASSERT(0) ;
-        return;
-    }
-
-    pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
-
-    if (NULL == pWDA)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                "%s: pWDA received NULL", __func__);
-        VOS_ASSERT(0);
-        goto error;
-    }
-
-    pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
-    if (NULL == pMac)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                "%s:pMac is NULL", __func__);
-        VOS_ASSERT(0);
-        goto error;
-    }
-
-    pCallbackContext = pMac->sme.pEXTScanCallbackContext;
-
-    if (pMac->sme.pEXTScanIndCb)
-    {
-        pMac->sme.pEXTScanIndCb(pCallbackContext,
-                WDA_EXTSCAN_SET_SSID_HOTLIST_RSP,
-                pEventData);
-    }
-    else
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                "%s:HDD callback is null", __func__);
-        VOS_ASSERT(0);
-    }
-
-
-error:
-
-    if (pWdaParams->wdaWdiApiMsgParam != NULL)
-    {
-        vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-    }
-    if (pWdaParams->wdaMsgParam != NULL)
-    {
-        vos_mem_free(pWdaParams->wdaMsgParam);
-    }
-    vos_mem_free(pWdaParams) ;
-
-    return;
-}
-
-/*==========================================================================
-  FUNCTION   WDA_EXTScanResetSSIDHotlistRspCallback
-
-  DESCRIPTION
-    API to send EXTScan ReSet SSID Hotlist Response to HDD
-
-  PARAMETERS
-    pEventData: Response from FW
-   pUserData:
-===========================================================================*/
-void WDA_EXTScanResetSSIDHotlistRspCallback(void *pEventData, void* pUserData)
+void WDA_EXTScanSetSignfRSSIChangeRspCallback(void *pEventData, void* pUserData)
 {
     tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
     tWDA_CbContext *pWDA = NULL;
@@ -20513,7 +17307,85 @@
     if (pMac->sme.pEXTScanIndCb)
     {
         pMac->sme.pEXTScanIndCb(pCallbackContext,
-                WDA_EXTSCAN_RESET_SSID_HOTLIST_RSP,
+                WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP,
+                pEventData);
+    }
+    else
+    {
+        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s:HDD callback is null", __func__);
+        VOS_ASSERT(0);
+    }
+
+
+error:
+
+    if (pWdaParams->wdaWdiApiMsgParam != NULL)
+    {
+        vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+    }
+    if (pWdaParams->wdaMsgParam != NULL)
+    {
+        vos_mem_free(pWdaParams->wdaMsgParam);
+    }
+    vos_mem_free(pWdaParams) ;
+
+    return;
+}
+
+/*==========================================================================
+  FUNCTION   WDA_EXTScanResetSignfRSSIChangeRspCallback
+
+  DESCRIPTION
+    API to send EXTScan Set Significant RSSI Change RSP to HDD
+
+  PARAMETERS
+    pEventData: Response from FW
+   pUserData:
+===========================================================================*/
+void WDA_EXTScanResetSignfRSSIChangeRspCallback(void *pEventData,
+        void* pUserData)
+{
+    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+    tWDA_CbContext *pWDA = NULL;
+    void *pCallbackContext;
+    tpAniSirGlobal pMac;
+
+    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+            "%s:", __func__);
+    if (NULL == pWdaParams)
+    {
+        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: pWdaParams received NULL", __func__);
+        VOS_ASSERT(0) ;
+        return;
+    }
+
+    pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
+
+    if (NULL == pWDA)
+    {
+        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s: pWDA received NULL", __func__);
+        VOS_ASSERT(0);
+        goto error;
+    }
+
+    pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
+    if (NULL == pMac)
+    {
+        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                "%s:pMac is NULL", __func__);
+        VOS_ASSERT(0);
+        goto error;
+    }
+
+    pCallbackContext = pMac->sme.pEXTScanCallbackContext;
+
+    if (pMac->sme.pEXTScanIndCb)
+    {
+        pMac->sme.pEXTScanIndCb(pCallbackContext,
+                WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP,
                 pEventData);
     }
     else
@@ -20798,17 +17670,17 @@
 }
 
 /*==========================================================================
-  FUNCTION   WDA_ProcessEXTScanSetSSIDHotlistReq
+  FUNCTION   WDA_ProcessEXTScanSetSignfRSSIChangeReq
 
   DESCRIPTION
-    API to send Set SSID Hotlist Request to WDI
+    API to send Set Significant RSSI Change Request to WDI
 
   PARAMETERS
     pWDA: Pointer to WDA context
     wdaRequest: Pointer to EXTScan req parameters
 ===========================================================================*/
-VOS_STATUS WDA_ProcessEXTScanSetSSIDHotlistReq(tWDA_CbContext *pWDA,
-        tSirEXTScanSetSsidHotListReqParams *wdaRequest)
+VOS_STATUS WDA_ProcessEXTScanSetSignfRSSIChangeReq(tWDA_CbContext *pWDA,
+        tSirEXTScanSetSignificantChangeReqParams *wdaRequest)
 {
     WDI_Status status = WDI_STATUS_SUCCESS;
     tWDA_ReqParams *pWdaParams;
@@ -20827,8 +17699,8 @@
     pWdaParams->wdaMsgParam = wdaRequest;
     pWdaParams->wdaWdiApiMsgParam = NULL;
 
-    status = WDI_EXTScanSetSSIDHotlistReq((void *)wdaRequest,
-         (WDI_EXTScanSetSSIDHotlistRspCb)WDA_EXTScanSetSSIDHotlistRspCallback,
+    status = WDI_EXTScanSetSignfRSSIChangeReq((void *)wdaRequest,
+    (WDI_EXTScanSetSignfRSSIChangeRspCb)WDA_EXTScanSetSignfRSSIChangeRspCallback,
             (void *)pWdaParams);
     if (IS_WDI_STATUS_FAILURE(status))
     {
@@ -20841,17 +17713,17 @@
 }
 
 /*==========================================================================
-  FUNCTION   WDA_ProcessEXTScanReSetSSIDHotlistReq
+  FUNCTION   WDA_ProcessEXTScanResetSignfRSSIChangeReq
 
   DESCRIPTION
-    API to send Reset SSID Hotlist Request to WDI
+    API to send Reset Significant RSSI Change Request to WDI
 
   PARAMETERS
     pWDA: Pointer to WDA context
     wdaRequest: Pointer to EXTScan req parameters
 ===========================================================================*/
-VOS_STATUS WDA_ProcessEXTScanResetSSIDHotlistReq(tWDA_CbContext *pWDA,
-        tSirEXTScanResetSsidHotlistReqParams *wdaRequest)
+VOS_STATUS WDA_ProcessEXTScanResetSignfRSSIChangeReq(tWDA_CbContext *pWDA,
+        tSirEXTScanResetSignificantChangeReqParams *wdaRequest)
 {
     WDI_Status status = WDI_STATUS_SUCCESS;
     tWDA_ReqParams *pWdaParams;
@@ -20870,8 +17742,9 @@
     pWdaParams->wdaMsgParam = wdaRequest;
     pWdaParams->wdaWdiApiMsgParam = NULL;
 
-    status = WDI_EXTScanResetSSIDHotlistReq((void *)wdaRequest,
-     (WDI_EXTScanResetSSIDHotlistRspCb)WDA_EXTScanResetSSIDHotlistRspCallback,
+    status = WDI_EXTScanResetSignfRSSIChangeReq((void *)wdaRequest,
+            (WDI_EXTScanResetSignfRSSIChangeRspCb)
+            WDA_EXTScanResetSignfRSSIChangeRspCallback,
             (void *)pWdaParams);
     if (IS_WDI_STATUS_FAILURE(status))
     {
@@ -20882,39 +17755,6 @@
     }
     return CONVERT_WDI2VOS_STATUS(status);
 }
-
-/*==========================================================================
-  FUNCTION   WDA_ProcessHighPriorityDataInfoInd
-
-  DESCRIPTION
-    API to send Reset SSID Hotlist Request to WDI
-
-  PARAMETERS
-    pWDA: Pointer to WDA context
-    wdaRequest: Pointer to EXTScan req parameters
-===========================================================================*/
-VOS_STATUS WDA_ProcessHighPriorityDataInfoInd(tWDA_CbContext *pWDA,
-        tSirHighPriorityDataInfoInd *wdaRequest)
-{
-    WDI_Status status = WDI_STATUS_SUCCESS;
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-            "%s:", __func__);
-
-    status = WDI_HighPriorityDataInfoInd((void *)wdaRequest);
-    if (WDI_STATUS_PENDING == status)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                 FL("pending status received "));
-    }
-    else if (WDI_STATUS_SUCCESS_SYNC != status)
-    {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               FL("Failure status %d"), status);
-    }
-    return CONVERT_WDI2VOS_STATUS(status);
-}
-
 #endif /* WLAN_FEATURE_EXTSCAN */
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
@@ -21166,650 +18006,3 @@
 }
 
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
-
-void WDA_FWStatsGetRspCallback(WDI_Status status,void *fwStatsResp,void *pUserData)
-{
-    tSirFWStatsInfo *fwStatsinfo = (tSirFWStatsInfo *)pUserData;
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                       "<------ %s " ,__func__);
-    if (NULL == fwStatsinfo)
-    {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams received NULL", __func__);
-       VOS_ASSERT(0);
-       return;
-    }
-
-    if(fwStatsinfo->callback)
-         fwStatsinfo->callback(status, fwStatsResp, fwStatsinfo->data);
-
-    vos_mem_free(pUserData);
-    return;
-}
-
-
-v_VOID_t WDA_ProcessFWStatsGetReq(tWDA_CbContext *pWDA,
-                                      tSirFWStatsGetReq *pData)
-{
-
-    WDI_Status wdiStatus;
-    tSirFWStatsInfo *fwStatsinfo;
-
-    VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-             "------> %s" , __func__);
-
-    fwStatsinfo =
-         (tSirFWStatsInfo *)vos_mem_malloc(sizeof(tSirFWStatsInfo));
-    if (NULL == fwStatsinfo)
-    {
-       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                "%s: VOS MEM Alloc Failure", __func__);
-       VOS_ASSERT(0);
-       vos_mem_free(pData);
-       return;
-    }
-
-    fwStatsinfo->callback = (tSirFWStatsCallback)(pData->callback);
-    fwStatsinfo->data     = pData->data;
-
-    wdiStatus = WDI_FWStatsGetReq(fwStatsinfo,
-                                   WDA_FWStatsGetRspCallback,
-                                                  pData->stats);
-    if (WDI_STATUS_PENDING == wdiStatus)
-    {
-        VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-              "Pending received for %s:%d ", __func__, __LINE__);
-    }
-    else if (WDI_STATUS_SUCCESS != wdiStatus)
-    {
-        if (fwStatsinfo->callback)
-        {
-            fwStatsinfo->callback(WDI_STATUS_E_FAILURE, NULL ,fwStatsinfo->data);
-        }
-        vos_mem_free(fwStatsinfo);
-    }
-    vos_mem_free(pData);
-}
-
-/*==========================================================================
-  FUNCTION  WDA_EncryptMsgRspCallback
-
-  DESCRIPTION
-    API to send Encrypt message response to HDD
-
-  PARAMETERS
-    pEventData: Response from FW
-    pUserData: Data sent to firmware as part of request
-===========================================================================*/
-void WDA_EncryptMsgRspCallback(WDI_Status status, void *pEventData,
-        void* pUserData)
-{
-    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-    tWDA_CbContext *pWDA = NULL;
-    tpAniSirGlobal pMac;
-    vos_msg_t vosMsg;
-    tpSirEncryptedDataRspParams pEncRspParams;
-    tpSetEncryptedDataRspParams pEncryptedDataRsp;
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-            FL("%s:"), __func__);
-    if (NULL == pWdaParams)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                FL("%s: pWdaParams received NULL"), __func__);
-        VOS_ASSERT(0);
-        return;
-    }
-
-    pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
-
-    if (NULL == pWDA)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                FL("%s: pWDA received NULL"), __func__);
-        VOS_ASSERT(0);
-        goto error;
-    }
-
-    pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
-    if (NULL == pMac)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                FL("%s:pMac is NULL"), __func__);
-        VOS_ASSERT(0);
-        goto error;
-    }
-
-    pEncryptedDataRsp = (tpSetEncryptedDataRspParams) pEventData;
-
-    pEncRspParams = vos_mem_malloc(sizeof(tSirEncryptedDataRspParams));
-    if (NULL == pEncRspParams)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                FL("%s: VOS MEM Alloc Failure"), __func__);
-        VOS_ASSERT(0);
-        goto error;
-    }
-
-    /* Message Header */
-    pEncRspParams->mesgType = eWNI_SME_ENCRYPT_MSG_RSP;
-    pEncRspParams->mesgLen = sizeof(tSirEncryptedDataRspParams);
-    pEncRspParams->encryptedDataRsp.encryptedPayload.length =
-        pEncryptedDataRsp->encryptedPayload.length;
-    vos_mem_copy(pEncRspParams->encryptedDataRsp.encryptedPayload.data,
-            pEncryptedDataRsp->encryptedPayload.data,
-            pEncryptedDataRsp->encryptedPayload.length);
-
-    /* VOS message wrapper */
-    vosMsg.type = eWNI_SME_ENCRYPT_MSG_RSP;
-    vosMsg.bodyptr = (void *)pEncRspParams;
-    vosMsg.bodyval = 0;
-
-    if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg))
-    {
-        /* free the mem */
-        vos_mem_free((v_VOID_t *) pEncRspParams);
-    }
-
-error:
-
-    if (pWdaParams->wdaWdiApiMsgParam != NULL)
-    {
-        vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-    }
-    if (pWdaParams->wdaMsgParam != NULL)
-    {
-        vos_mem_free(pWdaParams->wdaMsgParam);
-    }
-    vos_mem_free(pWdaParams) ;
-
-    return;
-}
-/*==========================================================================
-  FUNCTION   WDA_ProcessEncryptMsgReq
-
-  DESCRIPTION
-    API to send Encrypt message Request to WDI
-
-  PARAMETERS
-    pWDA: Pointer to WDA context
-    wdaRequest: Pointer to Encrypt_msg req parameters
-===========================================================================*/
-VOS_STATUS WDA_ProcessEncryptMsgReq(tWDA_CbContext *pWDA,
-        u8 *wdaRequest)
-{
-    WDI_Status status = WDI_STATUS_SUCCESS;
-    tWDA_ReqParams *pWdaParams;
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-            FL("%s: "), __func__);
-    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams));
-    if (NULL == pWdaParams)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-            FL("%s: VOS MEM Alloc Failure"), __func__);
-        VOS_ASSERT(0);
-        return VOS_STATUS_E_NOMEM;
-    }
-    pWdaParams->pWdaContext = pWDA;
-    pWdaParams->wdaMsgParam = wdaRequest;
-    pWdaParams->wdaWdiApiMsgParam = NULL;
-
-    status = WDI_EncryptMsgReq((void *)wdaRequest,
-            (WDI_EncryptMsgRspCb)WDA_EncryptMsgRspCallback,
-            (void *)pWdaParams);
-    if (IS_WDI_STATUS_FAILURE(status))
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-            FL("Failure to request.  Free all the memory " ));
-        vos_mem_free(pWdaParams->wdaMsgParam);
-        vos_mem_free(pWdaParams);
-    }
-    return CONVERT_WDI2VOS_STATUS(status);
-}
-/*==========================================================================
-  FUNCTION   WDA_ProcessSetRtsCtsHTVhtInd
-
-  DESCRIPTION
-    API to enable/disable RTS/CTS for different modes.
-
-  PARAMETERS
-    pWDA: Pointer to WDA context
-    rtsCtsVal : Bit mask value to enable RTS/CTS for different modes
-===========================================================================*/
-
-VOS_STATUS
-WDA_ProcessSetRtsCtsHTVhtInd(tWDA_CbContext *pWDA,
-                         tANI_U32 rtsCtsVal)
-{
-    WDI_Status status;
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                 FL("---> %s"), __func__);
-    status = WDI_SetRtsCtsHTVhtInd(rtsCtsVal);
-    if (WDI_STATUS_PENDING == status)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                 FL("pending status received "));
-    }
-    else if (WDI_STATUS_SUCCESS_SYNC != status)
-    {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               FL("Failure status %d"), status);
-    }
-    return CONVERT_WDI2VOS_STATUS(status) ;
-}
-
-void WDA_MonModeRspCallback(void *pEventData, void* pUserData)
-{
-   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-   tSirMonModeReq *pData;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "<------ %s " ,__func__);
-   if (NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams received NULL", __func__);
-      VOS_ASSERT(0) ;
-      return ;
-   }
-   pData = (tSirMonModeReq *)pWdaParams->wdaMsgParam;
-   if (pData != NULL) {
-        pData->callback(pData->magic, pData->cmpVar);
-        vos_mem_free(pWdaParams->wdaMsgParam);
-   }
-   vos_mem_free(pWdaParams) ;
-
-   return;
-}
-
-VOS_STATUS WDA_ProcessMonStartReq( tWDA_CbContext *pWDA, void *wdaRequest)
-{
-
-    WDI_Status status = WDI_STATUS_SUCCESS;
-    tWDA_ReqParams *pWdaParams;
-    tSirMonModeReq *pMonModeData = (tSirMonModeReq *)wdaRequest;
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-            FL("%s: "), __func__);
-    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams));
-    if (NULL == pWdaParams)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-            FL("%s: VOS MEM Alloc Failure"), __func__);
-        VOS_ASSERT(0);
-        return VOS_STATUS_E_NOMEM;
-    }
-    pWdaParams->pWdaContext = pWDA;
-    pWdaParams->wdaMsgParam = wdaRequest;
-    pWdaParams->wdaWdiApiMsgParam = NULL;
-
-    status = WDI_MonStartReq(pMonModeData->data,
-                               (WDI_MonModeRspCb)WDA_MonModeRspCallback,
-                               (void *)pWdaParams);
-    if (IS_WDI_STATUS_FAILURE(status))
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                   "Failure to request.  Free all the memory " );
-        vos_mem_free(pWdaParams->wdaMsgParam);
-        vos_mem_free(pWdaParams);
-    }
-    return CONVERT_WDI2VOS_STATUS(status);
-}
-
-VOS_STATUS WDA_ProcessMonStopReq( tWDA_CbContext *pWDA, void* wdaRequest)
-{
-
-    WDI_Status status = WDI_STATUS_SUCCESS;
-    tWDA_ReqParams *pWdaParams;
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-            FL("%s: "), __func__);
-    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams));
-    if (NULL == pWdaParams)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-            FL("%s: VOS MEM Alloc Failure"), __func__);
-        VOS_ASSERT(0);
-        return VOS_STATUS_E_NOMEM;
-    }
-    pWdaParams->pWdaContext = pWDA;
-    pWdaParams->wdaMsgParam = wdaRequest;
-    pWdaParams->wdaWdiApiMsgParam = NULL;
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-            "%s: Processing Mon stop request", __func__);
-    status = WDI_MonStopReq((WDI_MonModeRspCb)WDA_MonModeRspCallback,
-                             (void *)pWdaParams);
-
-    if (IS_WDI_STATUS_FAILURE(status))
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                   "Failure to request.  Free all the memory " );
-        vos_mem_free(pWdaParams->wdaMsgParam);
-        vos_mem_free(pWdaParams);
-    }
-    return CONVERT_WDI2VOS_STATUS(status);
-}
-
-VOS_STATUS WDA_ProcessEnableDisableCAEventInd(tWDA_CbContext *pWDA, tANI_U8 val)
-{
-    WDI_Status status;
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                 FL("---> %s"), __func__);
-    status = WDI_EnableDisableCAEventInd(val);
-    if (WDI_STATUS_PENDING == status)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                 FL("pending status received "));
-    }
-    else if (WDI_STATUS_SUCCESS_SYNC != status)
-    {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               FL("Failure status %d"), status);
-    }
-    return CONVERT_WDI2VOS_STATUS(status) ;
-}
-
-/*==========================================================================
-  FUNCTION WDA_WifiConfigSetRspCallback
-
-  DESCRIPTION
-    API to process set WifiConfig response from FW
-
-  PARAMETERS
-    pRsp: Pointer to set WifiConfig response
-    pUserData: Pointer to user data
-
-  RETURN VALUE
-    NONE
-
-===========================================================================*/
-void WDA_WifiConfigSetRspCallback(void *pEventData, void* pUserData)
-{
-   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
-
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "<------ %s " ,__func__);
-
-   if(NULL == pWdaParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams received NULL", __func__);
-      VOS_ASSERT(0);
-      return ;
-   }
-
-   if(NULL == pWdaParams->wdaMsgParam)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-              "%s: pWdaParams->wdaMsgParam is NULL", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pWdaParams);
-      return ;
-   }
-
-   vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-   vos_mem_free(pWdaParams->wdaMsgParam);
-   vos_mem_free(pWdaParams);
-
-   return;
-}
-
-/*==========================================================================
-  FUNCTION   WDA_ProcessWifiConfigReq
-
-  DESCRIPTION
-    API to send Set WifiConfig params request to WDI
-
-  PARAMETERS
-    pWDA: Pointer to WDA context
-    wdaRequest: Pointer to set WifiConfig req parameters
-===========================================================================*/
-
-VOS_STATUS  WDA_ProcessWifiConfigReq(tWDA_CbContext *pWDA,
-                                     tSetWifiConfigParams *pwdaWificonfig)
-{
-    WDI_Status status = WDI_STATUS_SUCCESS;
-    WDI_WifiConfigSetReqType    *pwdiWifConfigSetReqParams;
-    tWDA_ReqParams *pWdaParams ;
-    WDI_Status wstatus;
-
-    /* Sanity Check*/
-   if(NULL == pwdaWificonfig)
-  {
-     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                          "%s: tSetWifiConfigParams received NULL", __func__);
-     VOS_ASSERT(0) ;
-     return VOS_STATUS_E_FAULT;
-   }
-
-   pwdiWifConfigSetReqParams = (WDI_WifiConfigSetReqType *)vos_mem_malloc(
-                                      sizeof(WDI_WifiConfigSetReqType));
-  if(NULL == pwdiWifConfigSetReqParams)
-  {
-     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                          "%s: VOS MEM Alloc Failure", __func__);
-     VOS_ASSERT(0);
-     vos_mem_free(pwdaWificonfig);
-     return VOS_STATUS_E_NOMEM;
-  }
-
-  pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
-  if(NULL == pWdaParams)
-  {
-     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                          "%s: VOS MEM Alloc Failure", __func__);
-     VOS_ASSERT(0);
-     vos_mem_free(pwdiWifConfigSetReqParams);
-     vos_mem_free(pwdaWificonfig);
-     return VOS_STATUS_E_NOMEM;
-  }
-  pwdiWifConfigSetReqParams->paramType = pwdaWificonfig->paramType;
-  pwdiWifConfigSetReqParams->paramValue = pwdaWificonfig->paramValue;
-  vos_mem_copy(pwdiWifConfigSetReqParams->bssId,
-               &(pwdaWificonfig->bssId), sizeof(tSirMacAddr));
-
-  pWdaParams->pWdaContext = pWDA;
-  pWdaParams->wdaMsgParam = pwdaWificonfig;
-  pWdaParams->wdaWdiApiMsgParam = (void *)pwdiWifConfigSetReqParams;
-
-  wstatus = WDI_WifiConfigSetReq(pwdiWifConfigSetReqParams,
-                      (WDI_WifiConfigSetRspCb)WDA_WifiConfigSetRspCallback,
-                       pWdaParams);
-  if(IS_WDI_STATUS_FAILURE(wstatus))
-  {
-     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-             "Failure in sendind WifiConfigReq, free all the memory" );
-     status = CONVERT_WDI2VOS_STATUS(wstatus);
-     vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-     vos_mem_free(pWdaParams->wdaMsgParam);
-     vos_mem_free(pWdaParams);
-  }
-
-  return status;
-
-}
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-/*
- * FUNCTION: WDA_ProcessStartOemDataReqIndNew
- * Request to WDI.
- */
-VOS_STATUS WDA_ProcessStartOemDataReqIndNew(tWDA_CbContext *pWDA,
-                                  tOemDataReqNewConfig *pOemDataReqNewConfig)
-{
-   VOS_STATUS status = VOS_STATUS_SUCCESS;
-   WDI_Status wstatus;
-   WDI_OemDataReqNewConfig *wdiOemDataReqNewConfig;
-
-   /* Sanity Check*/
-   if(NULL == pOemDataReqNewConfig)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: pOemDataReqNewConfig received NULL", __func__);
-      VOS_ASSERT(0) ;
-      return VOS_STATUS_E_FAULT;
-   }
-
-   wdiOemDataReqNewConfig = (WDI_OemDataReqNewConfig *)vos_mem_malloc(
-                                              sizeof(WDI_OemDataReqNewConfig));
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                          "------> %s " ,__func__);
-
-   if(NULL == wdiOemDataReqNewConfig)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                           "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pOemDataReqNewConfig);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   vos_mem_copy(wdiOemDataReqNewConfig, pOemDataReqNewConfig,
-                                              sizeof(WDI_OemDataReqNewConfig));
-
-   wstatus = WDI_StartOemDataReqIndNew(wdiOemDataReqNewConfig);
-
-   if (WDI_STATUS_PENDING == wstatus)
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                  FL("pending status received "));
-   }
-   else if ((WDI_STATUS_SUCCESS_SYNC != wstatus) && (WDI_STATUS_SUCCESS != wstatus))
-   {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-       FL("Failure in OemDataReqIndNew WDI API, free all memory %d"), wstatus);
-   }
-
-   vos_mem_free(wdiOemDataReqNewConfig);
-   vos_mem_free(pOemDataReqNewConfig);
-
-   return status;
-}
-
-void WDA_GetCurrentAntennaIndexCallback(WDI_Status status, void *params,
-                                        void *pUserData)
-{
-   tSirAntennaDiversitySelectionInfo *pAntennaDivSelInfo =
-                           (tSirAntennaDiversitySelectionInfo *)pUserData;
-
-   tSirAntennaDivSelRsp *resParams = (tSirAntennaDivSelRsp *)params;
-   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                                 "<------ %s " ,__func__);
-   if (NULL == pAntennaDivSelInfo)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                "%s: pWdaParams received NULL", __func__);
-      VOS_ASSERT(0) ;
-      return ;
-   }
-   if (NULL == resParams)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                "%s: resParams received NULL", __func__);
-      VOS_ASSERT(0) ;
-      return ;
-   }
-
-   if (pAntennaDivSelInfo->callback)
-   {
-       if (WDI_STATUS_SUCCESS == status)
-       {
-           pAntennaDivSelInfo->callback(resParams->selectedAntennaId,
-                                        pAntennaDivSelInfo->data);
-       }
-       else
-       {
-           pAntennaDivSelInfo->callback(-1,
-                                        pAntennaDivSelInfo->data);
-       }
-   }
-
-   vos_mem_free(pUserData);
-   return;
-}
-
-/*
- * FUNCTION: WDA_ProcessAntennaDiversitySelectionReq
- * Request to WDI.
- */
-v_VOID_t WDA_ProcessAntennaDiversitySelectionReq(tWDA_CbContext *pWDA,
-                                  tSirAntennaDiversitySelectionReq *pData)
-{
-   WDI_Status wdiStatus;
-   tSirAntennaDiversitySelectionInfo *pAntennaDivSelInfo;
-
-   VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-             "------> %s " , __func__);
-
-   pAntennaDivSelInfo = (tSirAntennaDiversitySelectionInfo *)
-             vos_mem_malloc(sizeof(tSirAntennaDiversitySelectionInfo));
-   if (NULL == pAntennaDivSelInfo)
-   {
-      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                "%s: VOS MEM Alloc Failure", __func__);
-      VOS_ASSERT(0);
-      vos_mem_free(pData);
-      return;
-   }
-
-   pAntennaDivSelInfo->callback = (tAntennaDivSelCB)(pData->callback);
-   pAntennaDivSelInfo->data = pData->data;
-
-   wdiStatus = WDI_GetCurrentAntennaIndex(pAntennaDivSelInfo,
-               WDA_GetCurrentAntennaIndexCallback, pData->reserved);
-
-   if (WDI_STATUS_PENDING == wdiStatus)
-   {
-      VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-              "Pending received for %s:%d ", __func__, __LINE__);
-   }
-   else if (WDI_STATUS_SUCCESS != wdiStatus)
-   {
-       if (pAntennaDivSelInfo->callback)
-       {
-           pAntennaDivSelInfo->callback(-1, pAntennaDivSelInfo->data);
-       }
-   }
-
-   vos_mem_free(pData);
-   return;
-}
-
-/*
- * FUNCTION: WDA_ProcessBcnMissPenaltyCount
- * Request to WDI.
- */
-VOS_STATUS WDA_ProcessBcnMissPenaltyCount(tWDA_CbContext *pWDA,
-                                          tModifyRoamParamsReqParams *params)
-{
-    WDI_Status status;
-
-    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                 FL("---> %s"), __func__);
-
-    if (NULL == params)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                 FL("tModifyRoamParamsReqParams is received NULL"));
-        return VOS_STATUS_E_NOMEM;
-    }
-
-    status = WDI_SetBcnMissPenaltyCount((WDI_ModifyRoamParamsReqType *)params);
-    if (WDI_STATUS_PENDING == status)
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
-                 FL("pending status received "));
-    }
-    else if (WDI_STATUS_SUCCESS_SYNC != status)
-    {
-       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               FL("Failure status %d"), status);
-    }
-    vos_mem_free(params);
-    return CONVERT_WDI2VOS_STATUS(status) ;
-}
-
-#endif
diff --git a/wlan/prima/CORE/WDA/src/wlan_qct_wda_debug.c b/wlan/prima/CORE/WDA/src/wlan_qct_wda_debug.c
index 5f3cabc..3e0b97d 100644
--- a/wlan/prima/CORE/WDA/src/wlan_qct_wda_debug.c
+++ b/wlan/prima/CORE/WDA/src/wlan_qct_wda_debug.c
@@ -42,6 +42,9 @@
   Are listed for each API below.
 
 
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
diff --git a/wlan/prima/CORE/WDA/src/wlan_qct_wda_ds.c b/wlan/prima/CORE/WDA/src/wlan_qct_wda_ds.c
index 2e303fb..71dc706 100644
--- a/wlan/prima/CORE/WDA/src/wlan_qct_wda_ds.c
+++ b/wlan/prima/CORE/WDA/src/wlan_qct_wda_ds.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -43,6 +43,9 @@
   Are listed for each API below.
 
 
+  Copyright (c) 2010-2011 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
@@ -139,20 +142,6 @@
 }
 #endif /*WLAN_PERF*/
 
-void WDA_DS_RxLogCallback(v_U8_t logType)
-{
-  vos_msg_t vosMessage;
-
-  vosMessage.bodyval = (v_U32_t)logType;
-  vosMessage.reserved = 0;
-  vosMessage.type = WDA_SEND_LOG_DONE_IND;
-  if (VOS_STATUS_SUCCESS != vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage )) {
-     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-               "WLAN WDA:Posting DXE logging done indication failed" );
-  }
-  return;
-}
-
 /*==========================================================================
   FUNCTION    WDA_DS_Register
 
@@ -249,7 +238,6 @@
                                (WDI_DS_TxCompleteCallback)WDA_DS_TxCompleteCB,
                                (WDI_DS_RxPacketCallback)pfnRxPacketCallback,
                                WDA_DS_TxFlowControlCallback,
-                               WDA_DS_RxLogCallback,
                                pvosGCtx );
 
   if ( WDI_STATUS_SUCCESS != wdiStatus )
@@ -436,18 +424,13 @@
   v_U32_t          txFlag,
   v_U32_t         timeStamp,
   v_U8_t          ucIsEapol,
-  v_U8_t          ucUP,
-  v_U32_t         ucTxBdToken
+  v_U8_t          ucUP
 )
 {
   VOS_STATUS             vosStatus;
   WDI_DS_TxMetaInfoType* pTxMetaInfo = NULL;
   v_SIZE_t               usMacAddrSize;
   wpt_FrameCtrl          *pFrameControl;
-#ifdef WLAN_FEATURE_RMC
-  WLANTL_CbType*         pTLCb;
-  WLANTL_RMC_SESSION*    pRMCSession;
-#endif
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
   /*------------------------------------------------------------------------
@@ -461,20 +444,6 @@
     return VOS_STATUS_E_FAULT;
   }
 
-#ifdef WLAN_FEATURE_RMC
-/*----------------------------------------------------------------
-    Extract TL control block
-   --------------------------------------------------------------*/
-  pTLCb = VOS_GET_TL_CB(pvosGCtx);
-  if ( NULL == pTLCb )
-  {
-    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-      "WLAN TL %s: pTLCb is NULL", __func__));
-
-    return VOS_STATUS_E_FAILURE;
-  }
-#endif
-
   /*------------------------------------------------------------------------
     Extract TX Meta Info pointer from PAL packet
    ------------------------------------------------------------------------*/
@@ -500,7 +469,7 @@
   pTxMetaInfo->fdisableFrmXlt = ucDisableFrmXtl;
   pTxMetaInfo->frmType     = ( ( typeSubtype & 0x30 ) >> 4 );
   pTxMetaInfo->typeSubtype = typeSubtype;
-  pTxMetaInfo->txBdToken = ucTxBdToken;
+
   /* Length = MAC header + payload */
   vos_pkt_get_packet_length( vosDataBuff, pusPktLen);
   pTxMetaInfo->fPktlen = *pusPktLen;
@@ -549,42 +518,6 @@
   // ADDR2
   vos_copy_macaddr( (v_MACADDR_t*)pTxMetaInfo->addr2MACAddress, pAddr2 );
 
-#ifdef WLAN_FEATURE_RMC
-  if (pTLCb->rmcDataPathEnabled)
-  {
-    /*look up for mcast transmitter MAC address in TL's active rmc list*/
-    if (((WDA_TLI_DATA_FRAME_TYPE >> 4) == pTxMetaInfo->frmType) &&
-        (vos_is_macaddr_group(pvDestMacAddr)))
-    {
-        pRMCSession =
-           WLANTL_RmcLookUpRmcSession(pTLCb->rmcSession,
-           (v_MACADDR_t*)pTxMetaInfo->addr2MACAddress);
-
-        if (pRMCSession)
-        {
-            if (0xFF == pvDestMacAddr->bytes[0])
-            {
-               pTxMetaInfo->txFlags |= (HAL_USE_BD_RATE_1_MASK);
-            }
-            else
-            {
-                pTxMetaInfo->txFlags |= (HAL_RMC_REQUESTED_MASK);
-
-                VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-                    "RMC active for " MAC_ADDRESS_STR " RMC session",
-                    MAC_ADDR_ARRAY(pRMCSession->rmcAddr.bytes));
-            }
-        }
-        else
-        {
-            VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-               "RMC disabled for " MAC_ADDRESS_STR " RMC session",
-               MAC_ADDR_ARRAY(pTxMetaInfo->addr2MACAddress));
-        }
-    }
-  }
-#endif /*WLAN_FEATURE_RMC*/
-
   /* Dump TX meta infro for debugging */
   VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
              "WLAN TL: Dump TX meta info: "
diff --git a/wlan/prima/CORE/WDA/src/wlan_qct_wda_legacy.c b/wlan/prima/CORE/WDA/src/wlan_qct_wda_legacy.c
index 176aabf..6cb08e5 100644
--- a/wlan/prima/CORE/WDA/src/wlan_qct_wda_legacy.c
+++ b/wlan/prima/CORE/WDA/src/wlan_qct_wda_legacy.c
@@ -42,6 +42,9 @@
   Are listed for each API below.
 
 
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /* Standard include files */
@@ -175,7 +178,6 @@
    switch (msg.type & HAL_MMH_MB_MSG_TYPE_MASK)
    {
    case WDA_MSG_TYPES_BEGIN:    // Posts a message to the HAL MsgQ
-   case WDA_EXT_MSG_TYPES_BEGIN:
       wdaPostCtrlMsg(pMac, &msg);
       break;
 
diff --git a/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h b/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h
index b44e3f7..1cd9fae 100644
--- a/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h
+++ b/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -42,6 +42,9 @@
   module.
   
       
+  Copyright (c) 2010-2011 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
@@ -151,10 +154,6 @@
 /* Periodic Tx pattern offload feature */
 #define PERIODIC_TX_PTRN_MAX_SIZE 1536
 #define MAXNUM_PERIODIC_TX_PTRNS 6
-#define WDI_DISA_MAX_PAYLOAD_SIZE                1600
-#define MAX_NUM_OF_BUFFER 3
-#define VALID_FW_LOG_TYPES      2
-#define MAX_LOG_BUFFER_LENGTH      128 * 1024
 
 /*============================================================================
  *     GENERIC STRUCTURES 
@@ -395,20 +394,12 @@
 
   /* Periodic Tx Pattern FW Indication */
   WDI_PERIODIC_TX_PTRN_FW_IND,
-#ifdef WLAN_FEATURE_RMC
-  /* RMC_Ruler_Pick_New Indication */
-  WDI_RMC_RULER_PICK_NEW,
-#endif
 
 #ifdef FEATURE_WLAN_BATCH_SCAN
   /*Batch scan result indication from FW*/
   WDI_BATCH_SCAN_RESULT_IND,
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-  WDI_TX_FAIL_IND,
-#endif
-
 #ifdef FEATURE_WLAN_CH_AVOID
   WDI_CH_AVOID_IND,
 #endif /* FEATURE_WLAN_CH_AVOID */
@@ -421,16 +412,11 @@
   WDI_EXTSCAN_SCAN_RESULT_IND,
   WDI_EXTSCAN_GET_CAPABILITIES_IND,
   WDI_EXTSCAN_BSSID_HOTLIST_RESULT_IND,
-  WDI_EXTSCAN_SSID_HOTLIST_RESULT_IND,
+  WDI_EXTSCAN_SIGN_RSSI_RESULT_IND,
 #endif
   /*Delete BA Ind*/
   WDI_DEL_BA_IND,
-  WDI_NAN_EVENT_IND,
-  WDI_LOST_LINK_PARAMS_IND,
-  WDI_RSSI_BREACHED_IND,
-#ifdef FEATURE_OEM_DATA_SUPPORT
-  WDI_START_OEM_DATA_RSP_IND_NEW,
-#endif
+
   WDI_MAX_IND
 }WDI_LowLevelIndEnumType;
 
@@ -545,22 +531,6 @@
   wpt_uint8       macAddr[WDI_MAC_ADDR_LEN];
 }WDI_DHCPInd;
 
-#ifdef WLAN_FEATURE_RMC
-typedef struct
-{
-   /*Request status callback offered by UMAC - it is called if the current
-    req has returned PENDING as status; it delivers the status of sending
-    the message over the BUS */
-  WDI_ReqStatusCb   wdiReqStatusCB;
-
-  /*The user data passed in by UMAC, it will be sent back when the above
-    function pointer will be called */
-  void*             pUserData;
-
-  wpt_uint8         tx_fail_count;
-}WDI_TXFailMonitorInd;
-#endif /* WLAN_FEATURE_RMC */
-
 /*---------------------------------------------------------------------------
 
   WDI_MacSSid
@@ -647,13 +617,6 @@
 } WDI_WakeReasonIndType;
 #endif // WLAN_WAKEUP_EVENTS
 
-typedef struct
-{
-    wpt_uint16 event_data_len;
-    wpt_uint8* event_data;
-} WDI_NanEventType;
-
-
 /*---------------------------------------------------------------------------
  WDI_MissedBeaconIndType
 -----------------------------------------------------------------------------*/
@@ -763,33 +726,6 @@
 
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-typedef struct
-{
-  wpt_uint8 seqNo;
-  wpt_uint8 macAddr[WDI_MAC_ADDR_LEN];
-} WDI_TXFailIndType;
-#endif /* WLAN_FEATURE_RMC */
-
-typedef struct
-{
-  wpt_uint8  bssIdx;
-  wpt_uint8  rssi;
-  wpt_uint8  selfMacAddr[WDI_MAC_ADDR_LEN];
-  wpt_uint32 linkFlCnt;
-  wpt_uint32 linkFlTx;
-  wpt_uint32 lastDataRate;
-  wpt_uint32 rsvd1;
-  wpt_uint32 rsvd2;
-
-}WDI_LostLinkParamsIndType;
-
-typedef struct
-{
-  wpt_uint32     request_id;
-  wpt_uint8      bssId[WDI_MAC_ADDR_LEN];
-  wpt_int8       rssi;
-}WDI_RssiBreachedIndType;
 
 /*---------------------------------------------------------------------------
  WDI_IbssPeerInactivityIndType
@@ -801,112 +737,6 @@
    wpt_macAddr staMacAddr;
 }WDI_IbssPeerInactivityIndType;
 
-#ifdef WLAN_FEATURE_RMC
-/*---------------------------------------------------------------------------
- WDI_RmcRulerReqParams
------------------------------------------------------------------------------*/
-typedef struct
-{
-    wpt_uint8       cmd;
-
-    /* MAC address of MCAST Transmitter (source) */
-    wpt_macAddr mcastTransmitter;
-
-    /* MAC Address of Multicast Group (01-00-5E-xx-xx-xx) */
-    wpt_macAddr mcastGroup;
-
-    /* List of candidates for cmd = WLAN_HAL_SUGGEST_RULER*/
-    wpt_macAddr blacklist[8]; /* HAL_NUM_MAX_RULERS */
-
-    /*
-     * Request status callback offered by UMAC - it is called if the current
-     * req has returned PENDING as status; it delivers the status of sending
-     * the message over the BUS
-     */
-    WDI_ReqStatusCb    wdiReqStatusCB;
-
-} WDI_RmcRulerReqParams;
-
-/*---------------------------------------------------------------------------
- WDI_RmcUpdateIndParams
------------------------------------------------------------------------------*/
-typedef struct
-{
-    wpt_uint8       indication;  /* tRmcUpdateIndType */
-
-    wpt_uint8       role;
-
-    /* MAC address of MCAST Transmitter (source) */
-    wpt_macAddr mcastTransmitter;
-
-    /* MAC Address of Multicast Group (01-00-5E-xx-xx-xx) */
-    wpt_macAddr mcastGroup;
-
-    wpt_macAddr mcastRuler;
-
-    wpt_macAddr ruler[16];
-
-    /*
-     * Request status callback offered by UMAC - it is called if the current
-     * req has returned PENDING as status; it delivers the status of sending
-     * the message over the BUS
-     */
-    WDI_ReqStatusCb   wdiReqStatusCB;
-
-    /*
-     * The user data passed in by UMAC, it will be sent back when the above
-     * function pointer will be called
-     */
-    void   *pUserData;
-
-} WDI_RmcUpdateIndParams;
-
-typedef enum
-{
-  eWDI_SUGGEST_RULER_CMD = 0,
-  eWDI_BECOME_RULER_CMD  = 1,
-} eWDI_RulerRspCmdType;
-
-/*---------------------------------------------------------------------------
- WDI_RmcRspParamsType
------------------------------------------------------------------------------*/
-typedef struct
-{
-    wpt_uint8       status;  /* success or failure */
-
-    /*  Command Type */
-    eWDI_RulerRspCmdType cmd;
-
-    /* MAC address of MCAST Transmitter (source) */
-    wpt_macAddr mcastTransmitter;
-
-    /* MAC Address of Multicast Group (01-00-5E-xx-xx-xx) */
-    wpt_macAddr mcastGroup;
-
-    wpt_macAddr ruler[8];
-} WDI_RmcRspParamsType;
-
-/*---------------------------------------------------------------------------
- WDI_RmcPickNewRuler
------------------------------------------------------------------------------*/
-typedef struct
-{
-    wpt_uint8       indication;  /* pick_new */
-
-    wpt_uint8       role;
-
-    /* MAC address of MCAST Transmitter (source) */
-    wpt_macAddr mcastTransmitter;
-
-    /* MAC Address of Multicast Group (01-00-5E-xx-xx-xx) */
-    wpt_macAddr mcastGroup;
-
-    wpt_macAddr mcastRuler;
-
-    wpt_macAddr ruler[16];
-} WDI_RmcPickNewRuler;
-#endif
-
 /*---------------------------------------------------------------------------
  WDI_TxRateFlags
 -----------------------------------------------------------------------------*/
@@ -943,10 +773,10 @@
      * 0 implies MCAST RA, positive value implies fixed rate,
      * -1 implies ignore this param
      */
-    wpt_int32 rmcDataRate; //unit Mbpsx10
+    wpt_int32 reliableMcastDataRate; //unit Mbpsx10
 
     /* TX flag to differentiate between HT20, HT40 etc */
-    WDI_TxRateFlags rmcDataRateTxFlag;
+    WDI_TxRateFlags reliableMcastDataRateTxFlag;
 
     /*
      * MCAST(or BCAST) fixed data rate in 2.4 GHz, unit Mbpsx10,
@@ -981,23 +811,8 @@
 
 } WDI_RateUpdateIndParams;
 
-typedef struct
-{
-   wpt_uint32 ubsp_enter_cnt;
-   wpt_uint32 ubsp_jump_ddr_cnt;
-}ubspFwStats;
-
-typedef struct
-{
-   wpt_uint32 type;
-   /*data*/
-   union{
-      ubspFwStats ubspStats;
-   }wdiFwStatsData;
-}  WDI_FWStatsResults;
-
 #ifdef FEATURE_WLAN_CH_AVOID
-#define WDI_CH_AVOID_MAX_RANGE   15
+#define WDI_CH_AVOID_MAX_RANGE   4
 
 typedef struct
 {
@@ -1040,24 +855,6 @@
     wpt_macAddr  bssId;   // TO SUPPORT BT-AMP
 }  WDI_DeleteBAIndType;
 
-typedef struct
-{
-    wpt_uint32 tx_complete_status;
-    wpt_uint32 tx_bd_token;
-}  WDI_TxBDStatus;
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-/*----------------------------------------------------------------------------
-  OEM DATA RESPONSE - DATA STRUCTURES
-----------------------------------------------------------------------------*/
-typedef struct
-{
-    void *pOemRspNewIndData;
-    /* Max OemRspNewLen possible is NEW_OEM_DATA_RSP_SIZE*/
-    wpt_uint32 OemRspNewLen;
-} WDI_OemDataRspNew;
-#endif
-
 /*---------------------------------------------------------------------------
   WDI_LowLevelIndType
     Inidcation type and information about the indication being carried
@@ -1118,19 +915,11 @@
     /* Periodic TX Pattern FW Indication */
     WDI_PeriodicTxPtrnFwIndType  wdiPeriodicTxPtrnFwInd;
 
-#ifdef WLAN_FEATURE_RMC
-    WDI_RmcPickNewRuler        wdiRmcPickNewRulerInd;
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
     /*batch scan result indication from FW*/
     void *pBatchScanResult;
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-    WDI_TXFailIndType            wdiTXFailInd;
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_CH_AVOID
     WDI_ChAvoidIndType          wdiChAvoidInd;
 #endif /* FEATURE_WLAN_CH_AVOID */
@@ -1144,16 +933,6 @@
     void *pEXTScanIndData;
 #endif
     WDI_DeleteBAIndType         wdiDeleteBAInd;
-
-    WDI_NanEventType wdiNanEvent;
-
-    WDI_TxBDStatus              wdiTxBdInd;
-    WDI_LostLinkParamsIndType   wdiLostLinkParamsInd;
-    WDI_RssiBreachedIndType     wdiRssiBreachedInd;
-#ifdef FEATURE_OEM_DATA_SUPPORT
-/*OEM Data Rsp New Results from FW*/
-    WDI_OemDataRspNew           wdiOemDataRspNew;
-#endif
   }  wdiIndicationData;
 }WDI_LowLevelIndType;
 
@@ -2858,53 +2637,6 @@
 
 }WDI_SpoofMacAddrRspParamType;
 /*---------------------------------------------------------------------------
-  WDI_GetFrameLogRspParamType
----------------------------------------------------------------------------*/
-typedef struct
-{
-  /* wdi status */
-  wpt_uint32   wdiStatus;
-}WDI_GetFrameLogRspParamType;
-/*---------------------------------------------------------------------------
-  WDI_FWLoggingInitRspParamType
----------------------------------------------------------------------------*/
-typedef struct
-{
-  //FW mail box address
-  wpt_uint64 logMailBoxAddr;
-  wpt_uint32 status;
-  //Logging mail box version
-  wpt_uint8 logMailBoxVer;
-  //Qshrink is enabled
-  wpt_boolean logCompressEnabled;
-  /* store the size of fw mem dump */
-  wpt_uint32 fw_mem_dump_max_size;
-  //Reserved for future purpose
-  wpt_uint32 reserved1;
-  wpt_uint32 reserved2;
-}WDI_FWLoggingInitRspParamType;
-
-typedef struct
-{
-  /* wdi status */
-  wpt_uint32   status;
-}WDI_RssiMonitorStartRspParamType;
-
-typedef struct
-{
-  /* wdi status */
-  wpt_uint32   status;
-}WDI_RssiMonitorStopRspParamType;
-/*---------------------------------------------------------------------------
-  WDI_FatalEventLogsRspParamType
----------------------------------------------------------------------------*/
-typedef struct
-{
-  /* wdi status */
-  wpt_uint32   wdiStatus;
-}WDI_FatalEventLogsRspParamType;
-
-/*---------------------------------------------------------------------------
   WDI_AddBAReqinfoType
 ---------------------------------------------------------------------------*/
 typedef struct
@@ -4276,44 +4008,6 @@
    void*                      pUserData; 
 }WDI_ConfigureRxpFilterReqParamsType;
 
-typedef struct
-{
-   wpt_uint8 enableFlag;
-   wpt_uint8 frameType;
-   wpt_uint8 frameSize;
-   wpt_uint8 bufferMode;
-   wpt_uint8 continuousFrameLogging;
-   wpt_uint8 minLogBufferSize;
-   wpt_uint8 maxLogBufferSize;
-}WDI_FWLoggingInitReqInfoType;
-
-typedef struct
-{
-   wpt_uint32    requestId;
-   wpt_uint8     minRssi;
-   wpt_uint8     maxRssi;
-   wpt_macAddr   currentBssId;
-}WDI_RssiMonitorReqInfoType;
-
-typedef struct
-{
-    wpt_uint32 reason_code;
-}WDI_FatalEventLogsReqInfoType;
-
-
-typedef struct
-{
-   wpt_uint8 flags;
-}WDI_GetFrameLogReqInfoType;
-
-typedef struct
-{
-   wpt_uint16 status;
-   wpt_uint16 doneIndicationForSource;
-   wpt_uint64 logBuffAddress[MAX_NUM_OF_BUFFER];
-   wpt_uint32 logBuffLength[MAX_NUM_OF_BUFFER];
-}WDI_FWLoggingDXEdoneIndInfoType;
-
 /*---------------------------------------------------------------------------
   WDI_BeaconFilterInfoType
   Beacon Filtering data structures passed to WDA form UMAC
@@ -4833,14 +4527,6 @@
 #define OEM_DATA_RSP_SIZE 1968
 #endif
 
-#ifndef NEW_OEM_DATA_REQ_SIZE
-#define NEW_OEM_DATA_REQ_SIZE 292
-#endif
-
-#ifndef NEW_OEM_DATA_RSP_SIZE
-#define NEW_OEM_DATA_RSP_SIZE 2100
-#endif
-
 /*----------------------------------------------------------------------------
   WDI_oemDataReqInfoType
 ----------------------------------------------------------------------------*/
@@ -4877,19 +4563,6 @@
   wpt_uint8           oemDataRsp[OEM_DATA_RSP_SIZE];
 }WDI_oemDataRspParamsType;
 
-/*----------------------------------------------------------------------------
-  OEM DATA REQ NEW/OEM DATA RSP NEW - DATA STRUCTURES
-----------------------------------------------------------------------------*/
-/* Structure for defining req sent to the PE */
-typedef struct
-{
-    wpt_macAddr selfMacAddr;
-    wpt_uint8 reserved[2];
-    wpt_uint8  oemDataReqNew[NEW_OEM_DATA_REQ_SIZE];
-} WDI_OemDataReqNew, WDI_OemDataReqNewConfig;
-
-/*************************************************************************************************************/
-
 #endif /* FEATURE_OEM_DATA_SUPPORT */
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
@@ -5582,22 +5255,6 @@
    function pointer will be called */
    void*                      pUserData;
 } WDI_RoamScanOffloadReqParamsType;
-
-typedef struct
-{
-  wpt_uint32  requestId;
-  wpt_uint32  rateUpThreshold;
-  wpt_uint32  rateDownThreshold;
-  wpt_uint32  isPERRoamCCAEnabled;
-  wpt_uint32  waitPeriodForNextPERScan;
-  wpt_uint32  PERtimerThreshold;
-  wpt_uint32  PERroamTriggerPercent;
-} WDI_PERRoamOffloadScanInfo;
-
-typedef struct
-{
-  wpt_boolean roamScanReq; // Request info for all peers
-} WDI_PERRoamTriggerScanInfo;
 #endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
 
 /*---------------------------------------------------------------------------
@@ -6042,16 +5699,6 @@
 } WDI_AddPeriodicTxPtrnParamsType;
 
 /*---------------------------------------------------------------------------
-  WDI_NanRequestType
----------------------------------------------------------------------------*/
-typedef struct
-{
-    wpt_uint16 request_data_len;
-    wpt_uint8 request_data[1];
-} WDI_NanRequestType;
-
-
-/*---------------------------------------------------------------------------
   WDI_DelPeriodicTxPtrnParamsType
 ---------------------------------------------------------------------------*/
 typedef struct
@@ -6068,64 +5715,12 @@
   void*             pUserData;
 } WDI_DelPeriodicTxPtrnParamsType;
 
-#ifdef WLAN_FEATURE_RMC
-/*---------------------------------------------------------------------------
-  WDI_IbssPeerInfoParams
----------------------------------------------------------------------------*/
-typedef struct
-{
-    wpt_uint8  wdiStaIdx;       //StaIdx
-    wpt_uint32 wdiTxRate;       //Tx Rate
-    wpt_uint32 wdiMcsIndex;     //MCS Index
-    wpt_uint32 wdiTxRateFlags;  //TxRate Flags
-    wpt_int8   wdiRssi;         //RSSI
-}WDI_IbssPeerInfoParams;
-
-/*---------------------------------------------------------------------------
-  WDI_IbssPeerInfoRspParams
----------------------------------------------------------------------------*/
-typedef struct
-{
-    wpt_uint32        wdiStatus;                  // Return status
-    wpt_uint8         wdiNumPeers;                // Number of peers
-    WDI_IbssPeerInfoParams *wdiPeerInfoParams; // Peer Info parameters
-}WDI_IbssPeerInfoRspParams;
-
-/*---------------------------------------------------------------------------
-  WDI_GetIbssPeerInfoRspType
----------------------------------------------------------------------------*/
-typedef struct
-{
-    WDI_IbssPeerInfoRspParams  wdiPeerInfoRspParams;
-
-    /*Request status callback offered by UMAC - it is called if the current
-      req has returned PENDING as status; it delivers the status of sending
-      the message over the BUS */
-    WDI_ReqStatusCb   wdiReqStatusCB;
-
-    /*The user data passed in by UMAC, it will be sent back when the above
-      function pointer will be called */
-    void*             pUserData;
-}WDI_GetIbssPeerInfoRspType;
-
-/*---------------------------------------------------------------------------
-  WDI_IbssPeerInfoReqType
----------------------------------------------------------------------------*/
-typedef struct
-{
-    wpt_boolean wdiAllPeerInfoReqd; // Request info for all peers
-    wpt_uint8   wdiStaIdx;          // STA Index
-    wpt_uint8   wdiBssIdx;          // BSS Index
-}WDI_IbssPeerInfoReqType;
-
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef WLAN_FEATURE_EXTSCAN
 
 #define WDI_WLAN_EXTSCAN_MAX_CHANNELS                 16
 #define WDI_WLAN_EXTSCAN_MAX_BUCKETS                  16
 #define WDI_WLAN_EXTSCAN_MAX_HOTLIST_APS              128
-#define WDI_WLAN_EXTSCAN_MAX_HOTLIST_SSID             8
+#define WDI_WLAN_EXTSCAN_MAX_SIGNIFICANT_CHANGE_APS   64
 
 typedef enum
 {
@@ -6172,10 +5767,6 @@
      */
     wpt_uint8      reportEvents;
 
-    wpt_uint32        max_period;
-    wpt_uint32        exponent;
-    wpt_uint32        step_count;
-
     wpt_uint8      numChannels;
 
     /*
@@ -6192,10 +5783,8 @@
     wpt_uint32                maxAPperScan;
 
     /* in %, when buffer is this much full, wake up host */
-    wpt_uint32                reportThresholdPercent;
-    wpt_uint32                reportThresholdNumScans;
+    wpt_uint32                reportThreshold;
 
-    wpt_uint32               homeAwayTime;  //in units of milliseconds
     wpt_uint8                numBuckets;
     WDI_WifiScanBucketSpec  buckets[WDI_WLAN_EXTSCAN_MAX_BUCKETS];
 } WDI_EXTScanStartReqParams;
@@ -6229,22 +5818,15 @@
    wpt_uint8   bssid[6];     /* BSSID */
    wpt_int32    low;     // low threshold
    wpt_int32    high;    // high threshold
+   wpt_uint32   channel; // channel hint
 } WDI_APThresholdParam;
 
 typedef struct
 {
-   WDI_MacSSid  ssid;     /* SSID */
-   wpt_uint8 band;    /* band */
-   wpt_int32 lowRssiThreshold; /* low threshold */
-   wpt_int32 highRssiThreshold; /* high threshold */
-} WDI_SSIDThresholdParam;
-
-typedef struct
-{
     wpt_int32   requestId;
     wpt_int8    sessionId;    // session Id mapped to vdev_id
-    wpt_uint32  lostBssidSampleSize;
-    wpt_int32   numBssid;        // number of hotlist APs
+
+    wpt_int32   numAp;        // number of hotlist APs
     WDI_APThresholdParam   ap[WDI_WLAN_EXTSCAN_MAX_HOTLIST_APS];    // hotlist APs
 } WDI_EXTScanSetBSSIDHotlistReqParams;
 
@@ -6254,27 +5836,32 @@
     wpt_uint8     sessionId;
 } WDI_EXTScanResetBSSIDHotlistReqParams;
 
-typedef struct
-{
-    wpt_boolean pause;
-    wpt_uint32 reserved;
-} WDI_HighPriorityDataInfoIndParams;
 
 typedef struct
 {
     wpt_int32   requestId;
     wpt_int8    sessionId;    // session Id mapped to vdev_id
-    wpt_uint32  lostSsidSampleSize;
-    wpt_uint32   numSsid;        // number of hotlist APs
-    WDI_SSIDThresholdParam   ssid[WDI_WLAN_EXTSCAN_MAX_HOTLIST_SSID]; // hotlist SSIDs
-} WDI_EXTScanSetSSIDHotlistReqParams;
+
+    /* number of samples for averaging RSSI */
+    wpt_int32              rssiSampleSize;
+
+    /* number of missed samples to confirm AP loss */
+    wpt_int32              lostApSampleSize;
+
+    /* number of APs breaching threshold required for firmware
+     * to generate event
+     */
+    wpt_int32              minBreaching;
+
+    wpt_int32   numAp;        // number of hotlist APs
+    WDI_APThresholdParam   ap[WDI_WLAN_EXTSCAN_MAX_HOTLIST_APS];    // hotlist APs
+} WDI_EXTScanSetSignfRSSIChangeReqParams;
 
 typedef struct
 {
     wpt_uint32    requestId;
     wpt_uint8     sessionId;
-} WDI_EXTScanResetSSIDHotlistReqParams;
-
+} WDI_EXTScanResetSignfRSSIChangeReqParams;
 #endif /* WLAN_FEATURE_EXTSCAN */
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
@@ -6316,178 +5903,6 @@
    wpt_uint32 reserved;
 } WDI_SpoofMacAddrInfoType;
 
-//This is to force compiler to use the maximum of an int for enum
-#define SIR_MAX_ENUM_SIZE    0x7FFFFFFF
-// Enum to specify whether key is used
-// for TX only, RX only or both
-typedef enum
-{
-    eWDI_TX_ONLY,
-    eWDI_RX_ONLY,
-    eWDI_TX_RX,
-    eWDI_TX_DEFAULT,
-    eWDI_DONOT_USE_KEY_DIRECTION = SIR_MAX_ENUM_SIZE
-} tWDIKeyDirection;
-
-// MAX key length when ULA is used
-#define SIR_MAC_MAX_KEY_LENGTH               32
-/* Max key size  including the WAPI and TKIP */
-#define WLAN_MAX_KEY_RSC_LEN         16
-// Definition for Encryption Keys
-//typedef struct sSirKeys
-typedef struct
-{
-    wpt_uint8                  keyId;
-    wpt_uint8                  unicast;     // 0 for multicast
-    tWDIKeyDirection    keyDirection;
-    wpt_uint8                  keyRsc[WLAN_MAX_KEY_RSC_LEN];   // Usage is unknown
-    wpt_uint8                  paeRole;     // =1 for authenticator,
-                                     // =0 for supplicant
-    wpt_uint16                 keyLength;
-    wpt_uint8                  key[SIR_MAC_MAX_KEY_LENGTH];
-} tWDIKeys, *tpWDIKeys;
-
-typedef enum
-{
-    eWDI_WEP_STATIC,
-    eWDI_WEP_DYNAMIC,
-} tWDIWepType;
-
-// Encryption type enum used with peer
-typedef enum
-{
-    eWDI_ED_NONE,
-    eWDI_ED_WEP40,
-    eWDI_ED_WEP104,
-    eWDI_ED_TKIP,
-    eWDI_ED_CCMP,
-#if defined(FEATURE_WLAN_WAPI)
-    eWDI_ED_WPI,
-#endif
-    /* DPU HW treats encryption mode 4 plus RMF bit set in TX BD as BIP.
-     * Thus while setting BIP encryption mode in corresponding DPU Desc
-     * eSIR_ED_AES_128_CMAC should be set to eSIR_ED_CCMP
-     */
-    eWDI_ED_AES_128_CMAC,
-    eWDI_ED_NOT_IMPLEMENTED = SIR_MAX_ENUM_SIZE
-} tWDIEdType;
-#define SIR_WDI_MAX_NUM_OF_DEFAULT_KEYS      4
-/*
- * This is used by PE to configure the key information on a given station.
- * When the secType is WEP40 or WEP104, the defWEPIdx is used to locate
- * a preconfigured key from a BSS the station assoicated with; otherwise
- * a new key descriptor is created based on the key field.
- */
-typedef struct
-{
-    wpt_uint16          staIdx;
-    tWDIEdType          encType;        // Encryption/Decryption type
-    tWDIWepType         wepType;        // valid only for WEP
-    wpt_uint8           defWEPIdx;      // Default WEP key, valid only for static WEP, must between 0 and 3
-    tWDIKeys            key[SIR_WDI_MAX_NUM_OF_DEFAULT_KEYS];            // valid only for non-static WEP encyrptions
-    wpt_uint8           singleTidRc;    // 1=Single TID based Replay Count, 0=Per TID based RC
-    wpt_uint8           sessionId; // PE session id for PE<->HAL interface
-} tWDISetStaKeyParams, *tpWDISetStaKeyParams;
-
-typedef struct
-{
-    tWDISetStaKeyParams     keyParams;
-    wpt_uint8 pn[6];
-}wpt_encConfigParams;
-
-typedef struct
-{
-    wpt_uint16  length;
-    wpt_uint8 data[WDI_DISA_MAX_PAYLOAD_SIZE];
-}wpt_payload;
-
-typedef struct
-{
-    wpt_80211Header macHeader;
-    wpt_encConfigParams encParams;
-    wpt_payload data;
-}wpt_pkt80211;
-
-#define NUM_FILTERS_SUPPORTED 1
-typedef struct
-{
-   wpt_macAddr macAddr;
-   wpt_uint8 isA1filter;
-   wpt_uint8 isA2filter;
-   wpt_uint8 isA3filter;
-}WDI_filter;
-
-typedef struct
-{
-   /* start or stop */
-   wpt_uint8 state;
-   /*Conversion of packet required or not*/
-   wpt_uint8 is80211to803ConReq;
-   wpt_uint32 ChannelNo;
-   wpt_uint32 ChannelBW;
-   wpt_uint8 crcCheckEnabled;
-   wpt_uint8 numOfMacFilters;
-   WDI_filter mmFilters[NUM_FILTERS_SUPPORTED];
-   wpt_uint64 typeSubtypeBitmap;
-   wpt_uint64 rsvd;
-
-}WDI_MonStartReqType;
-
-typedef struct
-{
-   wpt_uint8  paramType;
-   wpt_uint32 paramValue;
-   wpt_macAddr  bssId;
-}WDI_WifiConfigSetReqType;
-
-/**
- * struct WDI_FwrMemDumpReqType - firmware memory dump request details.
-.*.@FWMemDumpReqCb - Associated Callback
- *.@fwMemDumpReqContext - Callback context
- * @reserved - reserved field 1.
- *
- * This structure carries information about the firmware
- * memory dump request.
- */
-typedef struct
-{
-    wpt_uint32        reserved1;
-}WDI_FwrMemDumpReqType;
-
-/**
- * struct WDI_FwrMemDumpRsp - firmware dump response details.
- *
- * This structure is used to store the firmware dump
- * response from the firmware.
- */
-typedef struct
-{
-    wpt_uint32 dump_status;
-}WDI_FwrMemDumpRsp;
-
-typedef struct
-{
-    wpt_uint32 wificonfigset_status;
-}WDI_WifconfigSetRsp;
-
-/**
- * struct WDI_ModifyRoamParamsReqType - Modified roam parameter details.
- *
- */
-
-typedef struct {
-   wpt_uint8  param;
-   wpt_uint32   value;
-}WDI_ModifyRoamParamsReqType;
-
-/**
- * struct WDI_AllowedActionFramesInd - Allowed Action frames details
- *
- */
-struct WDI_AllowedActionFramesInd {
-   wpt_uint32 bitmask;
-   wpt_uint32 reserved;
-};
 /*----------------------------------------------------------------------------
  *   WDI callback types
  *--------------------------------------------------------------------------*/
@@ -8077,8 +7492,6 @@
 typedef void  (*WDI_RoamOffloadScanCb)(WDI_Status  wdiStatus,
                                        void*       pUserData);
 
-typedef void (*WDI_PERRoamOffloadScanCb)(WDI_Status wdiStatus, void *pUserData);
-typedef void (*WDI_PERRoamTriggerScanCb)(WDI_Status wdiStatus, void *pUserData);
 #endif
 /*---------------------------------------------------------------------------
    WDI_SetTxPerTrackingRspCb
@@ -8241,25 +7654,6 @@
 typedef void  (*WDI_SetPowerParamsCb)(WDI_Status  wdiStatus,
                                       void*       pUserData);
 
-
-/*---------------------------------------------------------------------------
-   WDA_FwrMemDumpRespCallback
-
-   DESCRIPTION
-
-   This callback is invoked by DAL when it has received a Fwr Mem dump
-   response from the underlying device.
-
-   PARAMETERS
-
-    IN
-    wdiStatus:  response status received from HAL
-    pUserData:  user data
- ---------------------------------------------------------------------------*/
-typedef void (* WDI_FwrMemDumpCb) (WDI_FwrMemDumpRsp* wdiRsp,
-                                        void*       pUserData);
-
-
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
 /*---------------------------------------------------------------------------
    WDI_GtkOffloadCb
@@ -8359,15 +7753,6 @@
                                 void*        pUserData);
 #endif /* FEATURE_WLAN_LPHB */
 
-#ifdef WLAN_FEATURE_RMC
-typedef void  (*WDI_RmcRulerRspCb)(WDI_RmcRspParamsType *wdiRmcResponse,
-                                    void*        pUserData);
-
-typedef void  (*WDI_IbssPeerInfoReqCb)(WDI_IbssPeerInfoRspParams *pInfoRspParams,
-                                            void*        pUserData);
-
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
 /*---------------------------------------------------------------------------
    WDI_SetBatchScanCb
@@ -8408,9 +7793,9 @@
                                        void *pUserData);
 typedef void  (*WDI_EXTScanResetBSSIDHotlistRspCb)(void *pEventData,
                                        void *pUserData);
-typedef void  (*WDI_EXTScanSetSSIDHotlistRspCb)(void *pEventData,
+typedef void  (*WDI_EXTScanSetSignfRSSIChangeRspCb)(void *pEventData,
                                        void *pUserData);
-typedef void  (*WDI_EXTScanResetSSIDHotlistRspCb)(void *pEventData,
+typedef void  (*WDI_EXTScanResetSignfRSSIChangeRspCb)(void *pEventData,
                                        void *pUserData);
 #endif /* WLAN_FEATURE_EXTSCAN */
 
@@ -8425,29 +7810,6 @@
 
 typedef void  (*WDI_SetSpoofMacAddrRspCb)(
                         WDI_SpoofMacAddrRspParamType* wdiRsp, void *pUserData);
-
-typedef void  (*WDI_FWStatsGetRspCb)(WDI_Status status,void *fwStatsResp,
-                                         void *pUserData);
-
-typedef void  (*WDI_EncryptMsgRspCb)(wpt_uint8 status, void *pEventData, void* pUserData);
-typedef void  (*WDI_FWLoggingInitRspCb)(
-                        WDI_FWLoggingInitRspParamType *wdiRsp, void *pUserData);
-typedef void  (*WDI_GetFrameLogRspCb)(
-                        WDI_GetFrameLogRspParamType *wdiRsp, void *pUserData);
-typedef void  (*WDI_FatalEventLogsRspCb)(
-                         WDI_FatalEventLogsRspParamType *wdiRsp, void *pUserData);
-
-typedef void  (*WDI_MonModeRspCb)(void *pEventData,void *pUserData);
-typedef void  (*WDI_RssiMonitorStartRspCb)(void *pEventData,void *pUserData);
-typedef void  (*WDI_RssiMonitorStopRspCb)(void *pEventData,void *pUserData);
-
-typedef void  (*WDI_FwrMemDumpRspCb)(WDI_FwrMemDumpRsp *wdiRsp, void *pUserData);
-
-typedef void  (*WDI_WifiConfigSetRspCb) (WDI_WifconfigSetRsp *wdiRsp, void *pUserData);
-
-typedef void (*WDI_AntennaDivSelRspCb)(WDI_Status status,
-              void *resp, void *pUserData);
-
 /*========================================================================
  *     Function Declarations and Documentation
  ==========================================================================*/
@@ -9876,163 +9238,6 @@
   void*                   pUserData
 );
 
-
-/**
- @brief WDI_FatalEventLogsReq will be called when the upper
-        MAC wants to send the fatal event req. Upon the call of
-        this API the WLAN DAL will pack and send a HAL
-        Fatal event request message to the lower RIVA sub-system.
-
-        In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
-
-
- @param pwdiFatalEventLogsReqInfo: the Fatal event logs params
-                      as specified by the Device Interface
-
-        wdiFatalEventLogsRspCb: callback for passing back the
-        response of the fatal event operation received
-        from the device
-
-        pUserData: user data will be passed back with the
-        callback
-
- @return Result of the function call
-*/
-
-WDI_Status
-WDI_FatalEventLogsReq
-(
-   WDI_FatalEventLogsReqInfoType      *pwdiFatalEventLogsReqInfo,
-   WDI_FatalEventLogsRspCb             wdiFatalEventLogsRspCb,
-   void*                               pUserData
-);
-
-/**
- @brief WDI_GetFrameLogReq will be called when the upper
-        MAC wants to initialize frame logging. Upon the call of
-        this API the WLAN DAL will pack and send a HAL
-        Frame logging init request message to
-        the lower RIVA sub-system.
-
-        In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
-
-
- @param pwdiGetFrameLogReqInfo: the Frame Logging params
-                      as specified by the Device Interface
-
-        wdiGetFrameLogReqCb: callback for passing back the
-        response of the frame logging init operation received
-        from the device
-
-        pUserData: user data will be passed back with the
-        callback
-
- @return Result of the function call
-*/
-WDI_Status
-WDI_GetFrameLogReq
-(
-   WDI_GetFrameLogReqInfoType    *pwdiGetFrameLogReqInfo,
-   WDI_GetFrameLogRspCb             wdiGetFrameLogReqCb,
-   void*                                pUserData
-);
-
-/**
- @brief WDI_FWLoggingInitReq will be called when the upper
-        MAC wants to initialize frame logging. Upon the call of
-        this API the WLAN DAL will pack and send a HAL
-        Frame logging init request message to
-        the lower RIVA sub-system.
-
-        In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
-
-
- @param pwdiFWLoggingInitReqParams: the Frame Logging params
-                      as specified by the Device Interface
-
-        wdiFWLoggingInitReqCb: callback for passing back the
-        response of the frame logging init operation received
-        from the device
-
-        pUserData: user data will be passed back with the
-        callback
-
- @return Result of the function call
-*/
-WDI_Status
-WDI_FWLoggingInitReq
-(
-   WDI_FWLoggingInitReqInfoType      *pwdiFWLoggingInitReqInfo,
-   WDI_FWLoggingInitRspCb             wdiFWLoggingInitReqCb,
-   void*                                pUserData
-);
-
-/**
- @brief WDI_StartRssiMonitorReq will be called when the upper
-        MAC wants to initialize Rssi Monitor on a bssid.
-        Upon the call of this API the WLAN DAL will pack and
-        send a HAL Rssi Monitor init request message to
-        the lower RIVA sub-system.
-
-        In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
-
-
- @param pwdiRssiMonitorInfo: the Rssi Monitor params
-                      as specified by the Device Interface
-
-        wdiRssiMonitorStartRspCb: callback for passing back the
-        response of the rssi monitor operation received
-        from the device
-
-        pUserData: user data will be passed back with the
-        callback
-
- @return Result of the function call
-*/
-WDI_Status
-WDI_StartRssiMonitorReq
-(
-   WDI_RssiMonitorReqInfoType          *pwdiRssiMonitorInfo,
-   WDI_RssiMonitorStartRspCb            wdiRssiMonitorStartRspCb,
-   void*                                pUserData
-);
-
-
-/**
- @brief WDI_StopRssiMonitorReq will be called when the upper
-        MAC wants to stop Rssi Monitor on a bssid.
-        Upon the call of this API the WLAN DAL will pack and
-        send a HAL Rssi Monitor stop request message to
-        the lower RIVA sub-system.
-
-        In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
-
-
- @param pwdiRssiMonitorInfo: the Rssi Monitor params
-                      as specified by the Device Interface
-
-        wdiRssiMonitorStopRspCb: callback for passing back the
-        response of the rssi monitor operation received
-        from the device
-
-        pUserData: user data will be passed back with the
-        callback
-
- @return Result of the function call
-*/
-WDI_Status
-WDI_StopRssiMonitorReq
-(
-   WDI_RssiMonitorReqInfoType          *pwdiRssiMonitorInfo,
-   WDI_RssiMonitorStopRspCb            wdiRssiMonitorStopRspCb,
-   void*                               pUserData
-);
-
 /**
  @brief WDI_ConfigureRxpFilterReq will be called when the upper 
         MAC wants to set/reset the RXP filters for received pkts
@@ -10819,7 +10024,7 @@
 
  @param wdiAddBAReqParams: the add BA parameters as specified by
                       the Device Interface
-        baReqParamUserDataSize: user data size of wdiAddBAReqParams
+  
         wdiAddBARspCb: callback for passing back the response of
         the add BA operation received from the device
   
@@ -10833,7 +10038,6 @@
 WDI_TriggerBAReq
 (
   WDI_TriggerBAReqParamsType* pwdiTriggerBAReqParams,
-  wpt_uint8                   baReqParamUserDataSize,
   WDI_TriggerBARspCb          wdiTriggerBARspCb,
   void*                       pUserData
 );
@@ -11213,22 +10417,6 @@
   WDI_RoamOffloadScanCb                 wdiRoamOffloadScancb,
   void*                                 pUserData
 );
-
-WDI_Status
-WDI_PERRoamScanOffloadReq
-(
-  WDI_PERRoamOffloadScanInfo              *pwdiRoamScanOffloadReqParams,
-  WDI_PERRoamOffloadScanCb                 wdiRoamOffloadScancb,
-  void*                                    pUserData
-);
-
-WDI_Status
-WDI_PERRoamScanTriggerReq
-(
-  WDI_PERRoamTriggerScanInfo              *pwdiRoamScanTriggerReqParams,
-  WDI_PERRoamTriggerScanCb                 wdiRoamTriggerScancb,
-  void*                                    pUserData
-);
 #endif
 
 /**
@@ -11457,22 +10645,6 @@
   WDI_DHCPInd *wdiDHCPInd
 );
 
-#ifdef WLAN_FEATURE_RMC
-WDI_Status
-WDI_RmcRulerReq
-(
-  WDI_RmcRulerReqParams  *wdiRmcRulerReqParams,
-  WDI_RmcRulerRspCb rmcRulerRspCb,
-  void *usrData
-);
-
-WDI_Status
-WDI_RmcUpdateInd
-(
-  WDI_RmcUpdateIndParams  *wdiRmcUpdateIndParams
-);
-#endif /* WLAN_FEATURE_RMC */
-
 /**
  @brief WDI_RateUpdateInd will be called when the upper MAC
         requests the device to update rates.
@@ -11493,26 +10665,6 @@
   WDI_RateUpdateIndParams  *wdiRateUpdateIndParams
 );
 
-#ifdef WLAN_FEATURE_RMC
-/**
- @brief WDI_TXFailMonitorStartStopInd
-       Forward TX monitor start/stop event
-
- @param
-
-     WDI_TXFailMonitorInd
-
- @see
- @return Result of the function call
-*/
-
-WDI_Status
-WDI_TXFailMonitorStartStopInd
-(
-  WDI_TXFailMonitorInd *wdiTXFailMonitorInd
-);
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
 /**
  @brief WDI_GTKOffloadReq will be called when the upper MAC 
@@ -11702,16 +10854,6 @@
 );
 
 /**
- @brief WDI_TransportKickDxe -
-    Request Kick DXE when first HDD TX time out
-    happens
- @param  none
- @see
- @return none
-*/
-void WDI_TransportKickDxe(void);
-
-/**
  @brief WDI_SsrTimerCB
     Callback function for SSR timer, if this is called then the graceful
     shutdown for Riva did not happen.
@@ -11861,52 +11003,40 @@
 );
 
 /**
- @brief WDI_EXTScanSetSSIDHotlistReq
-    This API is called to send Set SSID Hotlist Request FW
+ @brief WDI_EXTScanSetSignfRSSIChangeReq
+    This API is called to send Set Significant RSSI Request FW
 
- @param pwdiEXTScanSetBssidHotlistReqParams : pointer to the request params.
-        wdiEXTScanSetBSSIDHotlistRspCb   : callback on getting the response.
+ @param pwdiEXTScanSetSignfRSSIChangeReqParams : pointer to the request params.
+        wdiEXTScanSetSignfRSSIChangeRspCb   : callback on getting the response.
         usrData : Client context
  @see
  @return SUCCESS or FAIL
 */
-WDI_Status WDI_EXTScanSetSSIDHotlistReq
+WDI_Status WDI_EXTScanSetSignfRSSIChangeReq
 (
-   WDI_EXTScanSetSSIDHotlistReqParams* pwdiEXTScanSetSSIDHotlistReqParams,
-   WDI_EXTScanSetSSIDHotlistRspCb     wdiEXTScanSetSSIDHotlistRspCb,
+   WDI_EXTScanSetSignfRSSIChangeReqParams*
+                                    pwdiEXTScanSetSignfRSSIChangeReqParams,
+   WDI_EXTScanSetSignfRSSIChangeRspCb   wdiEXTScanSetSignfRSSIChangeRspCb,
    void*                   pUserData
 );
 
 /**
- @brief WDI_EXTScanResetSSIDHotlistReq
-    This API is called to send Reset SSID Hotlist Request FW
+ @brief WDI_EXTScanResetSignfRSSIChangeReq
+    This API is called to send Reset BSSID Hotlist Request FW
 
- @param pwdiEXTScanResetSsidHotlistReqParams : pointer to the request params.
-        wdiEXTScanGetCachedResultsRspCb   : callback on getting the response.
+ @param pwdiEXTScanResetSignfRSSIChangeReqParams : pointer to the request params.
+        wdiEXTScanResetSignfRSSIChangeRs  : callback on getting the response.
         usrData : Client context
  @see
  @return SUCCESS or FAIL
 */
-WDI_Status WDI_EXTScanResetSSIDHotlistReq
+WDI_Status WDI_EXTScanResetSignfRSSIChangeReq
 (
-   WDI_EXTScanResetSSIDHotlistReqParams* pwdiEXTScanResetSSIDHotlistReqParams,
-   WDI_EXTScanResetSSIDHotlistRspCb     wdiEXTScanResetSSIDHotlistRspCb,
+   WDI_EXTScanResetSignfRSSIChangeReqParams*
+                                       pwdiEXTScanResetSignfRSSIChangeReqParams,
+   WDI_EXTScanResetSignfRSSIChangeRspCb     wdiEXTScanResetSignfRSSIChangeRspCb,
    void*                   pUserData
 );
-
-/**
- @brief WDI_HighPriorityDataInfoInd
-
- @param pHighPriorityDataInfoIndParams: Req parameter for the FW
-
- @return SUCCESS or FAIL
-*/
-WDI_Status
-WDI_HighPriorityDataInfoInd
-(
-   WDI_HighPriorityDataInfoIndParams* pHighPriorityDataInfoIndParams
-);
-
 #endif /* WLAN_FEATURE_EXTSCAN */
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
@@ -11962,26 +11092,6 @@
 );
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
 
-WDI_Status WDI_FWStatsGetReq
-(
-   void* pwdiFWStatsGetReqParams,
-   WDI_FWStatsGetRspCb          wdiFWStatsGetRspCb,
-   wpt_uint32                   pUserData
-);
-
-WDI_Status WDI_MonStartReq
-(
-    WDI_MonStartReqType*   pwdiMonStartReqParams,
-    WDI_MonModeRspCb       wdiMonModeRspCb,
-    void*                  pUserData
-);
-
-WDI_Status WDI_MonStopReq
-(
-    WDI_MonModeRspCb       wdiMonModeRspCb,
-    void*                  pUserData
-);
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
 /**
  @brief WDI_SetBatchScanReq
@@ -12028,26 +11138,6 @@
 
 #endif /*FEATURE_WLAN_BATCH_SCAN*/
 
-#ifdef WLAN_FEATURE_RMC
-/**
- @brief Process peer info req
-
- @param  pWDICtx:    pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-
-WDI_Status
-WDI_IbssPeerInfoReq
-(
-   WDI_IbssPeerInfoReqType*   wdiPeerInfoReqParams,
-   WDI_IbssPeerInfoReqCb      wdiIbssPeerInfoReqCb,
-  void*                         pUserData
-);
-#endif /* WLAN_FEATURE_RMC */
-
 /**
  @brief wdi_HT40OBSSScanInd
     This API is called to start OBSS scan
@@ -12083,157 +11173,8 @@
   void*                          pUserData
 );
 
-WDI_Status
-WDI_EncryptMsgReq(void* pwdiEncryptMsgParams,
-        WDI_EncryptMsgRspCb wdiEncryptMsgCbRsp,
-        void*                   pUserData
-        );
-
-WDI_Status
-WDI_FwrMemDumpReq
-
-(
-   WDI_FwrMemDumpReqType          *pwdiFwrMemDumpReqInfo,
-   WDI_FwrMemDumpCb                wdiFwrMemDumpRspCb,
-   void*                           pUserData
-);
-
-
-/**
- @brief WDI_NanRequest
-        NAN request
-
- @param pwdiNanRequest: data
-
-        pwdiNanCb: callback
-
-        usrData: user data will be passed back with the
-        callback
-
- @return Result of the function call
-*/
-WDI_Status
-WDI_NanRequest
-(
-    WDI_NanRequestType           *pwdiNanRequest,
-    void                         *usrData
-);
-
-/**
- @brief WDI_SetRtsCtsHTVhtInd
-        Set RTS/CTS indication for diff modes.
-
- @param rtsCtsVal: Bit mask value to enable RTS/CTS for different modes
-
- @return Result of the function call
-*/
-
-WDI_Status
-WDI_SetRtsCtsHTVhtInd
-(
-  wpt_uint32 rtsCtsVal
-);
-
-WDI_Status
-WDI_FWLoggingDXEdoneInd
-(
-  wpt_uint32 logType
-);
-
-/**
- @brief WDI_EnableDisableCAEventInd
-        Enable/Disable Chan Avoidance indication
-
- @param val: Enable/Disable Chan Avoidance indication
-
- @return Result of the function call
-*/
-
-WDI_Status
-WDI_EnableDisableCAEventInd
-(
-wpt_uint32 val
-);
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-
-/**
- @brief WDI_HighPriorityDataInfoInd
-
- @param pHighPriorityDataInfoIndParams: Req parameter for the FW
-
- @return SUCCESS or FAIL
-*/
-WDI_Status
-WDI_StartOemDataReqIndNew
-(
-   WDI_OemDataReqNewConfig *pOemDataReqNewConfig
-);
-#endif
-
 #ifdef __cplusplus
  }
 #endif 
 
-/**
- @brief WDI_WifiConfigSetReq
-    This API is called to send WifiConfig  request to FW
-
- @param pwdiWifConfigSetReqParams : pointer to  wificonfig params
-        wdiLLStatsSetRspCb     : set wificonfig response callback
-        usrData : Client context
- @see
- @return SUCCESS or FAIL
-*/
-WDI_Status
-WDI_WifiConfigSetReq
-   (WDI_WifiConfigSetReqType* pwdiWifConfigSetReqParams,
-    WDI_WifiConfigSetRspCb wdiWifiConfigSetRspCb,
-    void*                 pUserData);
-
-/**
- @brief WDI_GetCurrentAntennaIndex
-    This API is called to send getCurretAntennaIndex request to FW
-
- @param pUserData: pointer to request params
-        wdiLLStatsSetRspCb     : set wificonfig response callback
-        reserved: request parameter
- @see
- @return SUCCESS or FAIL
-*/
-WDI_Status
-WDI_GetCurrentAntennaIndex
-(
-  void *pUserData,
-  WDI_AntennaDivSelRspCb wdiAntennaDivSelRspCb,
-  wpt_uint32 reserved
-);
-
-/**
- @brief WDI_SetBcnMissPenaltyCount
-    This API is called to send modified roam parameters to FW
-
- @param params: pointer to request params
- @see
- @return SUCCESS or FAIL
-*/
-WDI_Status
-WDI_SetBcnMissPenaltyCount
-(
-    WDI_ModifyRoamParamsReqType *params
-);
-
-/**
- * WDI_SetAllowedActionFramesInd - This API is called to send Allowed
- *                    Action frame details to FW
- * @allowed_action_frames: Pointer to WDI_AllowedActionFramesInd structure
- *                     which holds bitmask of allowed action frames
- *
- */
-WDI_Status
-WDI_SetAllowedActionFramesInd(
-   struct WDI_AllowedActionFramesInd *allowed_action_frames
-);
-
-void WDI_SetMgmtPktViaWQ5(wpt_boolean sendMgmtPktViaWQ5);
 #endif /* #ifndef WLAN_QCT_WDI_H */
diff --git a/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_bd.h b/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_bd.h
index e42c183..560b848 100644
--- a/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_bd.h
+++ b/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_bd.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -451,8 +451,7 @@
         wpt_uint32 reorderSlotIdx:6;
         
 #ifdef WCN_PRONTO
-        wpt_uint32 reserved7: 1;
-        wpt_uint32 perRoamCndInd:1;
+        wpt_uint32 reserved7: 2;
         wpt_uint32 outOfOrderForward: 1;
         wpt_uint32 reorderEnable: 1;
 #else
@@ -464,8 +463,7 @@
 #ifdef WCN_PRONTO
         wpt_uint32 reorderEnable: 1;
         wpt_uint32 outOfOrderForward: 1;
-        wpt_uint32 perRoamCndInd:1;
-        wpt_uint32 reserved7: 1;
+        wpt_uint32 reserved7: 2;
 #else
         wpt_uint32 reserved7:4;
 #endif //WCN_PRONTO
@@ -1153,7 +1151,6 @@
         wpt_uint32 csuTcpUdpStartOffset:10;
 #endif
 #endif /*WCN_PRONTO*/
-        wpt_uint32 txBdToken;
 
 } WDI_TxBdType;
 
diff --git a/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_cfg.h b/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_cfg.h
index 90e7bce..7db17ae 100644
--- a/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_cfg.h
+++ b/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_cfg.h
@@ -42,6 +42,8 @@
   by the same name !! 
   
       
+  Copyright (c) 2010 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
diff --git a/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_dp.h b/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_dp.h
index 465946e..6e00dfa 100644
--- a/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_dp.h
+++ b/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_dp.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -43,6 +43,8 @@
   module to be used by the DAL Data Path Core. 
   
       
+  Copyright (c) 2010 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
@@ -120,13 +122,11 @@
 #define HAL_TDLS_PEER_STA_MASK              0x80 //bit 7 set for TDLS peer station
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-#define WDI_RMC_REQUESTED_MASK 0x100
-#endif
+/* Bit 8 is used to route reliable multicast data frames from QID 1.
+   This dynamically changes ACK_POLICY = TRUE for multicast frames */
+#define WDI_RELIABLE_MCAST_REQUESTED_MASK 0x100
 
-#define WDI_USE_BD_RATE_1_MASK            0x1000
-#define WDI_USE_BD_RATE_2_MASK            0x2000
-#define WDI_USE_BD_RATE_3_MASK            0x4000
+#define WDI_USE_BD_RATE_MASK              0x1000
 #define WDI_USE_FW_IN_TX_PATH             0x200 //bit 9 used to route the frames to Work Queue 5
 
 /*Macro for getting the size of the TX BD*/
@@ -139,9 +139,6 @@
 
 #define WDI_DPU_FEEDBACK_OFFSET       1
 
-#define WDI_MAC_LLC_HEADER_SIZE       8
-
-
 // Frame Type definitions
 
 #define WDI_MAC_MGMT_FRAME    0x0
@@ -306,7 +303,6 @@
 //LFR scan related
 #define WDI_RX_BD_GET_OFFLOADSCANLEARN( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->offloadScanLearn)
 #define WDI_RX_BD_GET_ROAMCANDIDATEIND( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->roamCandidateInd)
-#define WDI_RX_BD_GET_PER_ROAMCANDIDATEIND( _pvBDHeader )     (((WDI_RxBdType*)_pvBDHeader)->perRoamCndInd)
 #endif
 #ifdef WLAN_FEATURE_EXTSCAN
 #define WDI_RX_BD_GET_EXTSCANFULLSCANRESIND( _pvBDHeader ) (((WDI_RxBdType*)_pvBDHeader)->extscanBuffer)
@@ -340,9 +336,6 @@
 
 #define WDI_TX_BD_SET_MPDU_HEADER_LEN( _bd, _len )       (((WDI_TxBdType*)_bd)->mpduHeaderLength = _len)
 
-#define WDI_TX_BD_GET_MPDU_HEADER_LEN( _bd )               (((WDI_TxBdType*)_bd)->mpduHeaderLength)
-
-
 #define WDI_TX_BD_SET_MPDU_LEN( _bd, _len )              (((WDI_TxBdType*)_bd)->mpduLength = _len)
 
 #define WDI_RX_BD_GET_BA_OPCODE(_pvBDHeader)        (((WDI_RxBdType*)_pvBDHeader)->reorderOpcode)
@@ -435,8 +428,7 @@
     wpt_uint8              ucProtMgmtFrame,
     wpt_uint32             uTimeStamp,
     wpt_uint8              isEapol,
-    wpt_uint8*             staIndex,
-    wpt_uint32             txBdToken
+    wpt_uint8*             staIndex
 );
 
 /**
diff --git a/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_i.h b/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
index 7debb41..1e12357 100644
--- a/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
+++ b/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -96,10 +96,8 @@
  
 #ifdef WLAN_SOFTAP_VSTA_FEATURE
 #define WDI_MAX_SUPPORTED_STAS   41
-#define WDI_MAX_IBSS_PEER_SUPPORED_STAS 32
 #else
 #define WDI_MAX_SUPPORTED_STAS   12
-#define WDI_MAX_IBSS_PEER_SUPPORED_STAS 11
 #endif
 #define WDI_MAX_SUPPORTED_BSS     5 
 
@@ -437,129 +435,78 @@
 
   /* WLAN FW LPHB config request */
   WDI_LPHB_CFG_REQ                              = 85,
-#ifdef WLAN_FEATURE_RMC
-  WDI_RMC_RULER_REQ                            = 86,
-  WDI_HAL_IBSS_PEER_INFO_REQ                    = 87,
-#endif /* WLAN_FEATURE_RMC */
 
   /* WLAN FW set batch scan request */
-  WDI_SET_BATCH_SCAN_REQ                        = 88,
+  WDI_SET_BATCH_SCAN_REQ                        = 86,
 
   /*WLAN DAL Set Max Tx Power Per band Request*/
-  WDI_SET_MAX_TX_POWER_PER_BAND_REQ             = 89,
+  WDI_SET_MAX_TX_POWER_PER_BAND_REQ             = 87,
 
-  WDI_UPDATE_CHAN_REQ                           = 90,
+  WDI_UPDATE_CHAN_REQ                           = 88,
 
-  WDI_GET_BCN_MISS_RATE_REQ                     = 91,
+  WDI_GET_BCN_MISS_RATE_REQ                     = 89,
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
-  WDI_LL_STATS_SET_REQ                          = 92,
-  WDI_LL_STATS_GET_REQ                          = 93,
-  WDI_LL_STATS_CLEAR_REQ                        = 94,
+  WDI_LL_STATS_SET_REQ                          = 90,
+  WDI_LL_STATS_GET_REQ                          = 91,
+  WDI_LL_STATS_CLEAR_REQ                        = 92,
 #endif
 
 #ifdef WLAN_FEATURE_EXTSCAN
-  WDI_EXTSCAN_START_REQ                          = 95,
-  WDI_EXTSCAN_STOP_REQ                           = 96,
-  WDI_EXTSCAN_GET_CACHED_RESULTS_REQ             = 97,
-  WDI_EXTSCAN_GET_CAPABILITIES_REQ               = 98,
-  WDI_EXTSCAN_SET_BSSID_HOTLIST_REQ              = 99,
-  WDI_EXTSCAN_RESET_BSSID_HOTLIST_REQ            = 100,
-  WDI_EXTSCAN_SET_SSID_HOTLIST_REQ               = 101,
-  WDI_EXTSCAN_RESET_SSID_HOTLIST_REQ             = 102,
+  WDI_EXTSCAN_START_REQ                          = 93,
+  WDI_EXTSCAN_STOP_REQ                           = 94,
+  WDI_EXTSCAN_GET_CACHED_RESULTS_REQ             = 95,
+  WDI_EXTSCAN_GET_CAPABILITIES_REQ               = 96,
+  WDI_EXTSCAN_SET_BSSID_HOTLIST_REQ              = 97,
+  WDI_EXTSCAN_RESET_BSSID_HOTLIST_REQ            = 98,
+  WDI_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ          = 99,
+  WDI_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ        = 100,
 #endif
 
-  WDI_SPOOF_MAC_ADDR_REQ                         = 103,
-
-  WDI_GET_FW_STATS_REQ                           = 104,
-
-  /* Send command to encrypt the given message */
-  WDI_ENCRYPT_MSG_REQ                            = 105,
-
-  WDI_FW_LOGGING_INIT_REQ                        = 106,
-  WDI_GET_FRAME_LOG_REQ                          = 107,
-  /* NAN Request */
-  WDI_NAN_REQUEST                                = 108,
-
-  WDI_MON_START_REQ                              = 109,
-  WDI_MON_STOP_REQ                               = 110,
-  WDI_FATAL_EVENT_LOGGING_REQ                    = 111,
-  WDI_FWR_MEM_DUMP_REQ                           = 112,
-  WDI_START_RSSI_MONITOR_REQ                     = 113,
-  WDI_STOP_RSSI_MONITOR_REQ                      = 114,
-  WDI_WIFI_CONFIG_SET_REQ                        = 115,
-
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-  WDI_PER_ROAM_SCAN_OFFLOAD_REQ                  = 116,
-  WDI_PER_ROAM_SCAN_TRIGGER_REQ                  = 117,
-#endif
+  WDI_SPOOF_MAC_ADDR_REQ                         = 101,
 
   WDI_MAX_REQ,
 
   /*Send a suspend Indication down to HAL*/
-  WDI_HOST_SUSPEND_IND =  WDI_MAX_REQ,
+  WDI_HOST_SUSPEND_IND          = WDI_MAX_REQ ,
 
   /* Send a traffic stats indication to HAL */
-  WDI_TRAFFIC_STATS_IND = WDI_MAX_REQ + 1,
+  WDI_TRAFFIC_STATS_IND,
 
   /* DHCP Start Indication */
-  WDI_DHCP_START_IND = WDI_MAX_REQ + 2,
+  WDI_DHCP_START_IND,
 
   /* DHCP Stop Indication */
-  WDI_DHCP_STOP_IND = WDI_MAX_REQ + 3,
+  WDI_DHCP_STOP_IND,
 
   /* Drop/Receive unencrypted frames indication to HAL */
-  WDI_EXCLUDE_UNENCRYPTED_IND = WDI_MAX_REQ + 4,
+  WDI_EXCLUDE_UNENCRYPTED_IND,
 
   /* Send an add periodic Tx pattern indication to HAL */
-  WDI_ADD_PERIODIC_TX_PATTERN_IND = WDI_MAX_REQ + 5,
+  WDI_ADD_PERIODIC_TX_PATTERN_IND,
 
   /* Send a delete periodic Tx pattern indicationto HAL */
-  WDI_DEL_PERIODIC_TX_PATTERN_IND = WDI_MAX_REQ + 6,
+  WDI_DEL_PERIODIC_TX_PATTERN_IND,
 
-#ifdef WLAN_FEATURE_RMC
-  /* Send RMC Update Indication */
-  WDI_RMC_UPDATE_IND = WDI_MAX_REQ + 7,
-#endif
+  /*Send stop batch scan indication to FW*/
+  WDI_STOP_BATCH_SCAN_IND,
+
+  /*Send stop batch scan indication to FW*/
+  WDI_TRIGGER_BATCH_SCAN_RESULT_IND,
+
   /* Send Rate Update Indication */
-  WDI_RATE_UPDATE_IND = WDI_MAX_REQ + 8,
+  WDI_RATE_UPDATE_IND,
 
-  /*Send stop batch scan indication to FW*/
-  WDI_STOP_BATCH_SCAN_IND = WDI_MAX_REQ + 9,
-
-  /*Send stop batch scan indication to FW*/
-  WDI_TRIGGER_BATCH_SCAN_RESULT_IND = WDI_MAX_REQ + 10,
-
-#ifdef WLAN_FEATURE_RMC
-  /* TX Monitor start/stop indication */
-  WDI_TX_FAIL_MONITOR_IND = WDI_MAX_REQ + 11,
-#endif
-  WDI_START_HT40_OBSS_SCAN_IND = WDI_MAX_REQ +12,
-  WDI_STOP_HT40_OBSS_SCAN_IND = WDI_MAX_REQ +13,
+  WDI_START_HT40_OBSS_SCAN_IND,
+  WDI_STOP_HT40_OBSS_SCAN_IND,
 
   /* csa channel switch req*/
-  WDI_CH_SWITCH_REQ_V1 = WDI_MAX_REQ + 14,
-  WDI_TDLS_CHAN_SWITCH_REQ = WDI_MAX_REQ + 15,
-  WDI_SET_RTS_CTS_HTVHT_IND = WDI_MAX_REQ + 16,
-  WDI_FW_LOGGING_DXE_DONE_IND = WDI_MAX_REQ + 17,
-  WDI_SEND_FREQ_RANGE_CONTROL_IND = WDI_MAX_REQ + 18,
-
-#ifdef WLAN_FEATURE_EXTSCAN
-  WDI_HIGH_PRIORITY_DATA_INFO_IND = WDI_MAX_REQ + 19,
-#endif
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-  WDI_START_OEM_DATA_REQ_IND_NEW = WDI_MAX_REQ + 20,
-#endif
+  WDI_CH_SWITCH_REQ_V1,
+  WDI_TDLS_CHAN_SWITCH_REQ,
 
   /*Keep adding the indications to the max request
-    such that we keep them separate */
-  WDI_ANTENNA_DIVERSITY_SELECTION_REQ = WDI_MAX_REQ + 21,
-  WDI_MODIFY_ROAM_PARAMS_IND = WDI_MAX_REQ + 22,
-  WDI_SET_ALLOWED_ACTION_FRAMES_IND = WDI_MAX_REQ + 23,
-
-  WDI_MAX_UMAC_IND = WDI_MAX_REQ + 24
-
+    such that we keep them sepparate */
+  WDI_MAX_UMAC_IND
 }WDI_RequestEnumType;
 
 /*--------------------------------------------------------------------------- 
@@ -817,60 +764,32 @@
   /* WLAN FW LPHB Config response */
   WDI_LPHB_CFG_RESP                             = 84,
 
-#ifdef WLAN_FEATURE_RMC
-  WDI_RMC_RULER_RESP                           = 85,
-  WDI_HAL_IBSS_PEER_INFO_RSP                    = 86,
-#endif /* WLAN_FEATURE_RMC */
+  WDI_SET_BATCH_SCAN_RESP                       = 85,
 
-  WDI_SET_BATCH_SCAN_RESP                        = 87,
+  WDI_SET_MAX_TX_POWER_PER_BAND_RSP             = 86,
 
-  WDI_SET_MAX_TX_POWER_PER_BAND_RSP             = 88,
-
-  WDI_UPDATE_CHAN_RESP                          = 89,
+  WDI_UPDATE_CHAN_RESP                          = 87,
   /* channel switch resp v1*/
-  WDI_CH_SWITCH_RESP_V1                         = 90,
+  WDI_CH_SWITCH_RESP_V1                         = 88,
 
-  WDI_GET_BCN_MISS_RATE_RSP                     = 91,
+  WDI_GET_BCN_MISS_RATE_RSP                     = 89,
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
-  WDI_LL_STATS_SET_RSP                          = 92,
-  WDI_LL_STATS_GET_RSP                          = 93,
-  WDI_LL_STATS_CLEAR_RSP                        = 94,
+  WDI_LL_STATS_SET_RSP                          = 90,
+  WDI_LL_STATS_GET_RSP                          = 91,
+  WDI_LL_STATS_CLEAR_RSP                        = 92,
 #endif
 
 #ifdef WLAN_FEATURE_EXTSCAN
-  WDI_EXTSCAN_START_RSP                          = 95,
-  WDI_EXTSCAN_STOP_RSP                           = 96,
-  WDI_EXTSCAN_GET_CACHED_RESULTS_RSP             = 97,
-  WDI_EXTSCAN_GET_CAPABILITIES_RSP               = 98,
-  WDI_EXTSCAN_SET_HOTLIST_BSSID_RSP              = 99,
-  WDI_EXTSCAN_RESET_HOTLIST_BSSID_RSP            = 100,
-  WDI_EXTSCAN_SET_HOTLIST_SSID_RSP               = 101,
-  WDI_EXTSCAN_RESET_HOTLIST_SSID_RSP             = 102,
+  WDI_EXTSCAN_START_RSP                          = 93,
+  WDI_EXTSCAN_STOP_RSP                           = 94,
+  WDI_EXTSCAN_GET_CACHED_RESULTS_RSP             = 95,
+  WDI_EXTSCAN_GET_CAPABILITIES_RSP               = 96,
+  WDI_EXTSCAN_SET_HOTLIST_BSSID_RSP              = 97,
+  WDI_EXTSCAN_RESET_HOTLIST_BSSID_RSP            = 98,
+  WDI_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP          = 99,
+  WDI_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP        = 100,
 #endif
-  WDI_SPOOF_MAC_ADDR_RSP                         = 103,
-  WDI_GET_FW_STATS_RSP                           = 104,
-
-  /* Send command to encrypt the given message */
-  WDI_ENCRYPT_MSG_RSP                            = 105,
-
-  WDI_FW_LOGGING_INIT_RSP                        = 106,
-  WDI_GET_FRAME_LOG_RSP                          = 107,
-
-  WDI_NAN_RESPONSE                               = 108,
-
-  WDI_MON_START_RSP                              = 109,
-  WDI_MON_STOP_RSP                               = 110,
-  WDI_FATAL_EVENT_LOGGING_RSP                    = 111,
-  WDI_FWR_MEM_DUMP_RSP                           = 112,
-  WDI_START_RSSI_MONITOR_RSP                     = 113,
-  WDI_STOP_RSSI_MONITOR_RSP                      = 114,
-
-  WDI_WIFI_CONFIG_SET_RSP                        = 115,
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-  WDI_PER_ROAM_SCAN_OFFLOAD_RSP                  = 116,
-  WDI_PER_ROAM_SCAN_TRIGGER_RSP                  = 117,
-#endif
-
+  WDI_SPOOF_MAC_ADDR_RSP                         = 101,
   /*-------------------------------------------------------------------------
     Indications
      !! Keep these last in the enum if possible
@@ -930,38 +849,25 @@
   /* Periodic Tx Pattern Indication from FW to Host */
   WDI_HAL_PERIODIC_TX_PTRN_FW_IND     = WDI_HAL_IND_MIN + 16,
 
-#ifdef WLAN_FEATURE_RMC
-  /* Update Indication from FW to Host */
-  WDI_RMC_UPDATE_IND_TO_HOST           = WDI_HAL_IND_MIN + 17,
-#endif
 
-  WDI_BATCHSCAN_RESULT_IND           =  WDI_HAL_IND_MIN + 18,
+  WDI_BATCHSCAN_RESULT_IND           =  WDI_HAL_IND_MIN + 17,
 
-#ifdef WLAN_FEATURE_RMC
-  WDI_HAL_TX_FAIL_IND                  = WDI_HAL_IND_MIN + 19,
-#endif
-
-  WDI_HAL_CH_AVOID_IND                 = WDI_HAL_IND_MIN + 20,
+  WDI_HAL_CH_AVOID_IND                 = WDI_HAL_IND_MIN + 18,
 
   /* print register values indication from FW to Host */
-  WDI_PRINT_REG_INFO_IND               = WDI_HAL_IND_MIN + 21,
+  WDI_PRINT_REG_INFO_IND               = WDI_HAL_IND_MIN + 19,
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
-  WDI_HAL_LL_STATS_RESULTS_IND         = WDI_HAL_IND_MIN + 22,
+  WDI_HAL_LL_STATS_RESULTS_IND         = WDI_HAL_IND_MIN + 20,
 #endif
 #ifdef WLAN_FEATURE_EXTSCAN
-  WDI_HAL_EXTSCAN_PROGRESS_IND       = WDI_HAL_IND_MIN + 23,
-  WDI_HAL_EXTSCAN_SCAN_AVAILABLE_IND = WDI_HAL_IND_MIN + 24,
-  WDI_HAL_EXTSCAN_RESULT_IND         = WDI_HAL_IND_MIN + 25,
-  WDI_HAL_EXTSCAN_BSSID_HOTLIST_RESULT_IND    = WDI_HAL_IND_MIN + 26,
-  WDI_HAL_EXTSCAN_SSID_HOTLIST_RESULT_IND    = WDI_HAL_IND_MIN + 27,
+  WDI_HAL_EXTSCAN_PROGRESS_IND       = WDI_HAL_IND_MIN + 21,
+  WDI_HAL_EXTSCAN_SCAN_AVAILABLE_IND = WDI_HAL_IND_MIN + 22,
+  WDI_HAL_EXTSCAN_RESULT_IND         = WDI_HAL_IND_MIN + 23,
+  WDI_HAL_EXTSCAN_BSSID_HOTLIST_RESULT_IND    = WDI_HAL_IND_MIN + 24,
+  WDI_HAL_EXTSCAN_SIG_RSSI_RESULT_IND         = WDI_HAL_IND_MIN + 25,
 #endif
-  WDI_TDLS_CHAN_SWITCH_REQ_RESP      = WDI_HAL_IND_MIN + 28,
-  WDI_HAL_DEL_BA_IND                 = WDI_HAL_IND_MIN + 29,
-  WDI_HAL_NAN_EVENT                  = WDI_HAL_IND_MIN + 30,
-  WDI_HAL_LOST_LINK_PARAMS_IND       = WDI_HAL_IND_MIN + 31,
-  WDI_HAL_RSSI_BREACHED_IND          = WDI_HAL_IND_MIN + 32,
-  WDI_HAL_START_OEM_DATA_RSP_IND_NEW = WDI_HAL_IND_MIN + 33,
-  WDI_ANTENNA_DIVERSITY_SELECTION_RSP = WDI_HAL_IND_MIN + 34,
+  WDI_TDLS_CHAN_SWITCH_REQ_RESP      = WDI_HAL_IND_MIN + 26,
+  WDI_HAL_DEL_BA_IND                 = WDI_HAL_IND_MIN + 27,
   WDI_MAX_RESP
 }WDI_ResponseEnumType; 
 
@@ -1322,12 +1228,6 @@
 
   /* reason for WDI_DetectedDeviceError */
   void *                        DeviceErrorReason;
-
-   /* Roam delay statistic enabled in ini*/
-   wpt_uint8                  roamDelayStatsEnabled;
-   /* enable/disable sendMgmtPktViaWQ5 params in ini */
-   wpt_boolean                 sendMgmtPktViaWQ5;
-
 }WDI_ControlBlockType; 
 
 
@@ -3226,23 +3126,6 @@
  );
 
 #endif
-#ifdef WLAN_FEATURE_RMC
-/**
- @brief Process TX Fail monitor indication
-
- @param  pWDICtx:    pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessTXFailMonitor
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-#endif /* WLAN_FEATURE_RMC */
 /**
  @brief Process start OBSS scan request from Host
 
@@ -4689,24 +4572,6 @@
   WDI_EventInfoType*     pEventData
 );
 
-#ifdef WLAN_FEATURE_RMC
-/**
-*@brief Process Tx Fail Indication
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessTXFailInd
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-#endif /* WLAN_FEATURE_RMC */
-
 /**
 *@brief Process Noa Start Indication function (called when
         an indication of this kind is being received over the
@@ -5569,6 +5434,7 @@
 );
 #endif // FEATURE_WLAN_SCAN_PNO
 
+
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
 /**
  @brief Process Start Roam Candidate Lookup Request function
@@ -5585,14 +5451,6 @@
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 );
-
-WDI_Status
-WDI_ProcessPERRoamScanOffloadReq(WDI_ControlBlockType *pWDICtx,
-                                 WDI_EventInfoType *pEventData);
-
-WDI_Status
-WDI_ProcessPERRoamScanTriggerReq(WDI_ControlBlockType *pWDICtx,
-                                 WDI_EventInfoType *pEventData);
 /**
  @brief Process Start Roam Candidate Lookup Response function (called when a
         response is being received over the bus from HAL)
@@ -5609,22 +5467,9 @@
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 );
-
-WDI_Status
-WDI_ProcessPERRoamScanOffloadRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessPERRoamScanTriggerRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
 #endif
 
+
 #ifdef WLAN_FEATURE_PACKET_FILTERING
 /**
  @brief Process 8023 Multicast List Request function
@@ -5878,6 +5723,7 @@
   WDI_EventInfoType*     pEventData
 );
 #endif
+
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
 /**
  *  @brief WDI_wdiEdTypeEncToEdTypeEnc -
@@ -5930,82 +5776,6 @@
     WDI_EventInfoType*     pEventData
 );
 
-#ifdef WLAN_FEATURE_RMC
-WDI_Status
-WDI_ProcessRMCRulerReq
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessRMCRulerResp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessRMCUpdateInd
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_RmcUpdateInd
-(
-    WDI_RmcUpdateIndParams  *wdiRmcUpdateIndParams
-);
-
-WDI_Status
-WDI_ProcessRMCRulerResp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessRMCUpdateIndToHost
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-/**
- @brief Process peer info req
-
- @param  pWDICtx:    pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessIbssPeerInfoReq
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-);
-
-/**
- @brief Process peer info resp
-
- @param  pWDICtx:    pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessIbssPeerInfoRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
 /**
  @brief WDI_ProcessSetBatchScanRsp -
@@ -6055,20 +5825,6 @@
 
 #endif /* FEATURE_WLAN_BATCH_SCAN */
 
-WDI_Status
-WDI_ProcessGetFwStatsReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessGetFwStatsRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
 #ifdef FEATURE_WLAN_CH_AVOID
 /**
  @brief v -
@@ -6192,35 +5948,28 @@
 );
 
 WDI_Status
-WDI_ProcessEXTScanSetSSIDHotlistReq
+WDI_ProcessEXTScanSetSignifRSSIChangeReq
 (
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 );
 
 WDI_Status
-WDI_ProcessEXTScanSetHotlistSSIDRsp
+WDI_ProcessEXTScanSetSignfRSSIChangeRsp
 (
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 );
 
 WDI_Status
-WDI_ProcessEXTScanResetSSIDHotlistReq
+WDI_ProcessEXTScanResetSignfRSSIChangeReq
 (
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 );
 
 WDI_Status
-WDI_ProcessEXTScanResetHotlistSSIDRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessHighPriorityDataInfoInd
+WDI_ProcessEXTScanResetSignfRSSIChangeRsp
 (
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
@@ -6248,13 +5997,12 @@
 );
 
 WDI_Status
-WDI_ProcessEXTScanSsidHotListResultInd
+WDI_ProcessEXTScanSignfRssiResultInd
 (
    WDI_ControlBlockType*  pWDICtx,
    WDI_EventInfoType*     pEventData
 );
 
-
 #endif /* WLAN_FEATURE_EXTSCAN */
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
@@ -6329,352 +6077,5 @@
   WDI_EventInfoType*     pEventData
 );
 
-WDI_Status
-WDI_ProcessGetFrameLogRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-WDI_Status
-WDI_ProcessGetFrameLogReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessFWLoggingDXEdoneInd
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessFatalEventLogsReq
-
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessFatalEventLogsRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessFWLoggingInitReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessFWFrameLoggingInitRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessRssiMonitorStartReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessRssiMonitorStartRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessRssiMonitorStopReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessRssiMonitorStopRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessEncryptMsgReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessEncryptMsgRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-/**
- @brief Process NAN Request
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessNanRequest
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-/**
- @brief Process NAN Response
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessNanResponse
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-/**
-*@brief Process NAN Event function (called when
-        an indication is being received over the
-        bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessNanEvent
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-
-/**
-*@brief Process Lost Link param function (called when
-        an indication is being received over the
-        bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-
-WDI_Status
-WDI_Process_LostLinkParamInd
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_Process_RssiBreachedInd
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-);
-
-
-/**
- @brief WDI_ProcessSetRtsCtsHtvhtInd
-        Set RTS/CTS indication for diff modes.
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @return Result of the function call
-*/
-
-
-WDI_Status
-WDI_ProcessSetRtsCtsHtvhtInd
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessMonStartReq
-(
-   WDI_ControlBlockType*  pWDICtx,
-   WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessMonStartRsp
-(
-   WDI_ControlBlockType*  pWDICtx,
-   WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessMonStopReq
-(
-   WDI_ControlBlockType*  pWDICtx,
-   WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessMonStopRsp
-(
-   WDI_ControlBlockType*  pWDICtx,
-   WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessEnableDisableCAEventInd
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessFwrMemDumpReq
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-    WDI_ProcessFwrMemDumpRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessWifiConfigReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-WDI_Status
-WDI_ProcessWificonfigSetRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-/**
- @brief WDI_ProcessStartOemDataReqIndNew -
-    Send OEM Data request new indication to FW
-
- @param  pWDICtx : wdi context
-         pEventData : indication data
-
- @see
- @return none
-*/
-WDI_Status
-WDI_ProcessStartOemDataReqIndNew
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-/**
- @brief Process OemDataRsp New Indication indication from FW
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessStartOemDataRspIndNew
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-#endif
-
-/**
- @brief Process get current antenna index command
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessGetCurrentAntennaIndex
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-);
-
-/**
- @brief Process get current antenna index response from FW
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessGetCurrentAntennaIndexRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-/**
- @brief Process set modified roam params command
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessBcnMissPenaltyCount
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
-
-/**
- *  WDI_ProcessSetAllowedActionFramesInd - Process Set allowed action
- *                                         frames command
- *
- *  @pWDICtx: pointer to the WLAN DAL context
- *  @pEventData: pointer to the event information structure
- *
- */
-WDI_Status
-WDI_ProcessSetAllowedActionFramesInd
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-);
 #endif /*WLAN_QCT_WDI_I_H*/
 
diff --git a/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_sta.h b/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_sta.h
index 44cd97d..565cd50 100644
--- a/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_sta.h
+++ b/wlan/prima/CORE/WDI/CP/inc/wlan_qct_wdi_sta.h
@@ -40,6 +40,8 @@
   be used by the DAL Control Path Core . 
   
       
+  Copyright (c) 2010 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
diff --git a/wlan/prima/CORE/WDI/CP/src/wlan_qct_wdi.c b/wlan/prima/CORE/WDI/CP/src/wlan_qct_wdi.c
index 381006f..9f50dd8 100644
--- a/wlan/prima/CORE/WDI/CP/src/wlan_qct_wdi.c
+++ b/wlan/prima/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -45,6 +45,9 @@
   Are listed for each API below.
 
 
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
@@ -91,8 +94,6 @@
 #include "pttMsgApi.h"
 #include "vos_trace.h"
 
-#include "vos_api.h"
-
 /*===========================================================================
    WLAN DAL Control Path Internal Data Definitions and Declarations
  ===========================================================================*/
@@ -102,7 +103,7 @@
 #define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
 
 #define FEATURE_NOT_SUPPORTED 127
-#define MAX_FW_HOST_CAP_SIZE 1024
+
 #ifdef FEATURE_WLAN_SCAN_PNO
 #define WDI_PNO_VERSION_MASK 0x8000
 #endif
@@ -189,37 +190,11 @@
    ,DYNAMIC_WMM_PS                 //43
 
    ,MAC_SPOOFED_SCAN               //44
-   ,BMU_ERROR_GENERIC_RECOVERY     //45
-   ,DISA                           //46
-   ,FW_STATS                       //47
+   ,FEATURE_NOT_SUPPORTED          //45
+   ,FEATURE_NOT_SUPPORTED          //46
+   ,FEATURE_NOT_SUPPORTED          //47
    ,WPS_PRBRSP_TMPL                //48
    ,BCN_IE_FLT_DELTA               //49
-   ,FEATURE_NOT_SUPPORTED          //50
-#ifdef FEATURE_WLAN_TDLS
-    ,TDLS_OFF_CHANNEL              //51
-#else
-    ,FEATURE_NOT_SUPPORTED         //51
-#endif
-   ,RTT3                           //52
-   ,MGMT_FRAME_LOGGING             //53
-   ,ENHANCED_TXBD_COMPLETION       //54
-   ,LOGGING_ENHANCEMENT            //55
-#ifdef WLAN_FEATURE_EXTSCAN
-   ,EXT_SCAN_ENHANCED              //56
-#else
-    ,FEATURE_NOT_SUPPORTED         //56
-#endif
-   ,MEMORY_DUMP_SUPPORTED          //57
-   ,PER_PKT_STATS_SUPPORTED        //58
-   ,FEATURE_NOT_SUPPORTED          //59
-#ifdef FEATURE_EXT_LL_STAT
-   ,EXT_LL_STAT                    //60
-#else
-   ,FEATURE_NOT_SUPPORTED
-#endif
-   ,WIFI_CONFIG                    //61
-   ,ANTENNA_DIVERSITY_SELECTION    //62
-   ,PER_BASED_ROAMING              //63
 };
 
 /*-------------------------------------------------------------------------- 
@@ -441,13 +416,6 @@
 #else
   NULL,
 #endif /* FEATURE_WLAN_LPHB */
-#ifdef WLAN_FEATURE_RMC
-  WDI_ProcessRMCRulerReq,              /* WDI_LBP_RULER_REQ */
-  WDI_ProcessIbssPeerInfoReq,           /* WDI_HAL_IBSS_PEER_INFO_REQ */
-#else
-  NULL,
-  NULL,
-#endif /* WLAN_FEATURE_RMC */
 
 #ifdef FEATURE_WLAN_BATCH_SCAN
   WDI_ProcessSetBatchScanReq,               /* WDI_SET_BATCH_SCAN_REQ */
@@ -477,8 +445,8 @@
   WDI_ProcessEXTScanGetCapabilitiesReq,      /* WDI_EXTSCAN_GET_CAPABILITIES_REQ */
   WDI_ProcessEXTScanSetBSSIDHotlistReq,      /* WDI_EXTSCAN_SET_BSSID_HOTLIST_REQ */
   WDI_ProcessEXTScanResetBSSIDHotlistReq,    /* WDI_EXTSCAN_RESET_BSSID_HOTLIST_REQ */
-  WDI_ProcessEXTScanSetSSIDHotlistReq,       /* WDI_EXTSCAN_SET_SSID_HOTLIST_REQ */
-  WDI_ProcessEXTScanResetSSIDHotlistReq,     /* WDI_EXTSCAN_RESET_SSID_HOTLIST_REQ */
+  WDI_ProcessEXTScanSetSignifRSSIChangeReq,  /* WDI_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ */
+  WDI_ProcessEXTScanResetSignfRSSIChangeReq, /* WDI_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ */
 #else
   NULL,
   NULL,
@@ -490,32 +458,6 @@
   NULL,
 #endif /* WLAN_FEATURE_EXTSCAN */
   WDI_ProcessSpoofMacAddrReq,       /* WDI_SPOOF_MAC_ADDR_REQ */
-
-  WDI_ProcessGetFwStatsReq,                   /*WDI_GET_FW_STATS_REQ*/
-
-  WDI_ProcessEncryptMsgReq,         /* WDI_ENCRYPT_MSG_REQ*/
-
-  WDI_ProcessFWLoggingInitReq,          /* WDI_FW_LOGGING_INIT_REQ*/
-  WDI_ProcessGetFrameLogReq,            /* WDI_GET_FRAME_LOG_REQ*/
-
-  WDI_ProcessNanRequest,            /* WDI_NAN_REQUEST*/
-
-  WDI_ProcessMonStartReq,          /* WDI_MON_START_REQ */
-  WDI_ProcessMonStopReq,           /* WDI_MON_STOP_REQ */
-  WDI_ProcessFatalEventLogsReq,     /*WDI_FATAL_EVENT_LOGGING_REQ*/
-  WDI_ProcessFwrMemDumpReq,           /* WDI_FWR_MEM_DUMP_REQ*/
-
-  WDI_ProcessRssiMonitorStartReq,          /* WDI_START_RSSI_MONITOR_REQ */
-  WDI_ProcessRssiMonitorStopReq,           /* WDI_STOP_RSSI_MONITOR_REQ */
-
-  WDI_ProcessWifiConfigReq,                /*WDI_WIFI_CONFIG_SET_REQ*/
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-  WDI_ProcessPERRoamScanOffloadReq,  /* WDI_PER_ROAM_SCAN_OFFLOAD_REQ */
-  WDI_ProcessPERRoamScanTriggerReq,  /* WDI_PER_ROAM_SCAN_TRIGGER_REQ */
-#else
-  NULL,
-  NULL,
-#endif /* WLAN_FEATURE_ROAM_SCAN_OFFLOAD */
   /*-------------------------------------------------------------------------
     Indications
   -------------------------------------------------------------------------*/
@@ -530,12 +472,6 @@
 #endif
   WDI_ProcessAddPeriodicTxPtrnInd,      /* WDI_ADD_PERIODIC_TX_PATTERN_IND */
   WDI_ProcessDelPeriodicTxPtrnInd,      /* WDI_DEL_PERIODIC_TX_PATTERN_IND */
-#ifdef WLAN_FEATURE_RMC
-  WDI_ProcessRMCUpdateInd,              /* WDI_RMC_UPDATE_IND */
-#else
-  NULL,
-#endif /* WLAN_FEATURE_RMC */
-  WDI_ProcessRateUpdateInd,              /* WDI_RATE_UPDATE_IND */
 #ifdef FEATURE_WLAN_BATCH_SCAN
   WDI_ProcessStopBatchScanInd,          /* WDI_STOP_BATCH_SCAN_IND */
   WDI_ProcessTriggerBatchScanResultInd, /* WDI_TRIGGER_BATCH_SCAN_RESULT_IND */
@@ -543,11 +479,7 @@
   NULL,
   NULL,
 #endif /* FEATURE_WLAN_BATCH_SCAN */
-#ifdef WLAN_FEATURE_RMC
-  WDI_ProcessTXFailMonitor,
-#else
-  NULL,
-#endif
+  WDI_ProcessRateUpdateInd,              /* WDI_RATE_UPDATE_IND */
 
   WDI_ProcessHT40OBSSScanInd,        /*WDI_START_HT40_OBSS_SCAN_IND */
   WDI_ProcessHT40OBSSStopScanInd,    /*WDI_STOP_HT40_OBSS_SCAN_IND */
@@ -558,24 +490,7 @@
 #else
   NULL,
 #endif
-  WDI_ProcessSetRtsCtsHtvhtInd,       /* WDI_SET_RTS_CTS_HTVHT_IND */
-  WDI_ProcessFWLoggingDXEdoneInd,       /* WDI_FW_LOGGING_DXE_DONE_IND */
-  WDI_ProcessEnableDisableCAEventInd,   /* WDI_SEND_FREQ_RANGE_CONTROL_IND */
 
-#ifdef WLAN_FEATURE_EXTSCAN
-  WDI_ProcessHighPriorityDataInfoInd,        /* WDI_HIGH_PRIORITY_DATA_INFO_IND */
-#else
-  NULL,
-#endif /* WLAN_FEATURE_EXTSCAN */
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-  WDI_ProcessStartOemDataReqIndNew,           /* WDI_START_OEM_DATA_REQ_IND_NEW */
-#else
-  NULL,
-#endif /* FEATURE_OEM_DATA_SUPPORT */
-  WDI_ProcessGetCurrentAntennaIndex,          /* WDI_ANTENNA_DIVERSITY_SELECTION_REQ  */
-  WDI_ProcessBcnMissPenaltyCount,             /* WDI_MODIFY_ROAM_PARAMS_IND */
-  WDI_ProcessSetAllowedActionFramesInd,  /* WDI_SET_ALLOWED_ACTION_FRAMES_IND */
 };
 
 
@@ -694,6 +609,7 @@
 #endif // FEATURE_WLAN_SCAN_PNO
 
   WDI_ProcessSetTxPerTrackingRsp,      /* WDI_SET_TX_PER_TRACKING_RESP  */
+  
   /*---------------------------------------------------------------------
     Indications
   ---------------------------------------------------------------------*/
@@ -758,17 +674,6 @@
 #else
     NULL,
 #endif /* FEATURE_WLAN_LPHB */
-#ifdef WLAN_FEATURE_RMC
-  WDI_ProcessRMCRulerResp,          /* WDI_RMC_RULER_RESP */
-#else
-    NULL,
-#endif /* WLAN_FEATURE_RMC */
-
-#ifdef WLAN_FEATURE_RMC
-  WDI_ProcessIbssPeerInfoRsp,       /* WDI_HAL_GET_IBSS_PEER_INFO_RSP */
-#else
-  NULL,
-#endif /* WLAN_FEATURE_RMC */
 
 #ifdef FEATURE_WLAN_BATCH_SCAN
     WDI_ProcessSetBatchScanRsp,        /* WDI_SET_BATCH_SCAN_RESP */
@@ -800,8 +705,8 @@
     WDI_ProcessEXTScanGetCapabilitiesRsp,      /* WDI_EXTSCAN_GET_CAPABILITIES_RSP */
     WDI_ProcessEXTScanSetHotlistBSSIDRsp,      /* WDI_EXTSCAN_SET_HOTLIST_BSSID_RSP */
     WDI_ProcessEXTScanResetHotlistBSSIDRsp,    /* WDI_EXTSCAN_RESET_HOTLIST_BSSID_RSP */
-    WDI_ProcessEXTScanSetHotlistSSIDRsp,      /* WDI_EXTSCAN_SET_HOTLIST_SSID_RSP */
-    WDI_ProcessEXTScanResetHotlistSSIDRsp,    /* WDI_EXTSCAN_RESET_HOTLIST_SSID_RSP */
+    WDI_ProcessEXTScanSetSignfRSSIChangeRsp,   /* WDI_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP */
+    WDI_ProcessEXTScanResetSignfRSSIChangeRsp, /* WDI_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP */
 #else
     NULL,
     NULL,
@@ -813,30 +718,6 @@
     NULL,
 #endif /* WLAN_FEATURE_EXTSCAN */
     WDI_ProcessSpoofMacAddrRsp,                /* WDI_SPOOF_MAC_ADDR_RSP */
-
-    WDI_ProcessGetFwStatsRsp,                     /*WDI_GET_FW_STATS_RSP*/
-
-    WDI_ProcessEncryptMsgRsp,                  /* WDI_ENCRYPT_MSG_RSP*/
-    WDI_ProcessFWFrameLoggingInitRsp,          /* WDI_FW_LOGGING_INIT_RSP*/
-    WDI_ProcessGetFrameLogRsp,                 /* WDI_GET_FRAME_LOG_RSP*/
-
-    WDI_ProcessNanResponse,                    /* WDI_NAN_RESPONSE */
-
-    WDI_ProcessMonStartRsp,                    /* WDI_MON_START_RSP*/
-    WDI_ProcessMonStopRsp,                    /* WDI_MON_STOP_RSP*/
-    WDI_ProcessFatalEventLogsRsp,              /*WDI_FATAL_EVENT_LOGGING_RSP*/
-    WDI_ProcessFwrMemDumpRsp,                 /* WDI_FWR_MEM_DUMP_RSP */
-    WDI_ProcessRssiMonitorStartRsp,            /* WDI_START_RSSI_MONITOR_RSP*/
-    WDI_ProcessRssiMonitorStopRsp,             /* WDI_STOP_RSSI_MONITOR_RSP*/
-
-    WDI_ProcessWificonfigSetRsp,                   /* /WDI_WIFI_CONFIG_SET_RSP*/
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-    WDI_ProcessPERRoamScanOffloadRsp, /* WDI_PER_ROAM_SCAN_OFFLOAD_RSP */
-    WDI_ProcessPERRoamScanTriggerRsp, /* WDI_PER_ROAM_SCAN_TRIGGER_RSP */
-#else
-    NULL,
-    NULL,
-#endif
   /*---------------------------------------------------------------------
     Indications
   ---------------------------------------------------------------------*/
@@ -884,26 +765,14 @@
 
   WDI_ProcessPeriodicTxPtrnFwInd,   /* WDI_HAL_PERIODIC_TX_PTRN_FW_IND */
 
-#ifdef WLAN_FEATURE_RMC
-  WDI_ProcessRMCUpdateIndToHost,       /* WDI_RMC_UPDATE_IND_TO_HOST */
-#else
-    NULL,
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
   WDI_ProcessBatchScanResultInd,     /* WDI_BATCHSCAN_RESULT_IND */
 #else
   NULL,
 #endif
 
-#ifdef WLAN_FEATURE_RMC
-  WDI_ProcessTXFailInd,                 /*WDI_HAL_TX_FAIL_IND*/
-#else
-  NULL,
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_CH_AVOID
-    WDI_ProcessChAvoidInd,               /* WDI_HAL_CH_AVOID_IND */
+    WDI_ProcessChAvoidInd,               /* WDI_LBP_UPDATE_IND_TO_HOST */
 #else
    NULL,
 #endif /* FEATURE_WLAN_CH_AVOID */
@@ -919,7 +788,7 @@
   WDI_ProcessEXTScanScanAvailableInd,       /* WDI_HAL_EXTSCAN_SCAN_AVAILABLE_IND */
   WDI_ProcessEXTScanResultInd,              /* WDI_HAL_EXTSCAN_RESULT_IND */
   WDI_ProcessEXTScanBssidHotListResultInd,  /* WDI_HAL_EXTSCAN_BSSID_HOTLIST_RESULT_IND */
-  WDI_ProcessEXTScanSsidHotListResultInd,  /* WDI_HAL_EXTSCAN_SSID_HOTLIST_RESULT_IND */
+  WDI_ProcessEXTScanSignfRssiResultInd,     /* WDI_HAL_EXTSCAN_SIG_RSSI_RESULT_IND */
 #else
   NULL,
   NULL,
@@ -933,15 +802,6 @@
   NULL,
 #endif
   WDI_delBaInd,                             /* WDI_HAL_DEL_BA_IND*/
-  WDI_ProcessNanEvent,                      /* WDI_HAL_NAN_EVENT */
-  WDI_Process_LostLinkParamInd,             /* WDI_HAL_LOST_LINK_PARAMS_IND*/
-  WDI_Process_RssiBreachedInd,             /* WDI_HAL_RSSI_BREACHED_IND */
-#ifdef FEATURE_OEM_DATA_SUPPORT
-  WDI_ProcessStartOemDataRspIndNew,         /* WDI_HAL_START_OEM_DATA_RSP_IND_NEW */
-#else
-  NULL,
-#endif
-  WDI_ProcessGetCurrentAntennaIndexRsp,     /* WDI_ANTENNA_DIVERSITY_SELECTION_RSP */
 };
 
 
@@ -1257,9 +1117,6 @@
     CASE_RETURN_STRING( WDI_STOP_BATCH_SCAN_IND );
     CASE_RETURN_STRING( WDI_TRIGGER_BATCH_SCAN_RESULT_IND);
 #endif
-#ifdef WLAN_FEATURE_RMC
-    CASE_RETURN_STRING( WDI_TX_FAIL_MONITOR_IND );
-#endif /* WLAN_FEATURE_RMC */
     CASE_RETURN_STRING(WDI_START_HT40_OBSS_SCAN_IND);
     CASE_RETURN_STRING(WDI_STOP_HT40_OBSS_SCAN_IND);
     CASE_RETURN_STRING(WDI_UPDATE_CHAN_REQ);
@@ -1275,28 +1132,10 @@
     CASE_RETURN_STRING( WDI_EXTSCAN_GET_CAPABILITIES_REQ);
     CASE_RETURN_STRING( WDI_EXTSCAN_SET_BSSID_HOTLIST_REQ);
     CASE_RETURN_STRING( WDI_EXTSCAN_RESET_BSSID_HOTLIST_REQ);
-    CASE_RETURN_STRING( WDI_EXTSCAN_SET_SSID_HOTLIST_REQ);
-    CASE_RETURN_STRING( WDI_EXTSCAN_RESET_SSID_HOTLIST_REQ);
-    CASE_RETURN_STRING( WDI_HIGH_PRIORITY_DATA_INFO_IND);
+    CASE_RETURN_STRING( WDI_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ);
+    CASE_RETURN_STRING( WDI_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ);
 #endif /* WLAN_FEATURE_EXTSCAN */
     CASE_RETURN_STRING( WDI_SPOOF_MAC_ADDR_REQ);
-    CASE_RETURN_STRING( WDI_GET_FW_STATS_REQ);
-    CASE_RETURN_STRING( WDI_ENCRYPT_MSG_REQ);
-    CASE_RETURN_STRING( WDI_FW_LOGGING_INIT_REQ);
-    CASE_RETURN_STRING( WDI_GET_FRAME_LOG_REQ);
-    CASE_RETURN_STRING( WDI_NAN_REQUEST );
-    CASE_RETURN_STRING( WDI_SET_RTS_CTS_HTVHT_IND );
-    CASE_RETURN_STRING( WDI_MON_START_REQ );
-    CASE_RETURN_STRING( WDI_MON_STOP_REQ );
-    CASE_RETURN_STRING( WDI_FATAL_EVENT_LOGGING_REQ );
-    CASE_RETURN_STRING( WDI_SEND_FREQ_RANGE_CONTROL_IND );
-    CASE_RETURN_STRING( WDI_FWR_MEM_DUMP_REQ);
-    CASE_RETURN_STRING( WDI_START_RSSI_MONITOR_REQ );
-    CASE_RETURN_STRING( WDI_STOP_RSSI_MONITOR_REQ );
-    CASE_RETURN_STRING( WDI_START_OEM_DATA_REQ_IND_NEW );
-    CASE_RETURN_STRING( WDI_ANTENNA_DIVERSITY_SELECTION_REQ );
-    CASE_RETURN_STRING( WDI_MODIFY_ROAM_PARAMS_IND );
-    CASE_RETURN_STRING( WDI_SET_ALLOWED_ACTION_FRAMES_IND );
     default:
         return "Unknown WDI MessageId";
   }
@@ -1401,12 +1240,6 @@
     CASE_RETURN_STRING( WDI_SHUTDOWN_RESP );
     CASE_RETURN_STRING( WDI_SET_POWER_PARAMS_RESP );
     CASE_RETURN_STRING( WDI_GET_ROAM_RSSI_RESP );
-#ifdef WLAN_FEATURE_RMC
-    CASE_RETURN_STRING( WDI_RMC_RULER_RESP );
-    CASE_RETURN_STRING( WDI_RMC_UPDATE_IND_TO_HOST );
-
-    CASE_RETURN_STRING( WDI_HAL_IBSS_PEER_INFO_RSP );
-#endif /* WLAN_FEATURE_RMC */
 #ifdef FEATURE_WLAN_BATCH_SCAN
     CASE_RETURN_STRING( WDI_SET_BATCH_SCAN_RESP);
 #endif
@@ -1425,31 +1258,15 @@
     CASE_RETURN_STRING( WDI_EXTSCAN_GET_CAPABILITIES_RSP);
     CASE_RETURN_STRING( WDI_EXTSCAN_SET_HOTLIST_BSSID_RSP);
     CASE_RETURN_STRING( WDI_EXTSCAN_RESET_HOTLIST_BSSID_RSP);
-    CASE_RETURN_STRING( WDI_EXTSCAN_SET_HOTLIST_SSID_RSP);
-    CASE_RETURN_STRING( WDI_EXTSCAN_RESET_HOTLIST_SSID_RSP);
+    CASE_RETURN_STRING( WDI_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP);
+    CASE_RETURN_STRING( WDI_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP);
     CASE_RETURN_STRING( WDI_HAL_EXTSCAN_PROGRESS_IND);
     CASE_RETURN_STRING( WDI_HAL_EXTSCAN_SCAN_AVAILABLE_IND);
     CASE_RETURN_STRING( WDI_HAL_EXTSCAN_RESULT_IND);
     CASE_RETURN_STRING( WDI_HAL_EXTSCAN_BSSID_HOTLIST_RESULT_IND);
-    CASE_RETURN_STRING( WDI_HAL_EXTSCAN_SSID_HOTLIST_RESULT_IND);
+    CASE_RETURN_STRING( WDI_HAL_EXTSCAN_SIG_RSSI_RESULT_IND);
+
 #endif /* WLAN_FEATURE_EXTSCAN */
-    CASE_RETURN_STRING( WDI_GET_FW_STATS_RSP);
-    CASE_RETURN_STRING( WDI_ENCRYPT_MSG_RSP);
-    CASE_RETURN_STRING( WDI_FW_LOGGING_INIT_RSP);
-    CASE_RETURN_STRING( WDI_GET_FRAME_LOG_RSP);
-    CASE_RETURN_STRING (WDI_FATAL_EVENT_LOGGING_RSP);
-    CASE_RETURN_STRING( WDI_FWR_MEM_DUMP_RSP);
-    CASE_RETURN_STRING (WDI_START_RSSI_MONITOR_RSP);
-    CASE_RETURN_STRING (WDI_STOP_RSSI_MONITOR_RSP);
-    CASE_RETURN_STRING( WDI_WIFI_CONFIG_SET_RSP);
-#ifdef FEATURE_OEM_DATA_SUPPORT
-    CASE_RETURN_STRING (WDI_HAL_START_OEM_DATA_RSP_IND_NEW);
-#endif
-    CASE_RETURN_STRING (WDI_ANTENNA_DIVERSITY_SELECTION_RSP);
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-    CASE_RETURN_STRING (WDI_PER_ROAM_SCAN_OFFLOAD_RSP);
-    CASE_RETURN_STRING (WDI_PER_ROAM_SCAN_TRIGGER_RSP);
-#endif
     default:
         return "Unknown WDI MessageId";
   }
@@ -1466,17 +1283,8 @@
 void WDI_TraceHostFWCapabilities(tANI_U32 *capabilityBitmap)
 {
      int i,j;
-     char *pTempCapStr = NULL;
-     char *pCapStr = NULL;
-     pTempCapStr = vos_mem_malloc(MAX_FW_HOST_CAP_SIZE);
-     if (NULL == pTempCapStr)
-     {
-         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "Memory allocation failed for CapStr");
-         return;
-     }
-
-     pCapStr = pTempCapStr;
+     char capStr[512];
+     char *pCapStr = capStr;
      for (j = 0; j < 4; j++) {
          for (i = 0; i < 32; i++) {
              if ((*(capabilityBitmap + j) & (1 << i))) {
@@ -1578,9 +1386,6 @@
                      case EXTENDED_SCAN: snprintf(pCapStr, sizeof("EXTENDED_SCAN"), "%s", "EXTENDED_SCAN");
                           pCapStr += strlen("EXTENDED_SCAN");
                           break;
-                     case EXT_SCAN_ENHANCED: snprintf(pCapStr, sizeof("EXT_SCAN_ENHANCED"), "%s", "EXT_SCAN_ENHANCED");
-                          pCapStr += strlen("EXT_SCAN_ENHANCED");
-                          break;
 #endif
                      case MU_MIMO: snprintf(pCapStr, sizeof("MU_MIMO"), "%s", "MU_MIMO");
                           pCapStr += strlen("MU_MIMO");
@@ -1589,9 +1394,7 @@
                      case DYNAMIC_WMM_PS: snprintf(pCapStr, sizeof("DYNAMIC_WMM_PS"), "%s", "DYNAMIC_WMM_PS");
                           pCapStr += strlen("DYNAMIC_WMM_PS");
                           break;
-                     case FW_STATS: snprintf(pCapStr, sizeof("FW_STATS"), "%s", "FW_STATS");
-                          pCapStr += strlen("FW_STATS");
-                          break;
+
                      case MAC_SPOOFED_SCAN: snprintf(pCapStr, sizeof("MAC_SPOOFED_SCAN"), "%s", "MAC_SPOOFED_SCAN");
                           pCapStr += strlen("MAC_SPOOFED_SCAN");
                           break;
@@ -1601,46 +1404,12 @@
                      case BCN_IE_FLT_DELTA: snprintf(pCapStr, sizeof("BCN_IE_FLT_DELTA"), "%s", "BCN_IE_FLT_DELTA");
                           pCapStr += strlen("BCN_IE_FLT_DELTA");
                           break;
-                     case MGMT_FRAME_LOGGING: snprintf(pCapStr, sizeof("MGMT_FRAME_LOGGING"), "%s", "MGMT_FRAME_LOGGING");
-                          pCapStr += strlen("MGMT_FRAME_LOGGING");
-                          break;
+
+
                      case BMU_ERROR_GENERIC_RECOVERY: snprintf(pCapStr, sizeof("BMU_ERROR_GENERIC_RECOVERY"), "%s", "BMU_ERROR_GENERIC_RECOVERY");
                           pCapStr += strlen("BMU_ERROR_GENERIC_RECOVERY");
                           break;
 
-                     case DISA: snprintf(pCapStr, sizeof("DISA"), "%s", "DISA");
-                          pCapStr += strlen("DISA");
-                          break;
-
-                     case TDLS_OFF_CHANNEL: snprintf(pCapStr, sizeof("TDLS_OFF_CHANNEL"), "%s", "TDLS_OFF_CHANNEL");
-                          pCapStr += strlen("TDLS_OFF_CHANNEL");
-                          break;
-                     case LOGGING_ENHANCEMENT: snprintf(pCapStr, sizeof("LOGGING_ENHANCEMENT"), "%s", "LOGGING_ENHANCEMENT");
-                          pCapStr += strlen("LOGGING_ENHANCEMENT");
-                          break;
-                     case MEMORY_DUMP_SUPPORTED:snprintf(pCapStr, sizeof("FW_MEM_DUMP_LOGGING"), "%s", "FW_MEM_DUMP_LOGGING");
-                          pCapStr += strlen("FW_MEM_DUMP_LOGGING");
-                          break;
-                     case PER_PKT_STATS_SUPPORTED: snprintf(pCapStr, sizeof("PER_PKT_STATS_SUPPORTED"), "%s", "PER_PKT_STATS_SUPPORTED");
-                          pCapStr += strlen("PER_PKT_STATS_SUPPORTED");
-                          break;
-                     case EXT_LL_STAT: snprintf(pCapStr, sizeof("EXT_LL_STAT"), "%s", "EXT_LL_STAT");
-                          pCapStr += strlen("EXT_LL_STAT");
-                          break;
-                     case RTT3: snprintf(pCapStr, sizeof("RTT3"), "%s", "RTT3");
-                          pCapStr += strlen("RTT3");
-                          break;
-                     case ANTENNA_DIVERSITY_SELECTION:
-                          snprintf(pCapStr,
-                          sizeof("ANTENNA_DIVERSITY_SELECTION"), "%s",
-                                 "ANTENNA_DIVERSITY_SELECTION");
-                          pCapStr += strlen("ANTENNA_DIVERSITY_SELECTION");
-                          break;
-                     case PER_BASED_ROAMING:
-                          snprintf(pCapStr, sizeof("PER_BASED_ROAMING"),
-                                         "%s", "PER_BASED_ROAMING");
-                          pCapStr += strlen("PER_BASED_ROAMING");
-                          break;
                  }
                  *pCapStr++ = ',';
                  *pCapStr++ = ' ';
@@ -1649,12 +1418,8 @@
      }
      pCapStr -= 2;
      *pCapStr = '\0';
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO, "\t\t%s", pTempCapStr);
-     if (pTempCapStr)
-     {
-         vos_mem_free(pTempCapStr);
-         pTempCapStr = NULL;
-     }
+     pCapStr = capStr;
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR, "\t\t%s", pCapStr);
 }
 
 /**
@@ -1707,30 +1472,6 @@
   }
 }
 
-/**
- * wdi_state_info_dump() - prints state information of wdi layer
- */
-static void wdi_state_info_dump(void)
-{
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                "%s pending commands: %d", __func__,
-                gWDICb.wptPendingQueue.count);
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                "uGlobalState %d wdiExpectedResponse: %d",
-                gWDICb.uGlobalState, gWDICb.wdiExpectedResponse);
-}
-
-
-/**
- * wdi_register_debug_callback() - registration function for wdi layer
- * to print WDI state information
-  */
-static void wdi_register_debug_callback(void)
-{
-    vos_register_debug_callback(VOS_MODULE_ID_WDI, &wdi_state_info_dump);
-}
-
-
 /*========================================================================
 
                              INITIALIZATION APIs
@@ -1958,7 +1699,7 @@
 
   /*The WDI is initialized - set state to init */
   gWDICb.uGlobalState = WDI_INIT_ST;
-  gWDICb.roamDelayStatsEnabled = vos_get_roam_delay_stats_enabled();
+
   /*Send the context as a ptr to the global WDI Control Block*/
   *ppWDIGlobalCtx = &gWDICb;
 
@@ -1966,9 +1707,6 @@
   pWdiDevCapability->bFrameXtlSupported = eWLAN_PAL_FALSE;
   pWdiDevCapability->ucMaxSTASupported  = gWDICb.ucMaxStations;
   pWdiDevCapability->ucMaxBSSSupported  = gWDICb.ucMaxBssids;
-
-  wdi_register_debug_callback();
-
   return WDI_STATUS_SUCCESS;
 
   /* ERROR handlers
@@ -4413,398 +4151,6 @@
 }/*WDI_SetUapsdAcParamsReq*/
 
 /**
- @brief WDI_FWLoggingDXEdoneInd
-
-        FW Logging DXE done Indication from the upper layer will be sent
-        down to HAL
-
- @param WDI_FWLoggingDXEdoneIndInfoType
-
- @see
-
- @return Status of the request
-*/
-WDI_Status
-WDI_FWLoggingDXEdoneInd
-(
-  wpt_uint32    data
-)
-{
-
-  WDI_EventInfoType      wdiEventData;
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  /*------------------------------------------------------------------------
-    Sanity Check
-  ------------------------------------------------------------------------*/
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
-  }
-
-  /*------------------------------------------------------------------------
-    Fill in Event data and post to the Main FSM
-  ------------------------------------------------------------------------*/
-  wdiEventData.wdiRequest      = WDI_FW_LOGGING_DXE_DONE_IND;
-  wdiEventData.pEventData      = (void *)&data;
-  wdiEventData.uEventDataSize  = sizeof(wpt_uint32);
-  wdiEventData.pCBfnc          = NULL;
-  wdiEventData.pUserData       = NULL;
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-
-}/*WDI_FWLoggingDXEdoneInd*/
-
-/**
- @brief WDI_GetFrameLogReq will be called when the upper
-        MAC wants to initialize frame logging. Upon the call of
-        this API the WLAN DAL will pack and send a HAL
-        Frame logging init request message to
-        the lower RIVA sub-system.
-
-        In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
-
-
- @param pwdiGetFrameLogReqInfo: the Frame Logging params
-                      as specified by the Device Interface
-
-        wdiGetFrameLogRspCb: callback for passing back the
-        response of the frame logging init operation received
-        from the device
-
-        pUserData: user data will be passed back with the
-        callback
-
- @return Result of the function call
-*/
-WDI_Status
-WDI_GetFrameLogReq
-(
-   WDI_GetFrameLogReqInfoType    *pwdiGetFrameLogReqInfo,
-   WDI_GetFrameLogRspCb             wdiGetFrameLogRspCb,
-   void*                                pUserData
-)
-{
-   WDI_EventInfoType      wdiEventData;
-   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-   /*------------------------------------------------------------------------
-     Sanity Check
-   ------------------------------------------------------------------------*/
-   if ( eWLAN_PAL_FALSE == gWDIInitialized )
-   {
-     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-   }
-
-   /*------------------------------------------------------------------------
-     Fill in Event data and post to the Main FSM
-   ------------------------------------------------------------------------*/
-   wdiEventData.wdiRequest      = WDI_GET_FRAME_LOG_REQ;
-   wdiEventData.pEventData      = pwdiGetFrameLogReqInfo;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiGetFrameLogReqInfo);
-   wdiEventData.pCBfnc          = wdiGetFrameLogRspCb;
-   wdiEventData.pUserData       = pUserData;
-
-   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-
-/**
- @brief WDI_FatalEventLogsReq will be called when the upper
-        MAC wants to send the flush command. Upon the call of
-        this API the WLAN DAL will pack and send a HAL
-        Fatal Event Req message to the lower RIVA sub-system.
-
-        In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
-
-
- @param pwdiFlushLogsReqInfo: the Flush Logs params
-                      as specified by the Device Interface
-
-        wdiFlushLogsRspCb: callback for passing back the
-        response of the Flush Logs operation received
-        from the device
-
-        pUserData: user data will be passed back with the
-        callback
-
- @return Result of the function call
-*/
-
-WDI_Status
-WDI_FatalEventLogsReq
-(
-   WDI_FatalEventLogsReqInfoType      *pwdiFatalEventLogsReqInfo,
-   WDI_FatalEventLogsRspCb             wdiFatalEventLogsRspCb,
-   void*                               pUserData
-)
-{
-    WDI_EventInfoType      wdiEventData;
-
-    /*------------------------------------------------------------------------
-      Sanity Check
-    ------------------------------------------------------------------------*/
-    if ( eWLAN_PAL_FALSE == gWDIInitialized )
-    {
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                "WDI API call before module is initialized - Fail request");
-
-      return WDI_STATUS_E_NOT_ALLOWED;
-    }
-
-    /*------------------------------------------------------------------------
-      Fill in Event data and post to the Main FSM
-    ------------------------------------------------------------------------*/
-    wdiEventData.wdiRequest      = WDI_FATAL_EVENT_LOGGING_REQ;
-    wdiEventData.pEventData      = pwdiFatalEventLogsReqInfo;
-    wdiEventData.uEventDataSize  = sizeof(*pwdiFatalEventLogsReqInfo);
-    wdiEventData.pCBfnc          = wdiFatalEventLogsRspCb;
-    wdiEventData.pUserData       = pUserData;
-
-    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-
-}
-
-
-/**
- @brief WDI_FWLoggingInitReq will be called when the upper
-        MAC wants to initialize frame logging. Upon the call of
-        this API the WLAN DAL will pack and send a HAL
-        Frame logging init request message to
-        the lower RIVA sub-system.
-
-        In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
-
-
- @param pwdiFWLoggingInitReqParams: the Frame Logging params
-                      as specified by the Device Interface
-
-        wdiFWLoggingInitReqCb: callback for passing back the
-        response of the frame logging init operation received
-        from the device
-
-        pUserData: user data will be passed back with the
-        callback
-
- @return Result of the function call
-*/
-WDI_Status
-WDI_FWLoggingInitReq
-(
-   WDI_FWLoggingInitReqInfoType         *pwdiFWLoggingInitReqInfo,
-   WDI_FWLoggingInitRspCb               wdiFWLoggingInitRspCb,
-   void*                                pUserData
-)
-{
-   WDI_EventInfoType      wdiEventData;
-
-   /*------------------------------------------------------------------------
-     Sanity Check
-   ------------------------------------------------------------------------*/
-   if ( eWLAN_PAL_FALSE == gWDIInitialized )
-   {
-     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-   }
-
-   /*------------------------------------------------------------------------
-     Fill in Event data and post to the Main FSM
-   ------------------------------------------------------------------------*/
-   wdiEventData.wdiRequest      = WDI_FW_LOGGING_INIT_REQ;
-   wdiEventData.pEventData      = pwdiFWLoggingInitReqInfo;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiFWLoggingInitReqInfo);
-   wdiEventData.pCBfnc          = wdiFWLoggingInitRspCb;
-   wdiEventData.pUserData       = pUserData;
-
-   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-
-/**
- @brief WDI_FwrMemDumpReq will be called when the upper
-        MAC wants to get fwr mem dump. Upon the call of
-        this API the WLAN DAL will pack and send a HAL
-        Frame logging init request message to
-        the lower RIVA sub-system.
-
-        In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
-
-
- @param pWdiFwrMemDumpReq: the fwr mem dump req params
-                      as specified by the Device Interface
-
-        wdiFWLoggingInitReqCb: callback for passing back the
-        response of the frame logging init operation received
-        from the device
-
-        pUserData: user data will be passed back with the
-        callback
-
- @return Result of the function call
-*/
-
-WDI_Status
-WDI_FwrMemDumpReq
-
-(
-   WDI_FwrMemDumpReqType          *pwdiFwrMemDumpReqInfo,
-   WDI_FwrMemDumpCb                wdiFwrMemDumpRspCb,
-   void*                           pUserData
-)
-{
-   WDI_EventInfoType      wdiEventData;
-
-   /*------------------------------------------------------------------------
-     Sanity Check
-   ------------------------------------------------------------------------*/
-   if ( eWLAN_PAL_FALSE == gWDIInitialized )
-   {
-     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-   }
-
-   /*------------------------------------------------------------------------
-     Fill in Event data and post to the Main FSM
-   ------------------------------------------------------------------------*/
-   wdiEventData.wdiRequest      = WDI_FWR_MEM_DUMP_REQ;
-   wdiEventData.pEventData      = pwdiFwrMemDumpReqInfo;
-   wdiEventData.uEventDataSize  = sizeof(WDI_FwrMemDumpReqType);
-   wdiEventData.pCBfnc          = wdiFwrMemDumpRspCb;
-   wdiEventData.pUserData       = pUserData;
-
-   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-
-
-/**
- @brief WDI_StartRssiMonitorReq will be called when the upper
-        MAC wants to initialize Rssi Monitor on a bssid.
-        Upon the call of this API the WLAN DAL will pack and
-        send a HAL Rssi Monitor init request message to
-        the lower RIVA sub-system.
-
-        In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
-
-
- @param pwdiRssiMonitorInfo: the Rssi Monitor params
-                      as specified by the Device Interface
-
-        wdiRssiMonitorStartRspCb: callback for passing back the
-        response of the rssi monitor operation received
-        from the device
-
-        pUserData: user data will be passed back with the
-        callback
-
- @return Result of the function call
-*/
-WDI_Status
-WDI_StartRssiMonitorReq
-(
-   WDI_RssiMonitorReqInfoType          *pwdiRssiMonitorInfo,
-   WDI_RssiMonitorStartRspCb            wdiRssiMonitorStartRspCb,
-   void*                                pUserData
-)
-{
-   WDI_EventInfoType      wdiEventData;
-
-   /*------------------------------------------------------------------------
-     Sanity Check
-   ------------------------------------------------------------------------*/
-   if ( eWLAN_PAL_FALSE == gWDIInitialized )
-   {
-     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-   }
-
-   /*------------------------------------------------------------------------
-     Fill in Event data and post to the Main FSM
-   ------------------------------------------------------------------------*/
-   wdiEventData.wdiRequest      = WDI_START_RSSI_MONITOR_REQ;
-   wdiEventData.pEventData      = pwdiRssiMonitorInfo;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiRssiMonitorInfo);
-   wdiEventData.pCBfnc          = wdiRssiMonitorStartRspCb;
-   wdiEventData.pUserData       = pUserData;
-
-   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-/**
- @brief WDI_StopRssiMonitorReq will be called when the upper
-        MAC wants to stop Rssi Monitor on a bssid.
-        Upon the call of this API the WLAN DAL will pack and
-        send a HAL Rssi Monitor stop request message to
-        the lower RIVA sub-system.
-
-        In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
-
-
- @param pwdiRssiMonitorInfo: the Rssi Monitor params
-                      as specified by the Device Interface
-
-        wdiRssiMonitorStopRspCb: callback for passing back the
-        response of the rssi monitor operation received
-        from the device
-
-        pUserData: user data will be passed back with the
-        callback
-
- @return Result of the function call
-*/
-WDI_Status
-WDI_StopRssiMonitorReq
-(
-   WDI_RssiMonitorReqInfoType          *pwdiRssiMonitorInfo,
-   WDI_RssiMonitorStopRspCb            wdiRssiMonitorStopRspCb,
-   void*                               pUserData
-)
-{
-   WDI_EventInfoType      wdiEventData;
-
-   /*------------------------------------------------------------------------
-     Sanity Check
-   ------------------------------------------------------------------------*/
-   if ( eWLAN_PAL_FALSE == gWDIInitialized )
-   {
-     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-   }
-
-   /*------------------------------------------------------------------------
-     Fill in Event data and post to the Main FSM
-   ------------------------------------------------------------------------*/
-   wdiEventData.wdiRequest      = WDI_STOP_RSSI_MONITOR_REQ;
-   wdiEventData.pEventData      = pwdiRssiMonitorInfo;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiRssiMonitorInfo);
-   wdiEventData.pCBfnc          = wdiRssiMonitorStopRspCb;
-   wdiEventData.pUserData       = pUserData;
-
-   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-
-/**
  @brief WDI_ConfigureRxpFilterReq will be called when the upper
         MAC wants to set/reset the RXP filters for received pkts
         (MC, BC etc.). Upon the call of this API the WLAN DAL will pack
@@ -6199,7 +5545,6 @@
  @param wdiAddBAReqParams: the add BA parameters as specified by
                       the Device Interface
 
-        baReqParamUserDataSize: user data size of wdiAddBAReqParams
         wdiAddBARspCb: callback for passing back the response of
         the add BA operation received from the device
 
@@ -6213,7 +5558,6 @@
 WDI_TriggerBAReq
 (
   WDI_TriggerBAReqParamsType* pwdiTriggerBAReqParams,
-  wpt_uint8                   baReqParamUserDataSize,
   WDI_TriggerBARspCb          wdiTriggerBARspCb,
   void*                       pUserData
 )
@@ -6237,8 +5581,7 @@
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_TRIGGER_BA_REQ;
   wdiEventData.pEventData      = pwdiTriggerBAReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiTriggerBAReqParams)
-                                      + baReqParamUserDataSize;
+  wdiEventData.uEventDataSize  = sizeof(*pwdiTriggerBAReqParams);
   wdiEventData.pCBfnc          = wdiTriggerBARspCb;
   wdiEventData.pUserData       = pUserData;
 
@@ -7320,7 +6663,6 @@
   WDI_Status         wdiStatus;
   WDI_MainFuncType   pfnWDIMainEvHdlr;
   WDI_MainStateType  wdiOldState;
-  static int failCnt = 0;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
@@ -7369,11 +6711,9 @@
   }
   else
   {
-    if (!(failCnt & 0xF))
-        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Unexpected event %d in state: %d",
               wdiEV, wdiOldState);
-    failCnt++;
     wdiStatus = WDI_STATUS_E_NOT_ALLOWED;
   }
 
@@ -7583,7 +6923,7 @@
   wdiStartRspCb = (WDI_StartRspCb)pEventData->pCBfnc;
 
    /*Notify UMAC*/
-  wdiStartRspCb( &pWDICtx->wdiCachedStartRspParams, pEventData->pUserData);
+  wdiStartRspCb( &pWDICtx->wdiCachedStartRspParams, pWDICtx->pRspCBUserData);
 
   /*Return Success*/
   return WDI_STATUS_SUCCESS;
@@ -9764,7 +9104,6 @@
   WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS;
   tSetBssKeyReqMsg             halSetBssKeyReqMsg  = {{0}};
   wpt_uint8                    keyIndex            = 0;
-  wpt_uint8                    i;
 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
@@ -9858,40 +9197,17 @@
                      pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].unicast;
     halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyDirection =
                 pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyDirection;
-
-    if(WDI_getHostWlanFeatCaps(DISA) && WDI_getFwWlanFeatCaps(DISA))
-    {
-      for (i = 0; i < WDI_MAX_KEY_RSC_LEN; i++)
-      {
-        halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyRsc[i] =
-            ~(pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyRsc[i]);
-      }
-
-      for (i = 0; i < WDI_MAX_KEY_LENGTH; i++)
-      {
-        halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].key[i] =
-             ~(pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].key[i]);
-      }
-
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-             "%s: Negated Keys", __func__);
-    }
-    else
-    {
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-             "%s: No change in Keys", __func__);
-      wpalMemoryCopy(halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyRsc,
+    wpalMemoryCopy(halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyRsc,
                      pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyRsc,
                      WDI_MAX_KEY_RSC_LEN);
-      wpalMemoryCopy(halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].key,
-                     pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].key,
-                     WDI_MAX_KEY_LENGTH);
-    }
     halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].paeRole =
                      pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].paeRole;
     halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyLength =
                    pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyLength;
-  }
+    wpalMemoryCopy(halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].key,
+                         pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].key,
+                        WDI_MAX_KEY_LENGTH);
+   }
 
   wpalMemoryCopy( pSendBuffer+usDataOffset,
                     &halSetBssKeyReqMsg.setBssKeyParams,
@@ -10062,7 +9378,6 @@
   wpt_uint8                    ucCurrentBSSSesIdx;
   tSetStaKeyReqMsg             halSetStaKeyReqMsg  = {{0}};
   wpt_uint8                    keyIndex            = 0;
-  wpt_uint8                    i;
 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
@@ -10166,40 +9481,17 @@
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].unicast;
     halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyDirection =
                 pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyDirection;
-
-    if(WDI_getHostWlanFeatCaps(DISA) && WDI_getFwWlanFeatCaps(DISA))
-    {
-      for (i = 0; i < WDI_MAX_KEY_RSC_LEN; i++)
-      {
-        halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyRsc[i] =
-             ~(pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyRsc[i]);
-      }
-
-      for (i = 0; i< WDI_MAX_KEY_LENGTH; i++)
-      {
-        halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].key[i] =
-             ~(pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].key[i]);
-      }
-
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-             "%s: Negated Keys", __func__);
-    }
-    else
-    {
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-             "%s: No change in Keys", __func__);
-      wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyRsc,
+    wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyRsc,
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyRsc,
                      WDI_MAX_KEY_RSC_LEN);
-      wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].key,
-                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].key,
-                     WDI_MAX_KEY_LENGTH);
-    }
     halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].paeRole =
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].paeRole;
     halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyLength =
                    pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyLength;
-  }
+    wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].key,
+                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].key,
+                        WDI_MAX_KEY_LENGTH);
+   }
 
   wpalMemoryCopy( pSendBuffer+usDataOffset,
                     &halSetStaKeyReqMsg.setStaKeyParams,
@@ -10384,7 +9676,6 @@
   wpt_uint8                    ucCurrentBSSSesIdx;
   tSetStaKeyReqMsg             halSetStaKeyReqMsg  = {{0}};
   wpt_uint8                    keyIndex            = 0;
-  wpt_uint8                    i;
 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
@@ -10488,40 +9779,18 @@
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].unicast;
     halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyDirection =
                 pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyDirection;
-
-    if(WDI_getHostWlanFeatCaps(DISA) && WDI_getFwWlanFeatCaps(DISA))
-    {
-      for (i = 0; i < WDI_MAX_KEY_RSC_LEN; i++)
-      {
-        halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyRsc[i] =
-             ~(pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyRsc[i]);
-      }
-
-      for (i = 0; i< WDI_MAX_KEY_LENGTH; i++)
-      {
-        halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].key[i] =
-             ~(pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].key[i]);
-      }
-
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-             "%s: Negated Keys", __func__);
-    }
-    else
-    {
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-             "%s: No change in Keys", __func__);
-      wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyRsc,
+    wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyRsc,
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyRsc,
                      WDI_MAX_KEY_RSC_LEN);
-      wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].key,
-                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].key,
-                     WDI_MAX_KEY_LENGTH);
-    }
     halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].paeRole =
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].paeRole;
     halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyLength =
                    pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyLength;
-  }
+    wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].key,
+                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].key,
+                        WDI_MAX_KEY_LENGTH);
+   }
+
   wpalMemoryCopy( pSendBuffer+usDataOffset,
                     &halSetStaKeyReqMsg.setStaKeyParams,
                     sizeof(halSetStaKeyReqMsg.setStaKeyParams));
@@ -14479,7 +13748,6 @@
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "WDI Init failed to wait on an event");
 
-      WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_FULL, NULL);
       WDI_ASSERT(0);
       goto fail;
    }
@@ -14658,7 +13926,6 @@
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "WDI Init failed to wait on an event");
 
-      WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_FULL, NULL);
       WDI_ASSERT(0);
       goto fail;
    }
@@ -16748,7 +16015,7 @@
 
   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halInitScanRspMsg.initScanRspParams.status);
 
-  if (pWDICtx->bInBmps && (WDI_STATUS_SUCCESS == wdiStatus))
+  if ( pWDICtx->bInBmps )
   {
      // notify DTS that we are entering Full power
      wptStatus = WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_FULL, NULL);
@@ -16758,12 +16025,6 @@
         WDI_ASSERT(0);
     }
   }
-  else if (WDI_STATUS_SUCCESS != wdiStatus)
-  {
-     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "Error returned WDI_ProcessInitScanRspi:%d BMPS%d",
-               wdiStatus, pWDICtx->bInBmps);
-  }
 
   /*Notify UMAC*/
   wdiInitScanRspCb( wdiStatus, pWDICtx->pRspCBUserData);
@@ -18079,7 +17340,7 @@
 {
   WDI_LLStatsSetRspCb   wdiLLStatsSetRspCb;
 
-  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "%s: Enter ", __func__);
   /*-------------------------------------------------------------------------
     Sanity check
@@ -18120,7 +17381,7 @@
      WDI_ASSERT(0);
      return WDI_STATUS_E_FAILURE;
   }
-  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "%s: Enter ", __func__);
 
   wdiLLStatsGetRspCb = (WDI_LLStatsGetRspCb)pWDICtx->pfncRspCB;
@@ -18151,7 +17412,7 @@
      return WDI_STATUS_E_FAILURE;
   }
 
-  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "%s: CLEAR RESPONSE CALL BACK", __func__);
   wdiLLStatsClearRspCb = (WDI_LLStatsClearRspCb)pWDICtx->pfncRspCB;
 
@@ -20852,7 +20113,7 @@
    eHalStatus           halStatus;
    WDI_KeepAliveCb      wdiKeepAliveCb;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
                "Received WDI_ProcessKeepAliveRsp Callback from HAL");
 
 
@@ -21889,10 +21150,8 @@
 
   /*Fill in the indication parameters*/
   wdiInd.wdiIndicationType = WDI_TX_COMPLETE_IND;
-
-  wpalMemoryCopy( &wdiInd.wdiIndicationData,
-                  &halTxComplIndMsg.txComplParams,
-                  sizeof(WDI_TxBDStatus) );
+  wdiInd.wdiIndicationData.tx_complete_status
+                               = halTxComplIndMsg.txComplParams.status;
 
   if ( pWDICtx->wdiLowLevelIndCB )
   {
@@ -21964,64 +21223,6 @@
   return WDI_STATUS_SUCCESS;
 }/*WDI_ProcessTdlsInd*/
 #endif
-
-#ifdef WLAN_FEATURE_RMC
-/**
-*@brief Process Tx Fail Indication
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessTXFailInd
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_LowLevelIndType  wdiInd;
-  tHalTXFailIndMsg     halTXFailIndMsg;
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  /*-------------------------------------------------------------------------
-  Sanity check
- -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData ))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT( 0 );
-     return WDI_STATUS_E_FAILURE;
-  }
-  /*-------------------------------------------------------------------------
-  Extract indication and send it to UMAC
- -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halTXFailIndMsg.txFailIndParams,
-                  pEventData->pEventData,
-                  sizeof(halTXFailIndMsg.txFailIndParams) );
-
-  /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType = WDI_TX_FAIL_IND;
-
-  wdiInd.wdiIndicationData.wdiTXFailInd.seqNo
-                          = halTXFailIndMsg.txFailIndParams.seqNo;
-
-  wpalMemoryCopy(wdiInd.wdiIndicationData.wdiTXFailInd.macAddr,
-                 halTXFailIndMsg.txFailIndParams.macAddr,
-                 sizeof(wdiInd.wdiIndicationData.wdiTXFailInd.macAddr));
-
-  /*Notify UMAC*/
-  if (pWDICtx->wdiLowLevelIndCB)
-     pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-
-  return WDI_STATUS_SUCCESS;
-}
-#endif /* WLAN_FEATURE_RMC */
-
 /**
 *@brief Process Noa Start Indication function (called when
         an indication of this kind is being received over the
@@ -22825,7 +22026,6 @@
 
   halMsgHeader.msgLen  = sizeof(halMsgHeader) + usBufferLen;
   *pusDataOffset       = sizeof(halMsgHeader);
-
   wpalMemoryCopy(*pMsgBuffer, &halMsgHeader, sizeof(halMsgHeader));
 
   return WDI_STATUS_SUCCESS;
@@ -23150,7 +22350,7 @@
     }
 #ifndef WDI_RE_ENABLE_WIFI_ON_WDI_TIMEOUT
     wpalWcnssResetIntr();
-    if(wpalIslogPInProgress())
+    if(wpalIsWDresetInProgress())
     {
       if(wpalIsSsrPanicOnFailure())
           wpalDevicePanic();
@@ -23334,14 +22534,12 @@
     return;
   }
 
-  /*Access to the global state must be locked */
-  wpalMutexAcquire(&pWDICtx->wptMutex);
-
   /*Transition back to the state that we had before serialization
   - serialization transitions us to BUSY to stop any incomming requests
-  */
+  ! TO DO L: possible race condition here if a request comes in between the
+   state transition and the post function*/
+
   WDI_STATE_TRANSITION( pWDICtx, pMsg->val);
-  wpalMutexRelease(&pWDICtx->wptMutex);
 
   /*-----------------------------------------------------------------------
      Check to see what type of event we are serializing
@@ -23375,8 +22573,7 @@
     break;
   }/*switch ( pEventData->wdiRequest )*/
 
-  if (!(WDI_STATUS_SUCCESS == wdiStatus || WDI_STATUS_PENDING == wdiStatus
-     || WDI_STATUS_SUCCESS_SYNC == wdiStatus))
+  if ( WDI_STATUS_SUCCESS != wdiStatus  )
   {
     WDI_ExtractRequestCBFromEvent(pEventData, &pfnReqStatusCB, &pUserData);
 
@@ -24629,16 +23826,6 @@
     return WLAN_HAL_ADD_PERIODIC_TX_PTRN_IND;
   case WDI_DEL_PERIODIC_TX_PATTERN_IND:
     return WLAN_HAL_DEL_PERIODIC_TX_PTRN_IND;
-#ifdef WLAN_FEATURE_RMC
-  case WDI_RMC_RULER_REQ:
-    return WLAN_HAL_RMC_RULER_REQ;
-  case WDI_RMC_UPDATE_IND:
-    return WLAN_HAL_RMC_UPDATE_IND;
-  case WDI_HAL_IBSS_PEER_INFO_REQ:
-    return WLAN_HAL_GET_IBSS_PEER_INFO_REQ;
-#endif /* WLAN_FEATURE_RMC */
-  case WDI_RATE_UPDATE_IND:
-    return WLAN_HAL_RATE_UPDATE_IND;
 
 #ifdef FEATURE_WLAN_BATCH_SCAN
   case WDI_SET_BATCH_SCAN_REQ:
@@ -24648,12 +23835,8 @@
   case WDI_TRIGGER_BATCH_SCAN_RESULT_IND:
        return WLAN_HAL_BATCHSCAN_TRIGGER_RESULT_IND;
 #endif
-
-#ifdef WLAN_FEATURE_RMC
-  case WDI_TX_FAIL_MONITOR_IND:
-    return WLAN_HAL_TX_FAIL_MONITOR_IND;
-#endif
-
+  case WDI_RATE_UPDATE_IND:
+    return WLAN_HAL_RATE_UPDATE_IND;
   case WDI_START_HT40_OBSS_SCAN_IND:
        return WLAN_HAL_START_HT40_OBSS_SCAN_IND;
   case WDI_STOP_HT40_OBSS_SCAN_IND:
@@ -24686,59 +23869,13 @@
        return WLAN_HAL_BSSID_HOTLIST_SET_REQ;
   case WDI_EXTSCAN_RESET_BSSID_HOTLIST_REQ:
        return WLAN_HAL_BSSID_HOTLIST_RESET_REQ;
-  case WDI_EXTSCAN_SET_SSID_HOTLIST_REQ:
-       return WLAN_HAL_SSID_HOTLIST_SET_REQ;
-  case WDI_EXTSCAN_RESET_SSID_HOTLIST_REQ:
-       return WLAN_HAL_SSID_HOTLIST_RESET_REQ;
-  case WDI_HIGH_PRIORITY_DATA_INFO_IND:
-       return WLAN_HAL_HIGH_PRIORITY_DATA_INFO_REQ;
+  case WDI_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ:
+       return WLAN_HAL_SIG_RSSI_SET_REQ;
+  case WDI_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ:
+       return WLAN_HAL_SIG_RSSI_RESET_REQ;
 #endif /* WLAN_FEATURE_EXTSCAN */
   case WDI_SPOOF_MAC_ADDR_REQ:
        return WLAN_HAL_MAC_SPOOFED_SCAN_REQ;
-  case WDI_GET_FW_STATS_REQ:
-       return WLAN_HAL_FW_STATS_REQ;
-  case WDI_ENCRYPT_MSG_REQ:
-       return WLAN_HAL_ENCRYPT_DATA_REQ;
-  case WDI_FW_LOGGING_INIT_REQ:
-       return WLAN_HAL_FW_LOGGING_INIT_REQ;
-  case WDI_GET_FRAME_LOG_REQ:
-       return WLAN_HAL_GET_FRAME_LOG_REQ;
-  case WDI_NAN_REQUEST:
-       return WLAN_HAL_NAN_REQ;
-  case WDI_SET_RTS_CTS_HTVHT_IND:
-       return WLAN_HAL_SET_RTS_CTS_HTVHT_IND;
-  case WDI_MON_START_REQ:
-       return WLAN_HAL_ENABLE_MONITOR_MODE_REQ;
-  case WDI_MON_STOP_REQ:
-       return WLAN_HAL_DISABLE_MONITOR_MODE_REQ;
-  case WDI_FW_LOGGING_DXE_DONE_IND:
-       return WLAN_HAL_FW_LOGGING_DXE_DONE_IND;
-  case WDI_FATAL_EVENT_LOGGING_REQ:
-       return WLAN_HAL_FATAL_EVENT_LOGGING_REQ;
-  case WDI_SEND_FREQ_RANGE_CONTROL_IND:
-       return WLAN_HAL_SEND_FREQ_RANGE_CONTROL_IND;
-  case WDI_FWR_MEM_DUMP_REQ:
-       return WLAN_HAL_FW_MEMORY_DUMP_REQ;
-  case WDI_START_RSSI_MONITOR_REQ:
-       return WLAN_HAL_START_RSSI_MONITORING_REQ;
-  case WDI_STOP_RSSI_MONITOR_REQ:
-       return WLAN_HAL_STOP_RSSI_MONITORING_REQ;
-  case WDI_WIFI_CONFIG_SET_REQ:
-       return WLAN_HAL_WIFI_CONFIG_SET_PARAMS_REQ;
-  case WDI_START_OEM_DATA_REQ_IND_NEW:
-       return WLAN_HAL_START_OEM_DATA_REQ_IND_NEW;
-  case WDI_ANTENNA_DIVERSITY_SELECTION_REQ:
-       return WLAN_HAL_ANTENNA_DIVERSITY_SELECTION_REQ;
-  case WDI_MODIFY_ROAM_PARAMS_IND:
-       return WLAN_HAL_MODIFY_ROAM_PARAMS_IND;
-  case WDI_SET_ALLOWED_ACTION_FRAMES_IND:
-       return WLAN_HAL_SET_ALLOWED_ACTION_FRAMES_IND;
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-  case WDI_PER_ROAM_SCAN_OFFLOAD_REQ:
-      return WLAN_HAL_SET_PER_ROAM_CONFIG_REQ;
-  case WDI_PER_ROAM_SCAN_TRIGGER_REQ:
-      return WLAN_HAL_PER_ROAM_SCAN_TRIGGER_REQ;
-#endif
   default:
     return WLAN_HAL_MSG_MAX;
   }
@@ -24993,15 +24130,6 @@
   case WLAN_HAL_PERIODIC_TX_PTRN_FW_IND:
     return WDI_HAL_PERIODIC_TX_PTRN_FW_IND;
 
-#ifdef WLAN_FEATURE_RMC
-  case WLAN_HAL_RMC_RULER_RSP:
-    return WDI_RMC_RULER_RESP;
-  case WLAN_HAL_RMC_UPDATE_IND:
-    return WDI_RMC_UPDATE_IND_TO_HOST;
-  case WLAN_HAL_GET_IBSS_PEER_INFO_RSP:
-    return WDI_HAL_IBSS_PEER_INFO_RSP;
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_BATCH_SCAN
   case WLAN_HAL_BATCHSCAN_SET_RSP:
     return WDI_SET_BATCH_SCAN_RESP;
@@ -25009,11 +24137,6 @@
     return WDI_BATCHSCAN_RESULT_IND;
 #endif // FEATURE_WLAN_BATCH_SCAN
 
-#ifdef WLAN_FEATURE_RMC
-  case WLAN_HAL_TX_FAIL_IND:
-    return WDI_HAL_TX_FAIL_IND;
-#endif /* WLAN_FEATURE_RMC */
-
 #ifdef FEATURE_WLAN_CH_AVOID
   case WLAN_HAL_AVOID_FREQ_RANGE_IND:
     return WDI_HAL_CH_AVOID_IND;
@@ -25049,10 +24172,10 @@
        return WDI_EXTSCAN_SET_HOTLIST_BSSID_RSP;
   case WLAN_HAL_BSSID_HOTLIST_RESET_RSP:
        return WDI_EXTSCAN_RESET_HOTLIST_BSSID_RSP;
-  case WLAN_HAL_SSID_HOTLIST_SET_RSP:
-       return WDI_EXTSCAN_SET_HOTLIST_SSID_RSP;
-  case WLAN_HAL_SSID_HOTLIST_RESET_RSP:
-       return WDI_EXTSCAN_RESET_HOTLIST_SSID_RSP;
+  case WLAN_HAL_SIG_RSSI_SET_RSP:
+       return WDI_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP;
+  case WLAN_HAL_SIG_RSSI_RESET_RSP:
+       return WDI_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP;
   case WLAN_HAL_EXT_SCAN_PROGRESS_IND:
        return WDI_HAL_EXTSCAN_PROGRESS_IND;
   case WLAN_HAL_EXT_SCAN_RESULT_AVAILABLE_IND:
@@ -25061,53 +24184,12 @@
        return WDI_HAL_EXTSCAN_RESULT_IND;
   case WLAN_HAL_BSSID_HOTLIST_RESULT_IND:
        return WDI_HAL_EXTSCAN_BSSID_HOTLIST_RESULT_IND;
-  case WLAN_HAL_SSID_HOTLIST_RESULT_IND:
-       return WDI_HAL_EXTSCAN_SSID_HOTLIST_RESULT_IND;
+  case WLAN_HAL_SIG_RSSI_RESULT_IND:
+       return WDI_HAL_EXTSCAN_SIG_RSSI_RESULT_IND;
 #endif /* WLAN_FEATURE_EXTSCAN */
   case WLAN_HAL_MAC_SPOOFED_SCAN_RSP:
        return WDI_SPOOF_MAC_ADDR_RSP;
-  case WLAN_HAL_FW_STATS_RSP:
-       return WDI_GET_FW_STATS_RSP;
-  case WLAN_HAL_ENCRYPT_DATA_RSP:
-       return WDI_ENCRYPT_MSG_RSP;
-  case WLAN_HAL_FW_LOGGING_INIT_RSP:
-       return WDI_FW_LOGGING_INIT_RSP;
-  case WLAN_HAL_GET_FRAME_LOG_RSP:
-       return WDI_GET_FRAME_LOG_RSP;
-  case WLAN_HAL_NAN_RSP:
-       return WDI_NAN_RESPONSE;
-  case WLAN_HAL_NAN_EVT:
-       return WDI_HAL_NAN_EVENT;
-  case WLAN_HAL_LOST_LINK_PARAMETERS_IND:
-       return WDI_HAL_LOST_LINK_PARAMS_IND;
-  case WLAN_HAL_ENABLE_MONITOR_MODE_RSP:
-       return WDI_MON_START_RSP;
-  case WLAN_HAL_DISABLE_MONITOR_MODE_RSP:
-       return WDI_MON_STOP_RSP;
-  case WLAN_HAL_FATAL_EVENT_LOGGING_RSP:
-       return WDI_FATAL_EVENT_LOGGING_RSP;
-  case WLAN_HAL_FW_MEMORY_DUMP_RSP:
-       return WDI_FWR_MEM_DUMP_RSP;
-  case WLAN_HAL_START_RSSI_MONITORING_RSP:
-       return WDI_START_RSSI_MONITOR_RSP;
-  case WLAN_HAL_STOP_RSSI_MONITORING_RSP:
-       return WDI_STOP_RSSI_MONITOR_RSP;
-  case WLAN_HAL_RSSI_MONITORING_IND:
-       return WDI_HAL_RSSI_BREACHED_IND;
-  case WLAN_HAL_WIFI_CONFIG_SET_PARAMS_RSP:
-       return WDI_WIFI_CONFIG_SET_RSP;
-#ifdef FEATURE_OEM_DATA_SUPPORT
-  case WLAN_HAL_START_OEM_DATA_RSP_IND_NEW:
-       return WDI_HAL_START_OEM_DATA_RSP_IND_NEW;
-#endif /* FEATURE_OEM_DATA_SUPPORT */
-  case WLAN_HAL_ANTENNA_DIVERSITY_SELECTION_RSP:
-       return WDI_ANTENNA_DIVERSITY_SELECTION_RSP;
-#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
-  case WLAN_HAL_SET_PER_ROAM_CONFIG_RSP:
-       return WDI_PER_ROAM_SCAN_OFFLOAD_RSP;
-  case WLAN_HAL_PER_ROAM_SCAN_TRIGGER_RSP:
-       return WDI_PER_ROAM_SCAN_TRIGGER_RSP;
-#endif
+
   default:
     return eDRIVER_TYPE_MAX;
   }
@@ -25741,11 +24823,7 @@
   phalConfigBSS->dualCTSProtection        = pwdiConfigBSS->ucDualCTSProtection;
   phalConfigBSS->ucMaxProbeRespRetryLimit = pwdiConfigBSS->ucMaxProbeRespRetryLimit;
   phalConfigBSS->bHiddenSSIDEn            = pwdiConfigBSS->bHiddenSSIDEn;
-
-  if (vos_is_probe_rsp_offload_enabled())
-     phalConfigBSS->bProxyProbeRespEn = 1;
-  else
-     phalConfigBSS->bProxyProbeRespEn = pwdiConfigBSS->bProxyProbeRespEn;
+  phalConfigBSS->bProxyProbeRespEn        = pwdiConfigBSS->bProxyProbeRespEn;
 
 #ifdef WLAN_FEATURE_VOWIFI
   phalConfigBSS->maxTxPower               = pwdiConfigBSS->cMaxTxPower;
@@ -25903,12 +24981,6 @@
     *ppfnReqCB   =  ((WDI_DelSTAReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
     *ppUserData  =  ((WDI_DelSTAReqParamsType*)pEvent->pEventData)->pUserData;
     break;
-
-  case WDI_ADD_STA_SELF_REQ:
-    *ppfnReqCB   =  ((WDI_AddSTASelfReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
-    *ppUserData  =  ((WDI_AddSTASelfReqParamsType*)pEvent->pEventData)->pUserData;
-    break;
-
   case WDI_DEL_STA_SELF_REQ:
     *ppfnReqCB   =  ((WDI_DelSTASelfReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
     *ppUserData  =  ((WDI_DelSTASelfReqParamsType*)pEvent->pEventData)->pUserData;
@@ -26133,6 +25205,10 @@
     break;
 #endif
 
+  case WDI_SPOOF_MAC_ADDR_REQ:
+    *ppfnReqCB   =  ((WDI_GtkOffloadGetInfoReqMsg*)pEvent->pEventData)->wdiReqStatusCB;
+    *ppUserData  =  ((WDI_GtkOffloadGetInfoReqMsg*)pEvent->pEventData)->pUserData;
+    break;
   default:
     *ppfnReqCB   =  NULL;
     *ppUserData  =  NULL;
@@ -26792,7 +25868,7 @@
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_RSSI_FILTER_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_PREF_NETWORK_REQ,
                          sizeof(ucRssiThreshold),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(ucRssiThreshold) )))
@@ -26868,53 +25944,6 @@
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
 
-WDI_Status
-WDI_PERRoamScanOffloadReq(WDI_PERRoamOffloadScanInfo
-                          *pwdiPERRoamScanOffloadReqParams,
-                          WDI_PERRoamOffloadScanCb wdiPERRoamOffloadScancb,
-                          void *pUserData)
-{
-   WDI_EventInfoType wdiEventData = {{0}};
-
-   if (eWLAN_PAL_FALSE == gWDIInitialized) {
-     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-   }
-
-   wdiEventData.wdiRequest      = WDI_PER_ROAM_SCAN_OFFLOAD_REQ;
-   wdiEventData.pEventData      = pwdiPERRoamScanOffloadReqParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiPERRoamScanOffloadReqParams);
-   wdiEventData.pCBfnc          = wdiPERRoamOffloadScancb;
-   wdiEventData.pUserData       = pUserData;
-
-   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-WDI_Status
-WDI_PERRoamScanTriggerReq(WDI_PERRoamTriggerScanInfo
-                          *pwdiPERRoamScanTriggerReqParams,
-                          WDI_PERRoamTriggerScanCb wdiPERRoamTriggerScancb,
-                          void *pUserData)
-{
-   WDI_EventInfoType      wdiEventData = {{0}};
-   if (eWLAN_PAL_FALSE == gWDIInitialized) {
-     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-   }
-
-   wdiEventData.wdiRequest      = WDI_PER_ROAM_SCAN_TRIGGER_REQ;
-   wdiEventData.pEventData      = pwdiPERRoamScanTriggerReqParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiPERRoamScanTriggerReqParams);
-   wdiEventData.pCBfnc          = wdiPERRoamTriggerScancb;
-   wdiEventData.pUserData       = pUserData;
-
-   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
 void
 WDI_wdiEdTypeEncToEdTypeEnc(tEdType *EdType, WDI_EdType wdiEdType)
 {
@@ -27151,123 +26180,6 @@
                wdiRoamOffloadScancb, pEventData->pUserData, WDI_ROAM_SCAN_OFFLOAD_RESP);
 }
 
-
-WDI_Status
-WDI_ProcessPERRoamScanOffloadReq(WDI_ControlBlockType *pWDICtx,
-                                 WDI_EventInfoType *pEventData)
-{
-   wpt_uint16 usSendSize = 0;
-   wpt_uint16 usDataOffset = 0;
-   wpt_uint8 *pSendBuffer = NULL;
-   WDI_PERRoamOffloadScanInfo *wdiPERRoamOffloadReq = NULL;
-   WDI_PERRoamOffloadScanCb wdiPERRoamOffloadScancb = NULL;
-   tSetPerRoamConfigReq halPERRoamConfigReq;
-
-   wdiPERRoamOffloadReq = (WDI_PERRoamOffloadScanInfo *)pEventData->pEventData;
-   wdiPERRoamOffloadScancb   = (WDI_PERRoamOffloadScanCb)pEventData->pCBfnc;
-
-   if ((!pEventData) || (!wdiPERRoamOffloadReq)|| (!wdiPERRoamOffloadScancb)) {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "%s: Invalid parameters", __func__);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-   }
-
-    if ((WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(pWDICtx,
-                    WDI_PER_ROAM_SCAN_OFFLOAD_REQ,
-                    sizeof(halPERRoamConfigReq.perRoamConfigParams),
-                    &pSendBuffer, &usDataOffset, &usSendSize))||
-                    (usSendSize < (usDataOffset +
-                    sizeof(halPERRoamConfigReq.perRoamConfigParams)))) {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-                "Unable to get send buffer halPERRoamConfigReq Req");
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-   }
-
-   halPERRoamConfigReq.perRoamConfigParams.request_id =
-                     wdiPERRoamOffloadReq->requestId;
-   halPERRoamConfigReq.perRoamConfigParams.waitPeriodForNextPERScan =
-                     wdiPERRoamOffloadReq->waitPeriodForNextPERScan;
-   halPERRoamConfigReq.perRoamConfigParams.rateUpThreshold =
-                     wdiPERRoamOffloadReq->rateUpThreshold;
-   halPERRoamConfigReq.perRoamConfigParams.rateDownThreshold =
-                     wdiPERRoamOffloadReq->rateDownThreshold;
-   halPERRoamConfigReq.perRoamConfigParams.isPERRoamCCAEnabled =
-                     wdiPERRoamOffloadReq->isPERRoamCCAEnabled;
-   halPERRoamConfigReq.perRoamConfigParams.PERroamTriggerPercent =
-                     wdiPERRoamOffloadReq->PERroamTriggerPercent;
-   halPERRoamConfigReq.perRoamConfigParams.PERtimerThreshold =
-                     wdiPERRoamOffloadReq->PERtimerThreshold;
-
-   halPERRoamConfigReq.perRoamConfigParams.reserved = 0;
-
-   wpalMemoryCopy(pSendBuffer+usDataOffset,
-                   &halPERRoamConfigReq.perRoamConfigParams,
-                   sizeof(halPERRoamConfigReq.perRoamConfigParams));
-
-   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
-          "request_id %d waitPeriodForNextPERScan=%d rateUpThreshold=%d rateDownThreshold=%d isPERRoamCCAEnabled=%d PERtimerThreshold=%d PERroamTriggerPercent =%d",
-          halPERRoamConfigReq.perRoamConfigParams.request_id,
-          halPERRoamConfigReq.perRoamConfigParams.waitPeriodForNextPERScan,
-          halPERRoamConfigReq.perRoamConfigParams.rateUpThreshold,
-          halPERRoamConfigReq.perRoamConfigParams.rateDownThreshold,
-          halPERRoamConfigReq.perRoamConfigParams.isPERRoamCCAEnabled,
-          halPERRoamConfigReq.perRoamConfigParams.PERtimerThreshold,
-          halPERRoamConfigReq.perRoamConfigParams.PERroamTriggerPercent);
-   return  WDI_SendMsg(pWDICtx, pSendBuffer, usSendSize,
-               wdiPERRoamOffloadScancb, pEventData->pUserData,
-               WDI_PER_ROAM_SCAN_OFFLOAD_RSP);
-}
-
-WDI_Status
-WDI_ProcessPERRoamScanTriggerReq(WDI_ControlBlockType *pWDICtx,
-                                 WDI_EventInfoType *pEventData)
-{
-   wpt_uint16 usSendSize = 0;
-   wpt_uint16 usDataOffset = 0;
-   wpt_uint8 *pSendBuffer = NULL;
-   WDI_PERRoamTriggerScanCb wdiPERRoamTriggerScancb  = NULL;
-   WDI_PERRoamTriggerScanInfo *wdiPERRoamTriggerReq;
-   tStartRoamScanReq halPERRoamTriggerReq;
-
-   wdiPERRoamTriggerReq = (WDI_PERRoamTriggerScanInfo *) pEventData->pEventData;
-   wdiPERRoamTriggerScancb   = (WDI_PERRoamTriggerScanCb)pEventData->pCBfnc;
-
-   if ((!pEventData) || (!wdiPERRoamTriggerReq) || (!wdiPERRoamTriggerScancb)) {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "%s: Invalid parameters", __func__);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-   }
-
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(pWDICtx,
-                    WDI_PER_ROAM_SCAN_TRIGGER_REQ,
-                    sizeof(halPERRoamTriggerReq.startRoamScanTriggerParams),
-                    &pSendBuffer, &usDataOffset, &usSendSize))||
-                    (usSendSize < (usDataOffset +
-                    sizeof(halPERRoamTriggerReq.startRoamScanTriggerParams)))) {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-                "Unable to get send buffer in GetFrameLog Req");
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-   }
-
-   halPERRoamTriggerReq.startRoamScanTriggerParams.roamScanReq =
-                     wdiPERRoamTriggerReq->roamScanReq;
-
-   wpalMemoryCopy(pSendBuffer+usDataOffset,
-                   &halPERRoamTriggerReq.startRoamScanTriggerParams,
-                   sizeof(halPERRoamTriggerReq.startRoamScanTriggerParams));
-
-   return  WDI_SendMsg(pWDICtx, pSendBuffer, usSendSize,
-               wdiPERRoamTriggerScancb, pEventData->pUserData,
-               WDI_PER_ROAM_SCAN_TRIGGER_RSP);
-}
-
-
-
-
 /**
  @brief Process Start Roam Candidate Lookup Rsp function (called when a
         response is being received over the bus from HAL)
@@ -27316,63 +26228,6 @@
 
    return WDI_STATUS_SUCCESS;
 }/* WDI_ProcessRoamScanOffloadRsp  */
-
-WDI_Status
-WDI_ProcessPERRoamScanOffloadRsp(WDI_ControlBlockType *pWDICtx,
-                                 WDI_EventInfoType *pEventData)
-{
-   WDI_Status                   wdiStatus;
-   eHalStatus                   halStatus;
-   WDI_PERRoamOffloadScanCb     wdiPERRoamOffloadScancb = NULL;
-
-   if ((NULL == pWDICtx) || (NULL == pEventData) ||
-       (NULL == pEventData->pEventData)) {
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "%s: Invalid parameters", __func__);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-   }
-
-   wdiPERRoamOffloadScancb = (WDI_PERRoamOffloadScanCb)pWDICtx->pfncRspCB;
-
-   halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
-
-   /*Notify UMAC*/
-   wdiPERRoamOffloadScancb(wdiStatus, pWDICtx->pRspCBUserData);
-
-   return WDI_STATUS_SUCCESS;
-}/* WDI_ProcessPERRoamScanOffloadRsp  */
-
-WDI_Status
-WDI_ProcessPERRoamScanTriggerRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-   WDI_Status                   wdiStatus;
-   eHalStatus                   halStatus;
-   WDI_PERRoamOffloadScanCb     wdiPERRoamTriggerScancb = NULL;
-
-   if ((NULL == pWDICtx) || (NULL == pEventData) ||
-       (NULL == pEventData->pEventData)) {
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "%s: Invalid parameters", __func__);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-   }
-
-   wdiPERRoamTriggerScancb = (WDI_PERRoamTriggerScanCb)pWDICtx->pfncRspCB;
-
-   halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
-
-   /* Notify UMAC */
-   wdiPERRoamTriggerScancb(wdiStatus, pWDICtx->pRspCBUserData);
-
-   return WDI_STATUS_SUCCESS;
-}/* WDI_ProcessPERRoamScanTriggerRsp  */
 #endif
 
 /**
@@ -29219,44 +28074,6 @@
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
 
-#ifdef WLAN_FEATURE_RMC
-/**
- @brief WDI_TXFailMonitorInd
-        Host will send an event to the FW to start TX Fail Monitor
-
- @param
-        WDI_TXFailMonitorInd
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_TXFailMonitorStartStopInd
-(
-  WDI_TXFailMonitorInd *wdiTXFailMonitorInd
-)
-{
-   WDI_EventInfoType   wdiEventData;
-
-   /*------------------------------------------------------------------------
-     Sanity Check
-   ------------------------------------------------------------------------*/
-   if ( eWLAN_PAL_FALSE == gWDIInitialized )
-   {
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "WDI API call before module is initialized - Fail request");
-
-      return WDI_STATUS_E_NOT_ALLOWED;
-   }
-
-   wdiEventData.wdiRequest      = WDI_TX_FAIL_MONITOR_IND;
-   wdiEventData.pEventData      = wdiTXFailMonitorInd;
-   wdiEventData.uEventDataSize  = sizeof(wdiTXFailMonitorInd);
-   wdiEventData.pCBfnc          = NULL;
-   wdiEventData.pUserData       = NULL;
-
-   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-#endif /* WLAN_FEATURE_RMC */
 
 /**
  @brief Process DHCP Start Indication message and post it to HAL
@@ -29404,77 +28221,6 @@
 
 }/*WDI_ProcessDHCPStopInd*/
 
-#ifdef WLAN_FEATURE_RMC
-/**
- @brief Process TX Fail monitor indication
-
- @param  pWDICtx:    pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessTXFailMonitor
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  wpt_uint8*              pSendBuffer           = NULL;
-  wpt_uint16              usDataOffset          = 0;
-  wpt_uint16              usSendSize            = 0;
-  wpt_uint16              usLen                 = 0;
-  WDI_TXFailMonitorInd*   pwdiTxFailMonitorInd  = NULL;
-  tTXFailMonitorInfo*     pTXFailMonitorInfo;
-  WDI_Status           wdiStatus;
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-         "%s", __func__);
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-
-  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-  pwdiTxFailMonitorInd = (WDI_TXFailMonitorInd*)pEventData->pEventData;
-  /*-----------------------------------------------------------------------
-    Get message buffer
-  -----------------------------------------------------------------------*/
-
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                        WDI_TX_FAIL_MONITOR_IND,
-                        sizeof(tDHCPInfo),
-                        &pSendBuffer, &usDataOffset, &usSendSize))||
-      ( usSendSize < (usDataOffset + usLen )))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-              "Unable to get send buffer in DHCP Start req %p ",
-                pEventData);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  pTXFailMonitorInfo = (tTXFailMonitorInfo*)pSendBuffer+usDataOffset;
-  pTXFailMonitorInfo->tx_fail_count = pwdiTxFailMonitorInd->tx_fail_count;
-
-  pWDICtx->pReqStatusUserData = pwdiTxFailMonitorInd->pUserData;
-  pWDICtx->wdiReqStatusCB = pwdiTxFailMonitorInd->wdiReqStatusCB;
- /*-------------------------------------------------------------------------
-    Send TX Fail Monitor start/stop indication to HAL
-  -------------------------------------------------------------------------*/
-  wdiStatus = WDI_SendIndication( pWDICtx, pSendBuffer, usSendSize);
-
-  return  (wdiStatus != WDI_STATUS_SUCCESS)?wdiStatus:WDI_STATUS_SUCCESS_SYNC;
-}/*WDI_ProcessTXFailMonitor*/
-#endif /* WLAN_FEATURE_RMC */
 
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
 /**
@@ -30207,14 +28953,14 @@
    ------------------------------------------------------------------------*/
    FillAllFeatureCaps(gpHostWlanFeatCaps, supportEnabledFeatures,
       (sizeof(supportEnabledFeatures)/sizeof(supportEnabledFeatures[0])));
-   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
       "Host caps %x %x %x %x",
       gpHostWlanFeatCaps->featCaps[0],
       gpHostWlanFeatCaps->featCaps[1],
       gpHostWlanFeatCaps->featCaps[2],
       gpHostWlanFeatCaps->featCaps[3]
    );
-   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO, "Host Capability");
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR, "Host Capability");
    WDI_TraceHostFWCapabilities(gpHostWlanFeatCaps->featCaps);
    wdiEventData.wdiRequest      = WDI_FEATURE_CAPS_EXCHANGE_REQ;
    wdiEventData.pEventData      = gpHostWlanFeatCaps; 
@@ -30375,15 +29121,14 @@
 
    wpalMemoryCopy(gpFwWlanFeatCaps,(tWlanFeatCaps *) pEventData -> pEventData,
                     fCapsStructSize);
-   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
       "FW caps %x %x %x %x",
       gpFwWlanFeatCaps->featCaps[0],
       gpFwWlanFeatCaps->featCaps[1],
       gpFwWlanFeatCaps->featCaps[2],
       gpFwWlanFeatCaps->featCaps[3]
    );
-
-   WPAL_TRACE(  eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO, "Firmware Capability");
+   WPAL_TRACE(  eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR, "Firmware Capability");
    WDI_TraceHostFWCapabilities(gpFwWlanFeatCaps->featCaps);
    wdiFeatureCapsExchangeCb = (WDI_featureCapsExchangeCb) pWDICtx -> pfncRspCB; 
 
@@ -30498,75 +29243,6 @@
     return featSupported;
 }
 
-wpt_uint8 WDI_selectCbMode( wpt_uint8 channel, wpt_uint8 ChannelBW )
-{
-  /* 5gHz Channel */
-  if( channel >= 34 && channel <= 165 )
-  {
-    if( ChannelBW == 80 && WDI_getFwWlanFeatCaps(DOT11AC) )
-    {
-      if ( channel== 36 || channel == 52 || channel == 100 ||
-            channel == 116 || channel == 149 )
-      {
-            return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
-      }
-      else if ( channel == 40 || channel == 56 || channel == 104 ||
-            channel == 120 || channel == 153 )
-      {
-         return  PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
-      }
-      else if ( channel == 44 || channel == 60 || channel == 108 ||
-            channel == 124 || channel == 157 )
-      {
-         return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
-      }
-      else if ( channel == 48 || channel == 64 || channel == 112 ||
-            channel == 128 || channel == 144 || channel == 161 )
-      {
-         return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
-      }
-      else if ( channel == 165 )
-      {
-         return PHY_SINGLE_CHANNEL_CENTERED;
-      }
-     }
-
-    else
-    {
-      if ( channel== 40 || channel == 48 || channel == 56 ||
-            channel == 64 || channel == 104 || channel == 112 ||
-            channel == 120 || channel == 128 || channel == 136 ||
-            channel == 144 || channel == 153 || channel == 161 )
-      {
-         return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
-      }
-      else if ( channel== 36 || channel == 44 || channel == 52 ||
-            channel == 60 || channel == 100 || channel == 108 ||
-            channel == 116 || channel == 124 || channel == 132 ||
-            channel == 140 || channel == 149 || channel == 157 )
-      {
-         return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
-      }
-      else if ( channel == 165 )
-      {
-         return PHY_SINGLE_CHANNEL_CENTERED;
-      }
-    }
-   }
-
-   /* 2.4Ghz Channel */
-   if( ChannelBW == 40 && WDI_getFwWlanFeatCaps(HT40_OBSS_SCAN) )
-   {
-      if (channel >= 1 && channel <= 7)
-         return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
-      else if (channel >= 8 && channel <= 13)
-         return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
-      else if (channel ==14)
-         return PHY_SINGLE_CHANNEL_CENTERED;
-   }
-  return PHY_SINGLE_CHANNEL_CENTERED;
-}
-
 #ifdef WLAN_FEATURE_11AC
 WDI_Status
 WDI_ProcessUpdateVHTOpModeReq
@@ -30689,21 +29365,6 @@
    WDTS_ChannelDebug(displaySnapshot, debugFlags);
    return;
 }
-
-/**
- @brief WDI_TransportKickDxe -
-    Request Kick DXE when HDD TX time out happen
-
- @param  none
- @see
- @return none
-*/
-void WDI_TransportKickDxe()
-{
-   WDTS_ChannelKickDxe();
-   return;
-}
-
 /**
  @brief WDI_SsrTimerCB
     Callback function for SSR timer, if this is called then the graceful
@@ -30750,18 +29411,6 @@
    gWDICb.bEnableSSR = enableSSR;
 }
 
-/**
- * WDI_SetMgmtPktViaWQ5() - Set INI params sendMgmtPktViaWQ5 to Control
- *                           Block Type.
- * @sendMgmtPktViaWQ5: INI params to enable/disable sending mgmt pkt via WQ5.
- *
- * Return: void
- */
-void WDI_SetMgmtPktViaWQ5(wpt_boolean sendMgmtPktViaWQ5)
-{
-   gWDICb.sendMgmtPktViaWQ5 = sendMgmtPktViaWQ5;
-}
-
 
 #ifdef FEATURE_WLAN_LPHB
 /**
@@ -31138,7 +29787,6 @@
 
 } /*WDI_ProcessIbssPeerInactivityInd*/
 
-
 /**
 *@brief WDI_RateUpdateInd will be called when the upper MAC
         requests the device to set rates.
@@ -31249,8 +29897,8 @@
     /* Copy the tx flags */
     pRateUpdateInd->halRateUpdateParams.ucastDataRateTxFlag =
                              pwdiRateUpdateInd->ucastDataRateTxFlag;
-    pRateUpdateInd->halRateUpdateParams.rmcDataRateTxFlag =
-                             pwdiRateUpdateInd->rmcDataRateTxFlag;
+    pRateUpdateInd->halRateUpdateParams.reliableMcastDataRateTxFlag =
+                             pwdiRateUpdateInd->reliableMcastDataRateTxFlag;
     pRateUpdateInd->halRateUpdateParams.mcastDataRate24GHzTxFlag =
                              pwdiRateUpdateInd->mcastDataRate24GHzTxFlag;
     pRateUpdateInd->halRateUpdateParams.mcastDataRate5GHzTxFlag =
@@ -31259,8 +29907,8 @@
     /* Copy the tx rates */
     pRateUpdateInd->halRateUpdateParams.ucastDataRate =
                              pwdiRateUpdateInd->ucastDataRate;
-    pRateUpdateInd->halRateUpdateParams.rmcDataRate =
-                             pwdiRateUpdateInd->rmcDataRate;
+    pRateUpdateInd->halRateUpdateParams.reliableMcastDataRate =
+                             pwdiRateUpdateInd->reliableMcastDataRate;
     pRateUpdateInd->halRateUpdateParams.mcastDataRate24GHz =
                              pwdiRateUpdateInd->mcastDataRate24GHz;
     pRateUpdateInd->halRateUpdateParams.mcastDataRate5GHz =
@@ -31279,608 +29927,7 @@
 
 } /* WDI_ProcessRateUpdateInd */
 
-#ifdef WLAN_FEATURE_RMC
-WDI_Status
-WDI_ProcessRMCRulerResp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  tHalRmcRulerRspMsg halRmcRulerRspMsg;
-  WDI_RmcRulerRspCb wdiRmcRulerRspCb;
-  WDI_RmcRspParamsType wdiRmcRsp;
-
-  /* Sanity check */
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData ))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT( 0 );
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  wdiRmcRulerRspCb = (WDI_RmcRulerRspCb)pWDICtx->pfncRspCB;
-
-  /* Extract indication and send it to UMAC */
-  wpalMemoryCopy( &halRmcRulerRspMsg.rulerRspParams,
-                  pEventData->pEventData,
-                  sizeof(halRmcRulerRspMsg.rulerRspParams) );
-
-  wdiRmcRsp.status = halRmcRulerRspMsg.rulerRspParams.status;
-  wpalMemoryCopy(wdiRmcRsp.mcastTransmitter,
-                      &halRmcRulerRspMsg.rulerRspParams.mcastTransmitter,
-                      sizeof(wdiRmcRsp.mcastTransmitter));
-  wpalMemoryCopy(wdiRmcRsp.mcastGroup,
-                      &halRmcRulerRspMsg.rulerRspParams.mcastGroup,
-                      sizeof(wdiRmcRsp.mcastGroup));
-
-  switch (halRmcRulerRspMsg.rulerRspParams.cmd)
-  {
-    default:
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid command %d", __func__,
-                  halRmcRulerRspMsg.rulerRspParams.cmd);
-      return WDI_STATUS_E_FAILURE;
-
-    case WLAN_HAL_SUGGEST_RULER:
-    {
-      /* Fill in the indication parameters */
-      wdiRmcRsp.cmd = eWDI_SUGGEST_RULER_CMD;
-      wpalMemoryCopy(wdiRmcRsp.ruler,
-                      &halRmcRulerRspMsg.rulerRspParams.ruler,
-                      sizeof(halRmcRulerRspMsg.rulerRspParams.ruler));
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "%s Suggest_Ruler", __func__);
-      break;
-    }
-
-    case WLAN_HAL_BECOME_RULER:
-    {
-      /* Fill in the indication parameters */
-      wdiRmcRsp.cmd = eWDI_BECOME_RULER_CMD;
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "%s Become_Ruler", __func__);
-      break;
-    }
-  }
-
-  /* Notify UMAC */
-  wdiRmcRulerRspCb(&wdiRmcRsp, pWDICtx->pRspCBUserData);
-
-  return WDI_STATUS_SUCCESS;
-}
-
-WDI_Status
-WDI_ProcessRMCUpdateIndToHost
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_LowLevelIndType wdiInd;
-  tHalRmcUpdateInd halRmcUpdateInd;
-
-  /* Sanity check */
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData ))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT( 0 );
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  /* Extract indication and send it to UMAC */
-  wpalMemoryCopy( &halRmcUpdateInd.rulerIndParams,
-                  pEventData->pEventData,
-                  sizeof(halRmcUpdateInd.rulerIndParams) );
-
-  switch (halRmcUpdateInd.rulerIndParams.indication)
-  {
-    default:
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid command %d", __func__,
-                  halRmcUpdateInd.rulerIndParams.indication);
-      return WDI_STATUS_E_FAILURE;
-
-    case WLAN_HAL_RULER_PICK_NEW:
-    {
-      /* Fill in the indication parameters */
-      wdiInd.wdiIndicationType = WDI_RMC_RULER_PICK_NEW;
-      wdiInd.wdiIndicationData.wdiRmcPickNewRulerInd.indication
-                        = halRmcUpdateInd.rulerIndParams.indication;
-      wdiInd.wdiIndicationData.wdiRmcPickNewRulerInd.role
-                        = halRmcUpdateInd.rulerIndParams.role;
-      wpalMemoryCopy(wdiInd.wdiIndicationData.wdiRmcPickNewRulerInd. \
-                      mcastTransmitter,
-                      &halRmcUpdateInd.rulerIndParams.mcastTransmitter,
-                      sizeof(tSirMacAddr) );
-      wpalMemoryCopy(wdiInd.wdiIndicationData.wdiRmcPickNewRulerInd.mcastGroup,
-                      &halRmcUpdateInd.rulerIndParams.mcastGroup,
-                      sizeof(tSirMacAddr) );
-      wpalMemoryCopy(wdiInd.wdiIndicationData.wdiRmcPickNewRulerInd.mcastRuler,
-                      &halRmcUpdateInd.rulerIndParams.mcastRuler,
-                      sizeof(tSirMacAddr) );
-      wpalMemoryCopy(wdiInd.wdiIndicationData.wdiRmcPickNewRulerInd.ruler,
-                      &halRmcUpdateInd.rulerIndParams.ruler,
-                      sizeof(tSirMacAddr) * HAL_NUM_MAX_RULERS );
-      break;
-    }
-  }
-
-
-  /* Notify UMAC */
-  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-
-  return WDI_STATUS_SUCCESS;
-}
-
-WDI_Status
-WDI_RmcRulerReq
-(
-    WDI_RmcRulerReqParams  *wdiRmcRulerReqParams,
-    WDI_RmcRulerRspCb wdiRmcRulerRspCb,
-    void *usrData
-)
-{
-   WDI_EventInfoType      wdiEventData;
-   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-   /*------------------------------------------------------------------------
-     Sanity Check
-   ------------------------------------------------------------------------*/
-    if ( eWLAN_PAL_FALSE == gWDIInitialized )
-    {
-        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "WDI API call before module is initialized - Fail request");
-
-        return WDI_STATUS_E_NOT_ALLOWED;
-    }
-
-    /*------------------------------------------------------------------------
-      Fill in Event data and post to the Main FSM
-     ------------------------------------------------------------------------*/
-    wdiEventData.wdiRequest      = WDI_RMC_RULER_REQ;
-    wdiEventData.pEventData      = wdiRmcRulerReqParams;
-    wdiEventData.uEventDataSize  = sizeof(WDI_RmcRulerReqParams);
-    wdiEventData.pCBfnc          = wdiRmcRulerRspCb;
-    wdiEventData.pUserData       = usrData;
-
-    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-
-} /* WDI_RmcRulerReq */
-
-WDI_Status
-WDI_RmcUpdateInd
-(
-    WDI_RmcUpdateIndParams  *wdiRmcUpdateIndParams
-)
-{
-   WDI_EventInfoType      wdiEventData;
-   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-   /*------------------------------------------------------------------------
-    Sanity Check
-   ------------------------------------------------------------------------*/
-   if ( eWLAN_PAL_FALSE == gWDIInitialized )
-   {
-       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "WDI API call before module is initialized - Fail request");
-
-       return WDI_STATUS_E_NOT_ALLOWED;
-   }
-
-   /*------------------------------------------------------------------------
-     Fill in Event data and post to the Main FSM
-   ------------------------------------------------------------------------*/
-    wdiEventData.wdiRequest      = WDI_RMC_UPDATE_IND;
-    wdiEventData.pEventData      = wdiRmcUpdateIndParams;
-    wdiEventData.uEventDataSize  = sizeof(WDI_RmcUpdateIndParams);
-    wdiEventData.pCBfnc          = NULL;
-    wdiEventData.pUserData       = NULL;
-
-    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-
-}/* WDI_RmcUpdateInd */
-
-WDI_Status
-WDI_ProcessRMCRulerReq
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-)
-{
-    WDI_Status              wdiStatus;
-    wpt_uint8*              pSendBuffer        = NULL;
-    wpt_uint16              usDataOffset       = 0;
-    wpt_uint16              usSendSize         = 0;
-    WDI_RmcRulerReqParams *pwdiRulerReq      = NULL;
-    tHalRmcRulerReqMsg    *pRulerReq;
-
-    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-           "%s", __func__);
-
-    /*-------------------------------------------------------------------------
-      Sanity check
-    -------------------------------------------------------------------------*/
-    if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ))
-    {
-       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                   "%s: Invalid parameters", __func__);
-       WDI_ASSERT(0);
-       return WDI_STATUS_E_FAILURE;
-    }
-    pwdiRulerReq = (WDI_RmcRulerReqParams *)pEventData->pEventData;
-    /*-----------------------------------------------------------------------
-      Get message buffer
-    -----------------------------------------------------------------------*/
-
-    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                          WDI_RMC_RULER_REQ,
-                          sizeof(tHalRmcRulerReqParams),
-                          &pSendBuffer, &usDataOffset, &usSendSize))||
-                          ( usSendSize < (usDataOffset +
-                                 sizeof(tHalRmcRulerReqParams) )))
-    {
-       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-                "Unable to get send buffer in Ruler Req %p ",
-                  pEventData);
-       WDI_ASSERT(0);
-       return WDI_STATUS_E_FAILURE;
-    }
-
-    pRulerReq = (tHalRmcRulerReqMsg *)pSendBuffer;
-    pRulerReq->rulerReqParams.cmd = pwdiRulerReq->cmd;
-    wpalMemoryCopy(pRulerReq->rulerReqParams.mcastTransmitter,
-                     pwdiRulerReq->mcastTransmitter, WDI_MAC_ADDR_LEN);
-    wpalMemoryCopy(pRulerReq->rulerReqParams.mcastGroup,
-                     pwdiRulerReq->mcastGroup, WDI_MAC_ADDR_LEN);
-    wpalMemoryCopy(pRulerReq->rulerReqParams.blacklist,
-                     pwdiRulerReq->blacklist,
-                     WDI_MAC_ADDR_LEN * HAL_NUM_MAX_RULERS);
-
-    pWDICtx->pReqStatusUserData = pEventData->pUserData;
-    pWDICtx->pfncRspCB = pEventData->pCBfnc;
-
-    wdiStatus = WDI_SendMsg(pWDICtx, pSendBuffer,
-                            usSendSize, pWDICtx->pfncRspCB,
-                            pWDICtx->pReqStatusUserData,
-                            WDI_RMC_RULER_RESP);
-    return wdiStatus;
-
-} /* WDI_ProcessRMCRulerReq */
-
-/**
- @brief Process Update Indication and post it to HAL
-
- @param  pWDICtx:    pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessRMCUpdateInd
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-)
-{
-    wpt_uint8*              pSendBuffer        = NULL;
-    wpt_uint16              usDataOffset       = 0;
-    wpt_uint16              usSendSize         = 0;
-    WDI_RmcUpdateIndParams *pwdiUpdateInd      = NULL;
-    tHalRmcUpdateInd       *pUpdateInd;
-    WDI_Status              wdiStatus;
-
-    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-           "%s", __func__);
-
-    /*-------------------------------------------------------------------------
-      Sanity check
-    -------------------------------------------------------------------------*/
-    if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ))
-    {
-       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                   "%s: Invalid parameters", __func__);
-       WDI_ASSERT(0);
-       return WDI_STATUS_E_FAILURE;
-    }
-    pwdiUpdateInd = (WDI_RmcUpdateIndParams *)pEventData->pEventData;
-    /*-----------------------------------------------------------------------
-      Get message buffer
-    -----------------------------------------------------------------------*/
-
-    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                          WDI_RMC_UPDATE_IND,
-                          sizeof(tHalRmcUpdateIndParams),
-                          &pSendBuffer, &usDataOffset, &usSendSize))||
-                          ( usSendSize < (usDataOffset +
-                                 sizeof(tHalRmcUpdateIndParams) )))
-    {
-       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-                "Unable to get send buffer in RMC Update Indication %p ",
-                  pEventData);
-       WDI_ASSERT(0);
-       return WDI_STATUS_E_FAILURE;
-    }
-
-    pUpdateInd = (tHalRmcUpdateInd *)pSendBuffer;
-
-    pUpdateInd->rulerIndParams.indication = pwdiUpdateInd->indication;
-    pUpdateInd->rulerIndParams.role = pwdiUpdateInd->role;
-
-    wpalMemoryCopy(pUpdateInd->rulerIndParams.mcastTransmitter,
-                     pwdiUpdateInd->mcastTransmitter, WDI_MAC_ADDR_LEN);
-    wpalMemoryCopy(pUpdateInd->rulerIndParams.mcastGroup,
-                     pwdiUpdateInd->mcastGroup, WDI_MAC_ADDR_LEN);
-    wpalMemoryCopy(pUpdateInd->rulerIndParams.mcastRuler,
-                     pwdiUpdateInd->mcastRuler, WDI_MAC_ADDR_LEN);
-    /* Zero out parameters not needed for this command */
-    wpalMemoryZero(pUpdateInd->rulerIndParams.ruler,
-                     WDI_MAC_ADDR_LEN * HAL_NUM_MAX_RULERS);
-
-
-    /*-------------------------------------------------------------------------
-     Send Update Indication to HAL
-    -------------------------------------------------------------------------*/
-    pWDICtx->wdiReqStatusCB     = pwdiUpdateInd->wdiReqStatusCB;
-    pWDICtx->pReqStatusUserData = pwdiUpdateInd->pUserData;
-
-    wdiStatus = WDI_SendIndication(pWDICtx, pSendBuffer, usSendSize);
-
-    return (wdiStatus != WDI_STATUS_SUCCESS) ?
-                 wdiStatus : WDI_STATUS_SUCCESS_SYNC;
-
-} /* WDI_ProcessRMCUpdateInd */
-
-/**
- @brief Process peer info req
-
- @param  pWDICtx:    pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_IbssPeerInfoReq
-(
-   WDI_IbssPeerInfoReqType*   wdiPeerInfoReqParams,
-   WDI_IbssPeerInfoReqCb      wdiIbssPeerInfoReqCb,
-   void*                      pUserData
-)
-{
-
-   WDI_EventInfoType  wdiEventData;
-
-   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-   /*------------------------------------------------------------------------
-     Sanity Check
-   ------------------------------------------------------------------------*/
-    if ( eWLAN_PAL_FALSE == gWDIInitialized )
-    {
-        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "WDI API call before module is initialized - Fail request");
-
-        return WDI_STATUS_E_NOT_ALLOWED;
-    }
-
-    /*------------------------------------------------------------------------
-      Fill in Event data and post to the Main FSM
-     ------------------------------------------------------------------------*/
-    wdiEventData.wdiRequest      = WDI_HAL_IBSS_PEER_INFO_REQ;
-    wdiEventData.pEventData      = wdiPeerInfoReqParams;
-    wdiEventData.uEventDataSize  = sizeof(WDI_IbssPeerInfoReqType);
-    wdiEventData.pCBfnc          = wdiIbssPeerInfoReqCb;
-    wdiEventData.pUserData       = pUserData;
-
-    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-/**
- @brief Process peer info req
-
- @param  pWDICtx:    pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessIbssPeerInfoReq
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-)
-{
-    WDI_Status              wdiStatus;
-    wpt_uint8*              pSendBuffer        = NULL;
-    wpt_uint16              usDataOffset       = 0;
-    wpt_uint16              usSendSize         = 0;
-    WDI_IbssPeerInfoReqType *pwdiInfoReq        = NULL;
-    tHalIbssPeerInfoReq     *pPeerInfoReq;
-    WDI_StaStruct*   pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
-
-    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-           "%s", __func__);
-
-    /*-------------------------------------------------------------------------
-      Sanity check
-    -------------------------------------------------------------------------*/
-    if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ))
-    {
-       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                   "%s: Invalid parameters", __func__);
-       WDI_ASSERT(0);
-       return WDI_STATUS_E_FAILURE;
-    }
-    pwdiInfoReq = (WDI_IbssPeerInfoReqType *)pEventData->pEventData;
-    /*-----------------------------------------------------------------------
-      Get message buffer
-    -----------------------------------------------------------------------*/
-
-    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                          WDI_HAL_IBSS_PEER_INFO_REQ,
-                          sizeof(tHalIbssPeerInfoReqParams),
-                          &pSendBuffer, &usDataOffset, &usSendSize))||
-                          ( usSendSize < (usDataOffset +
-                                 sizeof(tHalIbssPeerInfoReqParams) )))
-    {
-       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-                "Unable to get send buffer in IBSS Peer Info Req %p ",
-                  pEventData);
-       WDI_ASSERT(0);
-       return WDI_STATUS_E_FAILURE;
-    }
-
-    pPeerInfoReq = (tHalIbssPeerInfoReq *)pSendBuffer;
-    if (VOS_FALSE == pwdiInfoReq->wdiAllPeerInfoReqd)
-    {
-       if (pSTATable[pwdiInfoReq->wdiStaIdx].valid)
-       {
-          pPeerInfoReq->ibssPeerInfoReqParams.bssIdx =
-                        pSTATable[pwdiInfoReq->wdiStaIdx].bssIdx;
-       }
-       else
-       {
-          WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-                   "Unable to find BSSIDX for STAIDX %d ",
-                    pwdiInfoReq->wdiStaIdx);
-          return WDI_STATUS_E_FAILURE;
-       }
-    }
-    else
-      pPeerInfoReq->ibssPeerInfoReqParams.bssIdx = 0;
-
-    pPeerInfoReq->ibssPeerInfoReqParams.staIdx = pwdiInfoReq->wdiStaIdx;
-    pPeerInfoReq->ibssPeerInfoReqParams.allPeerInfoReqd = pwdiInfoReq->wdiAllPeerInfoReqd;
-
-    pWDICtx->pReqStatusUserData = pEventData->pUserData;
-    pWDICtx->pfncRspCB = pEventData->pCBfnc;
-
-    /*-------------------------------------------------------------------------
-     Send IBSS Peer Info request to HAL
-    -------------------------------------------------------------------------*/
-    wdiStatus = WDI_SendMsg(pWDICtx, pSendBuffer,
-                            usSendSize, pWDICtx->pfncRspCB,
-                            pWDICtx->pReqStatusUserData,
-                            WDI_HAL_IBSS_PEER_INFO_RSP);
-    return wdiStatus;
-}
-
-/**
- @brief Process peer info resp
-
- @param  pWDICtx:    pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessIbssPeerInfoRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-   WDI_IbssPeerInfoReqCb     wdiPeerInfoCb   = NULL;
-   tHalIbssPeerParams        *pHalPeerInfoParams;
-   WDI_IbssPeerInfoRspParams wdiPeerInfoRspParams;
-   wpt_uint32                allocSize=0;
-   WDI_IbssPeerInfoParams   *pPeerInfoParams = NULL;
-   wpt_uint8                 wdiCount=0;
-
-   /*-------------------------------------------------------------------------
-     Sanity check
-   -------------------------------------------------------------------------*/
-   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-       ( NULL == pEventData->pEventData))
-   {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "%s: Invalid parameters", __func__);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-   }
-
-   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-   wdiPeerInfoCb = (WDI_IbssPeerInfoReqCb)pWDICtx->pfncRspCB;
-
-   /*-------------------------------------------------------------------------
-     Extract response and send it to UMAC
-   -------------------------------------------------------------------------*/
-   pHalPeerInfoParams =
-             ((tHalIbssPeerInfoRspParams *)pEventData->pEventData)->ibssPeerParams;
-   wdiPeerInfoRspParams.wdiStatus =
-             WDI_HAL_2_WDI_STATUS(((tHalIbssPeerInfoRspParams *)pEventData->pEventData)->status);
-   wdiPeerInfoRspParams.wdiNumPeers =
-             ((tHalIbssPeerInfoRspParams *)pEventData->pEventData)->numOfPeers;
-
-   if (!wdiPeerInfoRspParams.wdiNumPeers) {
-      wdiPeerInfoRspParams.wdiPeerInfoParams = NULL;
-      goto error;
-   }
-   if (wdiPeerInfoRspParams.wdiNumPeers >=
-            WDI_MAX_IBSS_PEER_SUPPORED_STAS) {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-             "Number of stations %d exceed max supported stations %d set max",
-              wdiPeerInfoRspParams.wdiNumPeers,
-               WDI_MAX_IBSS_PEER_SUPPORED_STAS);
-      wdiPeerInfoRspParams.wdiNumPeers =
-            WDI_MAX_IBSS_PEER_SUPPORED_STAS - 1;
-   }
-   /* Size of peer info data received from DAL */
-   allocSize = (sizeof(WDI_IbssPeerInfoParams) * (wdiPeerInfoRspParams.wdiNumPeers));
-
-   pPeerInfoParams = (WDI_IbssPeerInfoParams*)wpalMemoryAllocate(allocSize);
-
-   if (NULL == pPeerInfoParams)
-   {
-       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
-           "Failed to allocate memory in ibss peer info response %p %p %p ",
-           pWDICtx, pEventData, pEventData->pEventData);
-       wdiPeerInfoRspParams.wdiPeerInfoParams = NULL;
-       goto error;
-   }
-
-   for (wdiCount = 0; wdiCount < wdiPeerInfoRspParams.wdiNumPeers; wdiCount++)
-   {
-      tHalIbssPeerParams        *pHalTemp = &pHalPeerInfoParams[wdiCount];
-      WDI_IbssPeerInfoParams    *pWdiTemp = &pPeerInfoParams[wdiCount];
-      pWdiTemp->wdiStaIdx = pHalTemp->staIdx;
-      pWdiTemp->wdiRssi = pHalTemp->rssi;
-      pWdiTemp->wdiMcsIndex = pHalTemp->mcsIndex;
-      pWdiTemp->wdiTxRate = pHalTemp->txRate;
-      pWdiTemp->wdiTxRateFlags = pHalTemp->txRateFlags;
-   }
-
-   wdiPeerInfoRspParams.wdiPeerInfoParams = pPeerInfoParams;
-error:
-   /*Notify UMAC*/
-   if (wdiPeerInfoCb)
-   {
-      wdiPeerInfoCb(&wdiPeerInfoRspParams, pWDICtx->pRspCBUserData);
-   }
-
-   /* Free the allocation */
-   if(pPeerInfoParams)
-     vos_mem_free (pPeerInfoParams);
-
-   return WDI_STATUS_SUCCESS;
-}
-#endif
 #ifdef FEATURE_WLAN_BATCH_SCAN
-
 /**
  @brief Process stop batch indication from WDA
 
@@ -32475,7 +30522,6 @@
   WDI_LowLevelIndType  wdiInd;
   tHalAvoidFreqRangeIndParams chAvoidIndicationParam;
   wpt_uint16           rangeLoop;
-  wpt_uint32           dataSize;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
@@ -32490,20 +30536,12 @@
      return WDI_STATUS_E_FAILURE;
   }
 
-  dataSize = sizeof(tHalAvoidFreqRangeIndParams);
-  if (dataSize > pEventData->uEventDataSize)
-    dataSize = pEventData->uEventDataSize;
-
   /*-------------------------------------------------------------------------
   Extract indication and send it to UMAC
  -------------------------------------------------------------------------*/
   wpalMemoryCopy(&chAvoidIndicationParam,
                  pEventData->pEventData,
-                 dataSize);
-
-  /* Avoid Over flow */
-  if (WLAN_HAL_MAX_AVOID_FREQ_RANGE < chAvoidIndicationParam.avoidCnt)
-     chAvoidIndicationParam.avoidCnt = WLAN_HAL_MAX_AVOID_FREQ_RANGE;
+                 sizeof(tHalAvoidFreqRangeIndParams));
 
   wdiInd.wdiIndicationType = WDI_CH_AVOID_IND;
   wdiInd.wdiIndicationData.wdiChAvoidInd.avoidRangeCount =
@@ -32561,7 +30599,7 @@
 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
-  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
          "%s", __func__);
 
   /*-------------------------------------------------------------------------
@@ -33065,140 +31103,6 @@
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
-
-/*
- * FUNCTION: WDI_ProcessGetFwStatsRsp
- * send the response with FW stats asked.
- */
-WDI_Status
-       WDI_ProcessGetFwStatsRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_FWStatsGetRspCb        wdiGetFwstatsCb;
-  tpHalfwStatsRspParams      pHalFwstatsRsp;
-  WDI_FWStatsResults         fwStats;
-
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-  pHalFwstatsRsp = (tHalfwStatsRspParams *)pEventData->pEventData;
-  wdiGetFwstatsCb = (WDI_FWStatsGetRspCb) pWDICtx->pfncRspCB;
-
-  if(pHalFwstatsRsp->length)
-  {
-     switch( pHalFwstatsRsp->type )
-     {
-        case FW_UBSP_STATS:
-        {
-             ubspFwStats *ubspStatsfromFw;
-
-             fwStats.type = pHalFwstatsRsp->type;
-             ubspStatsfromFw = (ubspFwStats *) pHalFwstatsRsp->data;
-             fwStats.wdiFwStatsData.ubspStats.ubsp_enter_cnt =
-                                             ubspStatsfromFw->ubsp_enter_cnt;
-             fwStats.wdiFwStatsData.ubspStats.ubsp_jump_ddr_cnt =
-                                          ubspStatsfromFw->ubsp_jump_ddr_cnt;
-        }
-        break;
-        default:
-        {
-             WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "%s: No handling for stats type %d", __func__,
-               pHalFwstatsRsp->type);
-             wdiGetFwstatsCb(WDI_STATUS_E_FAILURE,
-                    NULL, pWDICtx->pRspCBUserData);
-             return WDI_STATUS_E_FAILURE;
-        }
-     }
-     wdiGetFwstatsCb(WDI_STATUS_SUCCESS, &fwStats , pWDICtx->pRspCBUserData);
-  }
-  else
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-            "%s: Length = 0 for type %d return failure ", __func__,
-              pHalFwstatsRsp->type);
-     wdiGetFwstatsCb(WDI_STATUS_E_FAILURE,
-                      NULL, pWDICtx->pRspCBUserData);
-     return WDI_STATUS_E_FAILURE;
-  }
-  return WDI_STATUS_SUCCESS;
-}
-
-/*
- * FUNCTION: WDI_ProcessGetFwStatsReq
- * Request to WDI to get FW Stats.
- */
-WDI_Status
-       WDI_ProcessGetFwStatsReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  wpt_uint8*                   pSendBuffer         = NULL;
-  wpt_uint16                   usDataOffset        = 0;
-  wpt_uint16                   usSendSize          = 0;
-  WDI_FWStatsGetRspCb          *wdiGetFwstatsCb;
-  tHalfwStatsReqParams         halFwStatsReq;
-
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData) ||
-      ( NULL == pEventData->pCBfnc ) )
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  wdiGetFwstatsCb   = (WDI_FWStatsGetRspCb *)pEventData->pCBfnc;
-
-  /*-----------------------------------------------------------------------
-    Get message buffer
-  -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(
-                                  pWDICtx, WDI_GET_FW_STATS_REQ,
-                                  sizeof(tHalfwStatsReqParams),
-                                 &pSendBuffer, &usDataOffset, &usSendSize)) ||
-      ( usSendSize < (usDataOffset + sizeof(tHalfwStatsReqParams))))
-  {
-     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
-                "Unable to get send buffer in get WDI_GET_FW_STAS_REQ %p",
-                pEventData);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  pWDICtx->wdiReqStatusCB = NULL;
-  pWDICtx->pReqStatusUserData = pEventData->pEventData;
-  halFwStatsReq.type = *((wpt_uint32 *)(pEventData->pEventData));
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halFwStatsReq,
-                  sizeof(tHalfwStatsReqParams));
-  /*-------------------------------------------------------------------------
-    Send Get STA Request to HAL
-  -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, wdiGetFwstatsCb,
-                       pEventData->pUserData, WDI_GET_FW_STATS_RSP);
-}
-
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
 
 /**
@@ -33614,276 +31518,6 @@
 }
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
 
-WDI_Status WDI_FWStatsGetReq( void* pUserData,
-                   WDI_FWStatsGetRspCb          wdiFWStatsGetRspCb,
-                   wpt_uint32                   stats)
-{
-  WDI_EventInfoType         wdiEventData;
-
-  /*------------------------------------------------------------------------
-    Sanity Check
-  ------------------------------------------------------------------------*/
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-            "WDI API call before module is initialized - Fail request");
-       return WDI_STATUS_E_NOT_ALLOWED;
-  }
-  /*------------------------------------------------------------------------
-      Fill in Event data and post to the Main FSM
-  ------------------------------------------------------------------------*/
-  wdiEventData.wdiRequest      = WDI_GET_FW_STATS_REQ;
-  wdiEventData.pEventData      = (void *)&stats;
-  wdiEventData.uEventDataSize  = sizeof(wpt_uint32);
-  wdiEventData.pCBfnc          = wdiFWStatsGetRspCb;
-  wdiEventData.pUserData       = pUserData;
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-
-}
-
-WDI_Status
-WDI_MonStartReq(WDI_MonStartReqType* pwdiMonStartReqParams,
-                           WDI_MonModeRspCb   wdiMonModeRspCb,
-                           void*                   pUserData)
-{
-   WDI_EventInfoType      wdiEventData;
-
-  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-         "%s", __func__);
-
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-     VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ERROR,
-                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-  }
-
-  wdiEventData.wdiRequest      = WDI_MON_START_REQ;
-  wdiEventData.pEventData      = pwdiMonStartReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiMonStartReqParams);
-  wdiEventData.pCBfnc          = wdiMonModeRspCb;
-  wdiEventData.pUserData       = pUserData;
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-WDI_Status
-WDI_ProcessMonStartReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_MonStartReqType* pwdiMonStartReqParams;
-  WDI_MonModeRspCb wdiMonStartCb;
-  wpt_uint8*               pSendBuffer         = NULL;
-  wpt_uint16               usSendSize          = 0;
-  wpt_uint16               usDataOffset        = 0;
-  tHalEnableMonitorModeReqParams  halEnableMonitorModeParams;
-
-  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-         "%s", __func__);
-
-  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
-      ( NULL == pEventData->pCBfnc ))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  pwdiMonStartReqParams = (WDI_MonStartReqType*)pEventData->pEventData;
-  wdiMonStartCb   = (WDI_MonModeRspCb)pEventData->pCBfnc;
-
-  /*-----------------------------------------------------------------------
-    Get message buffer
-    ! TO DO : proper conversion into the HAL Message Request Format
-  -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(
-                                        pWDICtx,
-                                        WDI_MON_START_REQ,
-                                        sizeof(tHalEnableMonitorModeReqParams),
-                                        &pSendBuffer, &usDataOffset,
-                                        &usSendSize))||
-      ( usSendSize < (usDataOffset + sizeof(halEnableMonitorModeParams) )))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
-              "Unable to get send buffer in %s %p %p %p", __func__,
-                pEventData, pwdiMonStartReqParams, wdiMonStartCb);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
- halEnableMonitorModeParams.channelNumber = pwdiMonStartReqParams->ChannelNo;
- halEnableMonitorModeParams.cbState = WDI_selectCbMode(pwdiMonStartReqParams->ChannelNo,
-                                                       pwdiMonStartReqParams->ChannelBW);
- halEnableMonitorModeParams.maxAmpduLen = 0x1FFFF;
- halEnableMonitorModeParams.maxMpduInAmpduLen = 0xF20-0x4C;
- halEnableMonitorModeParams.crcCheckEnabled = pwdiMonStartReqParams->crcCheckEnabled;
- halEnableMonitorModeParams.numMacFilters = pwdiMonStartReqParams->numOfMacFilters;
- wpalMemoryCopy(halEnableMonitorModeParams.macFilters[0].macAddr,
-                pwdiMonStartReqParams->mmFilters[0].macAddr,
-                sizeof( wpt_macAddr ));
- halEnableMonitorModeParams.macFilters[0].isA1filteringNeeded = pwdiMonStartReqParams->mmFilters[0].isA1filter;
- halEnableMonitorModeParams.macFilters[0].isA2filteringNeeded = pwdiMonStartReqParams->mmFilters[0].isA2filter;
- halEnableMonitorModeParams.macFilters[0].isA3filteringNeeded = pwdiMonStartReqParams->mmFilters[0].isA3filter;
- halEnableMonitorModeParams.typeSubtypeBitmap = pwdiMonStartReqParams->typeSubtypeBitmap;
-
- wpalMemoryCopy(pSendBuffer+usDataOffset,
-                  &halEnableMonitorModeParams,
-                  sizeof(halEnableMonitorModeParams));
-
- pWDICtx->pReqStatusUserData = pEventData->pUserData;
-
- return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                      wdiMonStartCb, pEventData->pUserData,
-                      WDI_MON_START_RSP);
-}
-
-WDI_Status
-WDI_ProcessMonStartRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_MonModeRspCb   wdiMonStartRspCb;
-
-  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "%s: Enter ", __func__);
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  wdiMonStartRspCb = (WDI_MonModeRspCb)pWDICtx->pfncRspCB;
-
-  wdiMonStartRspCb((void *) pEventData->pEventData, pWDICtx->pRspCBUserData);
-
-  return WDI_STATUS_SUCCESS;
-}
-
-WDI_Status
-WDI_MonStopReq(WDI_MonModeRspCb wdiMonModeRspCb,
-               void*                 pUserData)
-{
-   WDI_EventInfoType      wdiEventData;
-
-  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-         "%s", __func__);
-
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-     VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ERROR,
-                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-  }
-
-  wdiEventData.wdiRequest      = WDI_MON_STOP_REQ;
-  wdiEventData.pEventData      = NULL;
-  wdiEventData.uEventDataSize  = sizeof(NULL);
-  wdiEventData.pCBfnc          = wdiMonModeRspCb;
-  wdiEventData.pUserData       = pUserData;
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-WDI_Status
-WDI_ProcessMonStopReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_MonModeRspCb         wdiMonStopCb;
-  wpt_uint8*               pSendBuffer         = NULL;
-  wpt_uint16               usSendSize          = 0;
-  wpt_uint16               usDataOffset        = 0;
-  wpt_uint8                resetConfiguration;
-
-  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-         "%s", __func__);
-
-  if (( NULL == pEventData ) || ( NULL == pEventData->pCBfnc ))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  wdiMonStopCb   = (WDI_MonModeRspCb)pEventData->pCBfnc;
-
-  /*-----------------------------------------------------------------------
-    Get message buffer
-    ! TO DO : proper conversion into the HAL Message Request Format
-  -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(
-                                        pWDICtx,
-                                        WDI_MON_STOP_REQ,
-                                        sizeof(wpt_uint8),
-                                        &pSendBuffer, &usDataOffset,
-                                        &usSendSize))||
-      ( usSendSize < (usDataOffset + sizeof(wpt_uint8) )))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
-              "Unable to get send buffer in %s %p %p", __func__,
-                pEventData, wdiMonStopCb);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
- wpalMemoryCopy(pSendBuffer+usDataOffset,
-                  &resetConfiguration,
-                  sizeof(wpt_uint8));
-
- pWDICtx->pReqStatusUserData = pEventData->pUserData;
-
- return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                      wdiMonStopCb, pEventData->pUserData,
-                      WDI_MON_STOP_RSP);
-}
-
-WDI_Status
-WDI_ProcessMonStopRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_MonModeRspCb   wdiMonStopRspCb;
-
-  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "%s: Enter ", __func__);
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  wdiMonStopRspCb = (WDI_MonModeRspCb)pWDICtx->pfncRspCB;
-
-  wdiMonStopRspCb(pWDICtx->pRspCBUserData, pWDICtx->pRspCBUserData);
-
-  return WDI_STATUS_SUCCESS;
-}
-
 #ifdef WLAN_FEATURE_EXTSCAN
 
 /**
@@ -34103,7 +31737,7 @@
 } /* End of WDI_ProcessEXTScanBssidHotListResultInd  */
 
 /**
- @brief Process EXTScan SSID Hotlist Result Indication indication from FW
+ @brief Process EXTScan Significant RSSI Result Indication indication from FW
 
  @param  pWDICtx:         pointer to the WLAN DAL context
          pEventData:      pointer to the event information structure
@@ -34112,7 +31746,7 @@
  @return Result of the function call
 */
 WDI_Status
-WDI_ProcessEXTScanSsidHotListResultInd
+WDI_ProcessEXTScanSignfRssiResultInd
 (
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
@@ -34135,7 +31769,7 @@
     }
 
     /* Fill in the indication parameters */
-    wdiInd.wdiIndicationType = WDI_EXTSCAN_SSID_HOTLIST_RESULT_IND;
+    wdiInd.wdiIndicationType = WDI_EXTSCAN_SIGN_RSSI_RESULT_IND;
 
     /* extract response and send it to UMAC */
     wdiInd.wdiIndicationData.pEXTScanIndData = (void *)pEventData->pEventData;
@@ -34153,8 +31787,7 @@
         return WDI_STATUS_E_FAILURE;
     }
     return WDI_STATUS_SUCCESS;
-} /* End of WDI_ProcessEXTScanSsidHotListResultInd  */
-
+} /* End of WDI_ProcessEXTScanSignfRssiResultInd  */
 
 /**
  @brief WDI_EXTScanGetCapabilitiesReq
@@ -34644,14 +32277,11 @@
   pHalExtScanStartReqParams->basePeriod = pwdiEXTScanStartReqParams->basePeriod;
   pHalExtScanStartReqParams->maxApPerScan =
                                     pwdiEXTScanStartReqParams->maxAPperScan;
-  pHalExtScanStartReqParams->reportThresholdPercent =
-                                pwdiEXTScanStartReqParams->reportThresholdPercent;
-  pHalExtScanStartReqParams->reportThresholdNumScans =
-                                pwdiEXTScanStartReqParams->reportThresholdNumScans;
+  pHalExtScanStartReqParams->reportThreshold =
+                                pwdiEXTScanStartReqParams->reportThreshold;
   pHalExtScanStartReqParams->requestId = pwdiEXTScanStartReqParams->requestId;
   pHalExtScanStartReqParams->sessionId = pwdiEXTScanStartReqParams->sessionId;
   pHalExtScanStartReqParams->numBuckets = pwdiEXTScanStartReqParams->numBuckets;
-  pHalExtScanStartReqParams->homeAwayTime = pwdiEXTScanStartReqParams->homeAwayTime;
 
   for( i = 0; i < WDI_WLAN_EXTSCAN_MAX_BUCKETS ; i++ )
   {
@@ -34663,12 +32293,6 @@
                       pwdiEXTScanStartReqParams->buckets[i].period;
       pHalExtScanStartReqParams->bucketData[i].reportEvents =
                       pwdiEXTScanStartReqParams->buckets[i].reportEvents;
-      pHalExtScanStartReqParams->bucketData[i].max_period =
-                      pwdiEXTScanStartReqParams->buckets[i].max_period;
-      pHalExtScanStartReqParams->bucketData[i].exponent =
-                      pwdiEXTScanStartReqParams->buckets[i].exponent;
-      pHalExtScanStartReqParams->bucketData[i].step_count =
-                      pwdiEXTScanStartReqParams->buckets[i].step_count;
       pHalExtScanStartReqParams->bucketData[i].numChannels =
                       pwdiEXTScanStartReqParams->buckets[i].numChannels;
 
@@ -34686,32 +32310,25 @@
 
 
   VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-          " basePeriod %u maxApPerScan %u reportThresholdPercent %u"
-          "reportThresholdNumScans %u requestId %u"
-          " sessionId %u numBuckets%u homeAwayTime %u",
+          " basePeriod %u maxApPerScan %u reportThreshold %u requestId %u"
+          " sessionId %u numBuckets%u ",
           pHalExtScanStartReqParams->basePeriod,
           pHalExtScanStartReqParams->maxApPerScan,
-          pHalExtScanStartReqParams->reportThresholdPercent,
-          pHalExtScanStartReqParams->reportThresholdNumScans,
+          pHalExtScanStartReqParams->reportThreshold,
           pHalExtScanStartReqParams->requestId,
           pHalExtScanStartReqParams->sessionId,
-          pHalExtScanStartReqParams->numBuckets,
-          pHalExtScanStartReqParams->homeAwayTime);
+          pHalExtScanStartReqParams->numBuckets);
 
   for( i = 0; i < pHalExtScanStartReqParams->numBuckets ; i++ )
   {
       VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO ,
               " %d) bucketId %u  channelBand %u period %u "
-              " reportEvents %u numChannels %u "
-              "max_period %u exponent %u step_count %u",i,
+              " reportEvents %u numChannels %u ",i,
       pHalExtScanStartReqParams->bucketData[i].bucketId,
       pHalExtScanStartReqParams->bucketData[i].channelBand,
       pHalExtScanStartReqParams->bucketData[i].period,
       pHalExtScanStartReqParams->bucketData[i].reportEvents,
-      pHalExtScanStartReqParams->bucketData[i].numChannels,
-      pHalExtScanStartReqParams->bucketData[i].max_period,
-      pHalExtScanStartReqParams->bucketData[i].exponent,
-      pHalExtScanStartReqParams->bucketData[i].step_count);
+      pHalExtScanStartReqParams->bucketData[i].numChannels);
 
       for( j = 0; j< pHalExtScanStartReqParams->bucketData[i].numChannels; j++)
       {
@@ -34844,11 +32461,8 @@
   pHalBssidHotlistSetReqParams->sessionId =
                     pwdiEXTScanSetBSSIDHotlistReqParams->sessionId;
 
-  pHalBssidHotlistSetReqParams->lostBssidSampleSize =
-                    pwdiEXTScanSetBSSIDHotlistReqParams->lostBssidSampleSize;
-
-  pHalBssidHotlistSetReqParams->numBssid =
-                    pwdiEXTScanSetBSSIDHotlistReqParams->numBssid;
+  pHalBssidHotlistSetReqParams->numAp =
+                    pwdiEXTScanSetBSSIDHotlistReqParams->numAp;
 
   for( i = 0; i < WLAN_HAL_EXT_SCAN_MAX_HOTLIST_APS; i++){
 
@@ -34862,23 +32476,26 @@
     pHalBssidHotlistSetReqParams->ap[i].highRssiThreshold =
         pwdiEXTScanSetBSSIDHotlistReqParams->ap[i].high;
 
+    pHalBssidHotlistSetReqParams->ap[i].channel =
+        pwdiEXTScanSetBSSIDHotlistReqParams->ap[i].channel;
+
   }
 
   VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-          "ReqID %u sessionId %u numBssid %u lostBssidSampleSize: %u",
+          "ReqID %u sessionId %u numAp %u ",
       pHalBssidHotlistSetReqParams->requestId,
       pHalBssidHotlistSetReqParams->sessionId,
-      pHalBssidHotlistSetReqParams->numBssid,
-      pHalBssidHotlistSetReqParams->lostBssidSampleSize);
+      pHalBssidHotlistSetReqParams->numAp);
 
-  for( i = 0; i < pHalBssidHotlistSetReqParams->numBssid; i++){
+  for( i = 0; i < pHalBssidHotlistSetReqParams->numAp; i++){
 
     VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-         "%s %d %d) BSSID: %pM lowRssiThreshold %d highRssiThreshold %d",
+         "%s %d %d) BSSID: %pM lowRssiThreshold %d highRssiThreshold %d Channel %u ",
             __func__, __LINE__, i,
             pHalBssidHotlistSetReqParams->ap[i].bssid,
             pHalBssidHotlistSetReqParams->ap[i].lowRssiThreshold,
-            pHalBssidHotlistSetReqParams->ap[i].highRssiThreshold);
+            pHalBssidHotlistSetReqParams->ap[i].highRssiThreshold,
+            pHalBssidHotlistSetReqParams->ap[i].channel);
 
   }
 
@@ -35009,27 +32626,26 @@
                        WDI_EXTSCAN_RESET_HOTLIST_BSSID_RSP);
 }
 
-
 /**
- @brief WDI_EXTScanSetSSIDHotlistReq
+ @brief WDI_EXTScanSetSignfRSSIChangeReq
 
- @param WDI_EXTScanSetSSIDHotlistReqParams: Req parameter for the FW
-        WDI_EXTScanSetSSIDHotlistRspCb: callback for passing back the response
+ @param WDI_EXTScanSetSignfRSSIChangeReqParams: Req parameter for the FW
+        WDI_EXTScanSetSignfRSSIChangeRspCb: callback for passing back the response
         of the Req operation received from the device
         pUserData: user data will be passed back with the callback
 
  @return SUCCESS or FAIL
 */
 WDI_Status
-WDI_EXTScanSetSSIDHotlistReq(
-      WDI_EXTScanSetSSIDHotlistReqParams* pwdiEXTScanSetSSIDHotlistReqParams,
-      WDI_EXTScanSetSSIDHotlistRspCb  wdiEXTScanSetSSIDHotlistRspCb,
-      void*                   pUserData)
+WDI_EXTScanSetSignfRSSIChangeReq(
+ WDI_EXTScanSetSignfRSSIChangeReqParams* pwdiEXTScanSetSignfRSSIChangeReqParams,
+ WDI_EXTScanSetSignfRSSIChangeRspCb  wdiEXTScanSetSignfRSSIChangeRspCb,
+        void*                   pUserData)
 {
-   WDI_EventInfoType      wdiEventData;
+  WDI_EventInfoType      wdiEventData;
 
   VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d Enter ",__func__, __LINE__);
+                  "%s: %d ",__func__, __LINE__);
   /*------------------------------------------------------------------------
     Sanity Check
   ------------------------------------------------------------------------*/
@@ -35041,18 +32657,19 @@
      return WDI_STATUS_E_NOT_ALLOWED;
   }
 
-  wdiEventData.wdiRequest      = WDI_EXTSCAN_SET_SSID_HOTLIST_REQ;
-  wdiEventData.pEventData      = pwdiEXTScanSetSSIDHotlistReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiEXTScanSetSSIDHotlistReqParams);
-  wdiEventData.pCBfnc          = wdiEXTScanSetSSIDHotlistRspCb;
+  wdiEventData.wdiRequest      = WDI_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ;
+  wdiEventData.pEventData      = pwdiEXTScanSetSignfRSSIChangeReqParams;
+  wdiEventData.uEventDataSize  =
+                        sizeof(*pwdiEXTScanSetSignfRSSIChangeReqParams);
+  wdiEventData.pCBfnc          = wdiEXTScanSetSignfRSSIChangeRspCb;
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
 
 /**
- @brief WDI_ProcessEXTScanSetSSIDHotlistReq -
-    Extended Scan Set SSSID Hotlist Request to FW
+ @brief WDI_ProcessEXTScanSetSignifRSSIChangeReq -
+    Extended Scan set Significant RSSI change Request to FW
 
  @param  pWDICtx : wdi context
          pEventData : indication data
@@ -35061,18 +32678,19 @@
  @return none
 */
 WDI_Status
-WDI_ProcessEXTScanSetSSIDHotlistReq
+WDI_ProcessEXTScanSetSignifRSSIChangeReq
 (
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
-  WDI_EXTScanSetSSIDHotlistReqParams* pwdiEXTScanSetSSIDHotlistReqParams;
-  WDI_EXTScanSetSSIDHotlistRspCb  wdiEXTScanSetSSIDHotlistRspCb;
+  WDI_EXTScanSetSignfRSSIChangeReqParams*
+                                pwdiEXTScanSetSignfRSSIChangeReqParams;
+  WDI_EXTScanSetSignfRSSIChangeRspCb  wdiEXTScanSetSignfRSSIChangeRspCb;
   wpt_uint8*               pSendBuffer         = NULL;
   wpt_uint16               usSendSize          = 0;
   wpt_uint16               usDataOffset        = 0;
-  tpHalSsidHotlistSetReq   pHalSsidHotlistSetReqParams;
+  tpHalSigRssiSetReq       pHalSigRssiSetReqParams;
   int i;
 
   VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
@@ -35087,10 +32705,10 @@
      return WDI_STATUS_E_FAILURE;
   }
 
-  pwdiEXTScanSetSSIDHotlistReqParams =
-      (WDI_EXTScanSetSSIDHotlistReqParams *)pEventData->pEventData;
-  wdiEXTScanSetSSIDHotlistRspCb   =
-      (WDI_EXTScanSetSSIDHotlistRspCb)pEventData->pCBfnc;
+  pwdiEXTScanSetSignfRSSIChangeReqParams =
+      (WDI_EXTScanSetSignfRSSIChangeReqParams *)pEventData->pEventData;
+  wdiEXTScanSetSignfRSSIChangeRspCb   =
+      (WDI_EXTScanSetSignfRSSIChangeRspCb)pEventData->pCBfnc;
 
   /*-----------------------------------------------------------------------
     Get message buffer
@@ -35098,67 +32716,75 @@
   -----------------------------------------------------------------------*/
   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(
                                         pWDICtx,
-                                        WDI_EXTSCAN_SET_SSID_HOTLIST_REQ,
-                                        sizeof(tHalSsidHotlistSetReq),
+                                        WDI_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ,
+                                        sizeof(tHalSigRssiSetReq),
                                         &pSendBuffer, &usDataOffset,
                                         &usSendSize))||
-      ( usSendSize < (usDataOffset + sizeof(tHalSsidHotlistSetReq) )))
+      ( usSendSize < (usDataOffset + sizeof(tHalSigRssiSetReq) )))
   {
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in %s %p %p %p", __func__,
-                pEventData, pwdiEXTScanSetSSIDHotlistReqParams,
-                wdiEXTScanSetSSIDHotlistRspCb);
+                pEventData, pwdiEXTScanSetSignfRSSIChangeReqParams,
+                wdiEXTScanSetSignfRSSIChangeRspCb);
      WDI_ASSERT(0);
      return WDI_STATUS_E_FAILURE;
   }
-  pHalSsidHotlistSetReqParams =
-      (tpHalSsidHotlistSetReq) (pSendBuffer + usDataOffset);
 
-  pHalSsidHotlistSetReqParams->requestId =
-                    pwdiEXTScanSetSSIDHotlistReqParams->requestId;
+  pHalSigRssiSetReqParams =
+      (tpHalSigRssiSetReq) (pSendBuffer + usDataOffset);
 
-  pHalSsidHotlistSetReqParams->sessionId =
-                    pwdiEXTScanSetSSIDHotlistReqParams->sessionId;
+  pHalSigRssiSetReqParams->requestId =
+                    pwdiEXTScanSetSignfRSSIChangeReqParams->requestId;
+  pHalSigRssiSetReqParams->sessionId =
+                    pwdiEXTScanSetSignfRSSIChangeReqParams->sessionId;
+  pHalSigRssiSetReqParams->rssiSampleSize =
+                    pwdiEXTScanSetSignfRSSIChangeReqParams->rssiSampleSize;
+  pHalSigRssiSetReqParams->lostApSampleSize =
+                    pwdiEXTScanSetSignfRSSIChangeReqParams->lostApSampleSize;
+  pHalSigRssiSetReqParams->minBreaching =
+                    pwdiEXTScanSetSignfRSSIChangeReqParams->minBreaching;
+  pHalSigRssiSetReqParams->numAp =
+                    pwdiEXTScanSetSignfRSSIChangeReqParams->numAp;
 
-  pHalSsidHotlistSetReqParams->lostSsidSampleSize =
-                    pwdiEXTScanSetSSIDHotlistReqParams->lostSsidSampleSize;;
 
-  pHalSsidHotlistSetReqParams->numSsid =
-                    pwdiEXTScanSetSSIDHotlistReqParams->numSsid;
+  for( i = 0; i < WLAN_HAL_EXT_SCAN_MAX_SIG_CHANGE_APS; i++){
 
-  for( i = 0; i < pHalSsidHotlistSetReqParams->numSsid; i++){
+    wpalMemoryCopy(pHalSigRssiSetReqParams->ap[i].bssid,
+              pwdiEXTScanSetSignfRSSIChangeReqParams->ap[i].bssid,
+                            WDI_MAC_ADDR_LEN);
 
-    wpalMemoryZero(pHalSsidHotlistSetReqParams->ssid[i].ssid, 33);
-    wpalMemoryCopy(pHalSsidHotlistSetReqParams->ssid[i].ssid,
-              pwdiEXTScanSetSSIDHotlistReqParams->ssid[i].ssid.sSSID,
-              pwdiEXTScanSetSSIDHotlistReqParams->ssid[i].ssid.ucLength);
+    pHalSigRssiSetReqParams->ap[i].lowRssiThreshold =
+        pwdiEXTScanSetSignfRSSIChangeReqParams->ap[i].low;
 
-    pHalSsidHotlistSetReqParams->ssid[i].lowRssiThreshold =
-       pwdiEXTScanSetSSIDHotlistReqParams->ssid[i].lowRssiThreshold;
+    pHalSigRssiSetReqParams->ap[i].highRssiThreshold =
+        pwdiEXTScanSetSignfRSSIChangeReqParams->ap[i].high;
 
-    pHalSsidHotlistSetReqParams->ssid[i].highRssiThreshold =
-        pwdiEXTScanSetSSIDHotlistReqParams->ssid[i].highRssiThreshold;
+    pHalSigRssiSetReqParams->ap[i].channel =
+        pwdiEXTScanSetSignfRSSIChangeReqParams->ap[i].channel;
 
-    pHalSsidHotlistSetReqParams->ssid[i].band =
-        pwdiEXTScanSetSSIDHotlistReqParams->ssid[i].band;
   }
 
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-          "ReqID %u sessionId %u numSsid %u lost_ssid_sample_size: %u",
-      pHalSsidHotlistSetReqParams->requestId,
-      pHalSsidHotlistSetReqParams->sessionId,
-      pHalSsidHotlistSetReqParams->numSsid,
-      pHalSsidHotlistSetReqParams->lostSsidSampleSize);
 
-  for( i = 0; i < pHalSsidHotlistSetReqParams->numSsid; i++){
+  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
+          "ReqID %u sessionId %u rssiSampleSize %u lostApSampleSize %u "
+          " minBreaching %u numAp %u ",
+          pHalSigRssiSetReqParams->requestId,
+          pHalSigRssiSetReqParams->sessionId,
+          pHalSigRssiSetReqParams->rssiSampleSize,
+          pHalSigRssiSetReqParams->lostApSampleSize,
+          pHalSigRssiSetReqParams->minBreaching,
+          pHalSigRssiSetReqParams->numAp);
+
+  for( i = 0; i < pHalSigRssiSetReqParams->numAp; i++){
 
     VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-         "%s %d %d) SSID = %s lowRssiThreshold %d highRssiThreshold %d band: %d",
-            __func__, __LINE__, i,
-            pHalSsidHotlistSetReqParams->ssid[i].ssid,
-            pHalSsidHotlistSetReqParams->ssid[i].lowRssiThreshold,
-            pHalSsidHotlistSetReqParams->ssid[i].highRssiThreshold,
-            pHalSsidHotlistSetReqParams->ssid[i].band);
+         "%d) BSSID: %pM lowRssiThreshold %d highRssiThreshold %d Channel %u ",
+            i,
+            pHalSigRssiSetReqParams->ap[i].bssid,
+            pHalSigRssiSetReqParams->ap[i].lowRssiThreshold,
+            pHalSigRssiSetReqParams->ap[i].highRssiThreshold,
+            pHalSigRssiSetReqParams->ap[i].channel);
+
   }
 
   pWDICtx->pReqStatusUserData = pEventData->pUserData;
@@ -35168,30 +32794,32 @@
     Send EXTScan Stop Request to HAL
   -------------------------------------------------------------------------*/
   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiEXTScanSetSSIDHotlistRspCb, pEventData->pUserData,
-                       WDI_EXTSCAN_SET_HOTLIST_SSID_RSP);
+                       wdiEXTScanSetSignfRSSIChangeRspCb, pEventData->pUserData,
+                       WDI_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP);
 }
 
 /**
- @brief WDI_EXTScanResetSSIDHotlistReq
+ @brief WDI_EXTScanResetSignfRSSIChangeReq
 
- @param WDI_EXTScanResetSSIDHotlistReqParams: Req parameter for the FW
-        WDI_EXTScanResetSSIDHotlistRspCb: callback for passing back the response
+ @param WDI_EXTScanResetSignfRSSIChangeReqParams: Req parameter for the FW
+        WDI_EXTScanResetSignfRSSIChangeRspCb: callback for passing back the response
         of the Req operation received from the device
         pUserData: user data will be passed back with the callback
 
  @return SUCCESS or FAIL
 */
 WDI_Status
-WDI_EXTScanResetSSIDHotlistReq(
-   WDI_EXTScanResetSSIDHotlistReqParams* pwdiEXTScanResetSSIDHotlistReqParams,
-   WDI_EXTScanResetSSIDHotlistRspCb  wdiEXTScanResetSSIDHotlistRspCb,
-   void*                   pUserData)
+WDI_EXTScanResetSignfRSSIChangeReq(
+        WDI_EXTScanResetSignfRSSIChangeReqParams*
+                                    pwdiEXTScanResetSignfRSSIChangeReqParams,
+        WDI_EXTScanResetSignfRSSIChangeRspCb
+                                         wdiEXTScanResetSignfRSSIChangeRspCb,
+        void*                   pUserData)
 {
    WDI_EventInfoType      wdiEventData;
 
   VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d",__func__, __LINE__);
+                  "%s: %d ",__func__, __LINE__);
   /*------------------------------------------------------------------------
     Sanity Check
   ------------------------------------------------------------------------*/
@@ -35203,18 +32831,19 @@
      return WDI_STATUS_E_NOT_ALLOWED;
   }
 
-  wdiEventData.wdiRequest      = WDI_EXTSCAN_RESET_SSID_HOTLIST_REQ;
-  wdiEventData.pEventData      = pwdiEXTScanResetSSIDHotlistReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiEXTScanResetSSIDHotlistReqParams);
-  wdiEventData.pCBfnc          = wdiEXTScanResetSSIDHotlistRspCb;
+  wdiEventData.wdiRequest      = WDI_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ;
+  wdiEventData.pEventData      = pwdiEXTScanResetSignfRSSIChangeReqParams;
+  wdiEventData.uEventDataSize  =
+                        sizeof(*pwdiEXTScanResetSignfRSSIChangeReqParams);
+  wdiEventData.pCBfnc          = wdiEXTScanResetSignfRSSIChangeRspCb;
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
 
 /**
- @brief WDI_ProcessEXTScanResetSSIDHotlistReq -
-    Extended Scan reset SSID hotlist Request to FW
+ @brief WDI_ProcessEXTScanResetSignfRSSIChangeReq -
+    Extended Scana reset Significant RSSI change Request to FW
 
  @param  pWDICtx : wdi context
          pEventData : indication data
@@ -35223,21 +32852,22 @@
  @return none
 */
 WDI_Status
-WDI_ProcessEXTScanResetSSIDHotlistReq
+WDI_ProcessEXTScanResetSignfRSSIChangeReq
 (
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
-  WDI_EXTScanResetSSIDHotlistReqParams* pwdiEXTScanResetSSIDHotlistReqParams;
-  WDI_EXTScanResetSSIDHotlistRspCb  wdiEXTScanResetSSIDHotlistRspCb;
+  WDI_EXTScanResetSignfRSSIChangeReqParams*
+                            pwdiEXTScanResetSignfRSSIChangeReqParams;
+  WDI_EXTScanResetSignfRSSIChangeRspCb  wdiEXTScanResetSignfRSSIChangeRspCb;
   wpt_uint8*               pSendBuffer         = NULL;
   wpt_uint16               usSendSize          = 0;
   wpt_uint16               usDataOffset        = 0;
-  tpHalSsidHotlistResetReq     pHalSsidHotlistResetReqParams;
+  tpHalSigRssiResetReq     pHalSigRssiResetReqParams;
 
   VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d",__func__, __LINE__);
+                  "%s: %d ",__func__, __LINE__);
 
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
@@ -35248,154 +32878,43 @@
      return WDI_STATUS_E_FAILURE;
   }
 
-  pwdiEXTScanResetSSIDHotlistReqParams =
-      (WDI_EXTScanResetSSIDHotlistReqParams *)pEventData->pEventData;
-  wdiEXTScanResetSSIDHotlistRspCb   =
-      (WDI_EXTScanResetSSIDHotlistRspCb)pEventData->pCBfnc;
+  pwdiEXTScanResetSignfRSSIChangeReqParams =
+      (WDI_EXTScanResetSignfRSSIChangeReqParams *)pEventData->pEventData;
+  wdiEXTScanResetSignfRSSIChangeRspCb   =
+      (WDI_EXTScanResetSignfRSSIChangeRspCb)pEventData->pCBfnc;
 
   /*-----------------------------------------------------------------------
     Get message buffer
     ! TO DO : proper conversion into the HAL Message Request Format
   -----------------------------------------------------------------------*/
   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(
-                                        pWDICtx,
-                                        WDI_EXTSCAN_RESET_SSID_HOTLIST_REQ,
-                                        sizeof(tHalSsidHotlistResetReq),
-                                        &pSendBuffer, &usDataOffset,
-                                        &usSendSize))||
-     ( usSendSize < (usDataOffset + sizeof(tHalSsidHotlistResetReq) )))
+                                       pWDICtx,
+                                       WDI_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ,
+                                       sizeof(tHalSigRssiResetReq),
+                                       &pSendBuffer, &usDataOffset,
+                                       &usSendSize))||
+      ( usSendSize < (usDataOffset + sizeof(tHalSigRssiResetReq) )))
   {
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in %s %p %p %p", __func__,
-                pEventData, pwdiEXTScanResetSSIDHotlistReqParams,
-                wdiEXTScanResetSSIDHotlistRspCb);
+                pEventData, pwdiEXTScanResetSignfRSSIChangeReqParams,
+                wdiEXTScanResetSignfRSSIChangeRspCb);
      WDI_ASSERT(0);
      return WDI_STATUS_E_FAILURE;
   }
-  pHalSsidHotlistResetReqParams =
-      (tpHalSsidHotlistResetReq) (pSendBuffer+usDataOffset);
+  pHalSigRssiResetReqParams =
+      (tpHalSigRssiResetReq) (pSendBuffer+usDataOffset);
 
-  pHalSsidHotlistResetReqParams->requestId =
-                    pwdiEXTScanResetSSIDHotlistReqParams->requestId;
+  pHalSigRssiResetReqParams->requestId =
+                    pwdiEXTScanResetSignfRSSIChangeReqParams->requestId;
 
   pWDICtx->pReqStatusUserData = pEventData->pUserData;
 
-  /*-------------------------------------------------------------------------
-    Send RESET_HOTLIST_SSID Request to HAL
-  -------------------------------------------------------------------------*/
+
   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiEXTScanResetSSIDHotlistRspCb, pEventData->pUserData,
-                       WDI_EXTSCAN_RESET_HOTLIST_SSID_RSP);
-}
-
-
-/**
- @brief WDI_HighPriorityDataInfoInd
-
- @param pHighPriorityDataInfoIndParams: Req parameter for the FW
-
- @return SUCCESS or FAIL
-*/
-WDI_Status
-WDI_HighPriorityDataInfoInd
-(
-   WDI_HighPriorityDataInfoIndParams* pHighPriorityDataInfoIndParams
-)
-{
-   WDI_EventInfoType      wdiEventData;
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d",__func__, __LINE__);
-  /*------------------------------------------------------------------------
-    Sanity Check
-  ------------------------------------------------------------------------*/
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-     VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ERROR,
-                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-  }
-
-  wdiEventData.wdiRequest      = WDI_HIGH_PRIORITY_DATA_INFO_IND;
-  wdiEventData.pEventData      = pHighPriorityDataInfoIndParams;
-  wdiEventData.uEventDataSize  = sizeof(*pHighPriorityDataInfoIndParams);
-  wdiEventData.pCBfnc          = NULL;
-  wdiEventData.pUserData       = NULL;
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-/**
- @brief WDI_ProcessHighPriorityDataInfoInd -
-    Send WFD indication to FW
-
- @param  pWDICtx : wdi context
-         pEventData : indication data
-
- @see
- @return none
-*/
-WDI_Status
-WDI_ProcessHighPriorityDataInfoInd
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_HighPriorityDataInfoIndParams* pHighPriorityDataInfoIndParams;
-  wpt_uint8*               pSendBuffer         = NULL;
-  wpt_uint16               usSendSize          = 0;
-  wpt_uint16               usDataOffset        = 0;
-  tpHalHighPriorityDataInfoInd     pHalHighPriorityDataInfoIndParams;
-  WDI_Status wdiStatus = WDI_STATUS_SUCCESS;
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d",__func__, __LINE__);
-
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-           ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  pHighPriorityDataInfoIndParams =
-      (WDI_HighPriorityDataInfoIndParams *)pEventData->pEventData;
-
-  /*-----------------------------------------------------------------------
-    Get message buffer
-  -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(
-                                        pWDICtx,
-                                        WDI_HIGH_PRIORITY_DATA_INFO_IND,
-                                        sizeof(tHalHighPriorityDataInfoInd),
-                                        &pSendBuffer, &usDataOffset,
-                                        &usSendSize))||
-     ( usSendSize < (usDataOffset + sizeof(tHalHighPriorityDataInfoInd) )))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
-              "Unable to get send buffer in %s %p %p", __func__,
-                pEventData, pHighPriorityDataInfoIndParams);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-  pHalHighPriorityDataInfoIndParams =
-      (tpHalHighPriorityDataInfoInd) (pSendBuffer+usDataOffset);
-
-  pHalHighPriorityDataInfoIndParams->pause =
-                    pHighPriorityDataInfoIndParams->pause;
-
-  pWDICtx->pReqStatusUserData = NULL;
-  pWDICtx->pfncRspCB = NULL;
-
-  /*-------------------------------------------------------------------------
-    Send HIGH_PRIORITY_DATA_INFO Request to HAL
-  -------------------------------------------------------------------------*/
-  wdiStatus =  WDI_SendIndication( pWDICtx, pSendBuffer, usSendSize);
-  return (wdiStatus != WDI_STATUS_SUCCESS) ? wdiStatus:WDI_STATUS_SUCCESS_SYNC;
+                       wdiEXTScanResetSignfRSSIChangeRspCb,
+                       pEventData->pUserData,
+                       WDI_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP);
 }
 
 /**
@@ -35699,59 +33218,7 @@
 }
 
 /**
- @brief Process Extended Scan Set hotlist SSID Rsp function (called when a
-        response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessEXTScanSetHotlistSSIDRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_EXTScanSetSSIDHotlistRspCb   wdiEXTScanSetSSIDHotlistRspCb;
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d ",__func__, __LINE__);
-
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  wdiEXTScanSetSSIDHotlistRspCb =
-                (WDI_EXTScanSetSSIDHotlistRspCb)pWDICtx->pfncRspCB;
-  if ( NULL == wdiEXTScanSetSSIDHotlistRspCb)
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Callback function Invalid", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  wdiEXTScanSetSSIDHotlistRspCb(
-          (void *) pEventData->pEventData, pWDICtx->pRspCBUserData);
-
-  return WDI_STATUS_SUCCESS;
-}
-
-
-/**
- @brief Process Extended Scan Reset Hotlist BSSID Rsp function (called
+ @brief Process Extended Scan Set Significant RSSI Change Rsp function (called
         when a response is being received over the bus from HAL)
 
  @param  pWDICtx:         pointer to the WLAN DAL context
@@ -35761,16 +33228,16 @@
  @return Result of the function call
 */
 WDI_Status
-WDI_ProcessEXTScanResetHotlistSSIDRsp
+WDI_ProcessEXTScanSetSignfRSSIChangeRsp
 (
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
-  WDI_EXTScanResetSSIDHotlistRspCb   wdiEXTScanResetSSIDHotlistRspCb;
+  WDI_EXTScanSetSignfRSSIChangeRspCb   wdiEXTScanSetSignfRSSIChangeRspCb;
 
   VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d ",__func__, __LINE__);
+                  "%s: %d",__func__, __LINE__);
 
 
   /*-------------------------------------------------------------------------
@@ -35785,9 +33252,9 @@
      return WDI_STATUS_E_FAILURE;
   }
 
-  wdiEXTScanResetSSIDHotlistRspCb =
-                (WDI_EXTScanResetSSIDHotlistRspCb)pWDICtx->pfncRspCB;
-  if ( NULL == wdiEXTScanResetSSIDHotlistRspCb)
+  wdiEXTScanSetSignfRSSIChangeRspCb =
+      (WDI_EXTScanSetSignfRSSIChangeRspCb)pWDICtx->pfncRspCB;
+  if ( NULL == wdiEXTScanSetSignfRSSIChangeRspCb)
   {
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Callback function Invalid", __func__);
@@ -35795,7 +33262,58 @@
      return WDI_STATUS_E_FAILURE;
   }
 
-  wdiEXTScanResetSSIDHotlistRspCb(
+  wdiEXTScanSetSignfRSSIChangeRspCb(
+          (void *) pEventData->pEventData, pWDICtx->pRspCBUserData);
+
+  return WDI_STATUS_SUCCESS;
+}
+
+/**
+ @brief Process Extended Scan Reset Significant RSSI Change Rsp function
+        (called when a response is being received over the bus from HAL)
+
+ @param  pWDICtx:         pointer to the WLAN DAL context
+         pEventData:      pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessEXTScanResetSignfRSSIChangeRsp
+(
+  WDI_ControlBlockType*  pWDICtx,
+  WDI_EventInfoType*     pEventData
+)
+{
+  WDI_EXTScanResetSignfRSSIChangeRspCb   wdiEXTScanResetSignfRSSIChangeRspCb;
+
+  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
+                  "%s: %d Enter",__func__, __LINE__);
+
+
+  /*-------------------------------------------------------------------------
+    Sanity check
+  -------------------------------------------------------------------------*/
+  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+      ( NULL == pEventData->pEventData))
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Invalid parameters", __func__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  wdiEXTScanResetSignfRSSIChangeRspCb =
+      (WDI_EXTScanResetSignfRSSIChangeRspCb)pWDICtx->pfncRspCB;
+  if ( NULL == wdiEXTScanResetSignfRSSIChangeRspCb)
+  {
+     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+                 "%s: Callback function Invalid", __func__);
+     WDI_ASSERT(0);
+     return WDI_STATUS_E_FAILURE;
+  }
+
+  wdiEXTScanResetSignfRSSIChangeRspCb(
           (void *) pEventData->pEventData, pWDICtx->pRspCBUserData);
 
   return WDI_STATUS_SUCCESS;
@@ -35970,2203 +33488,3 @@
 
   return WDI_STATUS_SUCCESS;
 }
-
-/**
- @brief Process Get Frame Log Rsp function
-        (called when a response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessGetFrameLogRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  tGetFrameLogResp            halRsp;
-  WDI_GetFrameLogRspCb        wdiGetFrameLogRspCb;
-  WDI_GetFrameLogRspParamType wdiGetFrameLogRsp;
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d Enter",__func__, __LINE__);
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  wdiGetFrameLogRspCb = (WDI_GetFrameLogRspCb)pWDICtx->pfncRspCB;
-
-  /*-------------------------------------------------------------------------
-    Extract response and send it to UMAC
-  -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halRsp,
-                  pEventData->pEventData, sizeof(halRsp));
-
-  wdiGetFrameLogRsp.wdiStatus = WDI_HAL_2_WDI_STATUS(halRsp.status);
-
-  /*Notify UMAC*/
-  wdiGetFrameLogRspCb( &wdiGetFrameLogRsp, pWDICtx->pRspCBUserData );
-
-  return WDI_STATUS_SUCCESS;
-}
-
-/**
- @brief Process RssiMonitorStartReq Request
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessRssiMonitorStartReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-    WDI_RssiMonitorReqInfoType*    wdiRssiMonitorStartReq;
-    wpt_uint8*                     pSendBuffer  = NULL;
-    wpt_uint16                     usDataOffset = 0;
-    wpt_uint16                     usSendSize   = 0;
-    WDI_Status                     wdiStatus;
-    tHalStartRssimonitoringReq     halStartRssiMonitorReq;
-    WDI_RssiMonitorStartRspCb      wdiRssiMonitorStartReqCb;
-
-
-    VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                                          "%s: %d Enter",__func__, __LINE__);
-
-    /*-------------------------------------------------------------------------
-      Sanity check
-      ------------------------------------------------------------------------*/
-    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-            ( NULL == pEventData->pEventData))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                "%s: Invalid parameters", __func__);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-
-    wdiRssiMonitorStartReq = (WDI_RssiMonitorReqInfoType *)pEventData->pEventData;
-
-    /*-----------------------------------------------------------------------
-      Get message buffer
-      -----------------------------------------------------------------------*/
-    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                    WDI_START_RSSI_MONITOR_REQ,
-                    sizeof(halStartRssiMonitorReq.startRssiMonitoringReqParams),
-                    &pSendBuffer, &usDataOffset, &usSendSize))||
-                    (usSendSize < (usDataOffset +
-                    sizeof(halStartRssiMonitorReq.startRssiMonitoringReqParams))))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-                "Unable to get send buffer in GetFrameLog Req");
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-
-    halStartRssiMonitorReq.startRssiMonitoringReqParams.request_id =
-            wdiRssiMonitorStartReq->requestId;
-
-    halStartRssiMonitorReq.startRssiMonitoringReqParams.min_rssi =
-            wdiRssiMonitorStartReq->minRssi;
-
-    halStartRssiMonitorReq.startRssiMonitoringReqParams.max_rssi =
-            wdiRssiMonitorStartReq->maxRssi;
-    wpalMemoryCopy(halStartRssiMonitorReq.startRssiMonitoringReqParams.bssId,
-            &(wdiRssiMonitorStartReq->currentBssId),
-            sizeof(halStartRssiMonitorReq.startRssiMonitoringReqParams.bssId));
-
-    wdiRssiMonitorStartReqCb = (WDI_RssiMonitorStartRspCb)pEventData->pCBfnc;
-
-    wpalMemoryCopy(pSendBuffer+usDataOffset,
-                   &halStartRssiMonitorReq.startRssiMonitoringReqParams,
-                   sizeof(halStartRssiMonitorReq.startRssiMonitoringReqParams));
-
-    /*-------------------------------------------------------------------------
-      Send Suspend Request to HAL
-      ------------------------------------------------------------------------*/
-    wdiStatus = WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-        wdiRssiMonitorStartReqCb, pEventData->pUserData, WDI_START_RSSI_MONITOR_RSP);
-
-    return  wdiStatus;
-}
-
-
-/**
- @brief Process FWLoggingInit Request
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessRssiMonitorStopReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-    WDI_RssiMonitorReqInfoType*    wdiRssiMonitorStopReq;
-    wpt_uint8*                     pSendBuffer  = NULL;
-    wpt_uint16                     usDataOffset = 0;
-    wpt_uint16                     usSendSize   = 0;
-    WDI_Status                     wdiStatus;
-    tHalStopRssimonitoringReq      halStopRssiMonitorReq;
-    WDI_RssiMonitorStopRspCb       wdiRssiMonitorStopReqCb;
-
-
-    VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                                          "%s: %d Enter",__func__, __LINE__);
-
-    /*-------------------------------------------------------------------------
-      Sanity check
-      ------------------------------------------------------------------------*/
-    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-            ( NULL == pEventData->pEventData))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                "%s: Invalid parameters", __func__);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-    wdiRssiMonitorStopReq = (WDI_RssiMonitorReqInfoType *)pEventData->pEventData;
-
-    /*-----------------------------------------------------------------------
-      Get message buffer
-      -----------------------------------------------------------------------*/
-    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                    WDI_STOP_RSSI_MONITOR_REQ,
-                    sizeof(halStopRssiMonitorReq.stopRssiMonitoringParams),
-                    &pSendBuffer, &usDataOffset, &usSendSize))||
-            (usSendSize < (usDataOffset +
-            sizeof(halStopRssiMonitorReq.stopRssiMonitoringParams))))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-                "Unable to get send buffer in GetFrameLog Req");
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-
-    halStopRssiMonitorReq.stopRssiMonitoringParams.request_id =
-            wdiRssiMonitorStopReq->requestId;
-
-    wpalMemoryCopy(halStopRssiMonitorReq.stopRssiMonitoringParams.bssId,
-            &(wdiRssiMonitorStopReq->currentBssId),
-            sizeof(halStopRssiMonitorReq.stopRssiMonitoringParams.bssId));
-
-    wdiRssiMonitorStopReqCb = (WDI_RssiMonitorStopRspCb)pEventData->pCBfnc;
-
-    wpalMemoryCopy(pSendBuffer+usDataOffset,
-                   &halStopRssiMonitorReq.stopRssiMonitoringParams,
-                   sizeof(halStopRssiMonitorReq.stopRssiMonitoringParams));
-
-    /*-------------------------------------------------------------------------
-      Send Suspend Request to HAL
-      ------------------------------------------------------------------------*/
-    wdiStatus = WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-    wdiRssiMonitorStopReqCb, pEventData->pUserData, WDI_STOP_RSSI_MONITOR_RSP);
-
-    return  wdiStatus;
-}
-
-/**
- @brief Process MgmtFrame Logging Init Rsp function
-        (called when a response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessRssiMonitorStopRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  tHalStopRssimonitoringRspParams    halRsp;
-  WDI_RssiMonitorStopRspCb          wdiRssiMonitorStopRspCb;
-  WDI_RssiMonitorStopRspParamType   wdiRssiMonitorStopRsp;
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d Enter",__func__, __LINE__);
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-  wdiRssiMonitorStopRspCb = (WDI_RssiMonitorStopRspCb)pWDICtx->pfncRspCB;
-
-  /*-------------------------------------------------------------------------
-    Extract response and send it to UMAC
-  -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halRsp, pEventData->pEventData, sizeof(halRsp));
-
-  wdiRssiMonitorStopRsp.status = WDI_HAL_2_WDI_STATUS(halRsp.status);
-
-  /*Notify UMAC*/
-  wdiRssiMonitorStopRspCb( &wdiRssiMonitorStopRsp, pWDICtx->pRspCBUserData);
-
-  return WDI_STATUS_SUCCESS;
-}
-
-
-/**
- @brief Process MgmtFrame Logging Init Rsp function
-        (called when a response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessRssiMonitorStartRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  tHalStartRssimonitoringRspParams              halRsp;
-  WDI_RssiMonitorStartRspCb          wdiRssiMonitorStartRspCb;
-  WDI_RssiMonitorStartRspParamType   wdiRssiMonitorStartRsp;
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d Enter",__func__, __LINE__);
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-  wdiRssiMonitorStartRspCb = (WDI_RssiMonitorStopRspCb)pWDICtx->pfncRspCB;
-
-  /*-------------------------------------------------------------------------
-    Extract response and send it to UMAC
-  -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halRsp, pEventData->pEventData, sizeof(halRsp));
-
-  wdiRssiMonitorStartRsp.status = WDI_HAL_2_WDI_STATUS(halRsp.status);
-
-  /*Notify UMAC*/
-  wdiRssiMonitorStartRspCb( &wdiRssiMonitorStartRsp, pWDICtx->pRspCBUserData);
-
-  return WDI_STATUS_SUCCESS;
-}
-
-/**
- @brief Process FWLoggingInit Request
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessGetFrameLogReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-    WDI_GetFrameLogReqInfoType*    wdiGetFrameLogReq;
-    wpt_uint8*                     pSendBuffer  = NULL;
-    wpt_uint16                     usDataOffset = 0;
-    wpt_uint16                     usSendSize   = 0;
-    WDI_Status                     wdiStatus;
-    tGetFrameLogReqMsg             halGetFrameLogReq;
-    WDI_FWLoggingInitRspCb         wdiGetFrameLogRspCb;
-
-
-    VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                                          "%s: %d Enter",__func__, __LINE__);
-
-    /*-------------------------------------------------------------------------
-      Sanity check
-      ------------------------------------------------------------------------*/
-    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-            ( NULL == pEventData->pEventData))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                "%s: Invalid parameters", __func__);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-
-    wdiGetFrameLogReq = (WDI_GetFrameLogReqInfoType *)pEventData->pEventData;
-
-    /*-----------------------------------------------------------------------
-      Get message buffer
-      -----------------------------------------------------------------------*/
-    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                    WDI_GET_FRAME_LOG_REQ,
-                    sizeof(halGetFrameLogReq.tGetFrameLogReqParams),
-                    &pSendBuffer, &usDataOffset, &usSendSize))||
-            (usSendSize < (usDataOffset +
-            sizeof(halGetFrameLogReq.tGetFrameLogReqParams))))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-                "Unable to get send buffer in GetFrameLog Req");
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-
-    halGetFrameLogReq.tGetFrameLogReqParams.flags =
-                       wdiGetFrameLogReq->flags;
-
-    wdiGetFrameLogRspCb = (WDI_FWLoggingInitRspCb)pEventData->pCBfnc;
-
-    wpalMemoryCopy( pSendBuffer+usDataOffset,
-                                    &halGetFrameLogReq.tGetFrameLogReqParams,
-                              sizeof(halGetFrameLogReq.tGetFrameLogReqParams));
-
-    /*-------------------------------------------------------------------------
-      Send Suspend Request to HAL
-      ------------------------------------------------------------------------*/
-    wdiStatus = WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-    wdiGetFrameLogRspCb, pEventData->pUserData, WDI_GET_FRAME_LOG_RSP);
-
-    return  wdiStatus;
-}
-/**
- @brief Process MgmtFrame Logging Init Rsp function
-        (called when a response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessFWFrameLoggingInitRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  tFWLoggingInitResp              halRsp;
-  WDI_FWLoggingInitRspCb          wdiFWFrameLoggingInitRspCb;
-  WDI_FWLoggingInitRspParamType   wdiFWLogginginitRsp;
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d Enter",__func__, __LINE__);
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-  wdiFWFrameLoggingInitRspCb = (WDI_FWLoggingInitRspCb)pWDICtx->pfncRspCB;
-
-  /*-------------------------------------------------------------------------
-    Extract response and send it to UMAC
-  -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halRsp, pEventData->pEventData, sizeof(halRsp));
-
-  wdiFWLogginginitRsp.status = WDI_HAL_2_WDI_STATUS(halRsp.status);
-  wdiFWLogginginitRsp.fw_mem_dump_max_size = halRsp.fw_dump_max_size;
-
-  /*Notify UMAC*/
-  wdiFWFrameLoggingInitRspCb( &wdiFWLogginginitRsp, pWDICtx->pRspCBUserData);
-
-  return WDI_STATUS_SUCCESS;
-}
-
-/**
- @brief Process Fwr Mem Dump Rsp function
-        (called when a response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-    WDI_ProcessFwrMemDumpRsp
-
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  tHalFwMemoryDumpRespMsg      halRsp;
-  WDI_FwrMemDumpRspCb          wdiFwrMemDumpRspCb;
-  WDI_FwrMemDumpRsp            wdiFwrMemDumpRsp;
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d Enter",__func__, __LINE__);
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-  wdiFwrMemDumpRspCb = (WDI_FwrMemDumpRspCb)pWDICtx->pfncRspCB;
-
-  /*-------------------------------------------------------------------------
-    Extract response and send it to UMAC
-  -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halRsp.tFwMemoryDumpResp, pEventData->pEventData, sizeof(halRsp.tFwMemoryDumpResp));
-
-  wdiFwrMemDumpRsp.dump_status = WDI_HAL_2_WDI_STATUS(halRsp.tFwMemoryDumpResp.status);
-
-  /*Notify UMAC*/
-  wdiFwrMemDumpRspCb( &wdiFwrMemDumpRsp, pWDICtx->pRspCBUserData);
-
-  return WDI_STATUS_SUCCESS;
-}
-
-WDI_Status
-WDI_ProcessFWLoggingDXEdoneInd
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  wpt_uint8*  pSendBuffer = NULL;
-  wpt_uint16  usDataOffset = 0;
-  wpt_uint16  usSendSize = 0;
-  tFWLoggingDxeDoneInd  *FWLoggingDxeDoneIndParams;
-  WDI_DS_LoggingSessionType *pLoggingSession;
-  WDI_Status wdiStatus = WDI_STATUS_SUCCESS;
-  wpt_uint32 *pLogType;
-
-
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "%s", __func__);
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (NULL == pEventData ||
-      NULL == pEventData->pEventData)
-  {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-             "%s: Invalid parameters", __func__);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-  }
-  pLogType = (wpt_uint32 *)pEventData->pEventData;
-
-  pLoggingSession = (WDI_DS_LoggingSessionType *)
-                       WDI_DS_GetLoggingSession(WDI_DS_GetDatapathContext(
-                                                  (void *)pWDICtx));
-  /*-----------------------------------------------------------------------
-    Get message buffer
-  -----------------------------------------------------------------------*/
-
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                                     WDI_FW_LOGGING_DXE_DONE_IND,
-                                      sizeof(tFWLoggingDxeDoneInd),
-                          &pSendBuffer, &usDataOffset, &usSendSize))||
-       ( usSendSize < (usDataOffset + sizeof(tFWLoggingDxeDoneInd) )))
-  {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-              "Unable to get send buffer in RTS CTS ind %p ",
-               pEventData);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-  }
-  FWLoggingDxeDoneIndParams =
-           (tFWLoggingDxeDoneInd*)(pSendBuffer + usDataOffset);
-
-  wpalMemoryCopy(&FWLoggingDxeDoneIndParams->logBuffAddress,
-                 &pLoggingSession->logBuffAddress, MAX_NUM_OF_BUFFER *
-                 sizeof(FWLoggingDxeDoneIndParams->logBuffAddress[0]));
-
-  FWLoggingDxeDoneIndParams->status = pLoggingSession->status;
-  FWLoggingDxeDoneIndParams->doneIndicationForSource = (wpt_uint16)*pLogType;
-
-  wpalMemoryCopy(&FWLoggingDxeDoneIndParams->logBuffLength,
-                 &pLoggingSession->logBuffLength, MAX_NUM_OF_BUFFER *
-                 sizeof(FWLoggingDxeDoneIndParams->logBuffLength[0]));
-
-  pWDICtx->pReqStatusUserData = NULL;
-  pWDICtx->pfncRspCB = NULL;
-  /*-------------------------------------------------------------------------
-    Send FW_LOGGING_DXE_DONE_IND Indication to HAL
-  -------------------------------------------------------------------------*/
-  wdiStatus =  WDI_SendIndication( pWDICtx, pSendBuffer, usSendSize);
-  return (wdiStatus != WDI_STATUS_SUCCESS) ? wdiStatus:WDI_STATUS_SUCCESS_SYNC;
-}
-
-
-/**
- @brief Process Fatal Event Logs Rsp function
-        (called when a response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessFatalEventLogsRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-    tHalFatalEventLoggingRspParams           halRsp;
-    WDI_FatalEventLogsRspCb                 wdiFatalEventLogsRspCb;
-    WDI_FatalEventLogsRspParamType          wdiFatalEventLogsRsp;
-
-    VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                    "%s: %d Enter",__func__, __LINE__);
-
-    /*-------------------------------------------------------------------------
-      Sanity check
-    -------------------------------------------------------------------------*/
-    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-        ( NULL == pEventData->pEventData))
-    {
-       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                   "%s: Invalid parameters", __func__);
-       WDI_ASSERT(0);
-       return WDI_STATUS_E_FAILURE;
-    }
-    wdiFatalEventLogsRspCb = (WDI_FatalEventLogsRspCb)pWDICtx->pfncRspCB;
-
-    /*-------------------------------------------------------------------------
-      Extract response and send it to UMAC
-    -------------------------------------------------------------------------*/
-    wpalMemoryCopy( &halRsp, pEventData->pEventData, sizeof(halRsp));
-
-    wdiFatalEventLogsRsp.wdiStatus = WDI_HAL_2_WDI_STATUS(halRsp.status);
-
-    /*Notify UMAC*/
-    wdiFatalEventLogsRspCb( &wdiFatalEventLogsRsp,
-                                  pWDICtx->pRspCBUserData);
-
-    return WDI_STATUS_SUCCESS;
-}
-
-/**
- @brief Process FatalEventLogs Request
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-
-WDI_Status
-WDI_ProcessFatalEventLogsReq
-
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-    WDI_FatalEventLogsReqInfoType*     wdiFatalEventLogsReq;
-    wpt_uint8*                         pSendBuffer  = NULL;
-    wpt_uint16                         usDataOffset = 0;
-    wpt_uint16                         usSendSize   = 0;
-    WDI_Status                         wdiStatus;
-    tHalFatalEventLoggingReqMsg        halFatalEventLoggingReq;
-    WDI_FatalEventLogsRspCb            wdiFatalEventLogsRspCb;
-
-
-    VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-            "%s: %d Enter",__func__, __LINE__);
-
-    /*-------------------------------------------------------------------------
-      Sanity check
-      ------------------------------------------------------------------------*/
-    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-            ( NULL == pEventData->pEventData))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                "%s: Invalid parameters", __func__);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-    wdiFatalEventLogsReq =
-                     (WDI_FatalEventLogsReqInfoType *)pEventData->pEventData;
-
-    /*-----------------------------------------------------------------------
-      Get message buffer
-      -----------------------------------------------------------------------*/
-    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                    WDI_FATAL_EVENT_LOGGING_REQ,
-                    sizeof(halFatalEventLoggingReq.tFatalEventLoggingReqParams),
-                    &pSendBuffer, &usDataOffset, &usSendSize))||
-            (usSendSize < (usDataOffset +
-            sizeof(halFatalEventLoggingReq.tFatalEventLoggingReqParams))))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-                "Unable to get send buffer in Fatal Event Req");
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-    halFatalEventLoggingReq.tFatalEventLoggingReqParams.reasonCode =
-                                    wdiFatalEventLogsReq->reason_code;
-
-    wdiFatalEventLogsRspCb   = (WDI_FatalEventLogsRspCb)pEventData->pCBfnc;
-
-    wpalMemoryCopy( pSendBuffer+usDataOffset,
-                    &halFatalEventLoggingReq.tFatalEventLoggingReqParams,
-                    sizeof(halFatalEventLoggingReq.tFatalEventLoggingReqParams));
-
-    /*-------------------------------------------------------------------------
-      Send Mgmt Logging Init Request to HAL
-      ------------------------------------------------------------------------*/
-    wdiStatus = WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                             wdiFatalEventLogsRspCb, pEventData->pUserData,
-                             WDI_FATAL_EVENT_LOGGING_RSP);
-
-    return  wdiStatus;
-
-
-}
-
-
-/**
- @brief Process FWLoggingInit Request
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessFWLoggingInitReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-    WDI_FWLoggingInitReqInfoType*      wdiFWLoggingInitReq;
-    wpt_uint8*                         pSendBuffer  = NULL;
-    wpt_uint16                         usDataOffset = 0;
-    wpt_uint16                         usSendSize   = 0;
-    WDI_Status                         wdiStatus;
-    tHalFWLoggingInitReqMsg            halFWLoggingInitReq;
-    WDI_FWLoggingInitRspCb             wdiFWLoggingInitRspCb;
-
-
-    VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-            "%s: %d Enter",__func__, __LINE__);
-
-    /*-------------------------------------------------------------------------
-      Sanity check
-      ------------------------------------------------------------------------*/
-    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-            ( NULL == pEventData->pEventData))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                "%s: Invalid parameters", __func__);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-    wdiFWLoggingInitReq =
-                     (WDI_FWLoggingInitReqInfoType *)pEventData->pEventData;
-
-    /*-----------------------------------------------------------------------
-      Get message buffer
-      -----------------------------------------------------------------------*/
-    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                    WDI_FW_LOGGING_INIT_REQ,
-                    sizeof(halFWLoggingInitReq.tFWLoggingInitReqParams),
-                    &pSendBuffer, &usDataOffset, &usSendSize))||
-            (usSendSize < (usDataOffset +
-            sizeof(halFWLoggingInitReq.tFWLoggingInitReqParams))))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-                "Unable to get send buffer in Process Mgmt Logging Init Req");
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-
-    halFWLoggingInitReq.tFWLoggingInitReqParams.enableFlag=
-                                    wdiFWLoggingInitReq->enableFlag;
-    halFWLoggingInitReq.tFWLoggingInitReqParams.frameSize=
-                                    wdiFWLoggingInitReq->frameSize;
-    halFWLoggingInitReq.tFWLoggingInitReqParams.frameType=
-                                    wdiFWLoggingInitReq->frameType;
-    halFWLoggingInitReq.tFWLoggingInitReqParams.bufferMode=
-                                    wdiFWLoggingInitReq->bufferMode;
-    halFWLoggingInitReq.tFWLoggingInitReqParams.continuousFrameLogging=
-                                    wdiFWLoggingInitReq->continuousFrameLogging;
-    halFWLoggingInitReq.tFWLoggingInitReqParams.minLogBuffSize=
-                                    wdiFWLoggingInitReq->minLogBufferSize;
-    halFWLoggingInitReq.tFWLoggingInitReqParams.maxLogBuffSize=
-                                    wdiFWLoggingInitReq->maxLogBufferSize;
-    halFWLoggingInitReq.tFWLoggingInitReqParams.logMailBoxAddr=
-            (tANI_U64)(uintptr_t)(WDI_DS_GetLoggingMbPhyAddr(pWDICtx));
-    halFWLoggingInitReq.tFWLoggingInitReqParams.logMailBoxVer=
-            MAILBOX_VERSION_V1;
-
-    wdiFWLoggingInitRspCb   = (WDI_FWLoggingInitRspCb)pEventData->pCBfnc;
-
-    wpalMemoryCopy( pSendBuffer+usDataOffset,
-                    &halFWLoggingInitReq.tFWLoggingInitReqParams,
-                    sizeof(halFWLoggingInitReq.tFWLoggingInitReqParams));
-
-    /*-------------------------------------------------------------------------
-      Send Mgmt Logging Init Request to HAL
-      ------------------------------------------------------------------------*/
-    wdiStatus = WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                             wdiFWLoggingInitRspCb, pEventData->pUserData,
-                             WDI_FW_LOGGING_INIT_RSP);
-
-    return  wdiStatus;
-}
-
-/**
- @brief Process FwrMemDumpReq Request
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-    WDI_ProcessFwrMemDumpReq
-
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-    WDI_FwrMemDumpReqType *            wdiFwrMemDumpReq;
-    wpt_uint8*                         pSendBuffer  = NULL;
-    wpt_uint16                         usDataOffset = 0;
-    wpt_uint16                         usSendSize   = 0;
-    WDI_Status                         wdiStatus;
-    tHalFwMemoryDumpReqMsg             halFwrMemDumpReq;
-    WDI_FwrMemDumpRspCb                wdiFwrMemDumpRspCb;
-
-    VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-            "%s: %d Enter",__func__, __LINE__);
-
-    /*-------------------------------------------------------------------------
-      Sanity check
-      ------------------------------------------------------------------------*/
-    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-            ( NULL == pEventData->pEventData))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                "%s: Invalid parameters", __func__);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-
-    wdiFwrMemDumpReq = (WDI_FwrMemDumpReqType *)pEventData->pEventData;
-
-    /*-----------------------------------------------------------------------
-      Get message buffer
-      -----------------------------------------------------------------------*/
-    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                    WDI_FWR_MEM_DUMP_REQ,
-                    sizeof(halFwrMemDumpReq.tFwMemoryDumpReqParam),
-                    &pSendBuffer, &usDataOffset, &usSendSize))||
-            (usSendSize < (usDataOffset +
-            sizeof(halFwrMemDumpReq.tFwMemoryDumpReqParam))))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
-                "Unable to get send buffer in Process Fwr Mem Dump Req");
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-
-    wdiFwrMemDumpRspCb   = (WDI_FwrMemDumpRspCb)pEventData->pCBfnc;
-    wpalMemoryCopy( pSendBuffer+usDataOffset,
-                    &halFwrMemDumpReq.tFwMemoryDumpReqParam,
-                    sizeof(halFwrMemDumpReq.tFwMemoryDumpReqParam));
-
-    /*-------------------------------------------------------------------------
-        Send Fwr Mem Dump Request to HAL
-      ------------------------------------------------------------------------*/
-    wdiStatus = WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                             wdiFwrMemDumpRspCb, pEventData->pUserData,
-                             WDI_FWR_MEM_DUMP_RSP);
-    return  wdiStatus;
-}
-
-/**
- @brief WDI_EncryptMsgReq
-
- @param pwdiEncryptMsgParams: Req parameter for the FW
-        wdiEncryptMsgCbRsp: callback for passing back the response
-        of the Req operation received from the device
-        pUserData: user data will be passed back with the callback
-
- @return SUCCESS or FAIL
-*/
-WDI_Status
-WDI_EncryptMsgReq(void* pwdiEncryptMsgParams,
-        WDI_EncryptMsgRspCb wdiEncryptMsgCbRsp,
-        void*                   pUserData)
-{
-  WDI_EventInfoType      wdiEventData;
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-          "%s: %d Enter" ,__func__, __LINE__);
-  /*------------------------------------------------------------------------
-    Sanity Check
-    ------------------------------------------------------------------------*/
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-      VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ERROR,
-              "WDI API call before module is initialized - Fail request");
-
-      return WDI_STATUS_E_NOT_ALLOWED;
-  }
-
-  wdiEventData.wdiRequest      = WDI_ENCRYPT_MSG_REQ;
-  wdiEventData.pEventData      = pwdiEncryptMsgParams;
-  wdiEventData.uEventDataSize  = sizeof(wpt_pkt80211);
-  wdiEventData.pCBfnc          = wdiEncryptMsgCbRsp;
-  wdiEventData.pUserData       = pUserData;
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-/*
- * FUNCTION: WDI_ProcessEncryptMsgReq
- * Request to WDI to encrypt the given message.
- *
- * @param  pWDICtx:         pointer to the WLAN DAL context
- *         pEventData:      pointer to the event information structure
- *
- * @return Result of the function call
- */
-
-WDI_Status
-WDI_ProcessEncryptMsgReq
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  wpt_uint8*                   pSendBuffer         = NULL;
-  wpt_uint16                   usDataOffset        = 0;
-  wpt_uint16                   usSendSize          = 0;
-  WDI_EncryptMsgRspCb*         wdiEncMsgCb;
-  tSetEncryptedDataParams     *pHalEncryptDataReq;
-  wpt_pkt80211 *pkt = NULL;
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData) ||
-      ( NULL == pEventData->pCBfnc ) )
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  wdiEncMsgCb = (WDI_EncryptMsgRspCb*)pEventData->pCBfnc;
-
-  /*-----------------------------------------------------------------------
-    Get message buffer
-  -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(
-                                  pWDICtx, WDI_ENCRYPT_MSG_REQ,
-                                  sizeof(tSetEncryptedDataReqMsg),
-                                 &pSendBuffer, &usDataOffset, &usSendSize)) ||
-      ( usSendSize < (usDataOffset + sizeof(tSetEncryptedDataReqMsg))))
-  {
-     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
-                "Unable to get send buffer in get WDI_ENCRYPT_MSG_REQ %p",
-                pEventData);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  pWDICtx->wdiReqStatusCB = NULL;
-  pWDICtx->pReqStatusUserData = pEventData->pUserData;
-  pkt = (wpt_pkt80211 *)pEventData->pEventData;
-
-  pHalEncryptDataReq = &((tSetEncryptedDataReqMsg *)(pSendBuffer))->encryptedDataParams;
-  wpalMemoryZero(pHalEncryptDataReq, sizeof(tSetEncryptedDataParams));
-
-  wpalMemoryCopy(&pHalEncryptDataReq->macHeader, &pkt->macHeader, 32);
-
-  pHalEncryptDataReq->encParams.keyParams.key[0].keyId =
-      pkt->encParams.keyParams.key[0].keyId;
-
-  wpalMemoryCopy(&pHalEncryptDataReq->encParams.keyParams.key[0].key[0],
-          &pkt->encParams.keyParams.key[0].key[0], 16);
-
-  wpalMemoryCopy(&pHalEncryptDataReq->encParams.pn, &pkt->encParams.pn, 6);
-
-  pHalEncryptDataReq->data.length = pkt->data.length;
-  wpalMemoryCopy(&pHalEncryptDataReq->data.data[0], &pkt->data.data[0], pkt->data.length);
-
-  /*-------------------------------------------------------------------------
-    Send Get STA Request to HAL
-  -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, wdiEncMsgCb,
-                       pEventData->pUserData, WDI_ENCRYPT_MSG_RSP);
-}
-
-/*
- * FUNCTION: WDI_ProcessEncryptMsgRsp
- * Receives the encrypted message from the firmware
- * @param  pWDICtx:         pointer to the WLAN DAL context
- *         pEventData:      pointer to the event information structure
- *
- * @return Result of the function call
- */
-WDI_Status
-WDI_ProcessEncryptMsgRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  tpSetEncryptedDataRspParams pSetEncryptedDataRsp;
-  WDI_EncryptMsgRspCb wdiEncryptMsgRspCb;
-
-  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-                 "In %s",__func__);
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  pSetEncryptedDataRsp = (tpSetEncryptedDataRspParams)pEventData->pEventData;
-
-  wdiEncryptMsgRspCb = (WDI_EncryptMsgRspCb)pWDICtx->pfncRspCB;
-
-  wdiEncryptMsgRspCb(WDI_STATUS_SUCCESS,
-          pEventData->pEventData,
-          pWDICtx->pRspCBUserData);
-  return WDI_STATUS_SUCCESS;
-}
-
-WDI_Status
-WDI_NanRequest
-(
-   WDI_NanRequestType         *pwdiNanRequest,
-   void                       *usrData
-)
-{
-  WDI_EventInfoType      wdiEventData;
-
-  /*------------------------------------------------------------------------
-    Sanity Check
-  ------------------------------------------------------------------------*/
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-  }
-
-  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-              "WDI_NanRequest %zu %d", sizeof(*pwdiNanRequest),
-              pwdiNanRequest->request_data_len);
-
-  /*------------------------------------------------------------------------
-    Fill in Event data and post to the Main FSM
-  ------------------------------------------------------------------------*/
-  wdiEventData.wdiRequest      = WDI_NAN_REQUEST;
-  wdiEventData.pEventData      = pwdiNanRequest;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiNanRequest)
-                                 + pwdiNanRequest->request_data_len;
-  wdiEventData.pUserData       = usrData;
-  wdiEventData.pCBfnc          = NULL;
-
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-WDI_Status
-WDI_ProcessNanRequest
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_NanRequestType               *pwdiNanRequest   = NULL;
-  wpt_uint8*                       pSendBuffer       = NULL;
-  wpt_uint16                       usDataOffset      = 0;
-  wpt_uint16                       usSendSize        = 0;
-
-  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-              "WDI_ProcessNanRequest");
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pEventData ) ||
-      ( NULL == (pwdiNanRequest = (WDI_NanRequestType*)pEventData->pEventData)))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __FUNCTION__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  /*-----------------------------------------------------------------------
-    Get message buffer
-  -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS
-        != WDI_GetMessageBuffer( pWDICtx,
-                                 WDI_NAN_REQUEST,
-                                 pwdiNanRequest->request_data_len,
-                                 &pSendBuffer,
-                                 &usDataOffset,
-                                 &usSendSize))||
-      ( usSendSize < (usDataOffset + pwdiNanRequest->request_data_len)))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "Unable to get send buffer in NAN request %p %p",
-                 pEventData, pwdiNanRequest);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  pwdiNanRequest->request_data,
-                  pwdiNanRequest->request_data_len);
-
-  pWDICtx->pReqStatusUserData = NULL;
-  pWDICtx->pfncRspCB = NULL;
-  vos_mem_free( pEventData->pUserData);
-
-  /*-------------------------------------------------------------------------
-    Send NAN Request to HAL
-  -------------------------------------------------------------------------*/
-  return WDI_SendMsg( pWDICtx,
-                      pSendBuffer,
-                      usSendSize,
-                      NULL,
-                      NULL,
-                      WDI_NAN_RESPONSE);
-}
-
-/**
- @brief Process NAN Response function (called when a
-        response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessNanResponse
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_Status wdiStatus;
-  eHalStatus halStatus;
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus = WDI_HAL_2_WDI_STATUS(halStatus);
-
-  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-          "%s : Received NAN response, status : %d", __FUNCTION__, wdiStatus);
-
-  return WDI_STATUS_SUCCESS;
-}/*WDI_ProcessNanResponse*/
-
-
-/**
- @brief Process NAN Event function (called when
-        an indication is being received over the
-        bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessNanEvent
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_LowLevelIndType  wdiInd;
-
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData ))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT( 0 );
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-          "%s: Received NAN event", __func__);
-  /*-------------------------------------------------------------------------
-    Extract indication and send it to UMAC
-  -------------------------------------------------------------------------*/
-  wdiInd.wdiIndicationType = WDI_NAN_EVENT_IND;
-  wdiInd.wdiIndicationData.wdiNanEvent.event_data_len =
-      pEventData->uEventDataSize;
-  wdiInd.wdiIndicationData.wdiNanEvent.event_data =
-      pEventData->pEventData;
-
-  /*Notify UMAC*/
-  pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-
-  return WDI_STATUS_SUCCESS;
-}/*WDI_ProcessNanEvent*/
-
-
-WDI_Status
-WDI_Process_RssiBreachedInd
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-)
-{
-  WDI_LowLevelIndType  wdiInd;
-  tHalRssiMonitorIndParams *halRssiBreachedInd;
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  /*-------------------------------------------------------------------------
-     Sanity check
-    -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  /*-------------------------------------------------------------------------
-    Extract indication and send it to UMAC
-   -------------------------------------------------------------------------*/
-  halRssiBreachedInd = pEventData->pEventData;
-
-  /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType = WDI_RSSI_BREACHED_IND;
-  wdiInd.wdiIndicationData.wdiRssiBreachedInd.request_id =
-                                      halRssiBreachedInd->request_id;
-  wpalMemoryCopy(wdiInd.wdiIndicationData.wdiRssiBreachedInd.bssId,
-                 halRssiBreachedInd->bssId,
-                 WDI_MAC_ADDR_LEN);
-  wdiInd.wdiIndicationData.wdiRssiBreachedInd.rssi =
-                                      halRssiBreachedInd->rssi;
-  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-          "%s: session_id %d, rssi : %d, bssId: " MAC_ADDRESS_STR" ", __func__,
-           wdiInd.wdiIndicationData.wdiRssiBreachedInd.request_id,
-           wdiInd.wdiIndicationData.wdiRssiBreachedInd.rssi,
-           MAC_ADDR_ARRAY(wdiInd.wdiIndicationData.wdiRssiBreachedInd.bssId));
-  /*Notify UMAC*/
-  if (pWDICtx->wdiLowLevelIndCB)
-  {
-    pWDICtx->wdiLowLevelIndCB(&wdiInd, pWDICtx->pIndUserData);
-  }
-
-  return WDI_STATUS_SUCCESS;
-
-}
-
-
-WDI_Status
-WDI_Process_LostLinkParamInd
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-)
-{
-  WDI_LowLevelIndType  wdiInd;
-  tHalLostLinkParametersIndParams halLostLinkParamInd;
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  /*-------------------------------------------------------------------------
-     Sanity check
-    -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  /*-------------------------------------------------------------------------
-    Extract indication and send it to UMAC
-   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( (void *)&halLostLinkParamInd,
-                   pEventData->pEventData,
-                   sizeof(tHalLostLinkParametersIndParams));
-
-
-  /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType = WDI_LOST_LINK_PARAMS_IND;
-  wpalMemoryCopy((void *)&wdiInd.wdiIndicationData.wdiLostLinkParamsInd,
-                 (void *)&halLostLinkParamInd,
-                 sizeof(WDI_LostLinkParamsIndType));
-  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-          "%s: bssIdx %d, rssi : %d, selfMacAddr: " MAC_ADDRESS_STR", linkFlCnt: %d,"
-          "linkFlTx : %d,lastDataRate : %d", __func__,
-           wdiInd.wdiIndicationData.wdiLostLinkParamsInd.bssIdx,
-           wdiInd.wdiIndicationData.wdiLostLinkParamsInd.rssi,
-           MAC_ADDR_ARRAY(wdiInd.wdiIndicationData.wdiLostLinkParamsInd.selfMacAddr),
-           wdiInd.wdiIndicationData.wdiLostLinkParamsInd.linkFlCnt,
-           wdiInd.wdiIndicationData.wdiLostLinkParamsInd.linkFlTx,
-           wdiInd.wdiIndicationData.wdiLostLinkParamsInd.lastDataRate);
-  /*Notify UMAC*/
-  if (pWDICtx->wdiLowLevelIndCB)
-  {
-    pWDICtx->wdiLowLevelIndCB(&wdiInd, pWDICtx->pIndUserData);
-  }
-
-  return WDI_STATUS_SUCCESS;
-
-}
-
-WDI_Status
-WDI_ProcessSetRtsCtsHtvhtInd
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  wpt_uint8*  pSendBuffer = NULL;
-  wpt_uint16  usDataOffset = 0;
-  wpt_uint16  usSendSize = 0;
-  wpt_uint32  *rtsCtsVal;
-  tHalRtsCtsHtvhtIndParams  *rtsCtsHtvhtIndParams;
-  WDI_Status wdiStatus = WDI_STATUS_SUCCESS;
-
-
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "%s", __func__);
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ))
-  {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-             "%s: Invalid parameters", __func__);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-  }
-  rtsCtsVal = (wpt_uint32*)pEventData->pEventData;
-  /*-----------------------------------------------------------------------
-    Get message buffer
-  -----------------------------------------------------------------------*/
-
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                                     WDI_SET_RTS_CTS_HTVHT_IND,
-                                      sizeof(tHalRtsCtsHtvhtIndParams),
-                          &pSendBuffer, &usDataOffset, &usSendSize))||
-       ( usSendSize < (usDataOffset + sizeof(tHalRtsCtsHtvhtIndParams) )))
-  {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-              "Unable to get send buffer in RTS CTS ind %p ",
-               pEventData);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-  }
-  rtsCtsHtvhtIndParams =
-           (tHalRtsCtsHtvhtIndParams*)(pSendBuffer + usDataOffset);
-  rtsCtsHtvhtIndParams->rtsCtsValue = *rtsCtsVal;
-
-  pWDICtx->pReqStatusUserData = NULL;
-  pWDICtx->pfncRspCB = NULL;
-  /*-------------------------------------------------------------------------
-    Send SET_RTS_CTS_HTVHT Indication to HAL
-  -------------------------------------------------------------------------*/
-  wdiStatus =  WDI_SendIndication( pWDICtx, pSendBuffer, usSendSize);
-  return (wdiStatus != WDI_STATUS_SUCCESS) ? wdiStatus:WDI_STATUS_SUCCESS_SYNC;
-}
-
-WDI_Status
-WDI_SetRtsCtsHTVhtInd
-(
-    wpt_uint32 rtsCtsVal
-)
-{
-  WDI_EventInfoType      wdiEventData;
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  /*------------------------------------------------------------------------
-   Sanity Check
-  ------------------------------------------------------------------------*/
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                 "WDI API call before module is initialized - Fail request");
-      return WDI_STATUS_E_NOT_ALLOWED;
-  }
-
-  /*------------------------------------------------------------------------
-    Fill in Event data and post to the Main FSM
-  ------------------------------------------------------------------------*/
-  wdiEventData.wdiRequest      = WDI_SET_RTS_CTS_HTVHT_IND;
-  wdiEventData.pEventData      = (void *) &rtsCtsVal;
-  wdiEventData.uEventDataSize  = sizeof(wpt_uint32);
-  wdiEventData.pCBfnc          = NULL;
-  wdiEventData.pUserData       = NULL;
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-
-}/* WDI_SetRtsCtsHTVhtInd */
-
-WDI_Status
-WDI_ProcessEnableDisableCAEventInd
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  wpt_uint8*  pSendBuffer = NULL;
-  wpt_uint16  usDataOffset = 0;
-  wpt_uint16  usSendSize = 0;
-  wpt_uint32  *val;
-  tHalAvoidFreqRangeCtrlParam  *avoidFreqRangeCtrlParam;
-  WDI_Status wdiStatus = WDI_STATUS_SUCCESS;
-
-
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "%s", __func__);
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ))
-  {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-             "%s: Invalid parameters", __func__);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-  }
-  val = (wpt_uint32*)pEventData->pEventData;
-  /*-----------------------------------------------------------------------
-    Get message buffer
-  -----------------------------------------------------------------------*/
-
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                                     WDI_SEND_FREQ_RANGE_CONTROL_IND,
-                                      sizeof(tHalAvoidFreqRangeCtrlParam),
-                          &pSendBuffer, &usDataOffset, &usSendSize))||
-       ( usSendSize < (usDataOffset + sizeof(tHalAvoidFreqRangeCtrlParam) )))
-  {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-              "Unable to get send buffer in Channel Avoidance Ind %p ",
-               pEventData);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-  }
-  avoidFreqRangeCtrlParam =
-           (tHalAvoidFreqRangeCtrlParam*)(pSendBuffer + usDataOffset);
-  avoidFreqRangeCtrlParam->status = *val;
-
-  pWDICtx->pReqStatusUserData = NULL;
-  pWDICtx->pfncRspCB = NULL;
-  /*-------------------------------------------------------------------------
-    Send AVOID_FREQ_RANGE_CONTROL_IND Indication to HAL
-  -------------------------------------------------------------------------*/
-  wdiStatus =  WDI_SendIndication( pWDICtx, pSendBuffer, usSendSize);
-  return (wdiStatus != WDI_STATUS_SUCCESS) ? wdiStatus:WDI_STATUS_SUCCESS_SYNC;
-}
-
-WDI_Status
-WDI_EnableDisableCAEventInd
-(
-    wpt_uint32 val
-)
-{
-  WDI_EventInfoType      wdiEventData;
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  /*------------------------------------------------------------------------
-   Sanity Check
-  ------------------------------------------------------------------------*/
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                 "WDI API call before module is initialized - Fail request");
-      return WDI_STATUS_E_NOT_ALLOWED;
-  }
-
-  /*------------------------------------------------------------------------
-    Fill in Event data and post to the Main FSM
-  ------------------------------------------------------------------------*/
-  wdiEventData.wdiRequest      = WDI_SEND_FREQ_RANGE_CONTROL_IND;
-  wdiEventData.pEventData      = (void *) &val;
-  wdiEventData.uEventDataSize  = sizeof(wpt_uint32);
-  wdiEventData.pCBfnc          = NULL;
-  wdiEventData.pUserData       = NULL;
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-
-} /* WDI_EnableDisableCAEventInd */
-
-/**
- @brief WDI_WifiConfigSetReq
-    This API is called to set WifiConfig params request in FW
-
- @param pwdiWifiConfigSetReqParams : pointer to set WifiCofig request params
-        wdiWifiConfigSetRspCb : WifiConfig stats resp callback
-        usrData : Client context
- @see
- @return SUCCESS or FAIL
-*/
-WDI_Status
-WDI_WifiConfigSetReq(WDI_WifiConfigSetReqType* pwdiWifConfigSetReqParams,
-                           WDI_WifiConfigSetRspCb   wdiWifiConfigSetRspCb,
-                           void*                   pUserData)
-{
-   WDI_EventInfoType      wdiEventData;
-
-  /*------------------------------------------------------------------------
-    Sanity Check
-  ------------------------------------------------------------------------*/
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-     VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ERROR,
-                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-  }
-
-  wdiEventData.wdiRequest      = WDI_WIFI_CONFIG_SET_REQ;
-  wdiEventData.pEventData      = pwdiWifConfigSetReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiWifConfigSetReqParams);
-  wdiEventData.pCBfnc          = wdiWifiConfigSetRspCb;
-  wdiEventData.pUserData       = pUserData;
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-/**
- @brief WDI_ProcessWifiConfigReq -
-    Set WifiConfig request to FW
-
- @param  pWDICtx : wdi context
-         pEventData : indication data
-
- @see
- @return none
-*/
-   WDI_Status
-   WDI_ProcessWifiConfigReq
-   (
-     WDI_ControlBlockType*  pWDICtx,
-     WDI_EventInfoType*     pEventData
-   )
-   {
-     WDI_WifiConfigSetReqType* pwdiWifiConfigSetReqParams;
-     WDI_WifiConfigSetRspCb wdiWifiConfigSetRspCb;
-     wpt_uint8*               pSendBuffer         = NULL;
-     wpt_uint16               usSendSize          = 0;
-     wpt_uint16               usDataOffset        = 0;
-     tSetWifiConfigParamsReq halWifiConfigSetParams;
-
-     if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
-         ( NULL == pEventData->pCBfnc ))
-     {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                    "%s: Invalid parameters", __func__);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-     }
-     pwdiWifiConfigSetReqParams = (WDI_WifiConfigSetReqType*)pEventData->pEventData;
-     wdiWifiConfigSetRspCb   = (WDI_WifiConfigSetRspCb)pEventData->pCBfnc;
-
-     /*-----------------------------------------------------------------------
-       Get message buffer
-       ! TO DO : proper conversion into the HAL Message Request Format
-     -----------------------------------------------------------------------*/
-     if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(
-                                           pWDICtx,
-                                           WDI_WIFI_CONFIG_SET_REQ,
-                                           sizeof(halWifiConfigSetParams.wifiConfigParams),
-                                           &pSendBuffer, &usDataOffset,
-                                           &usSendSize))||
-         ( usSendSize < (usDataOffset + sizeof(halWifiConfigSetParams.wifiConfigParams) )))
-     {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "Unable to get send buffer in %s %p %p %p", __func__,
-                   pEventData, pwdiWifiConfigSetReqParams, wdiWifiConfigSetRspCb);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-     }
-
-     halWifiConfigSetParams.wifiConfigParams.paramType = pwdiWifiConfigSetReqParams->paramType;
-     halWifiConfigSetParams.wifiConfigParams.paramValue =
-         pwdiWifiConfigSetReqParams->paramValue;
-     vos_mem_copy(halWifiConfigSetParams.wifiConfigParams.bssid, &(pwdiWifiConfigSetReqParams->bssId),
-                                            sizeof(tSirMacAddr));
-
-     wpalMemoryCopy(pSendBuffer+usDataOffset,
-                     &halWifiConfigSetParams.wifiConfigParams,
-                     sizeof(halWifiConfigSetParams.wifiConfigParams));
-
-     pWDICtx->pReqStatusUserData = pEventData->pUserData;
-
-     /*-------------------------------------------------------------------------
-       Send Clear Link Layer Stats Request to HAL
-     -------------------------------------------------------------------------*/
-     return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                          wdiWifiConfigSetRspCb, pEventData->pUserData,
-                          WDI_WIFI_CONFIG_SET_RSP);
-   }
-
-WDI_Status
-WDI_ProcessWificonfigSetRsp
-( WDI_ControlBlockType* pWDICtx,
-  WDI_EventInfoType* pEventData )
-
-{
-  tHalSetWifiConfigRspParams    halRsp;
-  WDI_WifiConfigSetRspCb        wdiWifiConfigSetRspCb;
-  WDI_WifconfigSetRsp           wdiWifconfigSetRsp;
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                  "%s: %d Enter",__func__, __LINE__);
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-  wdiWifiConfigSetRspCb = (WDI_WifiConfigSetRspCb)pWDICtx->pfncRspCB;
-
-  /*-------------------------------------------------------------------------
-    Extract response and send it to UMAC
-  -------------------------------------------------------------------------*/
-  wpalMemoryCopy(&halRsp, pEventData->pEventData, sizeof(halRsp));
-
-  wdiWifconfigSetRsp.wificonfigset_status = WDI_HAL_2_WDI_STATUS(halRsp.status);
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                     "WifiConfig RSP status = %d",
-                     wdiWifconfigSetRsp.wificonfigset_status);
-  /*Notify UMAC*/
-  wdiWifiConfigSetRspCb( &wdiWifconfigSetRsp, pWDICtx->pRspCBUserData);
-
-  return WDI_STATUS_SUCCESS;
-}
-
-#ifdef FEATURE_OEM_DATA_SUPPORT
-
-/**
- @brief WDI_StartOemDataReqIndNew
-
- @param pOemDataReqNewConfig: Req parameter for the FW
-
- @return SUCCESS or FAIL
-*/
-WDI_Status
-WDI_StartOemDataReqIndNew
-(
-   WDI_OemDataReqNewConfig *pOemDataReqNewConfig
-)
-{
-   WDI_EventInfoType      wdiEventData;
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ERROR,
-                  "%s: %d",__func__, __LINE__);
-  /*------------------------------------------------------------------------
-    Sanity Check
-  ------------------------------------------------------------------------*/
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-     VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ERROR,
-                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
-  }
-
-  wdiEventData.wdiRequest      = WDI_START_OEM_DATA_REQ_IND_NEW;
-  wdiEventData.pEventData      = pOemDataReqNewConfig;
-  wdiEventData.uEventDataSize  = sizeof(*pOemDataReqNewConfig);
-  wdiEventData.pCBfnc          = NULL;
-  wdiEventData.pUserData       = NULL;
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-/**
- @brief WDI_ProcessStartOemDataReqIndNew -
-    Send OEM Data request new indication to FW
-
- @param  pWDICtx : wdi context
-         pEventData : indication data
-
- @see
- @return none
-*/
-WDI_Status
-WDI_ProcessStartOemDataReqIndNew
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  WDI_OemDataReqNewConfig* wdiOemDataReqNewConfig;
-  wpt_uint8*               pSendBuffer         = NULL;
-  wpt_uint16               usSendSize          = 0;
-  wpt_uint16               usDataOffset        = 0;
-  tpStartOemDataReqParamsNew   pHalStartOemDataReqParamsNew;
-  WDI_Status wdiStatus = WDI_STATUS_SUCCESS;
-
-  VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ERROR,
-                  "%s: %d",__func__, __LINE__);
-
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-           ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  wdiOemDataReqNewConfig =
-      (WDI_OemDataReqNewConfig *)pEventData->pEventData;
-
-  /*-----------------------------------------------------------------------
-    Get message buffer
-  -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(
-                                        pWDICtx,
-                                        WDI_START_OEM_DATA_REQ_IND_NEW,
-                                        sizeof(*pHalStartOemDataReqParamsNew),
-                                        &pSendBuffer, &usDataOffset,
-                                        &usSendSize))||
-     ( usSendSize < (usDataOffset + sizeof(*pHalStartOemDataReqParamsNew) )))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
-              "Unable to get send buffer in %s %p %p", __func__,
-                pEventData, wdiOemDataReqNewConfig);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-
-  pHalStartOemDataReqParamsNew =
-      (tpStartOemDataReqParamsNew) (pSendBuffer + usDataOffset);
-
-  wpalMemoryCopy(pHalStartOemDataReqParamsNew,
-                 wdiOemDataReqNewConfig,
-                 sizeof(*pHalStartOemDataReqParamsNew));
-
-  VOS_TRACE(VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-          "%s: selfMacAddr: " MAC_ADDRESS_STR" ", __func__,
-           MAC_ADDR_ARRAY(pHalStartOemDataReqParamsNew->selfMacAddr));
-
-  pWDICtx->pReqStatusUserData = NULL;
-  pWDICtx->pfncRspCB = NULL;
-
-  /*-------------------------------------------------------------------------
-    Send WDI_START_OEM_DATA_REQ_IND_NEW Request to HAL
-  -------------------------------------------------------------------------*/
-  wdiStatus =  WDI_SendIndication( pWDICtx, pSendBuffer, usSendSize);
-  return (wdiStatus != WDI_STATUS_SUCCESS) ? wdiStatus:WDI_STATUS_SUCCESS_SYNC;
-}
-
-/**
- @brief Process OemDataRsp New Indication indication from FW
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessStartOemDataRspIndNew
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-    WDI_LowLevelIndType wdiInd;
-    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-    VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                "%s: ", __func__);
-
-    /* sanity check */
-    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                 "%s: Invalid parameters", __func__);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-
-    /* Fill in the indication parameters */
-    wdiInd.wdiIndicationType = WDI_START_OEM_DATA_RSP_IND_NEW;
-
-    wdiInd.wdiIndicationData.wdiOemDataRspNew.pOemRspNewIndData =
-                                                (void *)pEventData->pEventData;
-    wdiInd.wdiIndicationData.wdiOemDataRspNew.OemRspNewLen =
-                                                    pEventData->uEventDataSize;
-    /* Notify UMAC */
-    if (pWDICtx->wdiLowLevelIndCB)
-    {
-        pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-    }
-    else
-    {
-        VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                 "%s: WDILowLevelIndCb is null", __func__);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-    return WDI_STATUS_SUCCESS;
-} /* End of WDI_ProcessEXTScanResultInd  */
-
-/**
- @brief Process Current Antenna Index information from FW
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessGetCurrentAntennaIndexRsp
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-   WDI_AntennaDivSelRspCb wdiGetCurrentAntennaIndexRspCb;
-   tHalAntennaDiversitySelectionRspParams *pHalAntDivSelRsp;
-
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
-      ( NULL == pEventData->pEventData))
-  {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "%s: Invalid parameters", __func__);
-     WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
-  }
-  pHalAntDivSelRsp =
-  (tHalAntennaDiversitySelectionRspParams*)pEventData->pEventData;
-  wdiGetCurrentAntennaIndexRspCb = (WDI_AntennaDivSelRspCb)pWDICtx->pfncRspCB;
-
-  if (pHalAntDivSelRsp->status != 0)
-  {
-      wdiGetCurrentAntennaIndexRspCb(WDI_STATUS_E_FAILURE,
-                      (void *)pHalAntDivSelRsp, pWDICtx->pRspCBUserData);
-  }
-  else
-  {
-      wdiGetCurrentAntennaIndexRspCb(WDI_STATUS_SUCCESS,
-                                     (void *)pHalAntDivSelRsp,
-                                     pWDICtx->pRspCBUserData);
-  }
-
-  return WDI_STATUS_SUCCESS;
-}
-
-/**
- @brief Process Get Current Antenna Index request command
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessGetCurrentAntennaIndex
-(
-    WDI_ControlBlockType*  pWDICtx,
-    WDI_EventInfoType*     pEventData
-)
-{
-    wpt_uint8*  pSendBuffer = NULL;
-    wpt_uint16  usDataOffset = 0;
-    wpt_uint16  usSendSize = 0;
-    tHalAntennaDiversitySelectionReqParams halAntDivSelReq;
-    WDI_AntennaDivSelRspCb wdiGetCurrentAntennaIndexRspCb;
-
-    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "%s", __func__);
-
-    /*-------------------------------------------------------------------------
-       Sanity check
-     -------------------------------------------------------------------------*/
-    if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
-        ( NULL == pEventData->pCBfnc ))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                    "%s: Invalid parameters", __func__);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-    wdiGetCurrentAntennaIndexRspCb = (WDI_AntennaDivSelRspCb)pEventData->pCBfnc;
-
-    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                                WDI_ANTENNA_DIVERSITY_SELECTION_REQ,
-                                sizeof(tHalAntennaDiversitySelectionReqParams),
-                                &pSendBuffer, &usDataOffset, &usSendSize))||
-       ( usSendSize < (usDataOffset +
-         sizeof(tHalAntennaDiversitySelectionReqParams) )))
-    {
-           WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                       "Unable to get send buffer in GetCurrentAntennaIndex %p",
-                       pEventData);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-    pWDICtx->wdiReqStatusCB = NULL;
-    pWDICtx->pReqStatusUserData = pEventData->pEventData;
-    halAntDivSelReq.reserved = *((wpt_uint32 *)(pEventData->pEventData));
-    wpalMemoryCopy( pSendBuffer+usDataOffset,
-                    &halAntDivSelReq,
-                    sizeof(tHalAntennaDiversitySelectionReqParams));
-
-   /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
-   -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiGetCurrentAntennaIndexRspCb,
-                        pEventData->pUserData,
-                        WDI_ANTENNA_DIVERSITY_SELECTION_RSP);
-}
-
-/**
- @brief WDI_GetCurrentAntennaIndex
-
- @param pOemDataReqNewConfig: Req parameter for the FW
-
- @return SUCCESS or FAIL
-*/
-WDI_Status
-WDI_GetCurrentAntennaIndex
-(
-  void *pUserData,
-  WDI_AntennaDivSelRspCb wdiAntennaDivSelRspCb,
-  wpt_uint32 reserved
-)
-{
-   WDI_EventInfoType      wdiEventData;
-
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  /*------------------------------------------------------------------------
-    Sanity Check
-  ------------------------------------------------------------------------*/
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                 "WDI API call before module is initialized - Fail request");
-      return WDI_STATUS_E_NOT_ALLOWED;
-  }
-  /*------------------------------------------------------------------------
-    Fill in Event data and post to the Main FSM
-  ------------------------------------------------------------------------*/
-  wdiEventData.wdiRequest      = WDI_ANTENNA_DIVERSITY_SELECTION_REQ;
-  wdiEventData.pEventData      = (void *)&reserved;
-  wdiEventData.uEventDataSize  = sizeof(wpt_uint32);
-  wdiEventData.pCBfnc          = wdiAntennaDivSelRspCb;
-  wdiEventData.pUserData       = pUserData;
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
-
-/**
- @brief Process Set beacon miss penalty count command
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
- @see
- @return Result of the function call
-*/
-WDI_Status
-WDI_ProcessBcnMissPenaltyCount
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_EventInfoType*     pEventData
-)
-{
-  wpt_uint8*  pSendBuffer = NULL;
-  wpt_uint16  usDataOffset = 0;
-  wpt_uint16  usSendSize = 0;
-  tHalModifyRoamParamsIndParams halModifyRoamParams;
-  WDI_ModifyRoamParamsReqType *modifyRoamParams;
-  WDI_Status wdiStatus = WDI_STATUS_SUCCESS;
-
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "%s", __func__);
-  /*-------------------------------------------------------------------------
-    Sanity check
-  -------------------------------------------------------------------------*/
-  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ))
-  {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-             "%s: Invalid parameters", __func__);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-  }
-
-  /*-----------------------------------------------------------------------
-    Get message buffer
-  -----------------------------------------------------------------------*/
-
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                                     WDI_MODIFY_ROAM_PARAMS_IND,
-                                     sizeof(tHalModifyRoamParamsIndParams),
-                          &pSendBuffer, &usDataOffset, &usSendSize))||
-       ( usSendSize < (usDataOffset + sizeof(tHalModifyRoamParamsIndParams) )))
-  {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-              "Unable to get send buffer for Modify roam req params %p ",
-               pEventData);
-      WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-  }
-
-  modifyRoamParams = (WDI_ModifyRoamParamsReqType *)pEventData->pEventData;
-  halModifyRoamParams.param = modifyRoamParams->param;
-  halModifyRoamParams.value = modifyRoamParams->value;
-  wpalMemoryCopy( pSendBuffer+usDataOffset, &halModifyRoamParams,
-                  sizeof(halModifyRoamParams));
-  pWDICtx->pReqStatusUserData = NULL;
-  pWDICtx->pfncRspCB = NULL;
-
-  /*-------------------------------------------------------------------------
-    Send WDI_MODIFY_ROAM_PARAMS_IND to HAL
-  -------------------------------------------------------------------------*/
-  wdiStatus =  WDI_SendIndication( pWDICtx, pSendBuffer, usSendSize);
-  return (wdiStatus != WDI_STATUS_SUCCESS) ? wdiStatus:WDI_STATUS_SUCCESS_SYNC;
-
-}
-
-/**
- @brief WDI_SetBcnMissPenaltyCount
-
- @param params: Req parameter for the FW
-
- @return SUCCESS or FAIL
-*/
-
-WDI_Status
-WDI_SetBcnMissPenaltyCount
-(
-    WDI_ModifyRoamParamsReqType *params
-)
-{
-  WDI_EventInfoType      wdiEventData;
-
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  /*------------------------------------------------------------------------
-   Sanity Check
-  ------------------------------------------------------------------------*/
-  if ( eWLAN_PAL_FALSE == gWDIInitialized )
-  {
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                 "WDI API call before module is initialized - Fail request");
-      return WDI_STATUS_E_NOT_ALLOWED;
-  }
-
-  /*------------------------------------------------------------------------
-    Fill in Event data and post to the Main FSM
-  ------------------------------------------------------------------------*/
-  wdiEventData.wdiRequest      = WDI_MODIFY_ROAM_PARAMS_IND;
-  wdiEventData.pEventData      = (void *)params;
-  wdiEventData.uEventDataSize  = sizeof(*params);
-  wdiEventData.pCBfnc          = NULL;
-  wdiEventData.pUserData       = NULL;
-
-  return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-
-} /* WDI_SetBcnMissPenaltyCount */
-
-#endif
-
-/**
- *  WDI_ProcessSetAllowedActionFramesInd() - Process Allowed action frames
- *                                   Indication message and post it to HAL
- *
- *  @pWDICtx: pointer to the WLAN DAL context
- *  @pEventData: pointer to the event information structure
- *
- *  Return: WDI_Status enumeration
- */
-WDI_Status WDI_ProcessSetAllowedActionFramesInd(WDI_ControlBlockType *pWDICtx,
-                                                  WDI_EventInfoType *pEventData)
-{
-    wpt_uint8 *pSendBuffer;
-    wpt_uint16 usDataOffset;
-    wpt_uint16 usSendSize;
-    wpt_uint16 usLen;
-    struct WDI_AllowedActionFramesInd* pwdiAllowedActionFramesInd;
-    tHalAllowedActionFrames* pAllowedActionFrames;
-    WDI_Status wdiStatus;
-
-    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-                                          "%s", __func__);
-
-    if ((!pEventData) || (!pEventData->pEventData))
-    {
-        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                                          "%s: Invalid parameters", __func__);
-        WDI_ASSERT(0);
-        return WDI_STATUS_E_FAILURE;
-    }
-
-    if ((WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(pWDICtx,
-                                        WDI_SET_ALLOWED_ACTION_FRAMES_IND,
-                                        sizeof(tHalAllowedActionFrames),
-                                        &pSendBuffer, &usDataOffset,
-                                        &usSendSize))||
-                                        (usSendSize < (usDataOffset + usLen)))
-    {
-         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                    "Unable to get send buffer in Allowed Action Frames req %p",
-                    pEventData);
-         return WDI_STATUS_E_FAILURE;
-    }
-
-    pwdiAllowedActionFramesInd =
-                     (struct WDI_AllowedActionFramesInd*)pEventData->pEventData;
-    pAllowedActionFrames =
-                        (tHalAllowedActionFrames*)(pSendBuffer+usDataOffset);
-    pAllowedActionFrames->actionFramesBitMask =
-                         pwdiAllowedActionFramesInd->bitmask;
-    pAllowedActionFrames->reserved = pwdiAllowedActionFramesInd->reserved;
-
-    pWDICtx->pReqStatusUserData = NULL;
-    pWDICtx->pfncRspCB = NULL;
-
-    wdiStatus = WDI_SendIndication(pWDICtx, pSendBuffer, usSendSize);
-    return (wdiStatus != WDI_STATUS_SUCCESS) ?
-                                            wdiStatus:WDI_STATUS_SUCCESS_SYNC;
-}/*WDI_ProcessSetAllowedActionFramesInd*/
-
-/**
- *  WDI_SetAllowedActionFramesInd() - Post Allowed Action Frames Indication to
- *                                    WDI Main Event Handler
- *  @params: pointer to the WDI_AllowedActionFramesInd structure
- *
- *  Return: WDI_Status enumeration
- */
-WDI_Status WDI_SetAllowedActionFramesInd(
-                                     struct WDI_AllowedActionFramesInd  *params)
-{
-    WDI_EventInfoType wdiEventData;
-
-    if (eWLAN_PAL_FALSE == gWDIInitialized)
-    {
-        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                   "WDI API call before module is initialized - Fail req");
-        return WDI_STATUS_E_NOT_ALLOWED;
-    }
-
-    wdiEventData.wdiRequest = WDI_SET_ALLOWED_ACTION_FRAMES_IND;
-    wdiEventData.pEventData = params;
-    wdiEventData.uEventDataSize  = sizeof(*params);
-    wdiEventData.pCBfnc = NULL;
-    wdiEventData.pUserData = NULL;
-
-    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
-}
diff --git a/wlan/prima/CORE/WDI/CP/src/wlan_qct_wdi_dp.c b/wlan/prima/CORE/WDI/CP/src/wlan_qct_wdi_dp.c
index 48bf139..00ab811 100644
--- a/wlan/prima/CORE/WDI/CP/src/wlan_qct_wdi_dp.c
+++ b/wlan/prima/CORE/WDI/CP/src/wlan_qct_wdi_dp.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -48,6 +48,9 @@
   Are listed for each API below.
 
 
+  Copyright (c) 2010 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
@@ -386,8 +389,7 @@
     wpt_uint8              ucProtMgmtFrame,
     wpt_uint32             uTimeStamp,
     wpt_uint8              isEapol,
-    wpt_uint8*             staIndex,
-    wpt_uint32             txBdToken
+    wpt_uint8*             staIndex
 )
 {
     wpt_uint8              ucTid        = *pTid; 
@@ -408,7 +410,6 @@
     /*------------------------------------------------------------------------
        Get type and subtype of the frame first 
     ------------------------------------------------------------------------*/
-    pBd->txBdToken = txBdToken;
     ucType = (ucTypeSubtype & WDI_FRAME_TYPE_MASK) >> WDI_FRAME_TYPE_OFFSET;
     ucSubType = (ucTypeSubtype & WDI_FRAME_SUBTYPE_MASK);
 
@@ -458,8 +459,7 @@
         pBd->dpuRF = BMUWQ_BTQM_TX_MGMT; 
     }
 
-    if (ucTxFlag & WDI_USE_FW_IN_TX_PATH ||
-            (pWDICtx->sendMgmtPktViaWQ5 && (ucType == WDI_MAC_MGMT_FRAME)))
+    if (ucTxFlag & WDI_USE_FW_IN_TX_PATH)
     {
         WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
           "iType: %d SubType %d, MAC S: %08x. MAC D: %08x., Tid=%d",
@@ -553,18 +553,10 @@
         }
 #endif
 
-        if(ucTxFlag & WDI_USE_BD_RATE_1_MASK)
+        if(ucTxFlag & WDI_USE_BD_RATE_MASK)
         {
             pBd->bdRate = WDI_BDRATE_BCDATA_FRAME;
         }
-        else if(ucTxFlag & WDI_USE_BD_RATE_2_MASK)
-        {
-            pBd->bdRate = WDI_BDRATE_BCMGMT_FRAME;
-        }
-        else if(ucTxFlag & WDI_USE_BD_RATE_3_MASK)
-        {
-            pBd->bdRate = WDI_BDRATE_CTRL_FRAME;
-        }
 
         pBd->rmf    = WDI_RMF_DISABLED;     
 
@@ -892,13 +884,6 @@
    
             WDI_STATableGetStaType(pWDICtx, ucStaId, &ucSTAType);
             if(!ucUnicastDst)
-#ifdef WLAN_FEATURE_RMC
-              /*Check for RMC enabled bit if set then
-                queue frames in QID 5 else 0*/
-              if ( ucTxFlag & WDI_RMC_REQUESTED_MASK )
-                pBd->queueId = BTQM_QID5;
-              else
-#endif
                 pBd->queueId = BTQM_QID0;
 #ifndef HAL_SELF_STA_PER_BSS
             else if( ucUnicastDst && (ucStaId == pWDICtx->ucSelfStaId))
diff --git a/wlan/prima/CORE/WDI/CP/src/wlan_qct_wdi_sta.c b/wlan/prima/CORE/WDI/CP/src/wlan_qct_wdi_sta.c
index 9b8aa78..8f0190c 100644
--- a/wlan/prima/CORE/WDI/CP/src/wlan_qct_wdi_sta.c
+++ b/wlan/prima/CORE/WDI/CP/src/wlan_qct_wdi_sta.c
@@ -42,6 +42,9 @@
   Are listed for each API below.
 
 
+  Copyright (c) 2008 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
diff --git a/wlan/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h b/wlan/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h
index 483ad65..9bebb44 100644
--- a/wlan/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h
+++ b/wlan/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,6 +39,8 @@
  *  This file contains the external API exposed by the 
  *   wlan device abstarction layer module.
  *
+ *   Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ *   Qualcomm Confidential and Proprietary
  */
 
 
@@ -68,7 +70,6 @@
    wpt_uint16 fPktlen;
    wpt_status txCompleteStatus;
    wpt_uint8  staIdx;
-   wpt_uint32  txBdToken;
 } WDI_DS_TxMetaInfoType;
 
 
@@ -87,20 +88,6 @@
   WDI_DS_OPCODE_MAX
 }WDI_DS_BAOpCodeEnumType;
 
-#define WDI_DS_LOG_PKT_TYPE_LEN 4
-typedef enum
-{
-  WDI_DS_PACKET_LOG = 1<<0,
-
-  // Insert new values before this
-
-  // If the value of WDI_DS_MAX LOG is increased please
-  // make sure to change the data type of
-  // WDI_DS_RxMetaInfoType.loggingData from wpt_uint8
-  // to accommodate more values
-  WDI_DS_MAX_LOG    = 1<<31
-}WDI_DS_LoggingDataEnumType;
-
 typedef struct 
 {
    wpt_uint8 staId;
@@ -168,12 +155,10 @@
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
    wpt_uint32 offloadScanLearn;
    wpt_uint32 roamCandidateInd;
-   wpt_uint32 perRoamCndInd;
 #endif
 #ifdef WLAN_FEATURE_EXTSCAN
    wpt_uint32 extscanBuffer;
 #endif
-   wpt_uint32 loggingData;
 } WDI_DS_RxMetaInfoType;
 
 typedef struct sPktMetaInfo
@@ -185,19 +170,6 @@
    } u;
 } WDI_DS_MetaInfoType;
 
-typedef struct
-{
-   wpt_uint16 status;
-   wpt_boolean active;
-   wpt_uint64 logBuffAddress[MAX_NUM_OF_BUFFER];
-   wpt_uint32 logBuffLength[MAX_NUM_OF_BUFFER];
-   /* Log type i.e. Mgmt frame = 0, QXDM = 1, FW Mem dump = 2 */
-   wpt_uint8   logType;
-   /* Indicate if Last segment of log is received*/
-   wpt_boolean done;
-   wpt_uint16 reasonCode;
-} WDI_DS_LoggingSessionType;
-
 WPT_STATIC WPT_INLINE WDI_DS_RxMetaInfoType* WDI_DS_ExtractRxMetaData (wpt_packet *pFrame)
 {
   WDI_DS_RxMetaInfoType * pRxMetadata =
@@ -217,7 +189,6 @@
 typedef void (*WDI_DS_TxCompleteCallback)(void *pContext, wpt_packet *pFrame);
 typedef void (*WDI_DS_RxPacketCallback) (void *pContext, wpt_packet *pFrame);
 typedef void (*WDI_DS_TxFlowControlCallback)(void *pContext, wpt_uint8 ac_mask);
-typedef void (*WDI_DS_RxLogCallback)(wpt_uint8 logType);
 
 
 
@@ -240,7 +211,6 @@
   WDI_DS_TxCompleteCallback pfnTxCompleteCallback,
   WDI_DS_RxPacketCallback pfnRxPacketCallback, 
   WDI_DS_TxFlowControlCallback pfnTxFlowControlCallback,
-  WDI_DS_RxLogCallback pfnRxLogCallback,
   void *pCallbackContext);
 
 
@@ -386,7 +356,4 @@
  */
 void WDI_DS_ClearTrafficStats(void);
 
-void *WDI_DS_GetLoggingMbPhyAddr(void *pContext);
-void *WDI_DS_GetLoggingMbAddr(void *pContext);
-void *WDI_DS_GetLoggingSession(void *pContext);
 #endif
diff --git a/wlan/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds_i.h b/wlan/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds_i.h
index 3a5f53d..b6bf52f 100644
--- a/wlan/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds_i.h
+++ b/wlan/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds_i.h
@@ -39,6 +39,8 @@
  *   This file contains the external API exposed by the
  *   wlan device abstarction layer module.
  *
+ *   Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ *   Qualcomm Confidential and Proprietary
  */
 
 #include "wlan_qct_pal_type.h"
@@ -47,7 +49,7 @@
 #include "wlan_qct_pal_trace.h"
 #include "wlan_qct_wdi_ds.h"
 #include "wlan_qct_dxe.h"
-#include "wlan_hal_msg.h"
+
 
 #define WDI_DS_MAX_CHUNK_SIZE 128
 #define WDI_802_11_MAX_HEADER_LEN 40
@@ -145,21 +147,11 @@
    wpt_uint8   staIdx;
 } WDI_DS_staIdxPerBssIdxType;
 
-typedef struct
-{
-   void *   pLoggingMbVirtAddress;
-   void *   pLoggingMbPhysAddress;
-   WDI_DS_LoggingSessionType loggingSession;
-} WDI_DS_LoggingMbType;
-
 WDI_Status WDI_DS_MemPoolCreate(WDI_DS_BdMemPoolType *memPool, wpt_uint8 chunkSize, wpt_uint8 numChunks);
 void *WDI_DS_MemPoolAlloc(WDI_DS_BdMemPoolType *memPool, void **pPhysAddress, WDI_ResPoolType wdiResPool);
 void  WDI_DS_MemPoolFree(WDI_DS_BdMemPoolType *memPool, void *pVirtAddress, void *pPhysAddress);
 void WDI_DS_MemPoolDestroy(WDI_DS_BdMemPoolType *memPool);
 
-WDI_Status WDI_DS_LoggingMbCreate(WDI_DS_LoggingMbType *pLoggingMailbox, wpt_uint8 size);
-void WDI_DS_LoggingMbDestroy(WDI_DS_LoggingMbType *pLoggingMailbox);
-
 typedef struct
 {
   void                            *pcontext;
@@ -170,9 +162,7 @@
   WDI_DS_RxPacketCallback          receiveFrameCB;
   WDI_DS_TxCompleteCallback        txCompleteCB;
   WDI_DS_TxFlowControlCallback     txResourceCB;
-  WDI_DS_RxLogCallback             rxLogCB;
   WDI_DS_staIdxPerBssIdxType       staIdxPerBssIdxTable[WDI_DS_MAX_SUPPORTED_BSS];
-  WDI_DS_LoggingMbType             loggingMbContext;
 } WDI_DS_ClientDataType;
 
 WPT_STATIC WPT_INLINE void WDI_GetBDPointers(wpt_packet *pFrame, void **pVirt, void **pPhys)
diff --git a/wlan/prima/CORE/WDI/DP/src/wlan_qct_wdi_bd.c b/wlan/prima/CORE/WDI/DP/src/wlan_qct_wdi_bd.c
index b29efa7..4284658 100644
--- a/wlan/prima/CORE/WDI/DP/src/wlan_qct_wdi_bd.c
+++ b/wlan/prima/CORE/WDI/DP/src/wlan_qct_wdi_bd.c
@@ -36,6 +36,8 @@
  *  This file contains the external API implemntation exposed by the
  *   wlan device abstarction layer module.
  *
+ *   Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ *   Qualcomm Confidential and Proprietary
  */
 
 #include "wlan_qct_wdi.h"
@@ -191,42 +193,6 @@
   wpalMemoryFree(memPool->AllocationBitmap);
   wpalMemoryZero(memPool, sizeof(*memPool));
 }
-
-WDI_Status WDI_DS_LoggingMbCreate(WDI_DS_LoggingMbType *pLoggingMailbox, wpt_uint8 size)
-{
-  pLoggingMailbox->pLoggingMbVirtAddress = wpalDmaMemoryAllocate(size,
-          &(pLoggingMailbox->pLoggingMbPhysAddress));
-  if (pLoggingMailbox->pLoggingMbVirtAddress == 0)
-    return WDI_STATUS_E_FAILURE;
-  return WDI_STATUS_SUCCESS;
-}
-
-void *WDI_DS_GetLoggingMbPhyAddr(void *pContext)
-{
-  WDI_DS_ClientDataType *pClientData = WDI_DS_GetDatapathContext(pContext);
-
-  return pClientData->loggingMbContext.pLoggingMbPhysAddress;
-}
-
-void *WDI_DS_GetLoggingMbAddr(void *pContext)
-{
-  WDI_DS_ClientDataType *pClientData = pContext;
-
-  return pClientData->loggingMbContext.pLoggingMbVirtAddress;
-}
-
-void*WDI_DS_GetLoggingSession(void *pContext)
-{
-  WDI_DS_ClientDataType *pClientData = pContext;
-
-  return &pClientData->loggingMbContext.loggingSession;
-}
-
-void WDI_DS_LoggingMbDestroy(WDI_DS_LoggingMbType *pLoggingMailbox)
-{
-  wpalDmaMemoryFree(pLoggingMailbox->pLoggingMbVirtAddress);
-}
-
 /*
  * Allocate chunk memory
  */
diff --git a/wlan/prima/CORE/WDI/DP/src/wlan_qct_wdi_ds.c b/wlan/prima/CORE/WDI/DP/src/wlan_qct_wdi_ds.c
index 902c0de..572cd18 100644
--- a/wlan/prima/CORE/WDI/DP/src/wlan_qct_wdi_ds.c
+++ b/wlan/prima/CORE/WDI/DP/src/wlan_qct_wdi_ds.c
@@ -36,6 +36,8 @@
  *  This file contains the external API implemntation exposed by the 
  *   wlan device abstarction layer module.
  *
+ *   Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ *   Qualcomm Confidential and Proprietary
  */
 
 
@@ -69,7 +71,6 @@
   WDI_DS_TxCompleteCallback pfnTxCompleteCallback,
   WDI_DS_RxPacketCallback pfnRxPacketCallback,
   WDI_DS_TxFlowControlCallback pfnTxFlowControlCallback,
-  WDI_DS_RxLogCallback pfnRxLogCallback,
   void *pCallbackContext)
 {
   WDI_DS_ClientDataType *pClientData;
@@ -95,7 +96,6 @@
   pClientData->receiveFrameCB = pfnRxPacketCallback;
   pClientData->txCompleteCB = pfnTxCompleteCallback;
   pClientData->txResourceCB = pfnTxFlowControlCallback;
-  pClientData->rxLogCB = pfnRxLogCallback;
   pClientData->pCallbackContext = pCallbackContext;
 
   for(bssLoop = 0; bssLoop < WDI_DS_MAX_SUPPORTED_BSS; bssLoop++)
@@ -212,8 +212,7 @@
               "Packet Length is %d\n", pTxMetadata->fPktlen);
   }
   wdiStatus = WDI_FillTxBd(pContext, ucTypeSubtype, pSTAMACAddress, pAddr2MACAddress,
-    &ucUP, 1, pvBDHeader, ucTxFlag /* No ACK */, ucProtMgmtFrame, 0, isEapol, &staId,
-    pTxMetadata->txBdToken);
+    &ucUP, 1, pvBDHeader, ucTxFlag /* No ACK */, ucProtMgmtFrame, 0, isEapol, &staId);
 
   if(WDI_STATUS_SUCCESS != wdiStatus)
   {
diff --git a/wlan/prima/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h b/wlan/prima/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h
index 16bfad0..8ca1240 100644
--- a/wlan/prima/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h
+++ b/wlan/prima/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h
@@ -39,6 +39,8 @@
   service module.
   
       
+  Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 
diff --git a/wlan/prima/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c b/wlan/prima/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c
index 9c04d88..41b6e37 100644
--- a/wlan/prima/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c
+++ b/wlan/prima/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -42,6 +42,9 @@
   Are listed for each API below.
 
 
+  Copyright (c) 2010-2011 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ===========================================================================*/
 
 /*===========================================================================
@@ -134,7 +137,6 @@
    WCTS_RxMsgCBType       wctsRxMsgCB;
    void*                  wctsRxMsgCBData;
    WCTS_StateType         wctsState;
-   vos_spin_lock_t        wctsStateLock;
    smd_channel_t*         wctsChannel;
    wpt_list               wctsPendingQueue;
    wpt_uint32             wctsMagic;
@@ -166,7 +168,15 @@
 /*----------------------------------------------------------------------------
  * Static Variable Definitions
  * -------------------------------------------------------------------------*/
+#ifdef FEATURE_R33D
+/* R33D will not close SMD port
+ * If receive close request from WDI, just pretend as port closed,
+ * Store control block info static memory, and reuse next open */
+static WCTS_ControlBlockType  *ctsCB;
 
+/* If port open once, not try to actual open next time */
+static int                     port_open;
+#endif /* FEATURE_R33D */
 /*----------------------------------------------------------------------------
  * Static Function Declarations and Definitions
  * -------------------------------------------------------------------------*/
@@ -551,13 +561,10 @@
       /* SMD channel was closed from the remote side,
        * this would happen only when Riva crashed and SMD is
        * closing the channel on behalf of Riva */
-      vos_spin_lock_acquire(&pWCTSCb->wctsStateLock);
       pWCTSCb->wctsState = WCTS_STATE_REM_CLOSED;
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                  "%s: received SMD_EVENT_CLOSE WLAN driver going down now",
                  __func__);
-      vos_spin_lock_release(&pWCTSCb->wctsStateLock);
-
       /* subsystem restart: shutdown */
       wpalDriverShutdown();
       return;
@@ -568,7 +575,7 @@
       return;
 
    case SMD_EVENT_REOPEN_READY:
-      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: received SMD_EVENT_REOPEN_READY from SMD", __func__);
 
       /* unlike other events which occur when our kernel threads are
@@ -665,6 +672,19 @@
        return (WCTS_HandleType)pWCTSCb;
    }
 
+#ifdef FEATURE_R33D
+   if(port_open)
+   {
+      /* Port open before, not need to open again */
+      /* notified registered client that the channel is open */
+      ctsCB->wctsState = WCTS_STATE_OPEN;
+      ctsCB->wctsNotifyCB((WCTS_HandleType)ctsCB,
+                           WCTS_EVENT_OPEN,
+                           ctsCB->wctsNotifyCBData);
+      return (WCTS_HandleType)ctsCB;
+   }
+#endif /* FEATURE_R33D */
+
    /* allocate a ControlBlock to hold all context */
    pWCTSCb = wpalMemoryAllocate(sizeof(*pWCTSCb));
    if (NULL == pWCTSCb) {
@@ -679,6 +699,12 @@
       values */
    wpalMemoryZero(pWCTSCb, sizeof(*pWCTSCb));
 
+#ifdef FEATURE_R33D
+   smd_init(0);
+   port_open = 1;
+   ctsCB = pWCTSCb;
+#endif /* FEATURE_R33D */
+
    /*Initialise the event*/
    wpalEventInit(&pWCTSCb->wctsEvent);
 
@@ -691,7 +717,6 @@
    /* initialize the remaining fields */
    wpal_list_init(&pWCTSCb->wctsPendingQueue);
    pWCTSCb->wctsMagic   = WCTS_CB_MAGIC;
-   vos_spin_lock_init(&pWCTSCb->wctsStateLock);
    pWCTSCb->wctsState   = WCTS_STATE_OPEN_PENDING;
    pWCTSCb->wctsChannel = NULL;
 
@@ -792,6 +817,18 @@
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
+#ifdef FEATURE_R33D
+   /* Not actually close port, just pretend */
+   /* notified registered client that the channel is closed */
+   pWCTSCb->wctsState = WCTS_STATE_CLOSED;
+   pWCTSCb->wctsNotifyCB((WCTS_HandleType)pWCTSCb,
+                         WCTS_EVENT_CLOSE,
+                         pWCTSCb->wctsNotifyCBData);
+
+   printk(KERN_ERR "R33D Not need to close");
+   return eWLAN_PAL_STATUS_SUCCESS;
+#endif /* FEATURE_R33D */
+
    /*Free the buffers in the pending queue.*/
    while (eWLAN_PAL_STATUS_SUCCESS ==
           wpal_list_remove_front(&pWCTSCb->wctsPendingQueue, &pNode)) {
@@ -837,7 +874,7 @@
    pWCTSCb->wctsNotifyCB((WCTS_HandleType)pWCTSCb,
                          WCTS_EVENT_CLOSE,
                          pWCTSCb->wctsNotifyCBData);
-   vos_spin_lock_destroy(&pWCTSCb->wctsStateLock);
+
    /* release the resource */
    pWCTSCb->wctsMagic = 0;
    wpalMemoryFree(pWCTSCb);
@@ -959,16 +996,14 @@
          to that state.  when we do so, we enable the remote read
          interrupt so that we'll be notified when messages are read
          from the remote end */
-      vos_spin_lock_acquire(&pWCTSCb->wctsStateLock);
-      if ((WCTS_STATE_DEFERRED != pWCTSCb->wctsState) &&
-                        (WCTS_STATE_REM_CLOSED != pWCTSCb->wctsState)) {
+      if (WCTS_STATE_DEFERRED != pWCTSCb->wctsState) {
 
-         /* Mark the state as deferred.*/
+         /* Mark the state as deferred.
+            Later: We may need to protect wctsState by locks*/
          pWCTSCb->wctsState = WCTS_STATE_DEFERRED;
 
          smd_enable_read_intr(pWCTSCb->wctsChannel);
       }
-      vos_spin_lock_release(&pWCTSCb->wctsStateLock);
 
       /*indicate to client that message was placed in deferred queue*/
       return eWLAN_PAL_STATUS_E_RESOURCES;
diff --git a/wlan/prima/CORE/WDI/TRP/DTS/inc/wlan_qct_wdi_dts.h b/wlan/prima/CORE/WDI/TRP/DTS/inc/wlan_qct_wdi_dts.h
index 363c946..657ca86 100644
--- a/wlan/prima/CORE/WDI/TRP/DTS/inc/wlan_qct_wdi_dts.h
+++ b/wlan/prima/CORE/WDI/TRP/DTS/inc/wlan_qct_wdi_dts.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -41,6 +41,8 @@
  * This file contains the API exposed by the 
  * wlan device abstarction layer module for abstracting DXE/SDIO.
  *
+ * Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ * Qualcomm Confidential and Proprietary
  *
  * Example usage for DXE.
  * ----------------------
@@ -72,18 +74,9 @@
    WDTS_CHANNEL_TX_HIGH_PRI,
    WDTS_CHANNEL_RX_LOW_PRI,
    WDTS_CHANNEL_RX_HIGH_PRI,
-   WDTS_CHANNEL_RX_LOG,
-   WDTS_CHANNEL_RX_FW_LOG,
    WDTS_CHANNEL_MAX
 }  WDTS_ChannelType;
 
-#define WDTS_TRANSPORT_CHANNELS_MASK \
-        (1<<WDTS_CHANNEL_TX_LOW_PRI | 1<<WDTS_CHANNEL_TX_HIGH_PRI \
-         | 1<<WDTS_CHANNEL_RX_LOW_PRI | 1<<WDTS_CHANNEL_RX_HIGH_PRI)
-
-#define WDTS_RX_LOG_CHANNEL_MASK (1<<WDTS_CHANNEL_RX_LOG)
-#define WDTS_RX_FW_LOG_CHANNEL_MASK (1<<WDTS_CHANNEL_RX_FW_LOG)
-
 typedef enum
 {
    WDTS_POWER_STATE_FULL,
@@ -93,19 +86,11 @@
    WDTS_POWER_STATE_MAX
 } WDTS_PowerStateType;
 
-typedef enum
-{
-   WDTS_LOGGING_STATUS_SUCCESS,
-   WDTS_LOGGING_STATUS_ERROR
-} WDTS_LoggingSessionStatus;
 
 typedef wpt_status (*WDTS_TxCompleteCbType)(void *pContext, wpt_packet *pFrame, wpt_status status);
 typedef wpt_status (*WDTS_RxFrameReadyCbType) (void *pContext, wpt_packet *pFrame, WDTS_ChannelType channel);
 typedef wpt_status (*WDTS_LowResourceCbType)(void *pContext, WDTS_ChannelType channel, wpt_boolean on);
 typedef void  (*WDTS_SetPSCbType)(wpt_status  status, unsigned int dxePhyAddr);
-typedef void (*WDTS_MbReceiveMsgType)(void *pContext);
-typedef void (*WDTS_RxLogDoneType)(void *pContext);
-
 /* DTS Set power state ACK callback. 
  * This callback function should be invoked by the DTS to notify WDI that set
  * power state request is complete.
@@ -118,31 +103,21 @@
 typedef void  (*WDTS_SetPowerStateCbType)(wpt_status   status,
                                           unsigned int dxePhyAddr,
                                           void*        pUserData);
-typedef struct
-{
-   WDTS_RxFrameReadyCbType  rxFrameReadyCB;
-   WDTS_TxCompleteCbType    txCompleteCB;
-   WDTS_LowResourceCbType   lowResourceCB;
-   WDTS_MbReceiveMsgType    receiveMbMsgCB;
-   WDTS_RxLogDoneType       receiveLogCompleteCB;
-}WDTS_ClientCallbacks;
 
 typedef struct {
   void * (*open)(void);
   wpt_status (*start) (void *pContext);
-  wpt_status (*register_client)(void *pContext, WDTS_ClientCallbacks, void *clientData);
+  wpt_status (*register_client)(void *pContext, WDTS_RxFrameReadyCbType, 
+      WDTS_TxCompleteCbType, WDTS_LowResourceCbType, void *clientData);
   wpt_status (*xmit) (void *pContext, wpt_packet *packet, WDTS_ChannelType channel);
   wpt_status (*txComplete) (void *pContext, wpt_uint32 ucTxResReq);
   wpt_status (*setPowerState) (void *pContext, WDTS_PowerStateType   powerState, 
                                WDTS_SetPSCbType cBack);
   void (*channelDebug)(wpt_boolean displaySnapshot,
                        wpt_uint8   debugFlags);
-  void (*kickDxe) (void);
   wpt_status (*stop) (void *pContext);
   wpt_status (*close) (void *pContext);
   wpt_uint32 (*getFreeTxDataResNumber) (void *pContext);
-  wpt_uint32 (*setupLogTransfer) (wpt_uint64 bufferAddr, wpt_uint32 bufferSize);
-  wpt_status  (*startLogTransfer) (void);
 } WDTS_TransportDriverTrype;
 
 typedef struct {
@@ -261,15 +236,6 @@
  */
 void WDTS_ChannelDebug(wpt_boolean displaySnapshot, wpt_uint8 debugFlags);
 
-/* DTS Transport Channel Kick Dxe
- * Request Kick DXE when HDD TX timeout happen
- *
- * Parameters  : NONE
- * Return Value: NONE
- *
- */
-void WDTS_ChannelKickDxe(void);
-
 /* DTS Stop function. 
  * Stop Transport driver, ie DXE, SDIO
  * Parameters:
diff --git a/wlan/prima/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c b/wlan/prima/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
index 22c9a01..27953ac 100644
--- a/wlan/prima/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
+++ b/wlan/prima/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,6 +36,8 @@
  *  This file contains the external API implemntation exposed by the 
  *   wlan device abstarction layer module.
  *
+ *   Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
+ *   Qualcomm Confidential and Proprietary
  */
 
 
@@ -46,9 +48,10 @@
 #include "wlan_qct_wdi_dts.h"
 #include "wlan_qct_wdi_dp.h"
 #include "wlan_qct_wdi_sta.h"
-#include "vos_utils.h"
-#include "vos_api.h"
 
+#ifdef DEBUG_ROAM_DELAY
+#include "vos_utils.h"
+#endif
 
 static WDTS_TransportDriverTrype gTransportDriver = {
   WLANDXE_Open, 
@@ -58,12 +61,9 @@
   WLANDXE_CompleteTX,
   WLANDXE_SetPowerState,
   WLANDXE_ChannelDebug,
-  WLANDXE_KickDxe,
   WLANDXE_Stop,
   WLANDXE_Close,
-  WLANDXE_GetFreeTxDataResNumber,
-  WLANDXE_SetupLogTransfer,
-  WLANDXE_StartLogTransfer
+  WLANDXE_GetFreeTxDataResNumber
 };
 
 static WDTS_SetPowerStateCbInfoType gSetPowerStateCbInfo;
@@ -76,25 +76,6 @@
    uint32 tputBpus;  //unit in Bytes per usec: round off to integral value
 }WDTS_RateInfo;
 
-#define WDTS_MAX_NUMBER_OF_RX_PKT 5
-#define WDTS_MAX_PAGE_SIZE 4096
-#define WDTS_MAX_RXDB_DATA_SIZE 128
-
-struct WDTS_RxPktInfo
-{
-    uint8 rx_bd[WDTS_MAX_RXDB_DATA_SIZE];
-    void *pFrame_head;
-    void *pFrame_tail;
-    uint32 pFrame_len;
-};
-
-static struct WDTS_PktInfoBuff
-{
-    struct WDTS_RxPktInfo PktInfo[WDTS_MAX_NUMBER_OF_RX_PKT];
-    uint32 current_count;
-    uint8 current_position;
-}WDTS_Pkt_Data_Buff = { .current_position = 0, .current_count = 0 };
-
 #define WDTS_MAX_RATE_NUM               137
 #define WDTS_MAX_11B_RATE_NUM           8
 #define MB_PER_SEC_TO_BYTES_PER_MSEC    13
@@ -433,9 +414,6 @@
 
   // Do Sanity checks
   if(NULL == pContext || NULL == pFrame){
-    VOS_TRACE(VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_WARN,
-                 "%s: Tx complete cannot proceed(%p:%p)",
-                 __func__, pContext, pFrame);
     return eWLAN_PAL_STATUS_E_FAILURE;
   }
 
@@ -474,8 +452,6 @@
     // intentional fall-through to handle eapol packet as mgmt
     case WDI_MAC_MGMT_FRAME:
       WDI_DS_MemPoolFree(&(pClientData->mgmtMemPool), pvBDHeader, physBDHeader);
-      VOS_TRACE(VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_INFO,
-                   "%s: Management frame Tx complete status: %d", __func__, status);
       break;
   }
   WDI_SetBDPointers(pFrame, 0, 0);
@@ -535,56 +511,6 @@
 #endif
 }
 
-/* Store RXBD, skb lenght, skb head, and skb end offset to global buffer.
- * This function should  be invoked when MPDU lenght + MPDU herader Offset
- * if higher then 3872 bytes.
- * Parameters:
- * pFrame:Refernce to PAL frame.
- * pBDHeader: BD header for PAL Frame.
- * Return Value: v_VOID_t
- *
- */
-v_VOID_t
-WDTS_StoreMetaInfo(wpt_packet *pFrame, wpt_uint8 *pBDHeader)
-{
-    wpt_uint8  usMPDUHLen;
-    wpt_boolean usAsf, usAef, usLsf, usESF;
-    wpt_uint16 usMPDULen;
-    wpt_uint32 usPmiCmd24to25;
-    struct WDTS_RxPktInfo *current_data =
-           &WDTS_Pkt_Data_Buff.PktInfo[WDTS_Pkt_Data_Buff.current_position];
-
-    vos_mem_copy(current_data->rx_bd, (void*)wpalPacketGetRawBuf(pFrame),
-                                                       WDTS_MAX_RXDB_DATA_SIZE);
-
-    usMPDULen = (wpt_uint16)WDI_RX_BD_GET_MPDU_LEN(pBDHeader);
-    usMPDUHLen = (wpt_uint8)WDI_RX_BD_GET_MPDU_H_LEN(pBDHeader);
-    usAsf = (wpt_boolean)WDI_RX_BD_GET_ASF(pBDHeader);
-    usAef = (wpt_boolean)WDI_RX_BD_GET_AEF(pBDHeader);
-    usLsf = (wpt_boolean)WDI_RX_BD_GET_LSF(pBDHeader);
-    usESF = (wpt_boolean)WDI_RX_BD_GET_ESF(pBDHeader);
-    usPmiCmd24to25 = (wpt_uint32)WDI_RX_BD_GET_PMICMD_24TO25(pBDHeader);
-
-    current_data->pFrame_head = wpalGetOSPktHead(pFrame);
-    current_data->pFrame_tail = wpalGetOSPktend(pFrame);
-    current_data->pFrame_len = wpalPacketGetLength(pFrame);
-
-    WDTS_Pkt_Data_Buff.current_count++;
-
-    /* Dump packet info */
-    VOS_TRACE(VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ERROR,
-                  "count: %d usMPDULen: 0x%x, usMPDUHLen: 0x%x, usAsf: %x,"
-                  "usAef: %x, usLsf: 0x%x, usESF: 0x%x, usPmiCmd24to25: 0x%x,"
-                  "skb_len: 0x%x",WDTS_Pkt_Data_Buff.current_count, usMPDULen,
-                  usMPDUHLen, usAsf, usAef, usLsf, usESF, usPmiCmd24to25,
-                  current_data->pFrame_len);
-
-    WDTS_Pkt_Data_Buff.current_position++;
-    if(WDTS_Pkt_Data_Buff.current_position >= WDTS_MAX_NUMBER_OF_RX_PKT)
-       WDTS_Pkt_Data_Buff.current_position = 0;
-
-    return;
-}
 
 /* DTS Rx packet function. 
  * This function should be invoked by the transport device to indicate 
@@ -606,8 +532,6 @@
   wpt_uint16                  usMPDUDOffset, usMPDULen;
   WDI_DS_RxMetaInfoType     *pRxMetadata;
   wpt_uint8                  isFcBd = 0;
-  WDI_DS_LoggingSessionType *pLoggingSession;
-  tPerPacketStats             rxStats = {0};
 
   tpSirMacFrameCtl  pMacFrameCtl;
   // Do Sanity checks
@@ -615,16 +539,6 @@
     return eWLAN_PAL_STATUS_E_FAILURE;
   }
 
-  // Normal DMA transfer does not contain RxBD
-  if (WDTS_CHANNEL_RX_FW_LOG == channel)
-  {
-      pLoggingSession = (WDI_DS_LoggingSessionType *)
-                         WDI_DS_GetLoggingSession(pContext);
-      wpalFwLogPktSerialize(pFrame, pLoggingSession->logType);
-
-      return eWLAN_PAL_STATUS_SUCCESS;
-  }
-
   /*------------------------------------------------------------------------
     Extract BD header and check if valid
     ------------------------------------------------------------------------*/
@@ -671,53 +585,6 @@
       ucMPDUHOffset, usMPDUDOffset, usMPDULen, ucMPDUHLen, ucTid,
       WDI_RX_BD_HEADER_SIZE);
 
-  pRxMetadata = WDI_DS_ExtractRxMetaData(pFrame);
-
-  // Special handling for frames which contain logging information
-  if (WDTS_CHANNEL_RX_LOG == channel)
-  {
-      if (VPKT_SIZE_BUFFER_ALIGNED < (usMPDULen+ucMPDUHOffset))
-      {
-          /* Size of the packet tranferred by the DMA engine is
-           * greater than the the memory allocated for the skb
-           * Recover the SKB  case of length is in same memory page
-           */
-          WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                   "Invalid Frame size, might memory corrupted(%d+%d/%d)",
-                   usMPDULen, ucMPDUHOffset, VPKT_SIZE_BUFFER_ALIGNED);
-
-          // Store RXBD,  skb head, tail and skb lenght in circular buffer
-          WDTS_StoreMetaInfo(pFrame, pBDHeader);
-
-          if ((usMPDULen+ucMPDUHOffset) <= WDTS_MAX_PAGE_SIZE)
-          {
-              wpalRecoverTail(pFrame);
-              wpalPacketFree(pFrame);
-          } else {
-              //Recovery may cause adjoining buffer corruption
-              WPAL_BUG(0);
-          }
-
-          return eWLAN_PAL_STATUS_SUCCESS;
-      }
-
-      /* Firmware should send the Header offset as length
-       * of RxBd and data length should be populated to
-       * the length of total data being sent
-       */
-      wpalPacketSetRxLength(pFrame, usMPDULen+ucMPDUHOffset);
-      wpalPacketRawTrimHead(pFrame, ucMPDUHOffset);
-
-      // Invoke Rx complete callback
-      wpalLogPktSerialize(pFrame);
-
-      return eWLAN_PAL_STATUS_SUCCESS;
-  }
-  else
-  {
-      pRxMetadata->loggingData = 0;
-  }
-
   if(!isFcBd)
   {
       if(usMPDUDOffset <= ucMPDUHOffset || usMPDULen < ucMPDUHLen) {
@@ -742,31 +609,19 @@
         ucMPDUHOffset = usMPDUDOffset;
       }
 
-      if (VPKT_SIZE_BUFFER_ALIGNED < (usMPDULen+ucMPDUHOffset))
-      {
-          /* Size of the packet tranferred by the DMA engine is
-           * greater than the the memory allocated for the skb
-           * Recover the SKB  case of length is in same memory page
-           */
-          WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+      if(VPKT_SIZE_BUFFER_ALIGNED < (usMPDULen+ucMPDUHOffset)){
+        WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
                    "Invalid Frame size, might memory corrupted(%d+%d/%d)",
                    usMPDULen, ucMPDUHOffset, VPKT_SIZE_BUFFER_ALIGNED);
 
-          // Store RXBD,  skb head, tail and skb lenght in circular buffer
-          WDTS_StoreMetaInfo(pFrame, pBDHeader);
+        /* Size of the packet tranferred by the DMA engine is
+         * greater than the the memory allocated for the skb
+         */
+        WPAL_BUG(0);
 
-          if ((usMPDULen+ucMPDUHOffset) <= WDTS_MAX_PAGE_SIZE)
-          {
-              wpalRecoverTail(pFrame);
-              wpalPacketFree(pFrame);
-          } else {
-              //Recovery may cause adjoining buffer corruption
-              WPAL_BUG(0);
-          }
-
-          return eWLAN_PAL_STATUS_SUCCESS;
+        wpalPacketFree(pFrame);
+        return eWLAN_PAL_STATUS_SUCCESS;
       }
-
       if(eWLAN_PAL_STATUS_SUCCESS != wpalPacketSetRxLength(pFrame, usMPDULen+ucMPDUHOffset))
       {
           DTI_TRACE( DTI_TRACE_LEVEL_ERROR, "Invalid Frame Length, Frame dropped..");
@@ -779,6 +634,9 @@
           wpalPacketFree(pFrame);
           return eWLAN_PAL_STATUS_SUCCESS;
       }
+     
+
+      pRxMetadata = WDI_DS_ExtractRxMetaData(pFrame);
 
       pRxMetadata->fc = isFcBd;
       pRxMetadata->staId = WDI_RX_BD_GET_STA_ID(pBDHeader);
@@ -804,7 +662,6 @@
 #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
       pRxMetadata->offloadScanLearn = WDI_RX_BD_GET_OFFLOADSCANLEARN(pBDHeader);
       pRxMetadata->roamCandidateInd = WDI_RX_BD_GET_ROAMCANDIDATEIND(pBDHeader);
-      pRxMetadata->perRoamCndInd = WDI_RX_BD_GET_PER_ROAMCANDIDATEIND(pBDHeader);
 #endif
 #ifdef WLAN_FEATURE_EXTSCAN
       pRxMetadata->extscanBuffer = WDI_RX_BD_GET_EXTSCANFULLSCANRESIND(pBDHeader);
@@ -873,27 +730,16 @@
       WPAL_PACKET_SET_BD_POINTER(pFrame, pBDHeader);
       WPAL_PACKET_SET_BD_LENGTH(pFrame, sizeof(WDI_RxBdType));
 
-      if (((WDI_ControlBlockType *)pClientData->pcontext)->roamDelayStatsEnabled)
+#ifdef DEBUG_ROAM_DELAY
+      //Hack we need to send the frame type, so we are using bufflen as frametype
+      vos_record_roam_event(e_DXE_RX_PKT_TIME, (void *)pFrame, pRxMetadata->type);
+      //Should we use the below check to avoid funciton calls
+      /*
+      if(gRoamDelayMetaInfo.dxe_monitor_tx)
       {
-          vos_record_roam_event(e_DXE_RX_PKT_TIME, (void *)pFrame, pRxMetadata->type);
       }
-      if ((WLAN_LOG_LEVEL_ACTIVE ==
-            vos_get_ring_log_level(RING_ID_PER_PACKET_STATS)) &&
-          !(WDI_MAC_CTRL_FRAME == pRxMetadata->type))
-      {
-          vos_mem_zero(&rxStats,sizeof(tPerPacketStats));
-          /* Peer tx packet and it is an Rx packet for us */
-          rxStats.is_rx= VOS_TRUE;
-          rxStats.tid = ucTid;
-          rxStats.rssi = (pRxMetadata->rssi0 > pRxMetadata->rssi1)?
-                                pRxMetadata->rssi0 : pRxMetadata->rssi1;
-          rxStats.rate_idx = pRxMetadata->rateIndex;
-          rxStats.seq_num = pRxMetadata->currentPktSeqNo;
-          rxStats.dxe_timestamp = vos_timer_get_system_ticks();
-          rxStats.data_len =
-               vos_copy_80211_data(pFrame, rxStats.data, pRxMetadata->type);
-          wpalPerPktSerialize(&rxStats);
-      }
+      */
+#endif
       // Invoke Rx complete callback
       pClientData->receiveFrameCB(pClientData->pCallbackContext, pFrame);  
   }
@@ -902,6 +748,7 @@
       wpalPacketSetRxLength(pFrame, usMPDULen+ucMPDUHOffset);
       wpalPacketRawTrimHead(pFrame, ucMPDUHOffset);
 
+      pRxMetadata = WDI_DS_ExtractRxMetaData(pFrame);
       //flow control related
       pRxMetadata->fc = isFcBd;
       pRxMetadata->mclkRxTimestamp = WDI_RX_BD_GET_TIMESTAMP(pBDHeader);
@@ -962,105 +809,6 @@
 
 }
 
-void WDTS_LogRxDone(void *pContext)
-{
-  WDI_DS_LoggingSessionType *pLoggingSession;
-
-  pLoggingSession = (WDI_DS_LoggingSessionType *)
-                       WDI_DS_GetLoggingSession(pContext);
-
-  if (NULL == pContext || pLoggingSession == NULL)
-  {
-    return;
-  }
-  /* check for done and Log type Mgmt frame = 0, QXDM = 1, FW Mem dump = 2 */
-  if (pLoggingSession->done && pLoggingSession->logType <= VALID_FW_LOG_TYPES)
-     vos_process_done_indication(pLoggingSession->logType,
-                                 pLoggingSession->reasonCode);
-
-
-  if (pLoggingSession->logType == QXDM_LOGGING &&
-     pLoggingSession->reasonCode)
-      pLoggingSession->logType = FATAL_EVENT;
-  ((WDI_DS_ClientDataType *)(pContext))->rxLogCB(pLoggingSession->logType);
-
-  pLoggingSession->done = 0;
-  pLoggingSession->logType = 0;
-  pLoggingSession->reasonCode = 0;
-
-  return;
-}
-
-void WDTS_MbReceiveMsg(void *pContext)
-{
-  tpLoggingMailBox pLoggingMb;
-  WDI_DS_LoggingSessionType *pLoggingSession;
-  wpt_int8 i, noMem = 0;
-  wpt_uint32 totalLen = 0;
-
-  pLoggingMb = (tpLoggingMailBox)WDI_DS_GetLoggingMbAddr(pContext);
-  pLoggingSession = (WDI_DS_LoggingSessionType *)
-                       WDI_DS_GetLoggingSession(pContext);
-
-  for(i = 0; i < MAX_NUM_OF_BUFFER; i++)
-  {
-      totalLen += pLoggingMb->logBuffLength[i];
-      // Send done indication when the logbuffer size exceeds 128KB.
-      if (totalLen > MAX_LOG_BUFFER_LENGTH || pLoggingMb->logBuffLength[i] > MAX_LOG_BUFFER_LENGTH)
-      {
-         DTI_TRACE( DTI_TRACE_LEVEL_ERROR, " %d received invalid log buffer length",
-                                              totalLen);
-         // Done using Mailbox, zero out the memory.
-         wpalMemoryZero(pLoggingMb, sizeof(tLoggingMailBox));
-         wpalMemoryZero(pLoggingSession, sizeof(WDI_DS_LoggingSessionType));
-         //Set Status as Failure
-         pLoggingSession->status = WDTS_LOGGING_STATUS_ERROR;
-         WDTS_LogRxDone(pContext);
-
-         return;
-      }
-  }
-
-  totalLen = 0;
-  for(i = 0; i < MAX_NUM_OF_BUFFER; i++)
-  {
-     pLoggingSession->logBuffAddress[i] = pLoggingMb->logBuffAddress[i];
-     if (!noMem)
-     {
-        pLoggingSession->logBuffLength[i] = gTransportDriver.setupLogTransfer(
-                                               pLoggingMb->logBuffAddress[i],
-                                               pLoggingMb->logBuffLength[i]);
-     }
-     else
-     {
-        pLoggingSession->logBuffLength[i] = 0;
-        continue;
-     }
-
-     totalLen += pLoggingSession->logBuffLength[i];
-
-     if (pLoggingSession->logBuffLength[i] < pLoggingMb->logBuffLength[i])
-     {
-        noMem = 1;
-     }
-  }
-
-  pLoggingSession->done = pLoggingMb->done;
-  pLoggingSession->logType = pLoggingMb->logType;
-  pLoggingSession->reasonCode = pLoggingMb->reasonCode;
-  pLoggingSession->status = WDTS_LOGGING_STATUS_SUCCESS;
-  // Done using Mailbox, zero out the memory.
-  wpalMemoryZero(pLoggingMb, sizeof(tLoggingMailBox));
-
-  if (totalLen)
-  {
-     if (gTransportDriver.startLogTransfer() == eWLAN_PAL_STATUS_SUCCESS)
-        return;
-  }
-
-  // Send Done event to upper layers, since we wont be getting any from DXE
-}
-
 /* DTS open  function. 
  * On open the transport device should initialize itself.
  * Parameters:
@@ -1076,7 +824,6 @@
   void *pDTDriverContext; 
   WDI_DS_ClientDataType *pClientData;
   WDI_Status sWdiStatus = WDI_STATUS_SUCCESS;
-  WDTS_ClientCallbacks WDTSCb;
 
   pClientData = (WDI_DS_ClientDataType*) wpalMemoryAllocate(sizeof(WDI_DS_ClientDataType));
   if (!pClientData){
@@ -1093,13 +840,8 @@
      return eWLAN_PAL_STATUS_E_FAILURE;
   }
   WDT_AssignTransportDriverContext(pContext, pDTDriverContext);
-
-  WDTSCb.rxFrameReadyCB = WDTS_RxPacket;
-  WDTSCb.txCompleteCB = WDTS_TxPacketComplete;
-  WDTSCb.lowResourceCB = WDTS_OOResourceNotification;
-  WDTSCb.receiveMbMsgCB = WDTS_MbReceiveMsg;
-  WDTSCb.receiveLogCompleteCB = WDTS_LogRxDone;
-  gTransportDriver.register_client(pDTDriverContext, WDTSCb, (void*)pClientData);
+  gTransportDriver.register_client(pDTDriverContext, WDTS_RxPacket, WDTS_TxPacketComplete, 
+    WDTS_OOResourceNotification, (void*)pClientData);
 
   /* Create a memory pool for Mgmt BDheaders.*/
   sWdiStatus = WDI_DS_MemPoolCreate(&pClientData->mgmtMemPool, WDI_DS_MAX_CHUNK_SIZE, 
@@ -1117,10 +859,6 @@
 
   wpalMemoryZero(&gDsTrafficStats, sizeof(gDsTrafficStats));
 
-  sWdiStatus = WDI_DS_LoggingMbCreate(&pClientData->loggingMbContext, sizeof(tLoggingMailBox));
-  if (WDI_STATUS_SUCCESS != sWdiStatus)
-    return eWLAN_PAL_STATUS_E_NOMEM;
-
   return eWLAN_PAL_STATUS_SUCCESS;
 
 }
@@ -1161,7 +899,6 @@
   WDI_DS_TxMetaInfoType     *pTxMetadata;
   WDTS_ChannelType channel = WDTS_CHANNEL_TX_LOW_PRI;
   wpt_status status = eWLAN_PAL_STATUS_SUCCESS;
-  tPerPacketStats               txPktStat = {0};
 
   // extract metadata from PAL packet
   pTxMetadata = WDI_DS_ExtractTxMetaData(pFrame);
@@ -1196,24 +933,16 @@
 #endif
   // Send packet to  Transport Driver. 
   status =  gTransportDriver.xmit(pDTDriverContext, pFrame, channel);
-  if ((WLAN_LOG_LEVEL_ACTIVE ==
-           vos_get_ring_log_level(RING_ID_PER_PACKET_STATS)) &&
-       !(pTxMetadata->frmType & WDI_MAC_CTRL_FRAME)){
-
-      vos_mem_zero(&txPktStat,sizeof(tPerPacketStats));
-      txPktStat.tid = pTxMetadata->fUP;
-      txPktStat.dxe_timestamp = vos_timer_get_system_ticks();
-      /*HW limitation cant get the seq number*/
-      txPktStat.seq_num = 0;
-      txPktStat.data_len =
-      vos_copy_80211_data((void *)pFrame, txPktStat.data,
-                   pTxMetadata->frmType);
-      wpalPerPktSerialize(&txPktStat);
-  }
-  if (((WDI_ControlBlockType *)pContext)->roamDelayStatsEnabled)
-  {
-      vos_record_roam_event(e_DXE_FIRST_XMIT_TIME, (void *)pFrame, pTxMetadata->frmType);
-  }
+#ifdef DEBUG_ROAM_DELAY
+   //Hack we need to send the frame type, so we are using bufflen as frametype
+   vos_record_roam_event(e_DXE_FIRST_XMIT_TIME, (void *)pFrame, pTxMetadata->frmType);
+   //Should we use the below check to avoid funciton calls
+   /*
+   if(gRoamDelayMetaInfo.dxe_monitor_tx)
+   {
+   }
+   */
+#endif
   return status;
 }
 
@@ -1302,19 +1031,6 @@
    return;
 }
 
-/* DTS Transport Channel Kick Dxe
- * Request Kick DXE when HDD TX time out happen
- *
- * Parameters  : NONE
- * Return Value: NONE
- *
- */
-void WDTS_ChannelKickDxe()
-{
-   gTransportDriver.kickDxe();
-   return;
-}
-
 /* DTS Stop function. 
  * Stop Transport driver, ie DXE, SDIO
  * Parameters:
@@ -1354,9 +1070,7 @@
   
   /*Destroy the mem pool for mgmt BD headers*/
   WDI_DS_MemPoolDestroy(&pClientData->dataMemPool);
-
-  WDI_DS_LoggingMbDestroy(&pClientData->loggingMbContext);
-
+  
   status =  gTransportDriver.close(pDTDriverContext);
 
   wpalMemoryFree(pClientData);
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_list.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_list.h
index bbbf492..357c432 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_list.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_list.h
@@ -36,6 +36,9 @@
                
    Definitions for platform dependent. It is with VOSS support.
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_status.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_status.h
index 01eac26..68c86bb 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_status.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_status.h
@@ -36,6 +36,9 @@
                
    Definitions for platform dependent(Windows XP). 
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_sync.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_sync.h
index ae76232..326d8c3 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_sync.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_sync.h
@@ -36,6 +36,9 @@
                
    Definitions for platform dependent(LA). 
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_timer.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_timer.h
index 162c2ca..a694530 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_timer.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_timer.h
@@ -36,6 +36,9 @@
                
    Definitions for platform dependent (Linux Android).
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_type.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_type.h
index a9a724e..eb44872 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_type.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_os_type.h
@@ -36,6 +36,9 @@
                
    Definitions for platform dependent. This is for Linux/Android
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pack_align.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pack_align.h
index f0c6045..c94af62 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pack_align.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pack_align.h
@@ -37,6 +37,9 @@
    Definitions for platform independent means of packing and aligning
    data structures
   
+   Copyright 2009 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_api.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_api.h
index c1a8d18..6c26f59 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_api.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_api.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,6 +36,9 @@
                
    Definitions for platform independent
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -326,30 +329,19 @@
 void wpalWcnssResetIntr(void);
 
 /*---------------------------------------------------------------------------
-    wpalWcnssIsProntoHwVer3 -  Check for Pronto ver3 HW
-
-    Param:
-       None
-    Return:
-       TRUE if Ponto Hw Ver 3
-       Therefore use WQ6 instead of WQ23 for TX Low/High Priority Channel
----------------------------------------------------------------------------*/
-int wpalWcnssIsProntoHwVer3(void);
-/*---------------------------------------------------------------------------
     wpalFwDumpReq -  Trigger the dump commands to Firmware
 
     Param:
-       cmd -   Command No. to execute
-       arg1 -  argument 1 to cmd
-       arg2 -  argument 2 to cmd
-       arg3 -  argument 3 to cmd
-       arg4 -  argument 4 to cmd
-       async -asynchronous event. Don't wait for completion.
+       cmd - Command No. to execute
+       arg1 - argument 1 to cmd
+       arg2 - argument 2 to cmd
+       arg3 - argument 3 to cmd
+       arg4 - argument 4 to cmd
     Return:
        NONE
 ---------------------------------------------------------------------------*/
 void wpalFwDumpReq(wpt_uint32 cmd, wpt_uint32 arg1, wpt_uint32 arg2,
-                    wpt_uint32 arg3, wpt_uint32 arg4, wpt_boolean async);
+                    wpt_uint32 arg3, wpt_uint32 arg4);
 
 /*---------------------------------------------------------------------------
     wpalDevicePanic -  Trigger Device Panic
@@ -364,14 +356,14 @@
 void wpalDevicePanic(void);
 
 /*---------------------------------------------------------------------------
-    wpalIslogPInProgress -  calls vos API vos_is_logp_in_progress()
+    wpalIsWDresetInProgress -  calls vos API isWDresetInProgress()
 
     Param:
        NONE
     Return:
        STATUS
 --------------------------------------------------------------------------*/
-int  wpalIslogPInProgress(void);
+int  wpalIsWDresetInProgress(void);
 
 /*---------------------------------------------------------------------------
     wpalIsSsrPanicOnFailure -  calls vos API isSsrPanicOnFailure()
@@ -382,11 +374,4 @@
        STATUS
 --------------------------------------------------------------------------*/
 int  wpalIsSsrPanicOnFailure(void);
-
-int  wpalGetDxeReplenishRXTimerVal(void);
-int  wpalIsDxeSSREnable(void);
-
-wpt_uint8 wpalIsFwLoggingEnabled(void);
-wpt_uint8 wpalIsFwLoggingSupported(void);
-wpt_uint8 wpalIsFwEvLoggingEnabled(void);
 #endif // __WLAN_QCT_PAL_API_H
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h
index bf13fe1..8cb3c32 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -306,10 +306,4 @@
 */
 void wpalInactivateRxInterrupt(void);
 
-
-int wpal_get_int_state
-(
-   wpt_uint32                          intType
-);
-
 #endif /* WLAN_QCT_PAL_DEVICE_H*/
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_list.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_list.h
index 4645c72..0d852ac 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_list.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_list.h
@@ -36,6 +36,9 @@
                
    Definitions for platform independent. 
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_msg.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_msg.h
index a059769..5e4219f 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_msg.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_msg.h
@@ -37,6 +37,9 @@
                
    Definitions for platform dependent. Only work with legacy UMAC.
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h
index e57fda9..917dfd5 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h
@@ -76,7 +76,7 @@
 #define VPKT_SIZE_BUFFER  ((30 * 128) + 32)
 
 /* Transport channel count to report DIAG */
-#define WPT_NUM_TRPT_CHANNEL      8
+#define WPT_NUM_TRPT_CHANNEL      4
 /* Transport channel name string size */
 #define WPT_TRPT_CHANNEL_NAME     4
 
@@ -412,86 +412,4 @@
 );
 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
 
-/*---------------------------------------------------------------------------
-    wpalLogPktSerialize - Serialize Logging data to logger thread
-
-    Param:
-    wpt_packet pFrame - The packet which contains the logging data.
-                        This packet has to be a VALID packet, as this
-                        API will not do any checks on the validity of
-                        the packet.
-
-    Return:
-        NONE
-
----------------------------------------------------------------------------*/
-void wpalLogPktSerialize
-(
-   wpt_packet *pFrame
-);
-
-
-/*---------------------------------------------------------------------------
-    wpalFwLogPktSerialize - Serialize Logging data to logger thread
-
-    Param:
-    wpt_packet pFrame - The packet which contains the logging data.
-                        This packet has to be a VALID packet, as this
-                        API will not do any checks on the validity of
-                        the packet.
-
-    Return:
-        NONE
-
----------------------------------------------------------------------------*/
-void wpalFwLogPktSerialize
-(
-   wpt_packet *pFrame, wpt_uint32 pktType
-);
-
-/*---------------------------------------------------------------------------
-    wpalPerPktSerialize - Serialize perpkt data to logger thread
-
-    Param:
-
-
-    Return:
-        NONE
-
----------------------------------------------------------------------------*/
-void wpalPerPktSerialize
-(
-   void *perPktStat
-);
-
-/*---------------------------------------------------------------------------
-    wpalGetOSPktHead – Get the head of OS spacific socket buffer
-    Param:
-        pPacket – pointer to a wpt_packet
-
-    Return:
-        void* - success
----------------------------------------------------------------------------*/
-void* wpalGetOSPktHead( wpt_packet *pPacket);
-
-/*---------------------------------------------------------------------------
-     wpalGetOSPktend – Get end pointer of OS spacific socket buffer
-    Param:
-        pPacket – pointer to a wpt_packet
-
-    Return:
-        void*  - success
----------------------------------------------------------------------------*/
-void* wpalGetOSPktend( wpt_packet *pPacket);
-
-/*---------------------------------------------------------------------------
-    wpalRecoverTail – recover currupted skb tail.
-    Param:
-        pPacket – pointer to a wpt_packet
-
-    Return:
-        void  - success
----------------------------------------------------------------------------*/
-void wpalRecoverTail( wpt_packet *pPacket);
-
 #endif // __WLAN_QCT_PAL_PACKET_H
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_status.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_status.h
index 99821f2..6535a51 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_status.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_status.h
@@ -36,6 +36,9 @@
                
    Definitions for platform independent. 
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_sync.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_sync.h
index 314263a..99ceaa0 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_sync.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_sync.h
@@ -36,6 +36,9 @@
                
    Definitions for platform independent. 
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_timer.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_timer.h
index c1750f5..0aa37f6 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_timer.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_timer.h
@@ -36,6 +36,9 @@
                
    Definitions for platform independent.
   
+   Copyright 2010-2011 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_trace.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_trace.h
index 88caff9..15d8b4b 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_trace.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_trace.h
@@ -36,6 +36,9 @@
                
    Definitions for platform independent
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_type.h b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_type.h
index 45046ac..586288d 100644
--- a/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_type.h
+++ b/wlan/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_type.h
@@ -36,6 +36,9 @@
                
    Definitions for platform independent. 
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 #include "wlan_qct_os_type.h"
diff --git a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_api.c b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_api.c
index 9e0f047..8ad374b 100644
--- a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_api.c
+++ b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_api.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012,2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012,2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -34,6 +34,9 @@
                
    Definitions for platform Windows.
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -410,84 +413,27 @@
 void wpalWcnssResetIntr(void)
 {
 #ifdef HAVE_WCNSS_RESET_INTR
-   wcnss_reset_fiq(true);
+   wcnss_reset_intr();
 #endif
    return;
 }
 
 /*---------------------------------------------------------------------------
-    wpalWcnssIsProntoHwVer3 -  Check if Pronto Hw ver3
-
-    Param:
-       None
-    Return:
-       TRUE if Ponto Hw Ver 3
-       Therefore use WQ6 instead of WQ23 for TX Low/High Priority Channel
----------------------------------------------------------------------------*/
-int wpalWcnssIsProntoHwVer3(void)
-{
-   return wcnss_is_hw_pronto_ver3();
-}
-
-/*---------------------------------------------------------------------------
-    wpalIsFwLoggingEnabled -  Check if Firmware will send logs using DXE
-
-    Param:
-       None
-    Return:
-        Check the documentation of vos_is_fw_logging_enabled
----------------------------------------------------------------------------*/
-wpt_uint8 wpalIsFwLoggingEnabled(void)
-{
-  return vos_is_fw_logging_enabled();
-}
-
-/*---------------------------------------------------------------------------
-    wpalIsFwLoggingEnabled -  Check if Firmware will send running
-                              logs using DXE
-
-    Param:
-       None
-    Return:
-        Check the documentation of vos_is_fw_logging_enabled
----------------------------------------------------------------------------*/
-wpt_uint8 wpalIsFwEvLoggingEnabled(void)
-{
-  return vos_is_fw_ev_logging_enabled();
-}
-/*---------------------------------------------------------------------------
-    wpalIsFwLoggingSupported -  Check if Firmware supports the fw->host
-                                logging infrastructure
-                                This API can only be called after fw caps
-                                are exchanged.
-
-    Param:
-       None
-    Return:
-        Check the documentation of vos_is_fw_logging_supported
----------------------------------------------------------------------------*/
-wpt_uint8 wpalIsFwLoggingSupported(void)
-{
-  return vos_is_fw_logging_supported();
-}
-
-/*---------------------------------------------------------------------------
     wpalFwDumpReq -  Trigger the dump commands to Firmware
      
     Param:
-       cmd -   Command No. to execute
-       arg1 -  argument 1 to cmd
-       arg2 -  argument 2 to cmd
-       arg3 -  argument 3 to cmd
-       arg4 -  argument 4 to cmd
-       async -asynchronous event. Don't wait for completion.
+       cmd - Command No. to execute
+       arg1 - argument 1 to cmd
+       arg2 - argument 2 to cmd
+       arg3 - argument 3 to cmd
+       arg4 - argument 4 to cmd
     Return:
        NONE
 ---------------------------------------------------------------------------*/
 void wpalFwDumpReq(wpt_uint32 cmd, wpt_uint32 arg1, wpt_uint32 arg2,
-                    wpt_uint32 arg3, wpt_uint32 arg4, wpt_boolean async)
+                    wpt_uint32 arg3, wpt_uint32 arg4)
 {
-   vos_fwDumpReq(cmd, arg1, arg2, arg3, arg4, async);
+   vos_fwDumpReq(cmd, arg1, arg2, arg3, arg4);
    return;
 }
 
@@ -507,16 +453,16 @@
    return;
 }
 /*---------------------------------------------------------------------------
-    wpalIslogPInProgress -  calls vos API vos_is_logp_in_progress()
+    wpalIsWDresetInProgress -  calls vos API isWDresetInProgress()
 
     Param:
        NONE
     Return:
        STATUS
  ---------------------------------------------------------------------------*/
-int  wpalIslogPInProgress(void)
+int  wpalIsWDresetInProgress(void)
 {
-   return vos_is_logp_in_progress(VOS_MODULE_ID_WDI, NULL);
+   return isWDresetInProgress();
 }
 
 /*---------------------------------------------------------------------------
@@ -532,13 +478,3 @@
    return isSsrPanicOnFailure();
 }
 
-int  wpalGetDxeReplenishRXTimerVal(void)
-{
-   return vos_get_dxeReplenishRXTimerVal();
-}
-
-int  wpalIsDxeSSREnable(void)
-{
-   return vos_get_dxeSSREnable();
-}
-
diff --git a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_device.c b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
index 3a43565..7932752 100644
--- a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
+++ b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -34,6 +34,9 @@
   This file implements the device specific HW access interface
   required by the WLAN Platform Abstraction Layer (WPAL)
 
+  Copyright (c) 2011 QUALCOMM Incorporated.
+  All Rights Reserved.
+  Qualcomm Confidential and Proprietary
 ========================================================================*/
 
 /*===========================================================================
@@ -103,7 +106,6 @@
    u64              *rx_enable_return;
    u8               rx_isr_enable_failure;
    u8               rx_isr_enable_partial_failure;
-   u8               tx_isr_enabled;
 } wcnss_env;
 
 static wcnss_env  gEnv;
@@ -333,7 +335,6 @@
 )
 {
    int ret;
-   wpt_status status = eWLAN_PAL_STATUS_SUCCESS;
    
    switch (intType) 
    {
@@ -361,12 +362,13 @@
            gpEnv->rx_isr_enable_partial_failure = 1;
             /* not fatal -- keep on going */
          }
+         gpEnv->rx_isr_enabled = 1;
       }
       else
       {
          enable_irq(gpEnv->rx_irq);
+         gpEnv->rx_isr_enabled = 1;
       }
-      gpEnv->rx_isr_enabled = 1;
       break;
    case DXE_INTERRUPT_TX_COMPLE:
       if (!gpEnv->tx_registered) 
@@ -394,18 +396,16 @@
       {
          enable_irq(gpEnv->tx_irq);
       }
-      gpEnv->tx_isr_enabled = 1;
       break;
    default:
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                     "%s: unknown interrupt: %d",
                     __func__, (int)intType);
-      status = eWLAN_PAL_STATUS_E_INVAL;
       break;
    }
    /* on the integrated platform there is no platform-specific
       interrupt control */
-   return status;
+   return eWLAN_PAL_STATUS_SUCCESS;
 }
 
 /**
@@ -428,9 +428,7 @@
    wpt_uint32    intType
 )
 {
-   wpt_status status = eWLAN_PAL_STATUS_SUCCESS;
-
-   switch (intType)
+   switch (intType) 
    {
    case DXE_INTERRUPT_RX_READY:
       gpEnv->rx_disable_return = VOS_RETURN_ADDRESS;
@@ -439,19 +437,17 @@
       break;
    case DXE_INTERRUPT_TX_COMPLE:
       disable_irq_nosync(gpEnv->tx_irq);
-      gpEnv->tx_isr_enabled = 0;
       break;
    default:
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                     "%s: unknown interrupt: %d",
                     __func__, (int)intType);
-      status = eWLAN_PAL_STATUS_E_INVAL;
       break;
    }
 
    /* on the integrated platform there is no platform-specific
       interrupt control */
-   return status;
+   return eWLAN_PAL_STATUS_SUCCESS;
 }
 
 /**
@@ -823,28 +819,3 @@
    return eWLAN_PAL_STATUS_SUCCESS;
 }
 
-/* Get Interrupt Status */
-int wpal_get_int_state
-(
-   wpt_uint32    intType
-)
-{
-   int ret;
-   ret = 0;
-
-   switch (intType)
-   {
-   case DXE_INTERRUPT_RX_READY:
-      if (gpEnv->rx_isr_enabled == 1)
-          ret = 1;
-      break;
-   case DXE_INTERRUPT_TX_COMPLE:
-      if (gpEnv->tx_isr_enabled == 1)
-          ret = 1;
-      break;
-   default:
-      break;
-   }
-
-   return ret;
-}
diff --git a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_msg.c b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_msg.c
index e99b61e..b49849d 100644
--- a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_msg.c
+++ b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_msg.c
@@ -33,6 +33,9 @@
                
    Definitions for platform with legacy UMAC support.
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c
index da46cba..f99751e 100644
--- a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c
+++ b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,6 +33,9 @@
                
    Definitions for platform with VOSS packet support and LA.
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
@@ -43,7 +46,6 @@
 #include "vos_packet.h"
 #include "vos_trace.h"
 #include "vos_list.h"
-#include "vos_api.h"
 
 #include <linux/skbuff.h>
 #include "dma-mapping.h"
@@ -178,13 +180,14 @@
                                        nPktSize, 1, VOS_FALSE, 
                                        wpalPacketRXLowResourceCB, usrData);
 
+#ifndef FEATURE_R33D
       /* Reserve the entire raw rx buffer for DXE */
       if( vosStatus == VOS_STATUS_SUCCESS )
       {
         wpalPacketAvailableCB = NULL;
         vosStatus =  vos_pkt_reserve_head_fast( pVosPkt, &pData, nPktSize ); 
       }
-
+#endif /* FEATURE_R33D */
       if((NULL != pVosPkt) && (VOS_STATUS_E_RESOURCES != vosStatus))
       {
          vos_pkt_get_packet_length(pVosPkt, &allocLen);
@@ -441,45 +444,6 @@
    }
 }/*wpalPacketSetRxLength*/
 
-void wpalRecoverTail(wpt_packet *pFrame)
-{
-   // Validate the parameter pointers
-   if (unlikely(NULL == pFrame))
-   {
-      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                "%s : NULL packet pointer", __func__);
-      return;
-   }
-
-   return vos_recover_tail(WPAL_TO_VOS_PKT(pFrame));
-}
-
-void* wpalGetOSPktHead(wpt_packet *pFrame)
-{
-   // Validate the parameter pointers
-   if (unlikely(NULL == pFrame))
-   {
-      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                "%s : NULL packet pointer", __func__);
-      return NULL;
-   }
-
-   return vos_get_pkt_head(WPAL_TO_VOS_PKT(pFrame));
-}
-
-void* wpalGetOSPktend(wpt_packet *pFrame)
-{
-   // Validate the parameter pointers
-   if (unlikely(NULL == pFrame))
-   {
-      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                "%s : NULL packet pointer", __func__);
-      return 0;
-   }
-
-   return vos_get_pkt_end(WPAL_TO_VOS_PKT(pFrame));
-}
-
 /*
   Set of helper functions that will prepare packet for DMA transfer,
   based on the type of transfer : - to and from the device
@@ -1012,84 +976,3 @@
    return;
 }
 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
-
-/*---------------------------------------------------------------------------
-    wpalLogPktSerialize - Serialize Logging data to logger thread
-
-    Param:
-    wpt_packet pFrame - The packet which contains the logging data.
-                        This packet has to be a VALID packet, as this
-                        API will not do any checks on the validity of
-                        the packet.
-
-    Return:
-        NONE
-
----------------------------------------------------------------------------*/
-void wpalLogPktSerialize
-(
-   wpt_packet *pFrame
-)
-{
-   WDI_DS_RxMetaInfoType *pRxMetadata;
-   void                  *pBuffer;
-   VOS_STATUS             vosStatus;
-
-   vosStatus = vos_pkt_peek_data(WPAL_TO_VOS_PKT(pFrame), 0, &pBuffer,
-                                 WDI_DS_LOG_PKT_TYPE_LEN);
-
-   if (VOS_IS_STATUS_SUCCESS(vosStatus))
-   {
-      // a VALID packet implies non NULL meta-data
-      pRxMetadata = WDI_DS_ExtractRxMetaData(pFrame);
-      pRxMetadata->loggingData = *((wpt_uint32 *)pBuffer);
-
-      wpalPacketRawTrimHead(pFrame, WDI_DS_LOG_PKT_TYPE_LEN);
-
-      vos_logger_pkt_serialize(WPAL_TO_VOS_PKT(pFrame), pRxMetadata->loggingData);
-   }
-   else
-   {
-      vos_pkt_return_packet(WPAL_TO_VOS_PKT(pFrame));
-   }
-}
-
-/*---------------------------------------------------------------------------
-    wpalFwLogPktSerialize - Serialize Logging data to logger thread
-
-    Param:
-    wpt_packet pFrame - The packet which contains the logging data.
-                        This packet has to be a VALID packet, as this
-                        API will not do any checks on the validity of
-                        the packet.
-
-    Return:
-        NONE
-
----------------------------------------------------------------------------*/
-void wpalFwLogPktSerialize
-(
-   wpt_packet *pFrame, wpt_uint32 pktType
-)
-{
-    vos_logger_pkt_serialize(WPAL_TO_VOS_PKT(pFrame), pktType);
-}
-
-
-/*---------------------------------------------------------------------------
-    wpalPerPktSerialize - Serialize perpkt data to logger thread
-
-    Param:
-
-
-    Return:
-        NONE
-
----------------------------------------------------------------------------*/
-void wpalPerPktSerialize
-(
-   void *perPktStat
-)
-{
-   vos_per_pkt_stats_to_user(perPktStat);
-}
diff --git a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_sync.c b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_sync.c
index 8dc369a..5e74261 100644
--- a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_sync.c
+++ b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_sync.c
@@ -33,6 +33,9 @@
                
    Definitions for platform Windows and with legacy UMAC.
   
+   Copyright 2010 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_timer.c b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_timer.c
index 8bb86a1..d38dd75 100644
--- a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_timer.c
+++ b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_timer.c
@@ -33,6 +33,9 @@
                
    Definitions for platform Windows.
   
+   Copyright 2010-2011 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_trace.c b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_trace.c
index 91df19e..83871cd 100644
--- a/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_trace.c
+++ b/wlan/prima/CORE/WDI/WPAL/src/wlan_qct_pal_trace.c
@@ -33,6 +33,9 @@
                
    Definitions for Linux/Android platform
   
+   Copyright 2010-2011 (c) Qualcomm, Incorporated.  All Rights Reserved.
+   
+   Qualcomm Confidential and Proprietary.
   
   ========================================================================*/
 
diff --git a/wlan/prima/Kbuild b/wlan/prima/Kbuild
index b7c1f72..de54045 100644
--- a/wlan/prima/Kbuild
+++ b/wlan/prima/Kbuild
@@ -199,7 +199,6 @@
 		$(MAC_SRC_DIR)/pe/lim/limProcessProbeRspFrame.o \
 		$(MAC_SRC_DIR)/pe/lim/limProcessSmeReqMessages.o \
 		$(MAC_SRC_DIR)/pe/lim/limPropExtsUtils.o \
-		$(MAC_SRC_DIR)/pe/lim/limRMC.o \
 		$(MAC_SRC_DIR)/pe/lim/limRoamingAlgo.o \
 		$(MAC_SRC_DIR)/pe/lim/limScanResultUtils.o \
 		$(MAC_SRC_DIR)/pe/lim/limSecurityUtils.o \
@@ -304,7 +303,7 @@
 
 SME_RRM_OBJS := $(SME_SRC_DIR)/rrm/sme_rrm.o
 
-SME_NAN_OBJS = $(SME_SRC_DIR)/nan/nan_Api.o
+#SME_NAN_OBJS = $(SME_SRC_DIR)/nan/nan_Api.o
 
 
 SME_OBJS :=	$(SME_BTC_OBJS) \
diff --git a/wlan/prima/Makefile b/wlan/prima/Makefile
index 6062e0b..7f58ffa 100644
--- a/wlan/prima/Makefile
+++ b/wlan/prima/Makefile
@@ -8,7 +8,7 @@
 		SUBDIRS=$(CURDIR) CROSS_COMPILE=$(CROSS_COMPILE) modules
 
 modules_install:
-	$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(shell pwd) modules_install
+	$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(WLAN_ROOT) modules_install
 
 clean::
 	find -type f -iname '*.o' | xargs rm || true
diff --git a/wlan/prima/firmware_bin/WCNSS_cfg.dat b/wlan/prima/firmware_bin/WCNSS_cfg.dat
deleted file mode 100644
index 0637816..0000000
--- a/wlan/prima/firmware_bin/WCNSS_cfg.dat
+++ /dev/null
Binary files differ
diff --git a/wlan/prima/firmware_bin/WCNSS_qcom_cfg.ini b/wlan/prima/firmware_bin/WCNSS_qcom_cfg.ini
deleted file mode 100644
index 97b61e9..0000000
--- a/wlan/prima/firmware_bin/WCNSS_qcom_cfg.ini
+++ /dev/null
@@ -1,483 +0,0 @@
-# This file allows user to override the factory
-
-# defaults for the WLAN Driver
-
-
-# Enable IMPS or not
-gEnableImps=1
-
-# Enable/Disable Idle Scan
-
-gEnableIdleScan=0
-
-
-# Enable/Disable vsta based on MAX Assoc limit
-gEnableVSTASupport=1
-
-
-# Increase sleep duration (seconds) during IMPS
-# 0 implies no periodic wake up from IMPS. Periodic wakeup is
-# unnecessary if Idle Scan is disabled.
-gImpsModSleepTime=0
-
-
-# Enable BMPS or not
-gEnableBmps=1
-
-# Enable suspend or not
-
-# 1: Enable standby, 2: Enable Deep sleep, 3: Enable Mcast/Bcast Filter
-
-gEnableSuspend=3
-
-# Phy Mode (auto, b, g, n, etc)
-# Valid values are 0-9, with 0 = Auto, 4 = 11n, 9 = 11ac
-gDot11Mode=0
-
-
-# CSR Roaming Enable(1) Disable(0)
-
-gRoamingTime=0
-
-
-# Assigned MAC Addresses - This will be used until NV items are in place
-
-# Each byte of MAC address is represented in Hex format as XX
-
-Intf0MacAddress=000AF58989FF
-Intf1MacAddress=000AF58989FE
-Intf2MacAddress=000AF58989FD
-
-Intf3MacAddress=000AF58989FC
-
-
-# UAPSD service interval for VO,VI, BE, BK traffic
-
-InfraUapsdVoSrvIntv=0
-
-InfraUapsdViSrvIntv=0
-
-InfraUapsdBeSrvIntv=0
-
-InfraUapsdBkSrvIntv=0
-
-# Flag to allow STA send AddTspec even when ACM is Off
-gAddTSWhenACMIsOff=1
-
-# Make 1x1 the default antenna configuration
-
-gNumRxAnt=1
-
-
-# Beacon filtering frequency (unit in beacon intervals)
-
-gNthBeaconFilter=50
-
-
-# Enable WAPI or not
-
-# WAPIIsEnabled=0
-
-
-# Flags to filter Mcast abd Bcast RX packets.
-
-# Value 0: No filtering, 1: Filter all Multicast.
-
-# 2: Filter all Broadcast. 3: Filter all Mcast abd Bcast
-
-McastBcastFilter=3
-
-
-#Flag to enable HostARPOffload feature or not
-
-hostArpOffload=1
-
-
-#Flag to enable HostNSOffload feature or not
-
-hostNSOffload=0
-
-#SoftAP Related Parameters
-
-# AP MAc addr
-
-gAPMacAddr=000AF589dcab
-
-
-# 802.11n Protection flag
-
-gEnableApProt=1
-
-
-#Enable OBSS protection
-
-gEnableApOBSSProt=1
-
-
-#Enable/Disable UAPSD for SoftAP
-
-gEnableApUapsd=1
-
-
-# Fixed Rate
-
-gFixedRate=0
-
-
-# Maximum Tx power
-
-# gTxPowerCap=30
-
-
-# Fragmentation Threshold
-
-# gFragmentationThreshold=2346
-
-
-# RTS threshold
-
-RTSThreshold=2347
-
-
-# Intra-BSS forward
-
-gDisableIntraBssFwd=0
-
-
-# WMM Enable/Disable
-
-WmmIsEnabled=0
-
-
-# 802.11d support
-
-g11dSupportEnabled=1
-
-# 802.11h support
-
-g11hSupportEnabled=1
-
-# ESE Support and fast transition
-EseEnabled=0
-ImplicitQosIsEnabled=0
-gNeighborScanTimerPeriod=200
-
-gNeighborLookupThreshold=76
-gNeighborReassocThreshold=81
-
-gNeighborScanChannelMinTime=20
-gNeighborScanChannelMaxTime=30
-gMaxNeighborReqTries=3
-
-# Legacy (non-ESE, non-802.11r) Fast Roaming Support
-# To enable, set FastRoamEnabled=1
-# To disable, set FastRoamEnabled=0
-FastRoamEnabled=1
-
-#Check if the AP to which we are roaming is better than current AP in terms of RSSI.
-#Checking is disabled if set to Zero.Otherwise it will use this value as to how better 
-#the RSSI of the new/roamable AP should be for roaming
-RoamRssiDiff=3
-
-# If the RSSI of any available candidate is better than currently associated
-# AP by at least gImmediateRoamRssiDiff, then being to roam immediately (without
-# registering for reassoc threshold).
-# NOTE: Value of 0 means that we would register for reassoc threshold.
-gImmediateRoamRssiDiff=10
-
-# To enable, set gRoamIntraBand=1 (Roaming within band)
-# To disable, set gRoamIntraBand=0 (Roaming across band)
-
-gRoamIntraBand=0
-
-#SAP Country code
-
-# Default Country Code is 2 bytes, 3rd byte is optional indoor or out door.
-
-# Example
-
-#   US Indoor, USI
-
-#   Korea Outdoor, KRO
-
-#   Japan without optional byte, JP
-
-#   France without optional byte, FR
-
-#gAPCntryCode=USI
-
-
-#Short Guard Interval Enable/disable
-
-gShortGI20Mhz=1
-
-gShortGI40Mhz=1
-
-
-#Auto Shutdown  Value in seconds. A value of 0 means Auto shutoff is disabled
-
-gAPAutoShutOff=0
-
-
-# SAP auto channel selection configuration
-
-# 0 = disable auto channel selection
-
-# 1 = enable auto channel selection, channel provided by supplicant will be ignored
-
-gApAutoChannelSelection=1
-
-
-# Listen Energy Detect Mode Configuration
-
-# Valid values 0-128
-
-# 128 means disable Energy Detect feature
-
-# 0-9 are threshold code and 7 is recommended value from system if feature is to be enabled.
-
-# 10-128 are reserved.
-
-# The EDET threshold mapping is as follows in 3dB step:
-
-# 0 = -60 dBm
-
-# 1 = -63 dBm
-
-# 2 = -66 dBm
-
-# ...
-
-# 7 = -81 dBm
-
-# 8 = -84 dBm
-
-# 9 = -87 dBm
-
-# Note: Any of these settings are valid. Setting 0 would yield the highest power saving (in a noisy environment) at the cost of more range. The range impact is approximately #calculated as:
-
-#
-
-#  Range Loss  (dB)  =  EDET threshold level (dBm) + 97 dBm.
-
-#
-
-gEnablePhyAgcListenMode=128
-
-
-#Preferred channel to start BT AMP AP mode (0 means, any channel)
-
-BtAmpPreferredChannel=0
-
-
-#Preferred band (both or 2.4 only or 5 only)
-
-BandCapability=0
-
-
-#Beacon Early Termination (1 = enable the BET feature, 0 = disable)
-
-enableBeaconEarlyTermination=0
-
-beaconEarlyTerminationWakeInterval=3
-
-
-#Bluetooth Alternate Mac Phy (1 = enable the BT AMP feature, 0 = disable)
-
-gEnableBtAmp=0
-
-
-#SOFTAP Channel Range selection 
-
-gAPChannelSelectStartChannel=1
-
-gAPChannelSelectEndChannel=11
-
-
-#SOFTAP Channel Range selection Operating band
-
-# 0:2.4GHZ 1: LOW-5GHZ 2:MID-5GHZ 3:HIGH-5GHZ 4: 4.9HZ BAND 5: 5GHZ BAND
-
-gAPChannelSelectOperatingBand=0
-
-
-#Channel Bonding
-gChannelBondingMode5GHz=1
-gChannelBondingMode24GHz=1
-
-#Enable Keep alive with non-zero period value
-
-#gStaKeepAlivePeriod = 30
-
-#Say gGoKeepAlivePeriod(5 seconds) and gGoLinkMonitorPeriod(10 seconds).
-#For every 10 seconds DUT send Qos Null frame(i.e., Keep Alive frame if link is idle for last 10 seconds.)
-#For both active and power save clients.
-
-#Power save clients: DUT set TIM bit from 10th second onwards and till client honors TIM bit.
-#If doesn't honor for 5 seconds then DUT remove client.
-
-#Active clients: DUT send Qos Null frame for 10th seconds onwards if it is not success still we try on
-#11th second if not tries on 12th and so on till 15th second. Hence before disconnection DUT will send 5 NULL frames.
-#Hence in any case DUT will detect client got removed in (10+5) seconds. i.e., (gGoKeepAlivePeriod + gGoLinkMonitorPeriod)..
-
-#gGoLinkMonitorPeriod/ gApLinkMonitorPeriod is period where link is idle and it is period
-#where we send NULL frame.
-
-#gApLinkMonitorPeriod = 10
-
-#gGoLinkMonitorPeriod = 10
-
-#gGoKeepAlivePeriod/gApKeepAlivePeriod is time to spend to check whether frame are succeed to send or not.
-#Hence total effective detection time is gGoLinkMonitorPeriod+ gGoKeepAlivePeriod/gApLinkMonitorPeriod+ gApKeepAlivePeriod.
-
-
-gGoKeepAlivePeriod=30
-
-gApKeepAlivePeriod=10
-
-
-#If set will start with active scan after driver load, otherwise will start with
-
-#passive scan to find out the domain
-
-gEnableBypass11d=1
-
-
-#If set to 0, will not scan DFS channels
-
-gEnableDFSChnlScan=1
-
-
-gVhtChannelWidth=2
-gEnableLogp=1
-
-
-# Enable Automatic Tx Power control
-
-gEnableAutomaticTxPowerControl=0
-
-# 0 for OLPC 1 for CLPC and SCPC
-gEnableCloseLoop=1
-
-#Data Inactivity Timeout when in powersave (in ms)
-gDataInactivityTimeout=200
-
-# VHT Tx/Rx MCS values
-# Valid values are 0,1,2. If commented out, the default value is 0.
-# 0=MCS0-7, 1=MCS0-8, 2=MCS0-9
-gVhtRxMCS=2
-gVhtTxMCS=2
-
-# Enable CRDA regulatory support by settings default country code
-#gCrdaDefaultCountryCode=TW
-
-# Scan Timing Parameters
-# gPassiveMaxChannelTime=110
-# gPassiveMinChannelTime=60
-# gActiveMaxChannelTime=40
-# gActiveMinChannelTime=20
-
-#If set to 0, MCC is not allowed.
-gEnableMCCMode=1
-
-# 1=enable STBC; 0=disable STBC 
-gEnableRXSTBC=1
-
-# Enable Active mode offload
-gEnableActiveModeOffload=1
-
-#Enable Scan Results Aging based on timer 
-#Timer value is in seconds
-#If Set to 0 it will not enable the feature
-gScanAgingTime=0
-
-#Enable Power saving mechanism Based on Android Framework
-#If set to 0 Driver internally control the Power saving mechanism
-#If set to 1 Android Framwrok control the Power saving mechanism
-isAndroidPsEn=0
-
-#disable LDPC in STA mode if the AP is TXBF capable
-gDisableLDPCWithTxbfAP=1
-
-#Enable thermal mitigation
-gThermalMitigationEnable=1
-
-gEnableFastRoamInConcurrency=1
-
-#List of Country codes for which 11ac needs to be disabled
-#Each country code must be delimited by comma(,)
-gListOfNon11acCountryCode=RU,UA,ZA
-
-#Maxium Channel time in msec
-gMaxMediumTime = 5480
-
-# 802.11K support
-gRrmEnable=1
-gRrmOperChanMax=8
-gRrmNonOperChanMax=8
-gRrmRandIntvl=100
-
-#Scan offload
-gEnableDirectedScanOffload=0
-
-#FlexConnect Power Factor
-#Default is set to 0 (disable)
-gFlexConnectPowerFactor=0
-
-#SAP/P2P-GO mode traffic monitor
-gEnableTrafficMonitor=1
-gTrafficIdleTimeout=3000
-
-#Disable/Enable Strict FCC Regulatory
-# 0 to disable, 1 to enable
-gEnableStrictRegulatoryForFCC=1
-
-#Enable/Disable Modulated DTIM feature
-gEnableModulatedDTIM=3
-
-#max LI value for modulated DTIM
-gMaxLIModulatedDTIM=3
-
-#Enable/Disable Link Layer Statistics Feature
-gEnableLLStats=1
-
-#Enable/Disable EXTScan Feature
-gEnableEXTScan=1
-
-#Enable/Disable TDLS Feature
-gEnableTDLSSupport=1
-
-#Enable/Disable TDLS Implicit Trigger
-gEnableTDLSImplicitTrigger=0
-
-#Enable/Disable TDLS Buffer Sta
-gEnableTDLSBufferSta=1
-
-#Enable/Disable RTS-CTS for HT,VHT
-#Bit mask value to enable RTS/CTS for different modes
-#For 2.4 GHz, HT20 - 0x0001 i.e 1, for 2.4 GHz, HT40 - 0x0002 i.e 2
-#For 2.4 GHz, VHT20 - 0x0004 i.e 4, for 2.4 GHz, VHT40 - 0x0008 i.e 8
-#For 5 GHz, HT20 - 0x0100 i.e 256, for 5 GHz, HT40 - 0x0200 i.e 512
-#For 5 GHz, VHT20 - 0x0400 i.e 1024, for 5 GHz, VHT40 - 0x0800 i.e 2048
-#For 5 GHz, VHT80 - 0x1000 i.e 4096
-#Can be enabled for multiple modes
-#For enabling in both HT20 and HT40 of 2.4 GHz - 0x0003 i.e 3
-#Default is set to 0 (disable)
-gEnableRtsCtsHtVht=0
-
-#Enable delACK
-gEnableDelAck=1
-
-#Compute interval for delack
-gTcpDelAckComputeInterval=2000
-
-#Delack set higher limit
-gTcpDelAckThresholdHigh=17000
-
-#Delack set lower limit
-gTcpDelAckThresholdLow=12000
-
-END
-
-# Note: Configuration parser would not read anything past the END marker
-
diff --git a/wlan/prima/firmware_bin/WCNSS_qcom_wlan_nv.bin b/wlan/prima/firmware_bin/WCNSS_qcom_wlan_nv.bin
deleted file mode 100644
index 14ce361..0000000
--- a/wlan/prima/firmware_bin/WCNSS_qcom_wlan_nv.bin
+++ /dev/null
Binary files differ
diff --git a/wlan/prima/modules.order b/wlan/prima/modules.order
new file mode 100644
index 0000000..83ce90f
--- /dev/null
+++ b/wlan/prima/modules.order
@@ -0,0 +1 @@
+kernel//mnt/android/cm12/device/samsung/gprimeltecan/wlan/prima/wlan.ko
diff --git a/wlan/prima/riva/inc/halLegacyPalTypes.h b/wlan/prima/riva/inc/halLegacyPalTypes.h
index 75808b6..3dd3f33 100644
--- a/wlan/prima/riva/inc/halLegacyPalTypes.h
+++ b/wlan/prima/riva/inc/halLegacyPalTypes.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -55,6 +55,6 @@
 
 typedef byte      tANI_BYTE;
 typedef boolean   tANI_BOOLEAN;
-typedef unsigned long   tANI_TIMESTAMP;
+typedef uint32    tANI_TIMESTAMP;
 
 #endif /*__LEGACYPALTYPES_H__*/
diff --git a/wlan/prima/riva/inc/wlan_hal_cfg.h b/wlan/prima/riva/inc/wlan_hal_cfg.h
index 9540b3c..63bb700 100644
--- a/wlan/prima/riva/inc/wlan_hal_cfg.h
+++ b/wlan/prima/riva/inc/wlan_hal_cfg.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013,2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -159,7 +159,7 @@
 #define QWLAN_HAL_CFG_ENABLE_DETECT_PS_SUPPORT          101
 #define QWLAN_HAL_CFG_AP_LINK_MONITOR_TIMEOUT           102
 #define QWLAN_HAL_CFG_BTC_DWELL_TIME_MULTIPLIER         103
-#define QWLAN_HAL_CFG_ENABLE_TDLS_MODE                  104
+#define QWLAN_HAL_CFG_ENABLE_TDLS_OXYGEN_MODE           104
 #define QWLAN_HAL_CFG_ENABLE_NAT_KEEP_ALIVE_FILTER      105
 #define QWLAN_HAL_CFG_ENABLE_SAP_OBSS_PROT              106
 #define QWLAN_HAL_CFG_PSPOLL_DATA_RECEP_TIMEOUT         107
@@ -225,7 +225,7 @@
 #define QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_ACTIVE_BT_LEN          167
 #define QWLAN_HAL_CFG_BTC_SAP_STATIC_OPP_WLAN_ACTIVE_WLAN_LEN    168
 #define QWLAN_HAL_CFG_BTC_SAP_STATIC_OPP_WLAN_ACTIVE_BT_LEN      169
-#define QWLAN_HAL_CFG_RMC_FIXED_RATE                    170
+#define QWLAN_HAL_CFG_RMCAST_FIXED_RATE                 170
 #define QWLAN_HAL_CFG_ASD_PROBE_INTERVAL                171
 #define QWLAN_HAL_CFG_ASD_TRIGGER_THRESHOLD             172
 #define QWLAN_HAL_CFG_ASD_RTT_RSSI_HYST_THRESHOLD       173
@@ -267,20 +267,13 @@
 #define QWLAN_HAL_CFG_BURST_MODE_BE_TXOP_VALUE               209
 #define QWLAN_HAL_CFG_ENABLE_DYNAMIC_RA_START_RATE           210
 #define QWLAN_HAL_CFG_BTC_FAST_WLAN_CONN_PREF                211
-#define QWLAN_HAL_CFG_ENABLE_RTSCTS_HTVHT                    212
-#define QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN      213
-#define QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN        214
-#define QWLAN_HAL_CFG_LINK_FAIL_TX_CNT                       215
-#define QWLAN_HAL_CFG_TOGGLE_ARP_BDRATES                     216
-#define QWLAN_HAL_CFG_OPTIMIZE_CA_EVENT                      217
-#define QWLAN_HAL_CFG_EXT_SCAN_CONC_MODE                     218
-#define QWLAN_HAL_CFG_BAR_WAKEUP_HOST_DISABLE                219
-#define QWLAN_HAL_CFG_SAR_BOFFSET_CORRECTION_ENABLE          220
 
-#define QWLAN_HAL_CFG_MAX_PARAMS                             221
+
+#define QWLAN_HAL_CFG_MAX_PARAMS                             212
+
 
 /* Total number of Integer CFGs. This is used while allocating the memory for TLV */
-#define QWLAN_HAL_CFG_INTEGER_PARAM                     221
+#define QWLAN_HAL_CFG_INTEGER_PARAM                     212
 
 /*-------------------------------------------------------------------------
   Configuration Parameter min, max, defaults
@@ -445,14 +438,6 @@
 #define QWLAN_HAL_CFG_FIXED_RATE_STAMAX                        226
 #define QWLAN_HAL_CFG_FIXED_RATE_STADEF                        QWLAN_HAL_CFG_FIXED_RATE_AUTO
 
-/* QWLAN_HAL_CFG_RMC_FIXED_RATE
- * Follwing rates in user configuration are mapped to TPE rates
- * Mapping is defined in the gHalUserFixedRateCfgToTpeRateTable
- */
-#define QWLAN_HAL_CFG_RMC_FIXED_RATE_STAMIN                 0
-#define QWLAN_HAL_CFG_RMC_FIXED_RATE_STAMAX                 226
-#define QWLAN_HAL_CFG_RMC_FIXED_RATE_STADEF                 QWLAN_HAL_CFG_FIXED_RATE_24MBPS
-
 /* QWLAN_HAL_CFG_RETRYRATE_POLICY */
 #define QWLAN_HAL_CFG_RETRYRATE_POLICY_STAMIN         0
 #define QWLAN_HAL_CFG_RETRYRATE_POLICY_STAMAX         255
@@ -889,10 +874,11 @@
 #define QWLAN_HAL_CFG_BTC_DWELL_TIME_MULTIPLIER_MAX    300
 #define QWLAN_HAL_CFG_BTC_DWELL_TIME_MULTIPLIER_DEF    300
 
-/* QWLAN_HAL_CFG_ENABLE_TDLS_MODE */
-#define QWLAN_HAL_CFG_ENABLE_TDLS_MODE_MIN    0
-#define QWLAN_HAL_CFG_ENABLE_TDLS_MODE_MAX    1
-#define QWLAN_HAL_CFG_ENABLE_TDLS_MODE_DEF    0
+/* QWLAN_HAL_CFG_ENABLE_TDLS_OXYGEN_MODE */
+#define QWLAN_HAL_CFG_ENABLE_TDLS_OXYGEN_MODE_MIN    0
+#define QWLAN_HAL_CFG_ENABLE_TDLS_OXYGEN_MODE_MAX    1
+#define QWLAN_HAL_CFG_ENABLE_TDLS_OXYGEN_MODE_DEF    0
+
 /* QWLAN_HAL_CFG_ENABLE_NAT_KEEP_ALIVE_FILTER */
 #define QWLAN_HAL_CFG_ENABLE_NAT_KEEP_ALIVE_FILTER_MIN   0
 #define QWLAN_HAL_CFG_ENABLE_NAT_KEEP_ALIVE_FILTER_MAX   1
@@ -1054,53 +1040,12 @@
 /* QWLAN_HAL_CFG_ENABLE_DYNAMIC_RA_START_RATE */
 #define QWLAN_HAL_CFG_ENABLE_DYNAMIC_RA_START_RATE_DEF 0
 #define QWLAN_HAL_CFG_ENABLE_DYNAMIC_RA_START_RATE_MIN 0
-#define QWLAN_HAL_CFG_ENABLE_DYNAMIC_RA_START_RATE_MAX 65535
+#define QWLAN_HAL_CFG_ENABLE_DYNAMIC_RA_START_RATE_MAX 300
 
 /* QWLAN_HAL_CFG_BTC_FAST_WLAN_CONN_PREF */
 #define QWLAN_HAL_CFG_BTC_FAST_WLAN_CONN_PREF_DEF 1
 #define QWLAN_HAL_CFG_BTC_FAST_WLAN_CONN_PREF_MIN 0
 #define QWLAN_HAL_CFG_BTC_FAST_WLAN_CONN_PREF_MAX 1
 
-/* QWLAN_HAL_CFG_ENABLE_RTSCTS_HTVHT */
-/* Bit mask value to enable RTS/CTS for different modes
- * for 2.4 GHz, HT20 - 0x0001, for 2.4 GHz, HT40 - 0x0002
- * for 2.4 GHz, VHT20 - 0x0004, for 2.4 GHz, VHT40 - 0x0008
- * for 5 GHz, HT20 - 0x0100, for 5 GHz, HT40 - 0x0200
- * for 5 GHz, VHT20 - 0x0400, for 5 GHz, VHT40 - 0x0800
- * for 5 GHz, VHT80 - 0x1000
- */
-#define QWLAN_HAL_CFG_ENABLE_RTSCTS_HTVHT_MIN 0x0000
-#define QWLAN_HAL_CFG_ENABLE_RTSCTS_HTVHT_MAX 0x1f0f
-#define QWLAN_HAL_CFG_ENABLE_RTSCTS_HTVHT_DEF 0x0000
-
-/* QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN */
-#define QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_MIN     0
-#define QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_MAX     250000
-#define QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_WLAN_LEN_DEF     40000
-/* QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN */
-#define QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_MIN       0
-#define QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_MAX       250000
-#define QWLAN_HAL_CFG_BTC_STATIC_OPP_WLAN_IDLE_BT_LEN_DEF       40000
-/* QWLAN_HAL_CFG_LINK_FAIL_TX_CNT */
-#define QWLAN_HAL_CFG_LINK_FAIL_TX_CNT_MIN    50
-#define QWLAN_HAL_CFG_LINK_FAIL_TX_CNT_MAX    1000
-#define QWLAN_HAL_CFG_LINK_FAIL_TX_CNT_DEF    200
-/*QWLAN_HAL_CFG_TOGGLE_ARP_BDRATES*/
-#define QWLAN_HAL_CFG_TOGGLE_ARP_BDRATES_MIN  0
-#define QWLAN_HAL_CFG_TOGGLE_ARP_BDRATES_MAX  1
-#define QWLAN_HAL_CFG_TOGGLE_ARP_BDRATES_DEF  0
-/* QWLAN_HAL_CFG_OPTIMIZE_CA_EVENT */
-#define QWLAN_HAL_CFG_OPTIMIZE_CA_EVENT_DISABLE  0
-#define QWLAN_HAL_CFG_OPTIMIZE_CA_EVENT_ENABLE   1
-#define QWLAN_HAL_CFG_OPTIMIZE_CA_EVENT_DEFAULT  0
-
-#define QWLAN_HAL_CFG_EXT_SCAN_CONC_MODE_DEF 1
-#define QWLAN_HAL_CFG_EXT_SCAN_CONC_MODE_MIN 0
-#define QWLAN_HAL_CFG_EXT_SCAN_CONC_MODE_MAX 2
-
-/* QWLAN_HAL_CFG_BAR_WAKEUP_HOST_DISABLE */
-#define QWLAN_HAL_CFG_BAR_WAKEUP_HOST_DISABLE_MIN 0
-#define QWLAN_HAL_CFG_BAR_WAKEUP_HOST_DISABLE_MAX 1
-#define QWLAN_HAL_CFG_BAR_WAKEUP_HOST_DISABLE_DEF 0
 
 #endif //__WLAN_HAL_CFG_H__
diff --git a/wlan/prima/riva/inc/wlan_hal_msg.h b/wlan/prima/riva/inc/wlan_hal_msg.h
index 820f0ac..d30012e 100644
--- a/wlan/prima/riva/inc/wlan_hal_msg.h
+++ b/wlan/prima/riva/inc/wlan_hal_msg.h
@@ -1,30 +1,29 @@
 
-/*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
+/* Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
+* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+
+*
+*
+* Permission to use, copy, modify, and/or distribute this software for
+* any purpose with or without fee is hereby granted, provided that the
+* above copyright notice and this permission notice appear in all
+* copies.
+*
+* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*/
 
 /*
- * This file was originally distributed by Qualcomm Atheros, Inc.
- * under proprietary terms before Copyright ownership was assigned
- * to the Linux Foundation.
- */
+* This file was originally distributed by Qualcomm Atheros, Inc.
+* under proprietary terms before Copyright ownership was assigned
+* to the Linux Foundation.
+*/
 
 /*==========================================================================
  *
@@ -68,8 +67,6 @@
   Commom Type definitons
  ---------------------------------------------------------------------------*/
 
-#define DISA_MAX_PAYLOAD_SIZE   1600
-
 //This is to force compiler to use the maximum of an int ( 4 bytes )
 #define WLAN_HAL_MAX_ENUM_SIZE    0x7FFFFFFF
 #define WLAN_HAL_MSG_TYPE_MAX_ENUM_SIZE    0x7FFF
@@ -128,35 +125,9 @@
 #define WLAN_HAL_EXT_SCAN_MAX_CHANNELS               16
 #define WLAN_HAL_EXT_SCAN_MAX_BUCKETS                16
 #define WLAN_HAL_EXT_SCAN_MAX_HOTLIST_APS            128
-#define WLAN_HAL_EXT_SCAN_MAX_HOTLIST_SSIDS          8
-
+#define WLAN_HAL_EXT_SCAN_MAX_SIG_CHANGE_APS         64
 #define WLAN_HAL_EXT_SCAN_MAX_RSSI_SAMPLE_SIZE       8
 
-/* For Logging enhancement feature currently max 2 address will be passed */
-/* In future we may pass 3 address and length in suspend mode corner case */
-#define MAX_NUM_OF_BUFFER 3
-
-/* Log types */
-typedef enum
-{
-    MGMT_FRAME_LOGS    = 0,
-    QXDM_LOGGING       = 1,
-    FW_MEMORY_DUMP     = 2,
-    FATAL_EVENT        = 3
-}tHalFrameLoggingType;
-
-/* Log size */
-typedef enum
-{
-    LOG_SIZE_4K   = 0,
-    LOG_SIZE_8K   = 1,
-    LOG_SIZE_12K  = 2,
-    LOG_SIZE_16K  = 3,
-    LOG_SIZE_32K  = 4,
-    LOG_SIZE_64K  = 5,
-    LOG_SIZE_96K  = 6
-}tHalLogBuffSize;
-
 /* Message types for messages exchanged between WDI and HAL */
 typedef enum
 {
@@ -451,9 +422,10 @@
    WLAN_HAL_SET_MAX_TX_POWER_PER_BAND_REQ   = 217,
    WLAN_HAL_SET_MAX_TX_POWER_PER_BAND_RSP   = 218,
 
-   WLAN_HAL_RMC_RULER_REQ                  = 219,
-   WLAN_HAL_RMC_RULER_RSP                  = 220,
-   WLAN_HAL_RMC_UPDATE_IND                  = 221,
+   /* Reliable Multicast using Leader Based Protocol */
+   WLAN_HAL_LBP_LEADER_REQ                  = 219,
+   WLAN_HAL_LBP_LEADER_RSP                  = 220,
+   WLAN_HAL_LBP_UPDATE_IND                  = 221,
 
    /* Batchscan */
    WLAN_HAL_BATCHSCAN_SET_REQ               = 222,
@@ -543,67 +515,9 @@
    WLAN_HAL_TDLS_CHAN_SWITCH_RSP            = 291,
    WLAN_HAL_MAC_SPOOFED_SCAN_REQ            = 292,
    WLAN_HAL_MAC_SPOOFED_SCAN_RSP            = 293,
-   /* LGE DISA encrypt-decrypt Messages */
-   WLAN_HAL_ENCRYPT_DATA_REQ                = 294,
-   WLAN_HAL_ENCRYPT_DATA_RSP                = 295,
 
    WLAN_HAL_FW_STATS_REQ                    = 296,
    WLAN_HAL_FW_STATS_RSP                    = 297,
-   WLAN_HAL_FW_LOGGING_INIT_REQ             = 298,
-   WLAN_HAL_FW_LOGGING_INIT_RSP             = 299,
-   WLAN_HAL_GET_FRAME_LOG_REQ               = 300,
-   WLAN_HAL_GET_FRAME_LOG_RSP               = 301,
-
-   /* Monitor Mode */
-   WLAN_HAL_ENABLE_MONITOR_MODE_REQ         = 302,
-   WLAN_HAL_ENABLE_MONITOR_MODE_RSP         = 303,
-
-   WLAN_HAL_DISABLE_MONITOR_MODE_REQ        = 304,
-   WLAN_HAL_DISABLE_MONITOR_MODE_RSP        = 305,
-
-   WLAN_HAL_SET_RTS_CTS_HTVHT_IND           = 306,
-   // FW Logging
-   WLAN_HAL_FATAL_EVENT_LOGGING_REQ         = 307,
-   WLAN_HAL_FATAL_EVENT_LOGGING_RSP         = 308,
-   WLAN_HAL_FW_MEMORY_DUMP_REQ              = 309,
-   WLAN_HAL_FW_MEMORY_DUMP_RSP              = 310,
-   WLAN_HAL_FW_LOGGING_DXE_DONE_IND         = 311,
-   WLAN_HAL_LOST_LINK_PARAMETERS_IND        = 312,
-   WLAN_HAL_SEND_FREQ_RANGE_CONTROL_IND     = 313,
-
-   WLAN_HAL_SSID_HOTLIST_SET_REQ            = 314,
-   WLAN_HAL_SSID_HOTLIST_SET_RSP            = 315,
-   WLAN_HAL_SSID_HOTLIST_RESET_REQ          = 316,
-   WLAN_HAL_SSID_HOTLIST_RESET_RSP          = 317,
-
-   WLAN_HAL_SSID_HOTLIST_RESULT_IND         = 318,
-
-   /* WFD Session Information to start/stop Scan */
-   WLAN_HAL_HIGH_PRIORITY_DATA_INFO_REQ     = 319,
-
-   WLAN_HAL_START_RSSI_MONITORING_REQ       = 321,
-   WLAN_HAL_START_RSSI_MONITORING_RSP       = 322,
-   WLAN_HAL_RSSI_MONITORING_IND             = 323,
-   WLAN_HAL_STOP_RSSI_MONITORING_REQ        = 324,
-   WLAN_HAL_STOP_RSSI_MONITORING_RSP        = 325,
-
-   //RTT3 SUPPORT
-   WLAN_HAL_START_OEM_DATA_REQ_IND_NEW      = 326,
-   WLAN_HAL_START_OEM_DATA_RSP_IND_NEW      = 327,
-
-   WLAN_HAL_WIFI_CONFIG_SET_PARAMS_REQ      = 328,
-   WLAN_HAL_WIFI_CONFIG_SET_PARAMS_RSP      = 329,
-
-   WLAN_HAL_ANTENNA_DIVERSITY_SELECTION_REQ  = 330,
-   WLAN_HAL_ANTENNA_DIVERSITY_SELECTION_RSP  = 331,
-   WLAN_HAL_MODIFY_ROAM_PARAMS_IND           = 332,
-   WLAN_HAL_SET_ALLOWED_ACTION_FRAMES_IND    = 333,
-
-   /* PER based roaming support */
-   WLAN_HAL_SET_PER_ROAM_CONFIG_REQ          = 334,
-   WLAN_HAL_SET_PER_ROAM_CONFIG_RSP          = 335,
-   WLAN_HAL_PER_ROAM_SCAN_TRIGGER_REQ        = 336,
-   WLAN_HAL_PER_ROAM_SCAN_TRIGGER_RSP        = 337,
 
    WLAN_HAL_MSG_MAX = WLAN_HAL_MSG_TYPE_MAX_ENUM_SIZE
 }tHalHostMsgType;
@@ -829,8 +743,7 @@
     HAL_GLOBAL_CLASS_B_STATS_INFO    = 0x00000004,
     HAL_GLOBAL_CLASS_C_STATS_INFO    = 0x00000008,
     HAL_GLOBAL_CLASS_D_STATS_INFO    = 0x00000010,
-    HAL_PER_STA_STATS_INFO           = 0x00000020,
-    HAL_PER_TX_PKT_STATS_INFO        = 0x00000040
+    HAL_PER_STA_STATS_INFO           = 0x00000020
 }eHalStatsMask;
 
 /* BT-AMP events type */
@@ -854,7 +767,6 @@
     PE_GLOBAL_CLASS_C_STATS_INFO    = 0x00000008,
     PE_GLOBAL_CLASS_D_STATS_INFO    = 0x00000010,
     PE_PER_STA_STATS_INFO           = 0x00000020,
-    PE_PER_TX_PKT_STATS_INFO        = 0x00000040,
     PE_STATS_TYPE_MAX = WLAN_HAL_MAX_ENUM_SIZE //This and beyond are invalid values
 }ePEStatsMask;
 
@@ -1030,14 +942,6 @@
     tANI_U32 contention_num_samples;     // num of data pkts used for contention statistics
 } wifi_wmm_ac_stat;
 
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U64            average_tsf_offset;
-    tANI_U32            leaky_ap_avg_num_frames_leaked;
-    tANI_U32            leaky_ap_guard_time;
-    tANI_U32            leaky_ap_detected;
-} wifi_iface_leaky_ap_info;
-
 /* Interface statistics - corresponding to 2nd most LSB in wifi statistics bitmap  for getting statistics */
 typedef PACKED_PRE struct PACKED_POST
 {
@@ -1050,7 +954,6 @@
     tANI_U32            rssi_data;                                  // access Point Data Frames RSSI (averaged) from connected AP
     tANI_U32            rssi_ack;                                   // access Point ACK RSSI (averaged) from connected AP
     wifi_wmm_ac_stat    AccessclassStats[WIFI_AC_MAX];              // per ac data packet statistics
-    wifi_iface_leaky_ap_info leakyApInfo;
 } wifi_iface_stat;
 
 /* Peer statistics - corresponding to 3rd most LSB in wifi statistics bitmap  for getting statistics */
@@ -1611,114 +1514,6 @@
    tHalFinishScanRspParams finishScanRspParams;
 }  tHalFinishScanRspMsg, *tpHalFinishScanRspMsg;
 
-typedef PACKED_PRE struct PACKED_POST
-{
-   tSetStaKeyParams keyParams;
-   uint8 pn[6];
-} tHalEncConfigParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   uint16 length;
-   uint8  data[DISA_MAX_PAYLOAD_SIZE];
-} tHalDisaPayload;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-#ifdef BYTE_ORDER_BIG_ENDIAN
-    uint8   reserved1          : 1;
-    uint8   ackpolicy          : 2;
-    uint8   eosp               : 1;
-    uint8   tid                : 4;
-
-    uint8   appsbufferstate    : 8;
-#else
-    uint8   appsbufferstate    : 8;
-
-    uint8   tid                : 4;
-    uint8   eosp               : 1;
-    uint8   ackpolicy          : 2;
-    uint8   reserved1          : 1;
-#endif
-} tHalQosCtrlFieldType;
-
-typedef PACKED_PRE struct PACKED_POST
- {
-#ifdef  BYTE_ORDER_BIG_ENDIAN
-    uint16 subtype   : 4;
-    uint16 type      : 2;
-    uint16 protocol  : 2;
-
-    uint16 order     : 1;
-    uint16 wep       : 1;
-    uint16 moredata  : 1;
-    uint16 pm        : 1;
-    uint16 retry     : 1;
-    uint16 morefrag  : 1;
-    uint16 fromds    : 1;
-    uint16 tods      : 1;
-#else
-
-    uint16 tods      : 1;
-    uint16 fromds    : 1;
-    uint16 morefrag  : 1;
-    uint16 retry     : 1;
-    uint16 pm        : 1;
-    uint16 moredata  : 1;
-    uint16 wep       : 1;
-    uint16 order     : 1;
-
-    uint16 protocol  : 2;
-    uint16 type      : 2;
-    uint16 subtype   : 4;
-#endif
-} tHalFrmCtrlType;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   /* Frame control field */
-   tHalFrmCtrlType fc;
-   /* Duration ID */
-   uint16 usDurationId;
-   /* Address 1 field */
-   uint8 vA1[HAL_MAC_ADDR_LEN];
-   /* Address 2 field */
-   uint8 vA2[HAL_MAC_ADDR_LEN];
-   /* Address 3 field */
-   uint8 vA3[HAL_MAC_ADDR_LEN];
-   /* Sequence control field */
-   uint16 seqNum;
-   /* Optional A4 address */
-   uint8 optvA4[HAL_MAC_ADDR_LEN];
-   /* Optional QOS control field */
-   tHalQosCtrlFieldType usQosCtrl;
-} tHal80211Header;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHal80211Header macHeader;
-   tHalEncConfigParams encParams;
-   tHalDisaPayload data;
-} tSetEncryptedDataParams, *tpSetEncryptedDataParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tSetEncryptedDataParams encryptedDataParams;
-}  tSetEncryptedDataReqMsg, *tpSetEncryptedDataReqMsg;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U32 status;
-   tHalDisaPayload encryptedPayload;
-} tSetEncryptedDataRspParams, *tpSetEncryptedDataRspParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tSetEncryptedDataRspParams encryptedDataRspParams;
-}  tSetEncryptedDataRspMsg, *tpSetEncryptedDataRspMsg;
-
 /*---------------------------------------------------------------------------
   WLAN_HAL_CONFIG_STA_REQ
 ---------------------------------------------------------------------------*/
@@ -2898,44 +2693,6 @@
    tStartOemDataRspParams    startOemDataRspParams;
 } tStartOemDataRspMsg, *tpStartOemDataRspMsg;
 
-#ifndef NEW_OEM_DATA_REQ_SIZE
-#define NEW_OEM_DATA_REQ_SIZE 292
-#endif
-
-#ifndef NEW_OEM_DATA_RSP_SIZE
-#define NEW_OEM_DATA_RSP_SIZE 2100
-#endif
-
-/*-------------------------------------------------------------------------
-WLAN_HAL_START_OEM_DATA_REQ_IND_NEW------------------------------------
---------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-   tSirMacAddr selfMacAddr;
-   tANI_U8 reserved[2];
-   tANI_U8   oemDataReq[NEW_OEM_DATA_REQ_SIZE];
-} tStartOemDataReqParamsNew, *tpStartOemDataReqParamsNew;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader  header;
-   tStartOemDataReqParamsNew  startOemDataReqParams;
-} tStartOemDataReqMsgNew, *tpStartOemDataReqMsgNew;
-
-/*-------------------------------------------------------------------------
-WLAN_HAL_START_OEM_DATA_RSP_IND_NEW------------------------------------
---------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U8  oemDataRsp[NEW_OEM_DATA_RSP_SIZE];
-} tStartOemDataRspParamsNew, *tpStartOemDataRspParamsNew;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader  header;
-   tStartOemDataRspParamsNew    startOemDataReqParams;
-} tStartOemDataRspMsgNew, *tpStartOemDataRspMsgNew;
-
 #endif
 
 /*---------------------------------------------------------------------------
@@ -3289,15 +3046,6 @@
                                     //is transmitted
 }tAniPerStaStatsInfo, *tpAniPerStaStatsInfo;
 
-// The following stats are averaged over the time between two consecutive GET_STATS_REQ messages.
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U32 lastTxRate;           // 802.11 data rate at which the last data frame is transmitted.
-    tANI_U32  txAvgRetry;           // Average number of retries per 10 packets.
-    tANI_U32 reserved;
-    tANI_U32 reserved1;
-}tAniPerTxPktStatsInfo, *tpAniPerTxPktStatsInfo;
-
 typedef PACKED_PRE struct PACKED_POST
 {
    /* Success or Failure */
@@ -3325,20 +3073,6 @@
    tHalStatsRspParams statsRspParams;
 } tHalStatsRspMsg, *tpHalStatsRspMsg;
 
- /*---------------------------------------------------------------------------
- * WLAN_HAL_SET_RTS_CTS_HTVHT_IND
- *---------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U32 rtsCtsValue;
-}tHalRtsCtsHtvhtIndParams, *tpHalRtsCtsHtvhtIndParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader        header;
-   tHalRtsCtsHtvhtIndParams   rtsCtsHtvhtIndParams;
-} tHalRtsCtsHtvhtIndMsg, *tpHalRtsCtsHtvhtIndMsg;
-
 /*---------------------------------------------------------------------------
  * WLAN_HAL_FW_STATS_REQ
  *---------------------------------------------------------------------------*/
@@ -5917,8 +5651,6 @@
 {
    /*Tx Complete Indication Success or Failure*/
    tANI_U32   status;
-   /* Dialog token */
-   tANI_U32   dialogToken;
 }tTxComplParams,*tpTxComplParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -6115,8 +5847,6 @@
     eAUTH_TYPE_WAPI_WAI_PSK          = 9,
     eAUTH_TYPE_CCKM_WPA              = 10,
     eAUTH_TYPE_CCKM_RSN              = 11,
-    eAUTH_TYPE_RSN_PSK_SHA256        = 12,
-    eAUTH_TYPE_RSN_8021X_SHA256      = 13,
 
     eAUTH_TYPE_MAX = WLAN_HAL_MAX_ENUM_SIZE
 
@@ -6864,18 +6594,6 @@
     FW_STATS               = 47,
     WPS_PRBRSP_TMPL        = 48,
     BCN_IE_FLT_DELTA       = 49,
-    TDLS_OFF_CHANNEL       = 51,
-    RTT3                   = 52,
-    MGMT_FRAME_LOGGING     = 53,
-    ENHANCED_TXBD_COMPLETION = 54,
-    LOGGING_ENHANCEMENT    = 55,
-    EXT_SCAN_ENHANCED      = 56,
-    MEMORY_DUMP_SUPPORTED  = 57,
-    PER_PKT_STATS_SUPPORTED  = 58,
-    EXT_LL_STAT              = 60,
-    WIFI_CONFIG            = 61,
-    ANTENNA_DIVERSITY_SELECTION  = 62,
-    PER_BASED_ROAMING      = 63,
     MAX_FEATURE_SUPPORTED  = 128,
 } placeHolderInCapBitmap;
 
@@ -6903,7 +6621,6 @@
 #define IS_DYNAMIC_WMM_PS_SUPPORTED_BY_HOST ((!!(halMsg_GetHostWlanFeatCaps(DYNAMIC_WMM_PS))))
 #define IS_MAC_SPOOF_SCAN_SUPPORTED_BY_HOST ((!!(halMsg_GetHostWlanFeatCaps(MAC_SPOOFED_SCAN))))
 #define IS_NEW_BMU_ERROR_RECOVERY_SUPPORTED_BY_HOST ((!!(halMsg_GetHostWlanFeatCaps(BMU_ERROR_GENERIC_RECOVERY))))
-#define IS_ENHANCED_TXBD_COMPLETION_SUPPORTED_BY_HOST ((!!(halMsg_GetHostWlanFeatCaps(ENHANCED_TXBD_COMPLETION))))
 
 tANI_U8 halMsg_GetHostWlanFeatCaps(tANI_U8 feat_enum_value);
 
@@ -7666,152 +7383,61 @@
 
 
 /*---------------------------------------------------------------------------
- * WLAN_HAL_RMC_RULER_REQ
- *-------------------------------------------------------------------------*/
-
-#define HAL_MAX_RMC_SESSIONS 2
-
-#define HAL_NUM_MAX_RULERS 8
-
-typedef enum
-{
-   WLAN_HAL_SUGGEST_RULER,
-   WLAN_HAL_BECOME_RULER,
-   WLAN_HAL_RULER_CMD_MAX = WLAN_HAL_MAX_ENUM_SIZE
-}tRulerReqCmdType, tRulerRspCmdType;
-
+* WLAN_HAL_TX_FAIL_IND
+*--------------------------------------------------------------------------*/
+// Northbound indication from FW to host on weak link detection
 typedef PACKED_PRE struct PACKED_POST
 {
-   tRulerReqCmdType cmd;
-
-   /* MAC address of MCAST Transmitter (source) */
-   tSirMacAddr mcastTransmitter;
-
-   /* MAC Address of Multicast Group (01-00-5E-xx-xx-xx) */
-   tSirMacAddr mcastGroup;
-
-   /* Optional black list for cmd = WLAN_HAL_SUGGEST_RULER */
-   tSirMacAddr blacklist[HAL_NUM_MAX_RULERS];
-}  tHalRmcRulerReqParams, *tpHalRmcRulerReqParams;
+   // Sequence number increases by 1 whenever the device driver
+   // sends a notification event. This is cleared as 0 when the
+   // JOIN IBSS commamd is issued
+    tANI_U16 seqNo;
+    tANI_U16 staId;
+    tANI_U8 macAddr[HAL_MAC_ADDR_LEN];
+} tHalTXFailIndParams, *tpHalTXFailIndParams;
 
 typedef PACKED_PRE struct PACKED_POST
 {
     tHalMsgHeader header;
-   tHalRmcRulerReqParams rulerReqParams;
-}  tHalRmcRulerReqMsg, *tpHalRmcRulerReqMsg;
+    tHalTXFailIndParams txFailIndParams;
+}  tHalTXFailIndMsg, *tpHalTXFailIndMsg;
 
 /*---------------------------------------------------------------------------
- * WLAN_HAL_RMC_RULER_RSP
- *-------------------------------------------------------------------------*/
+* WLAN_HAL_TX_FAIL_MONITOR_IND
+*--------------------------------------------------------------------------*/
+// Southbound message from Host to monitor the Tx failures
 typedef PACKED_PRE struct PACKED_POST
 {
-   /* success or failure */
-   tANI_U32 status;
-
-   /*  Command Type */
-   tRulerRspCmdType cmd;
-
-   /* MAC address of MCAST Transmitter (source) */
-   tSirMacAddr mcastTransmitter;
-
-   /* MAC Address of Multicast Group (01-00-5E-xx-xx-xx) */
-   tSirMacAddr mcastGroup;
-
-   /* List of candidates for cmd = WLAN_HAL_SUGGEST_RULER*/
-   tSirMacAddr ruler[HAL_NUM_MAX_RULERS];
-
-}  tHalRmcRulerRspParams, *tpHalRmcRulerRspParams;
+    // tx_fail_count = 0 should disable the TX Fail monitor, non-zero value should enable it.
+    tANI_U8 tx_fail_count;
+} tTXFailMonitorInfo, *tpTXFailMonitorInfo;
 
 typedef PACKED_PRE struct PACKED_POST
 {
     tHalMsgHeader  header;
-   tHalRmcRulerRspParams rulerRspParams;
-}  tHalRmcRulerRspMsg, *tpHalRmcRulerRspMsg;
+    tTXFailMonitorInfo txFailMonitor;
+} tTXFailMonitorInd, *tpTXFailMonitorInd;
 
 /*---------------------------------------------------------------------------
- * WLAN_HAL_RMC_UPDATE_IND
- *-------------------------------------------------------------------------*/
-typedef enum
+* WLAN_HAL_IP_FORWARD_TABLE_UPDATE_IND
+*--------------------------------------------------------------------------*/
+typedef PACKED_PRE struct PACKED_POST
 {
-   WLAN_HAL_RULER_ACCEPTED,    //Host-->FW
-   WLAN_HAL_RULER_CANCELED,    //Host-->FW
-   WLAN_HAL_RULER_PICK_NEW,    //FW-->Host
-   WLAN_HAL_RULER_IND_MAX = WLAN_HAL_MAX_ENUM_SIZE
-}tRmcUpdateIndType;
-
-typedef enum
-{
-   WLAN_HAL_RMC_RULER_ROLE,
-   WLAN_HAL_RMC_TRANSMITTER_ROLE,
-   WLAN_HAL_RMC_ROLE_MAX = WLAN_HAL_MAX_ENUM_SIZE
-}tRmcRoleType;
+   tANI_U8 destIpv4Addr[HAL_IPV4_ADDR_LEN];
+   tANI_U8 nextHopMacAddr[HAL_MAC_ADDR_LEN];
+} tDestIpNextHopMacPair;
 
 typedef PACKED_PRE struct PACKED_POST
 {
-   tRmcUpdateIndType indication;
-
-   /* Role of the entity generating this indication */
-   tRmcRoleType role;
-
-   /* MAC address of MCAST Transmitter (source) */
-   tSirMacAddr mcastTransmitter;
-
-   /* MAC Address of Multicast Group (01-00-5E-xx-xx-xx) */
-   tSirMacAddr mcastGroup;
-
-   tSirMacAddr mcastRuler;
-
-   /* Candidate list for indication = WLAN_HAL_RULER_PICK_NEW */
-   tSirMacAddr ruler[HAL_NUM_MAX_RULERS];
-}  tHalRmcUpdateIndParams, *tpHalRmcUpdateIndParams;
+   tANI_U8 numEntries;
+   tDestIpNextHopMacPair destIpMacPair[1];
+} tWlanIpForwardTableUpdateIndParam;
 
 typedef PACKED_PRE struct PACKED_POST
 {
    tHalMsgHeader header;
-   tHalRmcUpdateIndParams rulerIndParams;
-}  tHalRmcUpdateInd, *tpHalRmcUpdateInd;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U8  staIdx;       // Station Idx;
-   tANI_U32 txRate;       // Legacy transmit rate, in units of 500 kbit/sec,
-                          // for the most recently transmitted frame
-   tANI_U32 mcsIndex;     // mcs index for HT20 and HT40 rates
-   tANI_U32 txRateFlags;  // to differentiate between HT20 and
-                          // HT40 rates; short and long guard interval
-   tANI_S8  rssi;         // RSSI of the last received beacon
-}tHalIbssPeerParams, *tpHalIbssPeerParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U32           status;             // success or failure
-   tANI_U8            numOfPeers;         // Number of Peers for
-                                          // which stats are being reported
-   tHalIbssPeerParams ibssPeerParams[1];  // Stats of peer in IBSS
-}tHalIbssPeerInfoRspParams, *tpHalIbssPeerInfoRspParams;
-
-// WLAN_HAL_GET_IBSS_PEER_INFO_RSP
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalIbssPeerInfoRspParams ibssPeerInfoRspParams;
-}tHalIbssPeerInfoRsp, *tpHalIbssPeerInfoRsp;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U8         bssIdx;           // Bss Index
-   tANI_BOOLEAN    allPeerInfoReqd;  // If set, all IBSS peers stats are reported
-   tANI_U8         staIdx;           // If allPeerInfoReqd is not set,
-                                     // only stats of peer with
-                                     // staIdx is reported
-}tHalIbssPeerInfoReqParams, *tpHalIbssPeerInfoReqParams;
-
-// WLAN_HAL_GET_IBSS_PEER_INFO_REQ
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalIbssPeerInfoReqParams ibssPeerInfoReqParams;
-}tHalIbssPeerInfoReq, *tpHalIbssPeerInfoReq;
+   tWlanIpForwardTableUpdateIndParam ipForwardTableParams;
+} tWlanIpForwardTableUpdateInd;
 
 /*---------------------------------------------------------------------------
  * WLAN_HAL_ROAM_OFFLOAD_SYNCH_IND
@@ -7939,7 +7565,8 @@
 /*---------------------------------------------------------------------------
  WLAN_HAL_RATE_UPDATE_IND
  *-------------------------------------------------------------------------*/
- typedef PACKED_PRE struct PACKED_POST
+
+typedef PACKED_PRE struct PACKED_POST
 {
     /* 0 implies UCAST RA, positive value implies fixed rate, -1 implies ignore this param */
     tANI_S32 ucastDataRate; //unit Mbpsx10
@@ -7951,18 +7578,18 @@
     tSirMacAddr bssid;
 
     /* 0 implies MCAST RA, positive value implies fixed rate, -1 implies ignore */
-    tANI_S32 rmcDataRate; //unit Mbpsx10
+    tANI_S32 reliableMcastDataRate; //unit Mbpsx10
 
     /* TX flag to differentiate between HT20, HT40 etc */
-    tTxRateInfoFlags rmcDataRateTxFlag;
+    tTxRateInfoFlags reliableMcastDataRateTxFlag;
 
-    /* Default (non-RMC) MCAST(or BCAST)  fixed rate in 2.4 GHz, 0 implies ignore */
+    /* Default (non-reliable) MCAST(or BCAST)  fixed rate in 2.4 GHz, 0 implies ignore */
     tANI_U32 mcastDataRate24GHz; //unit Mbpsx10
 
     /* TX flag to differentiate between HT20, HT40 etc */
     tTxRateInfoFlags mcastDataRate24GHzTxFlag;
 
-    /*  Default (non-RMC) MCAST(or BCAST) fixed rate in 5 GHz, 0 implies ignore */
+    /*  Default (non-reliable) MCAST(or BCAST) fixed rate in 5 GHz, 0 implies ignore */
     tANI_U32 mcastDataRate5GHz; //unit Mbpsx10
 
     /* TX flag to differentiate between HT20, HT40 etc */
@@ -7977,46 +7604,10 @@
 }  tHalRateUpdateInd, * tpHalRateUpdateInd;
 
 /*---------------------------------------------------------------------------
-* WLAN_HAL_TX_FAIL_IND
-*--------------------------------------------------------------------------*/
-// Northbound indication from FW to host on weak link detection
-typedef PACKED_PRE struct PACKED_POST
-{
-   // Sequence number increases by 1 whenever the device driver
-   // sends a notification event. This is cleared as 0 when the
-   // JOIN IBSS commamd is issued
-    tANI_U16 seqNo;
-    tANI_U16 staId;
-    tANI_U8 macAddr[HAL_MAC_ADDR_LEN];
-} tHalTXFailIndParams, *tpHalTXFailIndParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tHalMsgHeader header;
-    tHalTXFailIndParams txFailIndParams;
-}  tHalTXFailIndMsg, *tpHalTXFailIndMsg;
-
-/*---------------------------------------------------------------------------
-* WLAN_HAL_TX_FAIL_MONITOR_IND
-*--------------------------------------------------------------------------*/
-// Southbound message from Host to monitor the Tx failures
-typedef PACKED_PRE struct PACKED_POST
-{
-    // tx_fail_count = 0 should disable the TX Fail monitor, non-zero value should enable it.
-    tANI_U8 tx_fail_count;
-} tTXFailMonitorInfo, *tpTXFailMonitorInfo;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tHalMsgHeader  header;
-    tTXFailMonitorInfo txFailMonitor;
-} tTXFailMonitorInd, *tpTXFailMonitorInd;
-
-/*---------------------------------------------------------------------------
  * WLAN_HAL_AVOID_FREQ_RANGE_IND
  *-------------------------------------------------------------------------*/
 
-#define WLAN_HAL_MAX_AVOID_FREQ_RANGE           15
+#define WLAN_HAL_MAX_AVOID_FREQ_RANGE           4
 
 typedef PACKED_PRE struct PACKED_POST
 {
@@ -8119,22 +7710,6 @@
    tHalBcnMissRateRspParams bcnMissRateRspParams;
 }tHalBcnMissRateRspMsg, *tpHalBcnMissRateRspMsg;
 
-/*---------------------------------------------------------------------------
- * WLAN_HAL_SET_ALLOWED_ACTION_FRAMES_IND
- *-------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U32  actionFramesBitMask;
-   tANI_U32  reserved;
-}tHalAllowedActionFrames, *tpHalAllowedActionFrames;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalAllowedActionFrames allowedActionFrames;
-}tHalAllowedActionFramesReqInd, *tpHalAllowedActionFramesReqInd;
-
 /*--------------------------------------------------------------------------
 * WLAN_HAL_LL_SET_STATS_REQ
 *---------------------------------------------------------------------------*/
@@ -8268,16 +7843,6 @@
    EXT_SCAN_CHANNEL_BAND_MAX          = WLAN_HAL_MAX_ENUM_SIZE
 } tExtScanChannelBandMask;
 
-#define WLAN_HAL_EXT_SCAN_MAX_HOTLIST_SSIDS                    8
-#define WLAN_HAL_EXT_SCAN_MAX_AP_CACHE_PER_SCAN                32
-
-#define WLAN_HAL_EXT_SCAN_FLAG_INTERRUPTED                             1
-
-#define WLAN_HAL_EXT_SCAN_REPORT_EVENTS_BUFFER_FULL     0
-#define WLAN_HAL_EXT_SCAN_REPORT_EVENTS_EACH_SCAN       1
-#define WLAN_HAL_EXT_SCAN_REPORT_EVENTS_FULL_RESULTS    2
-#define WLAN_HAL_EXT_SCAN_REPORT_EVENTS_NO_BATCH        4
-
 typedef PACKED_PRE struct PACKED_POST
 {
     tANI_U32 channel;       // frequency
@@ -8294,26 +7859,16 @@
    tExtScanChannelBandMask channelBand;
    /* period (milliseconds) for each bucket defines the periodicity of bucket */
    tANI_U32 period;
-   /*  This is a bit field; which defines following bits -
-       *  REPORT_EVENTS_BUFFER_FULL  => report only when scan history
-           is % full
-       *  REPORT_EVENTS_EACH_SCAN	  => report a scan completion event
-           after scan
-       *  REPORT_EVENTS_FULL_RESULTS => forward scan results
-           (beacons/probe responses + IEs) in real time to HAL, in addition
-           to completion events
-           Note: To keep backward compatibility, fire completion events
-           regardless of REPORT_EVENTS_EACH_SCAN.
-       *  REPORT_EVENTS_NO_BATCH	  => controls batching,
-           0 => batching, 1 => no batching
-       */
+   /* 0 => normal reporting (reporting rssi history only,
+           when rssi history buffer is % full)
+    * 1 => same as 0 + report a scan completion event after scanning this bucket
+    * 2 => same as 1 + forward scan results (beacons/probe responses + IEs) in
+           real time to HAL (Required for L = P0)
+    * 3 => same as 2 + forward scan results (beacons/probe responses + IEs) in
+           real time to host (Not required for L =  P3) */
    tANI_U8 reportEvents;
    /* number of channels */
    tANI_U8 numChannels;
-   // new Exponential Scan params
-   tANI_U32 max_period;
-   tANI_U32 exponent;
-   tANI_U32 step_count;
    /* if channels to scan. In the TLV channelList[] */
    tExtScanChannelSpec channelList[WLAN_HAL_EXT_SCAN_MAX_CHANNELS];
 }tExtScanBucketData, *tpExtScanBucketData;
@@ -8329,9 +7884,7 @@
       (keep the most significant, i.e. stronger RSSI) */
    tANI_U32 maxApPerScan;
    /* in %, when buffer is this much full, wake up host */
-   tANI_U32 reportThresholdPercent;
-   /* in number of scans, wake up AP after these many scans */
-   tANI_U32 reportThresholdNumScans;
+   tANI_U32 reportThreshold;
    /* This will be off channel minimum time */
    tANI_U16 neighborScanChannelMinTime;
    /* This will be out off channel max time */
@@ -8398,7 +7951,7 @@
    tANI_U32      maxScanReportingThreshold;
 
    tANI_U32      maxHotlistAPs;
-   tANI_U32      maxHotlistSSIDs;
+   tANI_U32      maxSignificantWifiChangeAPs;
 
    tANI_U32      maxBssidHistoryEntries;
 }tHalExtScanGetCapRsp, *tpHalExtScanGetCapRsp;
@@ -8461,20 +8014,8 @@
    tANI_U32 rttSd;               // standard deviation in rtt - not expected
    tANI_U16 beaconPeriod;        // period advertised in the beacon
    tANI_U16 capability;          // capabilities advertised in the beacon
-   tANI_U16 ieLength;            // size of the ie_data blob
-   tANI_U8  ieData[1];           // blob of all the information elements found in the beacon
 } tHalExtScanResultParams, *tpHalExtScanResultParams;
 
-/* Get the GSCAN cached scan results */
-typedef struct {
-   tANI_U16 scan_id;      // a unique identifier for the scan unit
-   tANI_U8  flags;        // a bitmask with additional
-                          // information about scan
-   tANI_U8  num_results;  // number of bssids retrieved by the scan
-   tHalExtScanResultParams results[WLAN_HAL_EXT_SCAN_MAX_AP_CACHE_PER_SCAN];
-                          // scan results - one for each bssid
-} tHalExtScanCachedResultParams, *tpHalExtScanCachedResultParams;
-
 typedef PACKED_PRE struct PACKED_POST
 {
    tHalMsgHeader header;
@@ -8556,6 +8097,10 @@
    tHalExtScanResAvailableInd extScanResAvailableInd;
 }tHalExtScanResAvailableIndMsg, *tpHalExtScanResAvailableIndMsg;
 
+/*---------------------------------------------------------------------------
+ * WLAN_HAL_SIG_RSSI_SET_REQ
+ *-------------------------------------------------------------------------*/
+
 typedef PACKED_PRE struct PACKED_POST
 {
    /* AP BSSID */
@@ -8565,8 +8110,105 @@
    tANI_S32 lowRssiThreshold;
    /* high threshold - used in L for significant rssi - used in L for hotlist */
    tANI_S32 highRssiThreshold;
+   /* channel hint */
+   tANI_U32 channel;
 } tApThresholdParams, *tpApThresholdParams;
 
+typedef PACKED_PRE struct PACKED_POST
+{
+   tANI_U32 requestId;
+   tANI_U8 sessionId;
+   /* number of samples for averaging RSSI */
+   tANI_U32 rssiSampleSize;
+   /* number of missed samples to confirm AP loss */
+   tANI_U32 lostApSampleSize;
+   /* number of APs breaching threshold required for firmware to generate event */
+   tANI_U32 minBreaching;
+   /* number of significant APs */
+   tANI_U32 numAp;
+   /* significant APs */
+   tApThresholdParams ap[WLAN_HAL_EXT_SCAN_MAX_SIG_CHANGE_APS];
+} tHalSigRssiSetReq, *tpHalSigRssiSetReq;
+
+typedef PACKED_PRE struct PACKED_POST
+{
+   tHalMsgHeader header;
+   tHalSigRssiSetReq extScanSigRssiReq;
+}tHalSigRssiSetReqMsg, *tpHalSigRssiSetReqMsg;
+
+/*---------------------------------------------------------------------------
+ * WLAN_HAL_SIG_RSSI_SET_RSP
+ *-------------------------------------------------------------------------*/
+
+typedef PACKED_PRE struct PACKED_POST
+{
+   tANI_U32 requestId;
+   tANI_U32 status;
+}tHalSigRssiSetRsp, *tpHalSigRssiSetRsp;
+
+
+typedef PACKED_PRE struct PACKED_POST
+{
+   tHalMsgHeader header;
+   tHalSigRssiSetRsp sigRssiSetRsp;
+}tHalSigRssiSetRspMsg, *tpHalSigRssiSetRspMsg;
+
+/*---------------------------------------------------------------------------
+ * WLAN_HAL_SIG_RSSI_RESET_REQ
+ *-------------------------------------------------------------------------*/
+
+typedef PACKED_PRE struct PACKED_POST
+{
+   tANI_U32 requestId;
+}tHalSigRssiResetReq, *tpHalSigRssiResetReq;
+
+typedef PACKED_PRE struct PACKED_POST
+{
+   tHalMsgHeader header;
+   tHalSigRssiResetReq sigRssiResetReq;
+}tHalSigRssiResetReqMsg, *tpHalSigRssiResetReqMsg;
+
+/*---------------------------------------------------------------------------
+ * WLAN_HAL_SIG_RSSI_RESET_RSP
+ *-------------------------------------------------------------------------*/
+
+typedef PACKED_PRE struct PACKED_POST
+{
+   tANI_U32 requestId;
+   tANI_U32 status;
+}tHalSigRssiResetRsp, *tpHalSigRssiResetRsp;
+
+typedef PACKED_PRE struct PACKED_POST
+{
+   tHalMsgHeader header;
+   tHalSigRssiResetRsp sigRssiResetRsp;
+}tHalSigRssiResetRspMsg, *tpHalSigRssiResetRspMsg;
+
+/*---------------------------------------------------------------------------
+ * WLAN_HAL_SIG_RSSI_RESULT_IND
+ *-------------------------------------------------------------------------*/
+
+typedef PACKED_PRE struct PACKED_POST
+{
+   // BSSID
+   tSirMacAddr bssid;
+   // channel frequency in MHz
+   tANI_U32 channel;
+   // number of rssi samples
+   tANI_U8 numRssi;
+   // RSSI history in db
+   tANI_S32 rssi[WLAN_HAL_EXT_SCAN_MAX_RSSI_SAMPLE_SIZE];
+} tHalSigRssiResultParams, *tpHalSigRssiResultParams;
+
+typedef PACKED_PRE struct PACKED_POST
+{
+   tHalMsgHeader header;
+   tANI_U32 requestId;
+   tANI_U32 numSigRssiBss;
+   tANI_BOOLEAN moreData;
+   tANI_U8 sigRssiResult[1];
+}tHalSigRssiResultIndMsg, *tpHalSigRssiResultIndMsg;
+
 /*---------------------------------------------------------------------------
  * WLAN_HAL_BSSID_HOTLIST_SET_REQ
  *-------------------------------------------------------------------------*/
@@ -8575,9 +8217,8 @@
 {
    tANI_U32 requestId;
    tANI_U8 sessionId;
-   tANI_U32 lostBssidSampleSize;
    // number of hotlist APs
-   tANI_U32 numBssid;
+   tANI_U32 numAp;
    // hotlist APs
    tApThresholdParams ap[WLAN_HAL_EXT_SCAN_MAX_HOTLIST_APS];
 } tHalBssidHotlistSetReq, *tpHalBssidHotlistSetReq;
@@ -8648,116 +8289,6 @@
    tANI_U8 bssHotlist[1];
 }tHalHotlistResultIndMsg, *tpHalHotlistResultIndMsg;
 
-/*---------------------------------------------------------------------------
- * WLAN_HAL_SSID_HOTLIST_SET_REQ
- *-------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   /* SSID */
-   char ssid [32+1];
-   /* low threshold - used in L for significant_change - not used in L for
-         hotlist*/
-   tANI_S32 lowRssiThreshold;
-   /* high threshold - used in L for significant rssi - used in L for hotlist */
-   tANI_S32 highRssiThreshold;
-   /* band */
-   tANI_U32 band;
- } tSsidThresholdParams, *tpSsidThresholdParams;
-
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U32 requestId;
-   tANI_U8 sessionId;
-   tANI_U32 lostSsidSampleSize;
-   // number of hotlist SSIDs
-   tANI_U32 numSsid;
-   // hotlist SSIDs
-   tSsidThresholdParams ssid[WLAN_HAL_EXT_SCAN_MAX_HOTLIST_SSIDS];
-} tHalSsidHotlistSetReq, *tpHalSsidHotlistSetReq;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalSsidHotlistSetReq ssidHotlistSetReq;
-}tHalSsidHotlistSetReqMsg, *tpHalSsidHotlistSetReqMsg;
-
-/*---------------------------------------------------------------------------
- * WLAN_HAL_SSID_HOTLIST_SET_RSP
- *-------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U32 requestId;
-   tANI_U32 status;
-}tHalSsidHotlistSetRsp, *tpHalSsidHotlistSetRsp;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalSsidHotlistSetRsp hotlistSetRsp;
-}tHalSsidHotlistSetRspMsg, *tpHalSsidHotlistSetRspMsg;
-
-/*---------------------------------------------------------------------------
- * WLAN_HAL_SSID_HOTLIST_RESET_REQ
- *-------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U32 requestId;
-}tHalSsidHotlistResetReq, *tpHalSsidHotlistResetReq;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalSsidHotlistResetReq hotlistResetReq;
-}tHalSsidHotlistResetReqMsg, *tpHalSsidHotlistResetReqMsg;
-
-/*---------------------------------------------------------------------------
- * WLAN_HAL_SSID_HOTLIST_RESET_RSP
- *-------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U32 requestId;
-   tANI_U32 status;
-}tHalSsidHotlistResetRsp, *tpHalSsidHotlistResetRsp;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalSsidHotlistResetRsp hotlistResetRsp;
-}tHalSsidHotlistResetRspMsg, *tpHalSsidHotlistResetRspMsg;
-
-/*---------------------------------------------------------------------------
- * WLAN_HAL_SSID_HOTLIST_RESULT_IND
- *-------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tANI_U32 requestId;
-   tANI_BOOLEAN ssid_found;
-   tANI_U32 numHotlistSsid;
-   tANI_BOOLEAN moreData;
-   tANI_U8 ssidHotlist[1];  // pointer to list of type tHalExtScanResultParams
-}tHalSsidHotlistResultIndMsg, *tpHalSsidHotlistResultIndMsg;
-
-/*---------------------------------------------------------------------------
- * WLAN_HAL_HIGH_PRIORITY_DATA_INFO_REQ
- *-------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_BOOLEAN  pause; // 1 -> pause, 0 -> unpause
-   tANI_U32      reserved; //reserved for future use
-}tHalHighPriorityDataInfoInd, *tpHalHighPriorityDataInfoInd;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalHighPriorityDataInfoInd highPriorityDataInfoInd;
-}tHalHighPriorityDataInfoIndMsg, *tpHalHighPriorityDataInfoIndMsg;
 
 /*---------------------------------------------------------------------------
   *WLAN_HAL_MAC_SPOOFED_SCAN_REQ
@@ -8790,516 +8321,6 @@
     tHalMsgHeader         header;
     tMacSpoofedScanResp tMacSpoofedScanRespParams;
 }  tMacSpoofedScanRespMsg,  * tpMacSpoofedScanRespMsg;
-/*---------------------------------------------------------------------------
- *WLAN_HAL_GET_FRAME_LOG_REQ
- *--------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U8 flags;
-}tGetFrameLogReqType, * tpGetFrameLogReqType;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tHalMsgHeader               header;
-    tGetFrameLogReqType         tGetFrameLogReqParams;
-} tGetFrameLogReqMsg, * tpGetFrameLogReqMsg;
-
-/*---------------------------------------------------------------------------
- * WLAN_HAL_GET_FRAME_LOG_RSP
- *-------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U32   status;
-} tGetFrameLogResp, * tpGetFrameLogResp;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tHalMsgHeader         header;
-    tGetFrameLogResp      tGetFrameLogRespParams;
-}  tGetFrameLogRespMsg,  * tpGetFrameLogRespMsg;
-
-/*---------------------------------------------------------------------------
- * WLAN_HAL_FATAL_EVENT_LOGGING_REQ
- *-------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U32 reasonCode;
-}tHalFatalEventLoggingReqParams, *tpHalFatalEventLoggingReqParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tHalMsgHeader header;
-    tHalFatalEventLoggingReqParams tFatalEventLoggingReqParams;
-}tHalFatalEventLoggingReqMsg, *tpHalFatalEventLoggingReqMsg;
-
-/*---------------------------------------------------------------------------
- * WLAN_HAL_FATAL_EVENT_LOGGING_RSP
- *-------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{   tANI_U32 status;
-}tHalFatalEventLoggingRspParams, *tpHalFatalEventLoggingRspParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tHalMsgHeader header;
-    tHalFatalEventLoggingRspParams tFatalEventLoggingRspParams;
-}tHalFatalEventLoggingRspMsg, *tpHalFatalEventLoggingRspMsg;
-
-/*---------------------------------------------------------------------------
-  * WLAN_HAL_LOST_LINK_PARAMETERS_IND
-  *-------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U8  bssIdx;
-    tANI_U8  rssi;
-    tSirMacAddr selfMacAddr;
-    tANI_U32 linkFlCnt;
-    tANI_U32 linkFlTx;
-    tANI_U32 lastDataRate;
-    tANI_U32 rsvd1;
-    tANI_U32 rsvd2;
-}tHalLostLinkParametersIndParams, *tpHalLostLinkParametersIndParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tHalMsgHeader header;
-    tHalLostLinkParametersIndParams lostLinkParameters;
-}tHalLostLinkParametersIndMsg, *tpHalLostLinkParametersIndMsg;
-
-
-/*---------------------------------------------------------------------------
- *WLAN_HAL_FW_LOGGING_INIT_REQ
- *--------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-    /* BIT0 - enable frame logging
-     * BIT1 - enableBMUHWtracing
-     * BIT2 - enableQXDMlogging
-     * BIT3 - enableUElogDpuTxp
-     */
-    tANI_U8 enableFlag;
-    tANI_U8 frameType;
-    tANI_U8 frameSize;
-    tANI_U8 bufferMode;
-    /* Host mem address to be used as logmailbox */
-    tANI_U64 logMailBoxAddr;
-    /* firmware will wakeup the host to send logs always */
-    tANI_U8 continuousFrameLogging;
-    /* Logging mail box version */
-    tANI_U8 logMailBoxVer;
-    /* Max ring size in firmware to log msgs when host is suspended state */
-    tANI_U8 maxLogBuffSize;
-    /* when firmware log reaches this threshold and
-     * if host is awake it will push the logs.
-     */
-    tANI_U8 minLogBuffSize;
-    /* Reserved for future purpose */
-    tANI_U32 reserved0;
-    tANI_U32 reserved1;
-    tANI_U32 reserved2;
-}tFWLoggingInitReqType, * tpFWLoggingInitReqType;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tHalMsgHeader             header;
-    tFWLoggingInitReqType     tFWLoggingInitReqParams;
-} tHalFWLoggingInitReqMsg, * tpHalFWLoggingInitReqMsg;
-
-/*---------------------------------------------------------------------------
- * WLAN_HAL_FW_LOGGING_INIT_RSP
- *-------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U32 status;
-    /* FW mail box address */
-    tANI_U64 logMailBoxAddr;
-    /* Logging mail box version */
-    tANI_U8 logMailBoxVer;
-    /* Qshrink is enabled */
-    tANI_BOOLEAN logCompressEnabled;
-    /* fw_dump_max_size is used to tell fwr mem dump size */
-    tANI_U32 fw_dump_max_size;
-    /* Reserved for future purpose */
-    tANI_U32 reserved1;
-    tANI_U32 reserved2;
-} tFWLoggingInitResp, * tpFWLoggingInitResp;
-
-
-typedef PACKED_PRE struct PACKED_POST {
-   tANI_U32     request_id;
-   tSirMacAddr  bssId;
-   tANI_S8      min_rssi;
-   tANI_S8      max_rssi;
-} tHalStartRssiMonitoringReqParams, * tpHalStartRssiMonitoringReqParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalStartRssiMonitoringReqParams   startRssiMonitoringReqParams;
-}tHalStartRssimonitoringReq, * tpHalStartRssimonitoringReq;
-
-//Following structure will be used for WLAN_HAL_START_RSSI_MONITORING_RSP
-typedef PACKED_PRE struct PACKED_POST {
-   tANI_U32 request_id;
-   tANI_U32 status;
-}  tHalStartRssimonitoringRspParams, * tpHalStartRssimonitoringRspParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalStartRssimonitoringRspParams startRssimonitoringRspParams;
-}tHalStartRssimonitoringRsp, * tpHalStartRssimonitoringRsp;
-
-//Following structures will be used for WLAN_HAL_RSSI_MONITORING_IND
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U32     request_id;
-   tSirMacAddr  bssId;
-   tANI_S8      rssi;
-} tHalRssiMonitorIndParams, * tpHalRssiMonitorIndParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalRssiMonitorIndParams RssiMonitorIndParams;
-}tHalRssiMonitorInd, * tpHalRssiMonitorInd;
-
-
-//Following structures will be used for WLAN_HAL_STOP_RSSI_MONITORING_REQ
-typedef PACKED_PRE struct PACKED_POST {
-   tANI_U32 request_id;
-   tSirMacAddr  bssId;
-} tHalStopRssiMonitoringParams, * tpHalStopRssiMonitoringParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalStopRssiMonitoringParams   stopRssiMonitoringParams;
-}tHalStopRssimonitoringReq, * tpHalStopRssimonitoringReq;
-
-//Following structures will be used for WLAN_HAL_STOP_RSSI_MONITORING_RSP
-typedef PACKED_PRE struct PACKED_POST {
-   tANI_U32 request_id;
-   tANI_U32 status;
-} tHalStopRssimonitoringRspParams, * tpHalStopRssimonitoringRspParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalStopRssimonitoringRspParams stopRssimonitoringRspParams;
-}tHalStopRssimonitoringRsp, * tpHalStopRssimonitoringRsp;
-
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tHalMsgHeader         header;
-    tFWLoggingInitResp    tFWLoggingInitRespParams;
-}  tFWLoggingInitRespMsg,  * tpFWLoggingInitRespMsg;
-
-/*---------------------------------------------------------------------------
- *   WLAN_HAL_SET_PER_ROAM_CONFIG_REQ
- *---------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST {
-    tANI_U32 request_id;
-    tANI_U32 isPERRoamCCAEnabled;
-    tANI_U32 rateUpThreshold;
-    tANI_U32 rateDownThreshold;
-    tANI_U32 waitPeriodForNextPERScan;
-    tANI_U32 PERtimerThreshold;
-    tANI_U32 PERroamTriggerPercent;
-    tANI_U32 reserved;
-} tPerRoamConfigParams, * tpPerRoamConfigParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tPerRoamConfigParams   perRoamConfigParams;
-}  tSetPerRoamConfigReq, * tpSetPerRoamConfigReq;
-
-/*---------------------------------------------------------------------------
- *   WLAN_HAL_SET_PER_ROAM_CONFIG_RSP
- *---------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    /* Success or Failure */
-    tANI_U32   status;
-} tConfigPerRoamRspParams, * tpConfigPerRoamRspParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tConfigPerRoamRspParams configPerRoamRspParams;
-}  tSetPerRoamConfigRsp, * tpSetPerRoamConfigRsp;
-
-/*---------------------------------------------------------------------------
- *   WLAN_HAL_PER_ROAM_SCAN_TRIGGER_REQ
- *---------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST {
-    bool                roamScanReq;
-} tStartRoamScanTriggerParams, * tpStartRoamScanTriggerParams;
-
-typedef PACKED_PRE struct PACKED_POST {
-
-   tHalMsgHeader header;
-   tStartRoamScanTriggerParams startRoamScanTriggerParams;
-}  tStartRoamScanReq, *tpStartRoamScanReq;
-
-/*---------------------------------------------------------------------------
- *     WLAN_HAL_PER_ROAM_SCAN_TRIGGER_RSP
- *---------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    /* Success /Failure / Nil result */
-    tANI_U32   status;
-} tConfigRoamScanRspParams, * tpConfigRoamScanRspParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tConfigRoamScanRspParams configRoamScanRspParams;
-}  tSetRoamScanConfigRsp, * tpSetRoamScanConfigRsp;
-
-
-#define PER_ROAM_MAX_AP_CNT 30
-#define PER_ROAM_MAX_CANDIDATE_CNT 15
-
-/* Candidate Information to be shared in the Candidate Indication,
- * similar to what is sent in legacy roaming with following additional info
- */
-
-typedef PACKED_PRE struct PACKED_POST {
-    tANI_U8    channelNumber;
-    tANI_U8    channelCCA;
-    tANI_U8    otherApCount;
-    tANI_S8    otherApRssi[PER_ROAM_MAX_AP_CNT];
-} tCandidateChannelInfo, * tpCandidateChannelInfo;
-
-typedef PACKED_PRE struct PACKED_POST {
-    tANI_U32    candidateCount;
-    tCandidateChannelInfo  channelInfo[PER_ROAM_MAX_CANDIDATE_CNT];
-} tPerRoamScanResult, * tpPerRoamScanResult;
-
-
-/*---------------------------------------------------------------------------
- * WLAN_HAL_FW_LOGGING_DXE_DONE_IND
- *-------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U16 status;
-    tANI_U16 doneIndicationForSource;
-    tANI_U32 logBuffLength[MAX_NUM_OF_BUFFER];
-    tANI_U64 logBuffAddress[MAX_NUM_OF_BUFFER];
-} tFWLoggingDxeDoneInd, * tpFWLoggingDxeDoneInd;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tHalMsgHeader         header;
-    tFWLoggingDxeDoneInd    tFWLoggingDxeDoneIndParams;
-}  tFWLoggingDxeDoneIndMsg,  * tpFWLoggingDxeDoneIndMsg;
-
-/*---------------------------------------------------------------------------
- * Logging mail box structure
- *-------------------------------------------------------------------------*/
-
-#define MAILBOX_VERSION_V1 0x1
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    /* Logging mail box version */
-    tANI_U8               logMbVersion;
-    /* Current logging buffer address */
-    tANI_U64              logBuffAddress[MAX_NUM_OF_BUFFER];
-    /* Current logging buffer length */
-    tANI_U32              logBuffLength[MAX_NUM_OF_BUFFER];
-    /* Flush reason code  0: Host requested Non zero FW FATAL event*/
-    tANI_U16              reasonCode;
-    /* Log type i.e. Mgmt frame = 0, QXDM = 1, FW Mem dump = 2 */
-    tANI_U8               logType;
-    /* Indicate if Last segment of log is received*/
-    tANI_BOOLEAN          done;
-}tLoggingMailBox, *tpLoggingMailBox;
-
-/*---------------------------------------------------------------------------
- *WLAN_HAL_FW_MEMORY_DUMP_REQ
- *--------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U32        reserved;
-}tHalFwMemoryDumpReqType, * tpHalFwMemoryDumpReqType;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tHalMsgHeader           header;
-    tHalFwMemoryDumpReqType tFwMemoryDumpReqParam;
-} tHalFwMemoryDumpReqMsg,   * tpHalFwMemoryDumpReqMsg;
-
-/*---------------------------------------------------------------------------
- * WLAN_HAL_FW_MEMORY_DUMP_RSP
- *-------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-    tANI_U32   status;
-} tHalFwMemoryDumpRespType, * tpHalFwMemoryDumpRespType;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    tHalMsgHeader             header;
-    tHalFwMemoryDumpRespType  tFwMemoryDumpResp;
-}  tHalFwMemoryDumpRespMsg,   * tpHalFwMemoryDumpRespMsg;
-
-
-/*---------------------------------------------------------------------------
-* WLAN_HAL_ENABLE_MONITOR_MODE_REQ
-*-------------------------------------------------------------------------*/
-
-/* only 1 filter is supported as of now */
-#define NUM_FILTERS_SUPPORTED 1
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tSirMacAddr macAddr;
-   tANI_U8 isA1filteringNeeded;
-   tANI_U8 isA2filteringNeeded;
-   tANI_U8 isA3filteringNeeded;
-}tHalMacFilter, *tpHalMacFilter;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U8 channelNumber;
-   ePhyChanBondState cbState;
-
-   tANI_U32 maxAmpduLen;
-   tANI_U32 maxMpduInAmpduLen;
-
-   tANI_U8 crcCheckEnabled;
-
-   /* value is "1" for this FR. "0" means no filter, RECEIVE ALL PACKETS */
-   tANI_U8 numMacFilters;
-   tHalMacFilter macFilters[NUM_FILTERS_SUPPORTED];
-
-   /* Each bit position maps to IEEE convention of typeSubtype */
-   tANI_U64 typeSubtypeBitmap;
-
-   tANI_U64 reserved;
-
-}tHalEnableMonitorModeReqParams, *tpHalEnableMonitorModeReqParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalEnableMonitorModeReqParams enableMonitorModeReqParams;
-}tHalEnableMonitorModeReqMsg, *tpHalEnableMonitorModeReqMsg;
-
-
-/*---------------------------------------------------------------------------
-* WLAN_HAL_ENABLE_MONITOR_MODE_RSP
-*-------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U32 status;
-}tHalEnableMonitorModeRspParams, *tpHalEnableMonitorModeRspParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalEnableMonitorModeRspParams enableMonitorModeRspParams;
-}tHalEnableMonitorModeRspMsg, *tpHalEnableMonitorModeRspMsg;
-
-/*---------------------------------------------------------------------------
-* WLAN_HAL_DISABLE_MONITOR_MODE_REQ
-*-------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tANI_U8 resetConfiguration;
-}tHalDisableMonitorModeReqMsg, *tpHalDisableMonitorModeReqMsg;
-
-/*---------------------------------------------------------------------------
-* WLAN_HAL_DISABLE_MONITOR_MODE_RSP
-*-------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U32 status;
-}tHalDisableMonitorModeRspParams, *tpHalDisableMonitorModeRspParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalDisableMonitorModeRspParams disableMonitorModeRspParams;
-}tHalDisableMonitorModeRspMsg, *tpHalDisableMonitorModeRspMsg;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-  tANI_U8   status;
-}tHalAvoidFreqRangeCtrlParam, *tpHalAvoidFreqRangeCtrlParam;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U8  paramType;
-   tANI_U32 paramValue;
-   tSirMacAddr bssid;
-} tSetWifiConfigParams, *tpSetWifiConfigParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader               header;
-   tSetWifiConfigParams        wifiConfigParams;
-} tSetWifiConfigParamsReq, *tpSetWifiConfigParamsReq;
-
-typedef PACKED_PRE struct PACKED_POST {
-   tANI_U32 status;
-} tHalSetWifiConfigRspParams, * tpHalSetWifiConfigRspParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-
-  tHalSetWifiConfigRspParams setWifiConfigRspParams;
-} tHalSetWifiConfigRsp, *tpHalSetWifiConfigRsp;
-
-/*---------------------------------------------------------------------------
-* WLAN_HAL_ANTENNA_DIVERSITY_SELECTION_REQ
-*-------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U32 reserved;
-} tHalAntennaDiversitySelectionReqParams, *tpHalAntennaDiversitySelectionReqParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalAntennaDiversitySelectionReqParams AntDivSelReqParams;
-}tHalAntennaDiversitySelectionReqMsg;
-
-/*---------------------------------------------------------------------------
-* WLAN_HAL_ANTENNA_DIVERSITY_SELECTION_RSP
-*-------------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U16 status;
-   tANI_U32 selectedAntennaId;
-   tANI_U32 reserved;
-} tHalAntennaDiversitySelectionRspParams, *tpHalAntennaDiversitySelectionRspParams;
-
-/* WDI_MODIFY_ROAM_PARAMS_IND */
-typedef PACKED_PRE struct PACKED_POST {
-   tANI_U8 param;
-   tANI_U32 value;
-} tHalModifyRoamParamsIndParams, *tpHalModifyRoamParamsIndParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader header;
-   tHalModifyRoamParamsIndParams  modifyRoamParamsReqParams;
-} tHalModifyRoamParamsInd, *tpHalModifyRoamParamsInd;
 
 #if defined(__ANI_COMPILER_PRAGMA_PACK_STACK)
 #pragma pack(pop)
diff --git a/wlan/prima/riva/inc/wlan_nv.h b/wlan/prima/riva/inc/wlan_nv.h
index b99666c..5eeca4b 100644
--- a/wlan/prima/riva/inc/wlan_nv.h
+++ b/wlan/prima/riva/inc/wlan_nv.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -229,17 +229,6 @@
     RF_SUBBAND_INVALID = 0x7FFFFFFF  /* define as 4 bytes data */
 }eRfSubBand;
 
-struct chan_to_ht_40_index_map {
-   uint16 ht_40_minus_index;
-   uint16 ht_40_plus_index;
-};
-
-typedef enum
-{
-    RF_CHAN_BOND_HT40_MINUS = 0,
-    RF_CHAN_BOND_HT40_PLUS
-}eChannnelBondingTypes;
-
 typedef enum
 {
     //2.4GHz Band
diff --git a/wlan/prima/riva/inc/wlan_phy.h b/wlan/prima/riva/inc/wlan_phy.h
index 59ba019..058e708 100644
--- a/wlan/prima/riva/inc/wlan_phy.h
+++ b/wlan/prima/riva/inc/wlan_phy.h
@@ -744,9 +744,6 @@
 
     MAX_PHY_CHAIN_SEL,
     INVALID_PHY_CHAIN_SEL,
-    PHY_CHAIN_SEL_ANT_0, //append for antenna 0 selection
-    PHY_CHAIN_SEL_ANT_1, //append for antenna 1 selection
-
     PHY_MAX_CHAIN_SELECT = 0x7FFFFFFF  /* define as 4 bytes data */
 }ePhyChainSelect;